query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
RequestIDHandler provide a midlleware
func RequestIDHandler(next http.Handler) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { ctx := newContextWithRequestID(req.Context(), req) if next != nil { next.ServeHTTP(rw, req.WithContext(ctx)) } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func RequestIDHandler(w http.ResponseWriter, r *http.Request) ErrorResponse {\n\t// Check that we have an authorised API key header\n\terr := checkAPIKey(r.Header.Get(\"api-key\"))\n\tif err != nil {\n\t\tlogMessage(\"REQUESTID\", \"invalid-api-key\", \"Invalid API key used\")\n\t\treturn ErrorInvalidAPIKey\n\t}\n\n\tnonce, err := Environ.DB.CreateDeviceNonce()\n\tif err != nil {\n\t\tlogMessage(\"REQUESTID\", \"generate-request-id\", err.Error())\n\t\treturn ErrorGenerateNonce\n\t}\n\n\t// Return successful JSON response with the nonce\n\tformatRequestIDResponse(true, \"\", nonce, w)\n\treturn ErrorResponse{Success: true}\n}", "func (l RequestID) Handler(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\trequestID := strconv.FormatInt(time.Now().Unix(), 10)\n\n\t// if was received the header x-request-id, its value is set in the request context\n\tif v := r.Header.Values(\"x-request-id\"); len(v) > 0 {\n\t\trequestID = v[0]\n\t}\n\n\tctx := context.WithValue(r.Context(), \"request-id\", requestID)\n\n\tnext(w, r.WithContext(ctx))\n}", "func RequestIDHandler(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\tfr := frame.FromContext(ctx)\n\t\tfr.UUID = uuid.New()\n\t\tfr.Logger = fr.Logger.With().\n\t\t\tStr(\"uuid\", fr.UUID.String()).\n\t\t\tLogger()\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func RequestIDHandler(fieldKey, headerName string) func(next httpserver.Handler) httpserver.Handler {\n\treturn func(next httpserver.Handler) httpserver.Handler {\n\t\treturn httpserver.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) {\n\t\t\tctx := r.Context()\n\t\t\tid, err := IDFromRequest(r, headerName)\n\t\t\tif err != nil {\n\t\t\t\tid = xid.New()\n\t\t\t}\n\t\t\tif fieldKey != \"\" {\n\t\t\t\tlog := zerolog.Ctx(ctx)\n\t\t\t\tlog.UpdateContext(func(c zerolog.Context) zerolog.Context {\n\t\t\t\t\treturn c.Str(fieldKey, id.String())\n\t\t\t\t})\n\t\t\t}\n\t\t\tif headerName != \"\" {\n\t\t\t\tr.Header.Set(headerName, id.String())\n\t\t\t}\n\t\t\treturn next.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "func RequestIDMidlleware() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tuuid := uuid.NewV4()\n\t\tc.Writer.Header().Set(\"X-Request-Id\", uuid.String())\n\t\tc.Next()\n\t}\n}", "func withRequestID(next http.HandlerFunc) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\trequestID := r.Header.Get(\"x-request-id\")\n\t\tif requestID == \"\" {\n\t\t\trequestID = uuid.Must(uuid.NewV4()).String()\n\t\t}\n\n\t\tctx := log.With(r.Context(), zap.String(\"request_id\", requestID))\n\t\tr = r.WithContext(ctx)\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func RequestID(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Header.Get(RequestIDHeader) == \"\" {\n\t\t\tr.Header.Set(RequestIDHeader, uuid.Must(uuid.NewV4()).String())\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func UseRequestID(headerName string) func(http.Handler) http.Handler {\n\tf := func(h http.Handler) http.Handler {\n\t\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t\tvar reqID string\n\t\t\tif reqID = r.Header.Get(headerName); reqID == \"\" {\n\t\t\t\t// first occurrence\n\t\t\t\treqID = pkg.GenerateNewStringUUID()\n\t\t\t}\n\t\t\tctx := r.Context()\n\t\t\tctx = context.WithValue(ctx, pkg.RequestID, reqID)\n\n\t\t\t// setup logger\n\t\t\trequestLogger := log.WithField(pkg.RequestID, reqID)\n\t\t\tctx = context.WithValue(ctx, pkg.RequestID, requestLogger)\n\n\t\t\th.ServeHTTP(w, r.WithContext(ctx))\n\t\t}\n\t\treturn http.HandlerFunc(fn)\n\t}\n\treturn f\n}", "func AssignRequestIDHandler(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tr = assignRequestID(r)\n\t\tid, _ := c.GetRequestID(r)\n\t\tw.Header().Set(HTTPHeaderNameRequestID, id)\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func RequestID(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\trequestID := uuid.New().String()\n\t\tnctx := context.WithValue(r.Context(), contextKey(\"requestID\"), requestID)\n\t\tnext.ServeHTTP(w, r.WithContext(nctx))\n\t})\n}", "func RequestID(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := newContextWithRequestID(r.Context(), r)\n\t\tw.Header().Set(requestIDHeaderKey, requestIDFromContext(ctx))\n\t\th.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "func AddRequestID(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tmyid := atomic.AddUint64(&reqID, 1)\n\t\tctx := r.Context()\n\t\tctx = context.WithValue(ctx, RequestIDKey, fmt.Sprintf(\"%s-%06d\", prefix, myid))\n\t\th.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "func RequestIDMiddleware(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\trequestID := r.Header.Get(xRequestID)\n\t\tif requestID == \"\" {\n\t\t\trequestID = uuid.New().String()\n\t\t}\n\t\tctx = context.WithValue(ctx, RequestIDKey, requestID)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func addRequestID() Wrapper {\n\treturn func(fn http.HandlerFunc) http.HandlerFunc {\n\t\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\t\tvar rid string = req.Header.Get(\"Request-ID\")\n\t\t\tif rid == \"\" || len(rid) > 8 {\n\t\t\t\trid = randStringBytesMaskSrc(8)\n\t\t\t}\n\n\t\t\treq = req.WithContext(context.WithValue(req.Context(), \"rid\", rid))\n\t\t\treq.Header.Add(\"Request-ID\", rid)\n\n\t\t\tfn(w, req)\n\t\t}\n\t}\n}", "func request_id() {\n\t// init server w/ ctrl+c support and middlewares\n\tvar s = webfmwk.InitServer(webfmwk.WithCtrlC(),\n\t\twebfmwk.WithHandlers(handler.Logging, handler.RequestID))\n\n\t// expose /test\n\ts.GET(\"/test\", func(c webfmwk.Context) error {\n\t\treturn c.JSONOk(\"ok\")\n\t})\n\n\t// start asynchronously on :4242\n\ts.Start(\":4242\")\n\n\t// ctrl+c is handled internaly\n\tdefer s.WaitAndStop()\n}", "func (e *engine) setRequestID(ctx *Context) {\n\tif ess.IsStrEmpty(ctx.Req.Header.Get(e.requestIDHeader)) {\n\t\tctx.Req.Header.Set(e.requestIDHeader, ess.NewGUID())\n\t} else {\n\t\tlog.Debugf(\"Request already has ID: %v\", ctx.Req.Header.Get(e.requestIDHeader))\n\t}\n\tctx.Reply().Header(e.requestIDHeader, ctx.Req.Header.Get(e.requestIDHeader))\n}", "func ProcessRequestById(c *gin.Context) {}", "func RequestID(nextRequestID IdGenerator) mux.MiddlewareFunc {\n\treturn TraceRequest(\"X-Request-Id\", nextRequestID)\n}", "func RequestID(headerName string) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\tfn := func(w http.ResponseWriter, req *http.Request) {\n\t\t\trequestID := req.Header.Get(headerName)\n\t\t\tif requestID == \"\" {\n\t\t\t\trequestID = NewRequestID()\n\t\t\t\treq.Header.Set(headerName, requestID)\n\t\t\t}\n\n\t\t\tctx := WithRequestID(req.Context(), requestID)\n\t\t\tnext.ServeHTTP(w, req.WithContext(ctx))\n\t\t}\n\t\treturn http.HandlerFunc(fn)\n\t}\n}", "func TestRequestID(t *testing.T) {\n\ta := wolf.New()\n\ta.Use(RequestID)\n\n\tvar run bool\n\ta.Get(\"/\", func(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\t\trun = true\n\t\tassert.True(t, len(GetReqID(ctx)) > 0)\n\t})\n\n\tvar w http.ResponseWriter = httptest.NewRecorder()\n\tr, err := http.NewRequest(\"GET\", \"/\", nil)\n\tassert.NoError(t, err)\n\ta.ServeHTTP(w, r)\n\n\tassert.True(t, run)\n}", "func RequestID() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t// Check for incoming header, use it if exists\n\t\trequestID := c.Request.Header.Get(HeaderXRequestIDKey)\n\n\t\t// Create request id\n\t\tif requestID == \"\" {\n\t\t\trequestID = krand.String(krand.R_All, 12) // 生成长度为12的随机字符串\n\t\t\tc.Request.Header.Set(HeaderXRequestIDKey, requestID)\n\t\t\t// Expose it for use in the application\n\t\t\tc.Set(ContextRequestIDKey, requestID)\n\t\t}\n\n\t\t// Set X-Request-ID header\n\t\tc.Writer.Header().Set(HeaderXRequestIDKey, requestID)\n\n\t\tc.Next()\n\t}\n}", "func RequestID() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tc.Header(\"X-Request-Id\", uuid.New().String())\n\t\tc.Next()\n\t}\n}", "func LogReqHandler(h http.Handler) http.Handler {\n\treturn logReqIdHandler{h}\n}", "func (h *handler) handleMaliciousIDsReq(ctx context.Context, _ []byte) ([]byte, error) {\n\tnodes, err := identities.GetMalicious(h.cdb)\n\tif err != nil {\n\t\th.logger.WithContext(ctx).With().Warning(\"serve: failed to get malicious IDs\", log.Err(err))\n\t\treturn nil, err\n\t}\n\th.logger.WithContext(ctx).With().Debug(\"serve: responded to malicious IDs request\", log.Int(\"num_malicious\", len(nodes)))\n\tmalicious := &MaliciousIDs{\n\t\tNodeIDs: nodes,\n\t}\n\tdata, err := codec.Encode(malicious)\n\tif err != nil {\n\t\th.logger.With().Fatal(\"serve: failed to encode malicious IDs\", log.Err(err))\n\t}\n\treturn data, nil\n}", "func RequestIDFilter(request *restful.Request, response *restful.Response, chain *restful.FilterChain) {\n\trequestID := request.Request.Header.Get(string(utils.ContextValueKeyRequestID))\n\tif len(requestID) == 0 {\n\t\trequestID = uuid.New().String()\n\t}\n\tctx := context.WithValue(request.Request.Context(), utils.ContextValueKeyRequestID, requestID)\n\trequest.Request = request.Request.WithContext(ctx)\n\tchain.ProcessFilter(request, response)\n}", "func RequestIDMiddleware() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tc.Writer.Header().Set(\"X-Request-Id\", util.NewUUID())\n\t\tc.Next()\n\t}\n}", "func handlerICon(w http.ResponseWriter, r *http.Request) {}", "func (c *CustomContext) injectRequestID(prev zerolog.Logger) zerolog.Logger {\n\tid := c.Response().Header().Get(echo.HeaderXRequestID)\n\treturn prev.With().Str(\"requestId\", id).Logger()\n}", "func RequestID() echo.MiddlewareFunc {\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\tif DefaultSkipper(c) {\n\t\t\t\treturn next(c)\n\t\t\t}\n\n\t\t\treq := c.Request()\n\t\t\tres := c.Response()\n\t\t\trid := req.Header.Get(echo.HeaderXRequestID)\n\t\t\tif rid == \"\" {\n\t\t\t\trid = uuid.New().String()\n\t\t\t}\n\t\t\tres.Header().Set(echo.HeaderXRequestID, rid)\n\n\t\t\tctx := contextx.SetID(req.Context(), rid)\n\t\t\tc.SetRequest(req.WithContext(ctx))\n\n\t\t\treturn next(c)\n\t\t}\n\t}\n}", "func useID(f IDFromRequest) func(http.Handler) http.Handler {\n\treturn func(delegate http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) {\n\t\t\tid, err := f(request)\n\t\t\tif err != nil {\n\t\t\t\thttperror.Formatf(\n\t\t\t\t\tresponse,\n\t\t\t\t\thttp.StatusBadRequest,\n\t\t\t\t\t\"Could extract device id: %s\",\n\t\t\t\t\terr,\n\t\t\t\t)\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tctx := WithID(id, request.Context())\n\t\t\tdelegate.ServeHTTP(response, request.WithContext(ctx))\n\t\t})\n\t}\n}", "func RequestIDMiddleware() gin.HandlerFunc {\n\treturn func(ctx *gin.Context) {\n\t\tctx.Writer.Header().Set(\"X-Request-Id\", uuid.New().String())\n\t\tctx.Next()\n\t}\n}", "func RouteIDInspectionHandler(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t// Timings\n\t\tt := timings.Tracker{}\n\t\tt.Start()\n\n\t\t// Check to see if ROUTEID is specified on the request line, and if so, push it into the request cookie\n\t\tif strings.Contains(r.URL.RawQuery, \"ROUTEID\") {\n\t\t\tif rkey := r.URL.Query().Get(\"ROUTEID\"); rkey != \"\" {\n\t\t\t\tr.AddCookie(&http.Cookie{\n\t\t\t\t\tName: \"ROUTEID\",\n\t\t\t\t\tValue: rkey,\n\t\t\t\t\tPath: \"/\",\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tTimingOut.Printf(\"RouteIDInspectionHandler took %s\\n\", t.Since().String())\n\t\tnext.ServeHTTP(w, r)\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "func GetRequestID(r *http.Request) string {\n\treturn r.Header.Get(\"X-Request-Id\")\n}", "func Test_RequestID(t *testing.T) {\n\tapp := fiber.New()\n\n\tapp.Use(New())\n\n\tapp.Get(\"/\", func(c *fiber.Ctx) error {\n\t\treturn c.SendString(\"Hello, World 👋!\")\n\t})\n\n\tresp, err := app.Test(httptest.NewRequest(\"GET\", \"/\", nil))\n\tutils.AssertEqual(t, nil, err)\n\tutils.AssertEqual(t, fiber.StatusOK, resp.StatusCode)\n\n\treqid := resp.Header.Get(fiber.HeaderXRequestID)\n\tutils.AssertEqual(t, 36, len(reqid))\n\n\treq := httptest.NewRequest(\"GET\", \"/\", nil)\n\treq.Header.Add(fiber.HeaderXRequestID, reqid)\n\n\tresp, err = app.Test(req)\n\tutils.AssertEqual(t, nil, err)\n\tutils.AssertEqual(t, fiber.StatusOK, resp.StatusCode)\n\tutils.AssertEqual(t, reqid, resp.Header.Get(fiber.HeaderXRequestID))\n}", "func ContextRequestId(ctx context.Context) (requestId string) {\n\tif d, ok := ctx.Value(contextHandlerDetailsKey).(*handlerDetails); ok {\n\t\trequestId = d.requestId\n\t}\n\treturn\n}", "func clientIDHandler(c *router.Context) {\n\tclientID, err := GetFrontendClientID(c.Context)\n\tif err != nil {\n\t\thttpReplyError(c, http.StatusInternalServerError, fmt.Sprintf(\"Can't grab the client ID - %s\", err))\n\t} else {\n\t\thttpReply(c, http.StatusOK, map[string]string{\"client_id\": clientID})\n\t}\n}", "func Middleware(h http.Handler) http.Handler {\n return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n log.Println(\"Running PRE plugin\")\n r.Header.Set(\"X-Trace-ID\", strconv.Itoa(int(rand.Int63())))\n h.ServeHTTP(w, r)\n })\n}", "func AddIDRequestMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tvar reqID = r.Header.Get(string(transactionID.Key))\n\t\tif reqID == \"\" {\n\t\t\treqID = uuid.New().String()\n\t\t\tr.Header.Add(\"TransactionID\", reqID)\n\t\t}\n\n\t\tnext.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), transactionID.Key, reqID)))\n\t})\n}", "func RequestID() echo.MiddlewareFunc {\n\treturn middleware.RequestID()\n}", "func getRequestID(c *gin.Context) string {\n\tif id := c.Request.Header.Get(\"x-request-id\"); len(id) > 0 {\n\t\treturn id\n\t}\n\treturn uuid.New().String()\n}", "func ID(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {\n\t\tif userCorrelationID := request.Header.Get(constants.CorrelationIDHeader); userCorrelationID != \"\" {\n\t\t\tif _, err := uuid.FromString(userCorrelationID); err != nil {\n\t\t\t\tbadRequest := http.StatusText(http.StatusBadRequest) + \": Request requires valid UUID v4 Correlation-ID\"\n\t\t\t\tmiddlewareLogger.Log(\"err\", badRequest)\n\t\t\t\terrorCollection := collections.NewErrorCollection().Append(errors.New(badRequest))\n\t\t\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\t\t\tjson.NewEncoder(writer).Encode(errorCollection)\n\t\t\t\treturn\n\t\t\t}\n\t\t\twriter.Header().Set(constants.CorrelationIDHeader, userCorrelationID)\n\t\t} else {\n\t\t\tuuidV4 := uuid.NewV4()\n\t\t\trequest.Header.Set(constants.CorrelationIDHeader, uuidV4.String())\n\t\t\twriter.Header().Set(constants.CorrelationIDHeader, uuidV4.String())\n\t\t}\n\n\t\thandler.ServeHTTP(writer, request)\n\t})\n}", "func RequestIDFinisher(w http.ResponseWriter, r *http.Request) {\n\tvar requestID string\n\tif rid := r.Context().Value(requestIDKey); rid != nil {\n\t\trequestID = rid.(string)\n\t}\n\tw.Header().Set(Conf.GetString(ConfigRequestIDHeaderName), requestID)\n\trnd, _ := rand.Int(rand.Reader, randMax)\n\trv := rnd.Int64()/2 + 1\n\tout := []byte(fmt.Sprintf(\"%s %d\\n\", requestID, rv))\n\tfor i := int64(0); i < rv; i++ {\n\t\tw.Write(out)\n\t}\n}", "func Interceptor(opts ...Option) gin.HandlerFunc {\n\tset := newOptionSet(opts...)\n\n\treturn func(ctx *gin.Context) {\n\t\tctx.Set(rkgininter.RpcEntryNameKey, set.EntryName)\n\n\t\trequestId := rkcommon.GenerateRequestId()\n\t\tctx.Header(rkginctx.RequestIdKey, requestId)\n\n\t\tevent := rkginctx.GetEvent(ctx)\n\t\tevent.SetRequestId(requestId)\n\t\tevent.SetEventId(requestId)\n\n\t\tctx.Header(set.AppNameKey, rkentry.GlobalAppCtx.GetAppInfoEntry().AppName)\n\t\tctx.Header(set.AppVersionKey, rkentry.GlobalAppCtx.GetAppInfoEntry().Version)\n\n\t\tnow := time.Now()\n\t\tctx.Header(set.AppUnixTimeKey, now.Format(time.RFC3339Nano))\n\t\tctx.Header(set.ReceivedTimeKey, now.Format(time.RFC3339Nano))\n\n\t\tctx.Next()\n\t}\n}", "func errorHandler(logger *log.Logger) func(context.Context, http.ResponseWriter, error) {\n\treturn func(ctx context.Context, w http.ResponseWriter, err error) {\n\t\tid := ctx.Value(middleware.RequestIDKey).(string)\n\t\tw.Write([]byte(\"[\" + id + \"] encoding: \" + err.Error()))\n\t\tlogger.Printf(\"[%s] ERROR: %s\", id, err.Error())\n\t}\n}", "func GetRequestID(c echo.Context) string {\n\treturn c.Response().Header().Get(echo.HeaderXRequestID)\n}", "func (s *service) reqHandler(endpoint *Endpoint, req *request) {\n\tstart := time.Now()\n\tendpoint.Handler.Handle(req)\n\ts.m.Lock()\n\tendpoint.stats.NumRequests++\n\tendpoint.stats.ProcessingTime += time.Since(start)\n\tavgProcessingTime := endpoint.stats.ProcessingTime.Nanoseconds() / int64(endpoint.stats.NumRequests)\n\tendpoint.stats.AverageProcessingTime = time.Duration(avgProcessingTime)\n\n\tif req.respondError != nil {\n\t\tendpoint.stats.NumErrors++\n\t\tendpoint.stats.LastError = req.respondError.Error()\n\t}\n\ts.m.Unlock()\n}", "func GetRequestID() int {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\trequestID = requestID + 1\n\treturn requestID\n}", "func (l *Middleware) Handler(next http.Handler) http.Handler {\n\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\n\t\tif l.inLogFlags(None) { // skip logging\n\t\t\tnext.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\n\t\tww := newCustomResponseWriter(w)\n\t\tbody, user := l.getBodyAndUser(r)\n\t\tt1 := time.Now()\n\t\tdefer func() {\n\t\t\tt2 := time.Now()\n\n\t\t\tq := l.sanitizeQuery(r.URL.String())\n\t\t\tif qun, err := url.QueryUnescape(q); err == nil {\n\t\t\t\tq = qun\n\t\t\t}\n\n\t\t\tremoteIP := strings.Split(r.RemoteAddr, \":\")[0]\n\t\t\tif strings.HasPrefix(r.RemoteAddr, \"[\") {\n\t\t\t\tremoteIP = strings.Split(r.RemoteAddr, \"]:\")[0] + \"]\"\n\t\t\t}\n\n\t\t\tif l.ipFn != nil { // mask ip with ipFn\n\t\t\t\tremoteIP = l.ipFn(remoteIP)\n\t\t\t}\n\n\t\t\tvar bld strings.Builder\n\t\t\tif l.prefix != \"\" {\n\t\t\t\tbld.WriteString(l.prefix)\n\t\t\t\tbld.WriteString(\" \")\n\t\t\t}\n\n\t\t\tbld.WriteString(fmt.Sprintf(\"%s - %s - %s - %d (%d) - %v\", r.Method, q, remoteIP, ww.status, ww.size, t2.Sub(t1)))\n\n\t\t\tif user != \"\" {\n\t\t\t\tbld.WriteString(\" - \")\n\t\t\t\tbld.WriteString(user)\n\t\t\t}\n\n\t\t\tif l.subjFn != nil {\n\t\t\t\tif subj, err := l.subjFn(r); err == nil {\n\t\t\t\t\tbld.WriteString(\" - \")\n\t\t\t\t\tbld.WriteString(subj)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif traceID := r.Header.Get(\"X-Request-ID\"); traceID != \"\" {\n\t\t\t\tbld.WriteString(\" - \")\n\t\t\t\tbld.WriteString(traceID)\n\t\t\t}\n\n\t\t\tif body != \"\" {\n\t\t\t\tbld.WriteString(\" - \")\n\t\t\t\tbld.WriteString(body)\n\t\t\t}\n\n\t\t\tl.log.Logf(\"%s\", bld.String())\n\t\t}()\n\n\t\tnext.ServeHTTP(ww, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func (client *clientInfo) logReq(id uint64, handler *respHandler) {\n\tclient.mtx.Lock()\n\tdefer client.mtx.Unlock()\n\tclient.respHandlers[id] = handler\n\tif len(client.respHandlers) > 1 {\n\t\tgo client.cleanUpHandlers()\n\t}\n}", "func RequestTracking(n janice.HandlerFunc) janice.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) error {\n\t\tid := uuid.NewString()\n\t\tctx := context.WithValue(r.Context(), reqIDKey, id)\n\n\t\treturn n(w, r.WithContext(ctx))\n\t}\n}", "func requestHandler(w http.ResponseWriter, r *http.Request) {\n\tjobreq := getJobRequestFrom(r)\n\tif r.FormValue(\"debug\") == \"1\" {\n\t\tfmt.Fprintf(w, \"%#v\", jobreq)\n\t\treturn\n\t}\n\n\tnewid := core.NewJob(jobreq)\n\tfmt.Printf(\"New job requested %#v -> id:%d\\n\", newid)\n\tfmt.Fprintf(w, \"%d\", newid)\n\n}", "func (t requestIDTracker) requestID(identifier ...string) string {\n\tkey := strings.Join(identifier, \"/\")\n\tid, exists := t.requestIDs[key]\n\tif !exists {\n\t\tid = uuid.New()\n\t\tt.requestIDs[key] = id\n\t}\n\treturn id\n}", "func middlewareIdToken(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t \tpathParams := mux.Vars(r)\n\t\t\tif raw, ok := pathParams[\"token\"]; !ok {\n\t\t\t\thttp.Error(w,\"Missing argument: id\", http.StatusForbidden)\n\t\t\t} else {\n\t\t\t\t_,err:= validateIDToken(raw)\n\t\t\t\tif err == nil {\n\t\t\t\t\tlog.Printf(\"Authenticated user\\n\")\n\t\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\t} else {\n\t\t\t\t\thttp.Error(w, \"Forbidden\", http.StatusForbidden)\n\t\t\t\t}\n\t\t\t}\n\t})\n}", "func RequestTimer(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tstart := time.Now()\n\t\tdefer func() {\n\t\t\tmillis := int64((time.Now().Sub(start)) / time.Millisecond)\n\t\t\tlog.Printf(\"severity=INFO RequestId=%v, Duration_ms=%v\", context.MustGetRequestId(r), millis)\n\t\t}()\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func MessageLaunchHandlerCreator(registrationDS registrationDatastore.RegistrationDatastore, cache ltiCache.Cache, store sessions.Store, sessionName string, debug bool) func(http.Handler) http.Handler {\n\tbase := ltiBase{registrationDS, cache, store, sessionName}\n\treturn func(handla http.Handler) http.Handler {\n\t\t// initialize the jwt middleware\n\t\topts := jwtmiddleware.Options{\n\t\t\tSigningMethod: jwt.SigningMethodRS256,\n\t\t\tUserProperty: userKeyName,\n\t\t\tExtractor: FromAnyParameter(\"id_token\"),\n\t\t\tDebug: debug,\n\t\t\tValidationKeyGetter: base.getValidationKey,\n\t\t\tErrorHandler: tokenMWErrorHandler,\n\t\t}\n\t\tjwtMW := jwtmiddleware.New(opts)\n\t\t// now create the inner handler\n\t\thandlerFunc := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\t\t// create this request handler's messageLaunch object\n\t\t\tmsgL := NewMessageLaunch(registrationDS, cache, store, sessionName, debug)\n\t\t\tsess, _ := msgL.store.Get(req, msgL.ltiBase.sessionName)\n\n\t\t\t// get id_token claims (which was validated and placed in the context by jwt middleware)\n\t\t\tclaims := GetClaims(req)\n\n\t\t\t// Note: token validity, security, expired handled by wrapper\n\t\t\tif err := msgL.validateState(req); err != nil {\n\t\t\t\thttp.Error(w, err.Error(), 401)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// validate the nonce\n\t\t\ttokNonce := claims[\"nonce\"].(string)\n\t\t\tif err := msgL.validateNonce(req, tokNonce); err != nil {\n\t\t\t\thttp.Error(w, err.Error(), 401)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := msgL.validateClientID(GetClaims(req)); err != nil {\n\t\t\t\thttp.Error(w, err.Error(), 401)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := msgL.validateDeployment(GetClaims(req)); err != nil {\n\t\t\t\thttp.Error(w, err.Error(), 401)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := msgL.validateMessage(GetClaims(req)); err != nil {\n\t\t\t\thttp.Error(w, err.Error(), 401)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tbytes, err := json.Marshal(claims)\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(w, \"failed to cache claims\", 500)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// save the launch in our cache, for future use\n\t\t\tclaimsStr := string(bytes)\n\t\t\tlog.Printf(\"launchData length: %d\", len(claimsStr))\n\t\t\t// log.Printf(\"launchData: %s\", claimsStr)\n\t\t\tmsgL.cache.PutLaunchData(req, msgL.launchID, string(bytes))\n\t\t\t// save the launchID in the request context\n\t\t\treq = requestWithLaunchIDContext(req, msgL.launchID)\n\t\t\tif err := sess.Save(req, w); err != nil {\n\t\t\t\tlog.Printf(\"error while saving session: %v\", err)\n\t\t\t}\n\t\t\thandla.ServeHTTP(w, req)\n\t\t})\n\t\treturn jwtMW.Handler(handlerFunc)\n\t}\n}", "func Interceptor(opts ...Option) gin.HandlerFunc {\n\tset := newOptionSet(opts...)\n\n\treturn func(ctx *gin.Context) {\n\t\tctx.Set(rkgininter.RpcEntryNameKey, set.EntryName)\n\n\t\t// start timer\n\t\tstartTime := time.Now()\n\n\t\tctx.Next()\n\n\t\t// end timer\n\t\telapsed := time.Now().Sub(startTime)\n\n\t\t// ignoring /rk/v1/assets, /rk/v1/tv and /sw/ path while logging since these are internal APIs.\n\t\tif rkgininter.ShouldLog(ctx) {\n\t\t\tif durationMetrics := GetServerDurationMetrics(ctx); durationMetrics != nil {\n\t\t\t\tdurationMetrics.Observe(float64(elapsed.Nanoseconds()))\n\t\t\t}\n\t\t\tif len(ctx.Errors) > 0 {\n\t\t\t\tif errorMetrics := GetServerErrorMetrics(ctx); errorMetrics != nil {\n\t\t\t\t\terrorMetrics.Inc()\n\t\t\t\t}\n\t\t\t}\n\t\t\tif resCodeMetrics := GetServerResCodeMetrics(ctx); resCodeMetrics != nil {\n\t\t\t\tresCodeMetrics.Inc()\n\t\t\t}\n\t\t}\n\t}\n}", "func SetupHandler(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t// Timings\n\t\tt := timings.Tracker{}\n\t\tt.Start()\n\n\t\t// Hit the request counter\n\t\tCounter()\n\n\t\t// Track connections, roughly\n\t\tConnectionCounterAdd()\n\t\tdefer ConnectionCounterRemove()\n\n\t\tvar requestID string\n\n\t\tif Conf.GetBool(ConfigTrustRequestIDHeader) {\n\t\t\trequestID = r.Header.Get(Conf.GetString(ConfigRequestIDHeaderName))\n\t\t}\n\n\t\tif requestID == \"\" {\n\t\t\t// Set the requestID ourselves\n\t\t\trequestID = Seq.NextHashID()\n\t\t}\n\n\t\tif Conf.GetBool(ConfigDebug) && Conf.GetBool(ConfigDebugRequests) {\n\t\t\t// dump the request, yo\n\t\t\tDebugOut.Printf(\"Request {%s}:\\n%s\\n/Request {%s}\\n\", requestID, spew.Sdump(*r), requestID)\n\t\t}\n\n\t\tDebugOut.Printf(\"{%s} Proto %s\\n\", requestID, r.Proto)\n\n\t\tif Conf.GetBool(ConfigDebug) && r.TLS != nil {\n\t\t\tDebugOut.Printf(\"{%s} TLS %s, CipherSuite %s\\n\", requestID, SslVersions.Suite(r.TLS.Version), Ciphers.Suite(r.TLS.CipherSuite))\n\t\t}\n\n\t\tr = r.WithContext(WithRqID(context.WithValue(r.Context(), timestampKey, time.Now()), requestID))\n\n\t\tr.Header.Set(Conf.GetString(ConfigRequestIDHeaderName), requestID)\n\n\t\tvar pathID string\n\t\tif pid := r.Context().Value(pathIDKey); pid != nil {\n\t\t\tpathID = pid.(string)\n\t\t}\n\t\tDebugOut.Printf(\"{%s} Executing Path: %s\\n\", requestID, pathID)\n\n\t\tTimingOut.Printf(\"Setup handler took %s\\n\", t.Since().String())\n\t\tnext.ServeHTTP(w, r)\n\t\t// CRITICAL: SetupHandler must never ever change the response. Do not write below this line.\n\t\tDebugOut.Printf(\"{%s} Done with Path: %s\\n\", requestID, pathID)\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "func errorHandler(logger *zap.Logger) func(context.Context, http.ResponseWriter, error) {\n\treturn func(ctx context.Context, w http.ResponseWriter, err error) {\n\t\tid := ctx.Value(middleware.RequestIDKey).(string)\n\t\t_, _ = w.Write([]byte(\"[\" + id + \"] encoding: \" + err.Error()))\n\t\tlogger.Error(\"ERROR:\", zap.String(\"ID\", id),\n\t\t\tzap.String(\"Message\", err.Error()))\n\t}\n}", "func HeaderRequestID(c *gin.Context) string {\n\treturn c.Request.Header.Get(HeaderXRequestIDKey)\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ThrottlingException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func TraceRequest(header string, nextRequestID IdGenerator) mux.MiddlewareFunc {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tctx := r.Context()\n\n\t\t\tvar err error\n\n\t\t\t// If request has the id then use it else generate one\n\t\t\trequestID := r.Header.Get(header)\n\t\t\tif requestID == \"\" {\n\t\t\t\trequestID, err = nextRequestID()\n\t\t\t}\n\n\t\t\t// No error then set it in the context & response\n\t\t\tif err == nil {\n\t\t\t\tctx = context.WithValue(ctx, header, requestID)\n\n\t\t\t\tw.Header().Set(header, requestID)\n\t\t\t} else {\n\t\t\t\tlog.Println(\"oops\", err)\n\t\t\t}\n\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t})\n\t}\n}", "func ServerInterceptor(keys ...interface{}) gin.HandlerFunc {\n\treturn func(ctx *gin.Context) {\n\t\tnewContextForHandleRequestID(ctx, keys...)\n\t\tctx.Next() // execute all the handlers\n\t}\n}", "func (s *PolicyTypeAlreadyEnabledException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *AccessPointLimitExceeded) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *MaximumResultReturnedException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func requestID(ctx context.Context) uuid.UUID {\n\tval := ctx.Value(requestIDKey)\n\tif val == nil {\n\t\treturn uuid.UUID{}\n\t}\n\treturn val.(uuid.UUID)\n}", "func handleRequest(payload Payload) (string, error) {\n action := payload.Action\n\tvar result = \"\"\n\tvar err error\n\n\tif action == \"create\" {\n\t\tresult, err = CreateToken(payload.UserID, payload.SecretName)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error: \" + err.Error())\n\t\t\treturn \"\", err\n\t\t}\n\t} else if action == \"verify\" {\n\t\tresult, err = VerifyToken(payload.TokenStr, payload.SecretName)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error: \" + err.Error())\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn result, err\n}", "func Test_RequestID_Next(t *testing.T) {\n\tapp := fiber.New()\n\tapp.Use(New(Config{\n\t\tNext: func(_ *fiber.Ctx) bool {\n\t\t\treturn true\n\t\t},\n\t}))\n\n\tresp, err := app.Test(httptest.NewRequest(\"GET\", \"/\", nil))\n\tutils.AssertEqual(t, nil, err)\n\tutils.AssertEqual(t, resp.Header.Get(fiber.HeaderXRequestID), \"\")\n\tutils.AssertEqual(t, fiber.StatusNotFound, resp.StatusCode)\n}", "func (t requestIDTracker) resetRequestID(identifier ...string) {\n\tkey := strings.Join(identifier, \"/\")\n\tdelete(t.requestIDs, key)\n}", "func (r *relay) handleRequest(reqId uint64, req []byte) {\n\trep := r.handler.HandleRequest(req)\n\tif err := r.sendReply(reqId, rep); err != nil {\n\t\tlog.Printf(\"iris: failed to send reply: %v.\", err)\n\t}\n}", "func (s *BlockedException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func RequestID(req *http.Request) string {\n\tif req == nil {\n\t\treturn \"\"\n\t}\n\treqIDContextValue := req.Context().Value(log.ContextreqIDKey)\n\tif reqIDContextValue == nil {\n\t\treturn \"\"\n\t}\n\treturn reqIDContextValue.(string)\n}", "func (s *TooManyRequests) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func GetRequestID(ctx context.Context) int {\n\tif rv := ctx.Value(requestIDKey); rv != nil {\n\t\tif id, ok := rv.(int); ok {\n\t\t\treturn id\n\t\t}\n\t}\n\n\treturn -1\n}", "func (s *RequestTimeoutException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func RequestHandler(fieldKey string) func(next httpserver.Handler) httpserver.Handler {\n\treturn func(next httpserver.Handler) httpserver.Handler {\n\t\treturn httpserver.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) {\n\t\t\tlog := zerolog.Ctx(r.Context())\n\t\t\tlog.UpdateContext(func(c zerolog.Context) zerolog.Context {\n\t\t\t\treturn c.Str(fieldKey, r.Method+\" \"+r.URL.String())\n\t\t\t})\n\t\t\treturn next.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "func assignRequestID(r *http.Request) *http.Request {\n\tctx := c.AddRequestIDToCTX(r.Context(), uuid.New().String())\n\treturn r.WithContext(ctx)\n}", "func NextRequestID() int32 { return atomic.AddInt32(&globalRequestID, 1) }", "func GetRequestID(ctx context.Context) string {\n\tid, ok := ctx.Value(contextKey(\"requestID\")).(string)\n\tif !ok {\n\t\tlogrus.Warn(\"requestID not found in context\")\n\t\treturn \"\"\n\t}\n\treturn id\n}" ]
[ "0.7193888", "0.7190277", "0.7146616", "0.71137834", "0.70654905", "0.7045712", "0.6964064", "0.69226104", "0.68777466", "0.6860696", "0.6859232", "0.68086654", "0.67448807", "0.6742552", "0.6723413", "0.6590125", "0.64984334", "0.6492414", "0.64490825", "0.6416975", "0.64008284", "0.6400117", "0.6339079", "0.63136697", "0.6301472", "0.6216165", "0.6208095", "0.6200917", "0.6172043", "0.6108759", "0.6107478", "0.60507077", "0.60149103", "0.60142344", "0.6005685", "0.59805924", "0.5964542", "0.59495264", "0.59341633", "0.5921853", "0.59209794", "0.5915079", "0.59132177", "0.58946466", "0.587216", "0.58585143", "0.585367", "0.58532375", "0.58190984", "0.58144075", "0.58072037", "0.5798602", "0.5795499", "0.5788878", "0.578275", "0.57818836", "0.57615095", "0.57567054", "0.5734917", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.5724157", "0.57241297", "0.57055736", "0.5703887", "0.5690046", "0.5688137", "0.5681496", "0.5680541", "0.56686133", "0.56540287", "0.5649638", "0.5648143", "0.56411797", "0.5622091", "0.5620987", "0.56126785", "0.56042755", "0.5604142", "0.56022525", "0.559161", "0.55812335" ]
0.7434374
0
SafeURL removes any trailing slash
func (g GetenvValue) SafeURL() string { if g.value[len(g.value)-1] == '/' { return g.value[:len(g.value)-1] } return g.value }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SanitizeURLKeepTrailingSlash(in string) string {\n\treturn sanitizeURLWithFlags(in, purell.FlagsSafe|purell.FlagRemoveDotSegments|purell.FlagRemoveDuplicateSlashes|purell.FlagRemoveUnnecessaryHostDots|purell.FlagRemoveEmptyPortSeparator)\n}", "func cleanURL(url string) (cleanURL string) {\n\tre := regexp.MustCompile(\"([^:])(\\\\/\\\\/)\")\n\tcleanURL = re.ReplaceAllString(url, \"$1/\")\n\treturn cleanURL\n}", "func StandardizeFinalShortLinkSlash(url string) string {\n\turlLen := len(url)\n\tif urlLen <= 0 {\n\t\treturn \"\"\n\t}\n\tif url[urlLen-1] == '/' {\n\t\treturn url[:urlLen-1]\n\t}\n\treturn url\n}", "func MaybeSafeify(u string, safe bool) string {\n\tif !safe { return u }\n\n\tURL, err := url.Parse(u)\n\tif err != nil { return \"\" }\n\n\tURL.Host = strings.Replace(URL.Host, api.Endpoint, api.FilteredEndpoint, -1)\n\treturn URL.String()\n}", "func SanitizeURL(in string) string {\n\treturn sanitizeURLWithFlags(in, purell.FlagsSafe|purell.FlagRemoveTrailingSlash|purell.FlagRemoveDotSegments|purell.FlagRemoveDuplicateSlashes|purell.FlagRemoveUnnecessaryHostDots|purell.FlagRemoveEmptyPortSeparator)\n}", "func (util copyHandlerUtil) replaceBackSlashWithSlash(urlStr string) string {\n\tstr := strings.Replace(urlStr, \"\\\\\", \"/\", -1)\n\n\treturn str\n}", "func safeUrl(u *url.URL) string {\n\tpassword := u.Query().Get(\"password\")\n\ts := u.String()\n\tif password != \"\" {\n\t\ts = strings.Replace(s, password, \"[scrubbed]\", 1)\n\t}\n\treturn s\n}", "func sanitizeURL(uri *url.URL) *url.URL {\n\tif uri == nil {\n\t\treturn nil\n\t}\n\tparams := uri.Query()\n\tif len(params.Get(\"token\")) > 0 {\n\t\tparams.Set(\"token\", \"REDACTED\")\n\t\turi.RawQuery = params.Encode()\n\t}\n\treturn uri\n}", "func sanitizeURL(uri *url.URL) *url.URL {\n\tif uri == nil {\n\t\treturn nil\n\t}\n\tparams := uri.Query()\n\tif len(params.Get(\"PWD\")) > 0 {\n\t\tparams.Set(\"PWD\", \"REDACTED\")\n\t\turi.RawQuery = params.Encode()\n\t}\n\treturn uri\n}", "func ensureFinalSlash(s string) string {\n\tif s[len(s)-1] != '/' {\n\t\treturn s + \"/\"\n\t} else {\n\t\treturn s\n\t}\n}", "func FormatURL(url string) string {\n\turl = strings.TrimSpace(url)\n\tif strings.Contains(url, \"\\\\\") {\n\t\turl = strings.ReplaceAll(url, \"\\\\\", \"/\")\n\t}\n\turl = strings.TrimRight(url, \"#/?\")\n\treturn url\n}", "func sanitizeURL(uri *url.URL) *url.URL {\n\tif uri == nil {\n\t\treturn nil\n\t}\n\tparams := uri.Query()\n\tif len(params.Get(\"apiKey\")) > 0 {\n\t\tparams.Set(\"apiKey\", \"REDACTED\")\n\t\turi.RawQuery = params.Encode()\n\t}\n\treturn uri\n}", "func sanitizeURL(uri *url.URL) *url.URL {\n\tif uri == nil {\n\t\treturn nil\n\t}\n\tparams := uri.Query()\n\tif len(params.Get(\"access_token\")) > 0 {\n\t\tparams.Set(\"access_token\", \"REDACTED\")\n\t\turi.RawQuery = params.Encode()\n\t}\n\treturn uri\n}", "func URLize(path string) string {\n\n\tpath = strings.Replace(strings.TrimSpace(path), \" \", \"-\", -1)\n\tpath = strings.ToLower(path)\n\tpath = UnicodeSanitize(path)\n\treturn path\n}", "func sanitizeURL(uri *url.URL) *url.URL {\n\tif uri == nil {\n\t\treturn nil\n\t}\n\tparams := uri.Query()\n\tif len(params.Get(\"client_secret\")) > 0 {\n\t\tparams.Set(\"client_secret\", \"REDACTED\")\n\t\turi.RawQuery = params.Encode()\n\t}\n\treturn uri\n}", "func sanitizeURL(uri *url.URL) *url.URL {\n\tif uri == nil {\n\t\treturn nil\n\t}\n\tparams := uri.Query()\n\tif len(params.Get(\"client_secret\")) > 0 {\n\t\tparams.Set(\"client_secret\", \"REDACTED\")\n\t\turi.RawQuery = params.Encode()\n\t}\n\treturn uri\n}", "func NormalizeURL(url string) string {\n\tfor strings.HasSuffix(url, \"/\") {\n\t\turl = url[:len(url)-1]\n\t}\n\treturn url\n}", "func ensureTrailingSlash(s string) string {\n\tif len(s) == 0 || s[len(s)-1:] == \"/\" {\n\t\treturn s\n\t}\n\treturn s + \"/\"\n}", "func sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}", "func sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}", "func slashClean(name string) string {\n\tif name == \"\" || name[0] != '/' {\n\t\tname = \"/\" + name\n\t}\n\treturn path.Clean(name)\n}", "func URLPathClean(urlPath string) string {\n\tflag := strings.HasSuffix(urlPath, \"/\")\n\tstr := path.Clean(fmt.Sprintf(\"/%s\", urlPath))\n\tif flag && str != \"/\" {\n\t\treturn fmt.Sprintf(\"%s/\", str)\n\t}\n\treturn str\n}", "func clean_url(cand string) string {\n // TODO: url pattern should be refined\n r, _ := regexp.Compile(\"^((http[s]?|ftp)://)?(www\\\\.)?(?P<body>[a-z]+\\\\.[a-z]+)$\")\n if r.MatchString(cand) {\n r2 := r.FindAllStringSubmatch(cand, -1)\n return r2[0][len(r2[0]) - 1]\n }\n return \"\"\n}", "func sanitizeUrl(href string, domain string) (url.URL, bool){\n\tif strings.Trim(href, \" \") == \"\"{\n\t\treturn url.URL{}, false\n\t}\n\n\tu, err := url.Parse(href)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn url.URL{}, false\n\t}\n\n\tif u.Host == \"\"{\n\t\tu.Host = domain\n\t} else if u.Host != domain || u.Path == \"/\" || u.Path == \"\"{\n\t\treturn url.URL{}, false\n\t}\n\n\tif u.Scheme == \"\"{\n\t\tu.Scheme = \"https\"\n\t}\n\n\t// Ignore alien schemas [ mailto, ftp, etc ]\n\tif !strings.Contains(u.Scheme, \"http\") {\n\t\treturn url.URL{}, false\n\t}\n\n\t// TODO: Check URL is accessible\n\n\treturn *u, true\n}", "func SanitizeRoute(path string) string {\n\treturn strings.Trim(path, \"/\")\n}", "func Sanitize(cfg *config.Config) {\n\t// sanitize config\n\tif cfg.HTTP.Root != \"/\" {\n\t\tcfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, \"/\")\n\t}\n}", "func urlify(rawInput string) string {\n\tencoded := strings.TrimSpace(rawInput)\n\treturn strings.ReplaceAll(encoded, \" \", \"%20\")\n}", "func Base64UrlSafeEncode(source []byte) string {\n\tbyteArr := base64.StdEncoding.EncodeToString(source)\n\tsafeUrl := strings.Replace(byteArr, \"/\", \"_\", -1)\n\tsafeUrl = strings.Replace(safeUrl, \"+\", \"-\", -1)\n\tsafeUrl = strings.Replace(safeUrl, \"=\", \"\", -1)\n\treturn safeUrl\n}", "func fixUrl(url string) string {\n\turlParts := strings.SplitN(url, \"/\", 2)\n\tif len(urlParts) < 2 {\n\t\treturn \"\"\n\t}\n\n\treturn urlParts[0] + \":\" + urlParts[1]\n}", "func ToURL(path string) string {\n\treturn filepath.Clean(path)\n}", "func ToURL(s string) string {\n\ts = strings.Trim(s, \" \")\n\ts = strings.ReplaceAll(s, \" \", \"%20\")\n\treturn s\n}", "func SafePath(s string) string {\n\treturn tr.Replace(s)\n}", "func NormalizeURL(currentURL string) string {\n\tidx := strings.IndexAny(currentURL, \"?#\")\n\tif idx != -1 {\n\t\tcurrentURL = currentURL[:idx]\n\t}\n\treturn currentURL\n}", "func clean(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\n\tnp := path.Clean(p)\n\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\t// Fast path for common case of p being the string we want:\n\t\tif len(p) == len(np)+1 && strings.HasPrefix(p, np) {\n\t\t\tnp = p\n\t\t} else {\n\t\t\tnp += \"/\"\n\t\t}\n\t}\n\n\treturn np\n}", "func (f *FortiWebClient) SafeName(url string) string {\n\n\treturn strings.Replace(url, \"/\", \"_\", -1)\n}", "func TrimSlashes(c string) string {\n\treturn strings.TrimSuffix(strings.TrimPrefix(cleanPath(c), \"/\"), \"/\")\n}", "func canonicalURI(r *http.Request) string {\n\tpattens := strings.Split(r.URL.Path, SLASH)\n\tvar uri []string\n\tfor _, v := range pattens {\n\t\tswitch v {\n\t\tcase \"\":\n\t\t\tcontinue\n\t\tcase \".\":\n\t\t\tcontinue\n\t\tcase \"..\":\n\t\t\tif len(uri) > 0 {\n\t\t\t\turi = uri[:len(uri)-1]\n\t\t\t}\n\t\tdefault:\n\t\t\turi = append(uri, url.QueryEscape(v))\n\t\t}\n\t}\n\turlpath := SLASH + strings.Join(uri, SLASH)\n\turlpath = strings.Replace(urlpath, \"+\", \"%20\", -1)\n\tif ok := strings.HasSuffix(urlpath, SLASH); ok {\n\t\treturn urlpath\n\t} else {\n\t\treturn urlpath + SLASH\n\t}\n}", "func ToURL(path string) string {\n\t// fix seperator on Windows\n\treturn strings.ReplaceAll(filepath.Clean(path), \"\\\\\", \"/\")\n}", "func sanitisePath(path string) string {\n\t// re := regexp.MustCompile(`\\s+`)\n\t// return re.ReplaceAllString(path, ``)\n\treturn path\n}", "func formatUrl(source string) string {\n\tif match, _ := regexp.MatchString(\"https?:\\\\/\\\\/\", source); match {\n\t\treturn source\n\t}\n\n\treturn \"https://\" + source\n}", "func CleanUrl(p string) string {\n\t// Turn empty string into \"/\"\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\n\tn := len(p)\n\tvar buf []byte\n\n\t// Invariants:\n\t// reading from path; r is index of next byte to process.\n\t// writing to buf; w is index of next byte to write.\n\n\t// path must start with '/'\n\tr := 1\n\tw := 1\n\n\tif p[0] != '/' {\n\t\tr = 0\n\t\tbuf = make([]byte, n+1)\n\t\tbuf[0] = '/'\n\t}\n\n\ttrailing := n > 2 && p[n-1] == '/'\n\n\t// A bit more clunky without a 'lazybuf' like the path package, but the loop\n\t// gets completely inlined (bufApp). So in contrast to the path package this\n\t// loop has no expensive function calls (except 1x make)\n\n\tfor r < n {\n\t\tswitch {\n\t\tcase p[r] == '/':\n\t\t\t// empty path element, trailing slash is added after the end\n\t\t\tr++\n\n\t\tcase p[r] == '.' && r+1 == n:\n\t\t\ttrailing = true\n\t\t\tr++\n\n\t\tcase p[r] == '.' && p[r+1] == '/':\n\t\t\t// . element\n\t\t\tr++\n\n\t\tcase p[r] == '.' && p[r+1] == '.' && (r+2 == n || p[r+2] == '/'):\n\t\t\t// .. element: remove to last /\n\t\t\tr += 2\n\n\t\t\tif w > 1 {\n\t\t\t\t// can backtrack\n\t\t\t\tw--\n\n\t\t\t\tif buf == nil {\n\t\t\t\t\tfor w > 1 && p[w] != '/' {\n\t\t\t\t\t\tw--\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor w > 1 && buf[w] != '/' {\n\t\t\t\t\t\tw--\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\tdefault:\n\t\t\t// real path element.\n\t\t\t// add slash if needed\n\t\t\tif w > 1 {\n\t\t\t\tbufApp(&buf, p, w, '/')\n\t\t\t\tw++\n\t\t\t}\n\n\t\t\t// copy element\n\t\t\tfor r < n && p[r] != '/' {\n\t\t\t\tbufApp(&buf, p, w, p[r])\n\t\t\t\tw++\n\t\t\t\tr++\n\t\t\t}\n\t\t}\n\t}\n\n\t// re-append trailing slash\n\tif trailing && w > 1 {\n\t\tbufApp(&buf, p, w, '/')\n\t\tw++\n\t}\n\n\tif buf == nil {\n\t\treturn p[:w]\n\t}\n\treturn string(buf[:w])\n}", "func getCleanPath(r *http.Request) string {\n\tpath := r.URL.Path\n\tif strings.HasPrefix(path, \"/\") {\n\t\tpath = path[1:]\n\t}\n\tif strings.HasSuffix(path, \"/\") {\n\t\tpath = path[:len(path)-1]\n\t}\n\treturn path\n}", "func removeTrailingSlash(path string) string {\n\treturn strings.TrimRight(path, \"/\")\n}", "func stripSlash(str string) string {\n\treturn strings.TrimRight(strings.TrimLeft(str, \"/\"), \"/\")\n}", "func NormalizeURLs(s string, escape bool) string {\n\tif escape {\n\t\tif urls := xurls.Strict().FindAllString(s, -1); len(urls) > 0 {\n\t\t\tfor _, url := range urls {\n\t\t\t\tnormalized := strings.ReplaceAll(url, \"\\\\\", \"\")\n\t\t\t\ts = strings.ReplaceAll(s, url, normalized)\n\t\t\t}\n\t\t}\n\t}\n\treturn s\n}", "func normEndpoint(url string) string {\n\tif len(url) > 0 {\n\t\tif url[len(url)-1] != '/' {\n\t\t\turl += \"/\"\n\t\t}\n\t\treturn url\n\t}\n\tpanic(\"az: invalid endpoint\")\n}", "func cleanHost(in string) string {\n\tif i := strings.IndexAny(in, \" /\"); i != -1 {\n\t\treturn in[:i]\n\t}\n\treturn in\n}", "func normalizePath(s string) string {\n\tif s == \"/\" {\n\t\treturn \"\"\n\t}\n\treturn s\n}", "func foldSlashes(u *url.URL) {\n\to := u.RequestURI()\n\n\tfor u.Path = strings.Replace(\n\t\tu.RequestURI(), `//`, `/`, -1,\n\t); o != u.RequestURI(); u.Path = strings.Replace(\n\t\tu.RequestURI(), `//`, `/`, -1,\n\t) {\n\t\to = u.RequestURI()\n\t}\n}", "func cleanLink(base, link string) (string, error) {\n\tlink = RegexAnchors.ReplaceAllString(link, \"\")\n\tif len(link) == 0 {\n\t\treturn \"\", ErrInvalidLink\n\t}\n\tlinkURL, err := url.Parse(link)\n\tif err != nil {\n\t\treturn \"\", ErrInvalidLink\n\t}\n\n\tif validScheme(linkURL.Scheme) {\n\t\treturn link, nil\n\t}\n\n\tbaseURL, err := url.Parse(base)\n\tif err != nil {\n\t\treturn \"\", ErrInvalidLink\n\t} else if len(baseURL.Host) == 0 {\n\t\treturn \"\", ErrInvalidLink\n\t}\n\n\tif link[0] == '/' || link[len(link)-1] == '/' {\n\t\tlink = strings.Trim(link, \"/\")\n\t}\n\n\treturn strings.Join([]string{baseURL.Scheme, \"://\", baseURL.Host, \"/\", link}, \"\"), nil\n}", "func escape(token string) string {\n\ttoken = strings.Replace(token, \"~\", \"~0\", -1)\n\ttoken = strings.Replace(token, \"/\", \"~1\", -1)\n\treturn url.PathEscape(token)\n}", "func escapePath(p string) string {\n\treturn strings.ReplaceAll(url.PathEscape(p), \"%2F\", \"/\")\n}", "func clean(name string) string {\n\tname = strings.Trim(name, \"/\")\n\tname = filepath.Clean(name)\n\tif name == \".\" || name == \"/\" {\n\t\tname = \"\"\n\t}\n\treturn name\n}", "func urlEscapePath(unescaped string) string {\n\tarr := strings.Split(unescaped, \"/\")\n\tfor i, partString := range strings.Split(unescaped, \"/\") {\n\t\tarr[i] = url.QueryEscape(partString)\n\t}\n\treturn strings.Join(arr, \"/\")\n}", "func NormalizeURL(u string) (*url.URL, error) {\n\tif !isHTTPPrepended(u) {\n\t\tu = prependHTTP(u)\n\t}\n\n\t// We do it like browsers, just remove the trailing slash.\n\t// This will save us from a lot of problems later.\n\tu = strings.TrimSuffix(u, \"/\")\n\n\tparsedURL, err := url.Parse(u)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to parse URL/hostname: %s. %s\", u, err)\n\t}\n\n\treturn parsedURL, nil\n}", "func cleanPath(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\tnp += \"/\"\n\t}\n\treturn np\n}", "func cleanPath(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\tnp += \"/\"\n\t}\n\treturn np\n}", "func cleanPath(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\tnp += \"/\"\n\t}\n\treturn np\n}", "func cleanPath(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\tnp += \"/\"\n\t}\n\treturn np\n}", "func cleanPath(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\tnp += \"/\"\n\t}\n\treturn np\n}", "func cleanPath(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\tnp += \"/\"\n\t}\n\treturn np\n}", "func cleanPath(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\tnp += \"/\"\n\t}\n\treturn np\n}", "func cleanPath(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\tnp += \"/\"\n\t}\n\treturn np\n}", "func rawUrl(htmlUrl string) string {\n\tdomain := strings.Replace(htmlUrl, \"https://github.com/\", \"https://raw.githubusercontent.com/\", -1)\n\treturn strings.Replace(domain, \"/blob/\", \"/\", -1)\n}", "func normalizePath(s string) string {\n\tseparator := \"/\"\n\tif !strings.HasPrefix(s, separator) {\n\t\ts = separator + s\n\t}\n\n\tif len(s) > 1 && strings.HasSuffix(s, separator) {\n\t\ts = s[:len(s)-1]\n\t}\n\treturn s\n}", "func TrimAndSplitURL(u string) []string {\n\tu = strings.TrimSuffix(u, \"/\")\n\treturn strings.Split(u, \"/\")\n}", "func CanonicalURLPath(p string) string {\r\n\tif p == \"\" {\r\n\t\treturn \"/\"\r\n\t}\r\n\tif p[0] != '/' {\r\n\t\tp = \"/\" + p\r\n\t}\r\n\tnp := path.Clean(p)\r\n\t// path.Clean removes trailing slash except for root,\r\n\t// put the trailing slash back if necessary.\r\n\tif p[len(p)-1] == '/' && np != \"/\" {\r\n\t\tnp += \"/\"\r\n\t}\r\n\treturn np\r\n}", "func urlify(s string) string {\n\tvar r strings.Builder\n\n\tfor i := 0; i < len(s); i++ {\n\t\tif string(s[i]) == \" \" {\n\t\t\tr.WriteString(\"%20\")\n\t\t} else {\n\t\t\tr.WriteString(string(s[i]))\n\t\t}\n\t}\n\treturn r.String()\n}", "func Clean(s string, u *url.URL) (string, string) {\n\tr := bytes.NewReader([]byte(strings.TrimSpace(s)))\n\tz := html.NewTokenizer(r)\n\tbuf := &bytes.Buffer{}\n\tstrip := &bytes.Buffer{}\n\tskip := 0\n\tif u != nil {\n\t\tu.RawQuery = \"\"\n\t\tu.Fragment = \"\"\n\t}\n\tfor {\n\t\tif z.Next() == html.ErrorToken {\n\t\t\tif err := z.Err(); err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn s, s\n\t\t\t}\n\t\t}\n\n\t\tt := z.Token()\n\t\tif t.Type == html.StartTagToken || t.Type == html.SelfClosingTagToken {\n\t\t\tif !AcceptableElements[t.Data] {\n\t\t\t\tif UnacceptableElementsWithEndTag[t.Data] && t.Type != html.SelfClosingTagToken {\n\t\t\t\t\tskip += 1\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcleanAttributes(u, &t)\n\t\t\t\tbuf.WriteString(t.String())\n\t\t\t}\n\t\t} else if t.Type == html.EndTagToken {\n\t\t\tif !AcceptableElements[t.Data] {\n\t\t\t\tif UnacceptableElementsWithEndTag[t.Data] {\n\t\t\t\t\tskip -= 1\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbuf.WriteString(t.String())\n\t\t\t}\n\t\t} else if skip == 0 {\n\t\t\tbuf.WriteString(t.String())\n\t\t\tif t.Type == html.TextToken {\n\t\t\t\tstrip.WriteString(t.String())\n\t\t\t}\n\t\t}\n\t}\n\n\treturn buf.String(), strip.String()\n}", "func unescape(escaped string) string {\n unescaped, e := url.QueryUnescape(escaped)\n if e != nil {\n log.Fatal(e)\n }\n return unescaped\n}", "func CleanSlashes(p string) string {\n\treturn MoreSlashes.ReplaceAllString(filepath.ToSlash(p), \"/\")\n}", "func sanitizePath(p string) string {\n\tbase := \".\"\n\tif filepath.IsLocal(p) {\n\t\treturn filepath.Clean(p)\n\t}\n\tresult := filepath.Join(base, filepath.Clean(filepath.Base(p)))\n\tif result == \"..\" {\n\t\treturn \".\"\n\t}\n\treturn result\n}", "func sanitizeFileName(v string) string {\n\treturn path.Clean(strings.ReplaceAll(v, \"../\", \"\"))\n}", "func StripSlashes(s string) string {\n\tout := make([]byte, 0, len(s)) // might be more than we need, but no reallocs\n\tfor i := 0; i < len(s); i++ {\n\t\tif s[i] == '\\\\' && i < len(s)-1 {\n\t\t\tswitch s[i+1] {\n\t\t\tcase '.', '_', '-': // these pass unquoted\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tout = append(out, byte(s[i]))\n\t}\n\treturn string(out)\n}", "func fixup(prefix, path string, params ...[2]string) string {\n\tprefix = strings.TrimSuffix(prefix, \"/\")\n\tpath = strings.TrimPrefix(path, \"/\")\n\n\tvalues := make(url.Values)\n\tfor _, param := range params {\n\t\tif param[1] != \"\" {\n\t\t\tvalues.Add(param[0], param[1])\n\t\t}\n\t}\n\n\tquery := values.Encode()\n\n\t// there is a better way to build url queries\n\tcompleteURL := prefix + \"/\" + path\n\tif len(query) > 0 {\n\t\tcompleteURL += \"?\" + query\n\t}\n\treturn completeURL\n}", "func EscapeURL(s string) string {\n\treturn got.URLQueryEscaper(s)\n}", "func cleanPath(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\t// Fast path for common case of p being the string we want:\n\t\tif len(p) == len(np)+1 && strings.HasPrefix(p, np) {\n\t\t\tnp = p\n\t\t} else {\n\t\t\tnp += \"/\"\n\t\t}\n\t}\n\treturn np\n}", "func cleanPath(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\t// Fast path for common case of p being the string we want:\n\t\tif len(p) == len(np)+1 && strings.HasPrefix(p, np) {\n\t\t\tnp = p\n\t\t} else {\n\t\t\tnp += \"/\"\n\t\t}\n\t}\n\treturn np\n}", "func cleanPath(p string, mode TrailingSlashMode) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tnp := path.Clean(p)\n\t// path.Clean removes trailing slash except for root;\n\t// put the trailing slash back if necessary.\n\tif p[len(p)-1] == '/' && np != \"/\" {\n\t\tnp += \"/\"\n\t}\n\n\tswitch mode {\n\tcase Add:\n\t\tif np[len(np)-1] != '/' {\n\t\t\tnp += \"/\"\n\t\t}\n\tcase Remove:\n\t\tif len(np) > 1 && np[len(np)-1] == '/' {\n\t\t\tnp = np[:len(np)-1]\n\t\t}\n\t}\n\treturn np\n}", "func RemoveTrailingSlash(path string) string {\n\tif len(path) > 1 && strings.HasSuffix(path, \"/\") {\n\t\treturn path[:len(path)-1]\n\t}\n\treturn path\n}", "func DenormalizeSlashes(path string) string {\n\tpath = strings.ReplaceAll(path, `\\`, `/`)\n\treturn path\n}", "func Test_FullPathURL(t *testing.T) {\n\turl := \"/api/machines/Machines-42\"\n\tif actual, err := normalizeURI(url); err != nil {\n\t\tt.Error(\"Got error: \", err)\n\t} else if strings.Compare(url, actual.String()) != 0 {\n\t\tt.Errorf(\"Expected \\\"%s\\\", got \\\"%s\\\"\", url, actual)\n\t}\n}", "func sanitizeTagValue(v string) string {\n\tif strings.TrimSpace(v) == \"\" {\n\t\treturn \"_\"\n\t}\n\treturn strings.ReplaceAll(v, \"/\", \"_\")\n}", "func RemoveTrailingSlash(s string) string {\n\tre := regexp.MustCompile(`/$`)\n\treturn re.ReplaceAllString(s, \"\")\n}", "func TrimSlash(str string) string {\n\treturn TrimByteSuffix(TrimBytePrefix(str, '/'), '/')\n}", "func replaceRoot(url string) string {\n\trootUrl := viper.GetString(\"replaceRoot\")\n\turl = strings.TrimPrefix(url, strings.ToLower(rootUrl))\n\tif len(url) == 0 {\n\t\treturn \"/\"\n\t}\n\treturn url\n}", "func fmtPreURL(preURL string) string {\n\tif len(preURL) == 0 || (len(preURL) == 1 && preURL[0] == '/') {\n\t\treturn \"\"\n\t}\n\n\tvar fmtURL string\n\tif preURL[0] != '/' {\n\t\tfmtURL = fmt.Sprintf(\"/%s\", preURL)\n\t} else {\n\t\tfmtURL = preURL\n\t}\n\n\tif fmtURL[len(fmtURL)-1] == '/' {\n\t\tfmtURL = fmtURL[0 : len(fmtURL)-1]\n\t}\n\n\treturn fmtURL\n}", "func RemoveTrailingSlash(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.URL.Path != \"/\" {\n\t\t\tr.URL.Path = strings.TrimSuffix(r.URL.Path, \"/\")\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func sanitizeAdaptorEndpoint(endp string) string {\n\tendp = strings.Trim(endp, \"/\")\n\n\tif strings.HasPrefix(endp, \"localhost\") {\n\t\t// Replace localhost in case we are running insde docker\n\t\tif mode := os.Getenv(\"MODE\"); len(mode) > 0 && mode == \"docker\" {\n\t\t\treturn strings.Replace(endp, \"localhost\", \"host.docker.internal\", 1)\n\t\t}\n\t}\n\n\treturn endp\n}", "func (i *Index) securePath(path string) (cleaned string, hostpath string) {\n\tpath, err := url.QueryUnescape(path)\n\tif err != nil {\n\t\treturn \"/\", i.Root\n\t}\n\tcleaned = filepath.Clean(path)\n\thostpath = i.Root + cleaned\n\treturn\n}", "func CanonicalizeURL(base *url.URL, rawurl string) (string, error) {\n\tparsed, err := base.Parse(rawurl)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tparsed.Fragment = \"\"\n\treturn parsed.String(), nil\n}", "func StandardizeURL(url string) string {\n\tlink := url\n\tvar schema, domain, path string\n\n\t// Try to get the schema\n\tslice := strings.SplitN(url, \"://\", 2)\n\tif len(slice) == 2 && len(slice[0]) < 10 { // schema exists\n\t\tschema = slice[0] + \"://\"\n\t\tlink = slice[1]\n\t} else {\n\t\tschema = \"http://\"\n\t}\n\n\t// Get the domain\n\tslice = strings.SplitN(link, \"/\", 2)\n\tif len(slice) == 2 {\n\t\tdomain = slice[0]\n\t\tpath = \"/\" + slice[1]\n\t} else {\n\t\tdomain = slice[0]\n\t\tpath = \"/\"\n\t}\n\n\tdomain, _ = idna.ToASCII(domain)\n\tlink = schema + domain + path\n\n\treturn link\n}", "func TestNormaliseUrl(t *testing.T) {\n\t\n\turl := \"http://google.com\"\n\tans := NormaliseUrl(\"google.com\")\n\tif url != ans{\n\t\tt.Errorf(\"Test failed: expected %v, got %v\", url, ans)\n\t}\n}", "func Canonicalize(nsPath string) string {\n\tif nsPath == \"\" {\n\t\treturn \"\"\n\t}\n\n\t// Canonicalize the path to not have a '/' prefix\n\tnsPath = strings.TrimPrefix(nsPath, \"/\")\n\n\t// Canonicalize the path to always having a '/' suffix\n\tif !strings.HasSuffix(nsPath, \"/\") {\n\t\tnsPath += \"/\"\n\t}\n\n\treturn nsPath\n}", "func addSlashes(p string) string {\n\tif p == \"\" {\n\t\treturn \"/\"\n\t}\n\tif p[0] != '/' {\n\t\tp = \"/\" + p\n\t}\n\tif p[len(p)-1] != '/' {\n\t\tp = p + \"/\"\n\t}\n\treturn p\n}", "func StripSlash(str string) string {\n\tre := regexp.MustCompile(\"/+$\")\n\treturn re.ReplaceAllString(str, \"\")\n}", "func NormalizeURI(u *url.URL, mode ValidationMode) (*url.URL, error) {\n\tif err := ValidateURI(u, mode); err != nil {\n\t\treturn nil, err\n\t}\n\treturn normalizeURI(u), nil\n}", "func trimPathAfterLastSlash(path string) string {\n\tif index := strings.LastIndex(path, \"/\"); index != -1 {\n\t\t// fmt.Println(path, \" Trimmed =\", path[:index])\n\t\treturn path[:index] //remove including the last /\n\t}\n\tfmt.Println(\"Failed to trim strings after last '/'\")\n\treturn path\n}", "func Sanitize(text string) string {\n sanitized := rePhoto.ReplaceAllString(text, \"/photo\")\n sanitized = reRetweet.ReplaceAllString(sanitized, \"$1 \")\n sanitized = reMention.ReplaceAllString(sanitized, \"$1 $2\")\n sanitized = reLink.ReplaceAllString(sanitized, \"$1 $2$3\")\n\n sanitized = reEllipsis.ReplaceAllString(sanitized, \"$1 \")\n sanitized = reHyphen.ReplaceAllString(sanitized, \"$1 \")\n sanitized = reComma.ReplaceAllString(sanitized, \"$1$2 $3\")\n\n sanitized = strings.Replace(sanitized, \"&amp;\", \"&\", -1)\n sanitized = strings.Replace(sanitized, \"&gt;\", \">\", -1)\n sanitized = strings.Replace(sanitized, \"&lt;\", \"<\", -1)\n\n sanitized = strings.Replace(sanitized, \"#\", \"#\", -1)\n sanitized = strings.Replace(sanitized, \"#\", \" #\", -1)\n\n return sanitized\n}", "func normalizeSourceUrl(assetPath string, origin *url.URL) (string, error) {\n\ts, err := url.Parse(assetPath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Remove '//' from assets. Ex: //foo.bar/baz.css => foo.bar/baz.css\n\tif strings.HasPrefix(assetPath, \"//\") {\n\t\tassetPath = strings.Replace(assetPath, \"//\", \"\", 1)\n\t}\n\n\t// Remove relative '..' paths. Ex: ../../app.css => app.css\n\tassetPath = strings.Replace(assetPath, \"../\", \"\", -1)\n\n\t// If the asset path doesn't contain a host (meaning it's a relative path), prefix it with the origin host.\n\tif len(s.Host) == 0 {\n\t\tassetPath = addHttpProtocolIfNotExists(origin.Host + \"/\" + assetPath)\n\t} else {\n\t\tassetPath = addHttpProtocolIfNotExists(assetPath)\n\t}\n\n\treturn assetPath, nil\n}" ]
[ "0.73186594", "0.67580515", "0.6732549", "0.66908634", "0.6412657", "0.6403609", "0.63658345", "0.6280971", "0.6222566", "0.6208953", "0.619915", "0.61960405", "0.61782575", "0.61374104", "0.6118367", "0.6118367", "0.60970885", "0.6083308", "0.60275537", "0.60275537", "0.60109985", "0.59829795", "0.5960126", "0.5949337", "0.59121186", "0.587308", "0.5817259", "0.5815244", "0.5801678", "0.57981306", "0.5764552", "0.57560265", "0.57196426", "0.5712238", "0.56937116", "0.5689504", "0.5679076", "0.5674131", "0.5672112", "0.56686056", "0.56301546", "0.5618123", "0.55917656", "0.559007", "0.55629236", "0.5541669", "0.5532386", "0.55244994", "0.5513413", "0.54727364", "0.5472125", "0.5468097", "0.5436522", "0.54178226", "0.54008657", "0.53980684", "0.53980684", "0.53980684", "0.53980684", "0.53980684", "0.53980684", "0.53980684", "0.539242", "0.5383192", "0.5356235", "0.5309343", "0.5309224", "0.5303586", "0.5290556", "0.52881885", "0.52846164", "0.5283998", "0.5274644", "0.52678365", "0.5248807", "0.5238006", "0.5232805", "0.5232805", "0.52216524", "0.5215808", "0.5215785", "0.52141297", "0.52093506", "0.5202157", "0.51973695", "0.51951665", "0.5186154", "0.5174208", "0.5143583", "0.5136983", "0.5121251", "0.5120648", "0.51157904", "0.5113359", "0.5096268", "0.50746906", "0.50679123", "0.5066356", "0.50608367", "0.5060428" ]
0.69711566
1
VerifyKernelFuncs ensures all kernel functions exist in ksyms located at provided path.
func VerifyKernelFuncs(requiredKernelFuncs ...string) (map[string]struct{}, error) { return funcCache.verifyKernelFuncs(requiredKernelFuncs) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *ExportRunner) checkFnPaths() error {\n\tcwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn err\n\t}\n\tcwd = fmt.Sprintf(\"%s%s\", cwd, string(os.PathSeparator))\n\n\tfor _, fnPath := range r.FnPaths {\n\t\tp := fnPath\n\t\tif !path.IsAbs(p) {\n\t\t\tp = path.Join(cwd, p)\n\t\t}\n\n\t\tif !strings.HasPrefix(p, cwd) {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"function path (%s) is not within the current working directory\",\n\t\t\t\tfnPath,\n\t\t\t)\n\t\t}\n\n\t\tif _, err := os.Stat(p); os.IsNotExist(err) {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t`function path (%s) does not exist`,\n\t\t\t\tfnPath,\n\t\t\t)\n\t\t}\n\t}\n\n\treturn nil\n}", "func checkKmod() error {\n\tkmods := []string{\n\t\t\"nf_conntrack_ipv4\",\n\t\t\"nf_conntrack_ipv6\",\n\t}\n\n\tif _, err := os.Stat(\"/sys/module/nf_conntrack\"); os.IsNotExist(err) {\n\t\t// Fall back to _ipv4/6 if nf_conntrack is missing.\n\t\tfor _, km := range kmods {\n\t\t\tif _, err := os.Stat(fmt.Sprintf(\"/sys/module/%s\", km)); os.IsNotExist(err) {\n\t\t\t\treturn fmt.Errorf(\"missing kernel module %s and module nf_conntrack\", km)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func Check(mainPkg *ssa.Package) {\n\tvar funcList []*ssa.Function\n\n\tfor name, member := range mainPkg.Members {\n\t\tswitch f := member.(type) {\n\t\tcase *ssa.Function:\n\t\t\tif name == \"init\" {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tfuncList = append(funcList, f)\n\t\t}\n\t}\n\n\tfor _, funcVar := range funcList {\n\n\t\tresults := CheckCallerFunc(funcVar)\n\t\tfor _, result := range results {\n\t\t\tfmt.Println(result)\n\t\t}\n\t}\n\n}", "func checkFuncs(t Type, pkg *Package, log *errlog.ErrorLog) error {\n\t// TODO: Ignore types defined in a different package\n\tswitch t2 := t.(type) {\n\tcase *AliasType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\tfor _, f := range t2.Funcs {\n\t\t\tif err := checkFuncs(f.Type, pkg, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := checkFuncBody(f, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif f.DualFunc != nil {\n\t\t\t\tif err := checkFuncs(f.DualFunc.Type, pkg, log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := checkFuncBody(f.DualFunc, log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn checkFuncs(t2.Alias, pkg, log)\n\tcase *PointerType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\treturn checkFuncs(t2.ElementType, pkg, log)\n\tcase *MutableType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\treturn checkFuncs(t2.Type, pkg, log)\n\tcase *SliceType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\treturn checkFuncs(t2.ElementType, pkg, log)\n\tcase *ArrayType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\treturn checkFuncs(t2.ElementType, pkg, log)\n\tcase *StructType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\tif t2.BaseType != nil {\n\t\t\tif err := checkFuncs(t2.BaseType, pkg, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tfor _, iface := range t2.Interfaces {\n\t\t\tif err := checkFuncs(iface, pkg, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tfor _, f := range t2.Funcs {\n\t\t\tif err := checkFuncs(f.Type, pkg, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := checkFuncBody(f, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif f.DualFunc != nil {\n\t\t\t\tif err := checkFuncs(f.DualFunc.Type, pkg, log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := checkFuncBody(f.DualFunc, log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\tcase *UnionType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\tfor _, f := range t2.Funcs {\n\t\t\tif err := checkFuncs(f.Type, pkg, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := checkFuncBody(f, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif f.DualFunc != nil {\n\t\t\t\tif err := checkFuncs(f.DualFunc.Type, pkg, log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := checkFuncBody(f.DualFunc, log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\tcase *InterfaceType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\tfor _, b := range t2.BaseTypes {\n\t\t\tif err := checkFuncs(b, pkg, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tfor _, f := range t2.Funcs {\n\t\t\tif err := checkFuncs(f.FuncType, pkg, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\tcase *ClosureType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\treturn checkFuncs(t2.FuncType, pkg, log)\n\tcase *GroupedType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\treturn checkFuncs(t2.Type, pkg, log)\n\tcase *FuncType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\t// TODO: Check that target is acceptable\n\t\tfor _, p := range t2.In.Params {\n\t\t\tif err := checkFuncs(p.Type, pkg, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tfor _, p := range t2.Out.Params {\n\t\t\tif err := checkFuncs(p.Type, pkg, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\tcase *GenericInstanceType:\n\t\tif t2.pkg != pkg || t2.TypeBase.funcsChecked || t2.equivalent != nil {\n\t\t\treturn nil\n\t\t}\n\t\tt2.funcsChecked = true\n\t\tif err := checkFuncs(t2.InstanceType, pkg, log); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, f := range t2.Funcs {\n\t\t\tif err := checkFuncs(f.Type, pkg, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tpkg.Funcs = append(pkg.Funcs, f)\n\t\t\tif err := checkFuncBody(f, log); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif f.DualFunc != nil {\n\t\t\t\tif err := checkFuncs(f.DualFunc.Type, pkg, log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := checkFuncBody(f.DualFunc, log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\tcase *GenericType:\n\t\t// Do nothing\n\t\treturn nil\n\tcase *PrimitiveType:\n\t\t// Do nothing\n\t\treturn nil\n\t}\n\tpanic(\"Wrong\")\n}", "func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences(ctx context.Context) {\n\tclient.logger.Info(\"verifying function spec references for all functions in the cluster\")\n\n\tvar err error\n\tvar fList *fv1.FunctionList\n\terrs := &multierror.Error{}\n\n\tfor _, namespace := range utils.DefaultNSResolver().FissionResourceNS {\n\t\tfor i := 0; i < maxRetries; i++ {\n\t\t\tfList, err = client.fissionClient.CoreV1().Functions(namespace).List(ctx, metav1.ListOptions{})\n\t\t\tif err == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif err != nil {\n\t\t\tclient.logger.Fatal(\"error listing functions after max retries\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.Int(\"max_retries\", maxRetries))\n\t\t}\n\n\t\t// check that all secrets, configmaps, packages are in the same namespace\n\t\tfor _, fn := range fList.Items {\n\t\t\tsecrets := fn.Spec.Secrets\n\t\t\tfor _, secret := range secrets {\n\t\t\t\tif secret.Namespace != \"\" && secret.Namespace != fn.ObjectMeta.Namespace {\n\t\t\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"function : %s.%s cannot reference a secret : %s in namespace : %s\", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, secret.Name, secret.Namespace))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconfigmaps := fn.Spec.ConfigMaps\n\t\t\tfor _, configmap := range configmaps {\n\t\t\t\tif configmap.Namespace != \"\" && configmap.Namespace != fn.ObjectMeta.Namespace {\n\t\t\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"function : %s.%s cannot reference a configmap : %s in namespace : %s\", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, configmap.Name, configmap.Namespace))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif fn.Spec.Package.PackageRef.Namespace != \"\" && fn.Spec.Package.PackageRef.Namespace != fn.ObjectMeta.Namespace {\n\t\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"function : %s.%s cannot reference a package : %s in namespace : %s\", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))\n\t\t\t}\n\t\t}\n\t}\n\n\tif errs.ErrorOrNil() != nil {\n\t\tclient.logger.Fatal(\"installation failed\",\n\t\t\tzap.Error(errs),\n\t\t\tzap.String(\"summary\", \"a function cannot reference secrets, configmaps and packages outside it's own namespace\"))\n\t}\n\n\tclient.logger.Info(\"function spec references verified\")\n}", "func getKsyms() ([]string, error) {\n\tf, err := ioutil.ReadFile(\"/proc/kallsyms\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Trim trailing newlines and split by newline\n\tcontent := strings.Split(strings.TrimSuffix(string(f), \"\\n\"), \"\\n\")\n\tout := make([]string, len(content))\n\n\tfor i, l := range content {\n\t\t// Replace any tabs by spaces\n\t\tl = strings.Replace(l, \"\\t\", \" \", -1)\n\n\t\t// Get the third column\n\t\tout[i] = strings.Split(l, \" \")[2]\n\t}\n\n\treturn out, nil\n}", "func testForCommonKernelModules() testFunctionReturn {\n\terr, out, _ := executeBashCommand(\"find /lib/modules/$(uname -r) -type f -name '*.ko*' 2>/dev/null | grep \\\"vboxguest\\\\|/vme/\\\" | wc -l\")\n\tsuspectKernelModules, _ := strconv.Atoi(out)\n\tif err == nil {\n\t\tif suspectKernelModules > 0 {\n\t\t\treturn testFunctionReturn{definitelyVM: true}\n\t\t} else {\n\t\t\treturn testFunctionReturn{percentageUser: 0.8}\n\t\t}\n\n\t}\n\n\t// windows & mac\n\treturn testFunctionReturn{}\n}", "func findKsym(sym string) bool {\n\tfor _, v := range ksyms {\n\t\tif v == sym {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func testPkgs(t *testing.T) []string {\n\t// Packages which do not contain tests (or do not contain tests for the\n\t// build target) will still compile a test binary which vacuously pass.\n\tcmd := exec.Command(\"go\", \"list\",\n\t\t\"github.com/u-root/u-root/cmds/boot/...\",\n\t\t\"github.com/u-root/u-root/cmds/core/...\",\n\t\t\"github.com/u-root/u-root/cmds/exp/...\",\n\t\t\"github.com/u-root/u-root/pkg/...\",\n\t)\n\tcmd.Env = append(os.Environ(), \"GOARCH=\"+vmtest.TestArch())\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tpkgs := strings.Fields(strings.TrimSpace(string(out)))\n\n\t// TODO: Some tests do not run properly in QEMU at the moment. They are\n\t// blocklisted. These tests fail for mostly two reasons:\n\t// 1. either it requires networking (not enabled in the kernel)\n\t// 2. or it depends on some test files (for example /bin/sleep)\n\tblocklist := []string{\n\t\t\"github.com/u-root/u-root/cmds/core/cmp\",\n\t\t\"github.com/u-root/u-root/cmds/core/dd\",\n\t\t\"github.com/u-root/u-root/cmds/core/fusermount\",\n\t\t\"github.com/u-root/u-root/cmds/core/gosh\",\n\t\t\"github.com/u-root/u-root/cmds/core/wget\",\n\t\t\"github.com/u-root/u-root/cmds/core/netcat\",\n\t\t\"github.com/u-root/u-root/cmds/core/which\",\n\t\t// Some of TestEdCommands do not exit properly and end up left running. No idea how to fix this yet.\n\t\t\"github.com/u-root/u-root/cmds/exp/ed\",\n\t\t\"github.com/u-root/u-root/cmds/exp/pox\",\n\t\t\"github.com/u-root/u-root/pkg/crypto\",\n\t\t\"github.com/u-root/u-root/pkg/tarutil\",\n\t\t\"github.com/u-root/u-root/pkg/ldd\",\n\n\t\t// These have special configuration.\n\t\t\"github.com/u-root/u-root/pkg/gpio\",\n\t\t\"github.com/u-root/u-root/pkg/mount\",\n\t\t\"github.com/u-root/u-root/pkg/mount/block\",\n\t\t\"github.com/u-root/u-root/pkg/mount/loop\",\n\t\t\"github.com/u-root/u-root/pkg/ipmi\",\n\t\t\"github.com/u-root/u-root/pkg/smbios\",\n\n\t\t// Missing xzcat in VM.\n\t\t\"github.com/u-root/u-root/cmds/exp/bzimage\",\n\t\t\"github.com/u-root/u-root/pkg/boot/bzimage\",\n\n\t\t// No Go compiler in VM.\n\t\t\"github.com/u-root/u-root/pkg/uroot\",\n\t\t\"github.com/u-root/u-root/pkg/uroot/builder\",\n\n\t\t// ??\n\t\t\"github.com/u-root/u-root/pkg/tss\",\n\t\t\"github.com/u-root/u-root/pkg/syscallfilter\",\n\t}\n\tif vmtest.TestArch() == \"arm64\" {\n\t\tblocklist = append(\n\t\t\tblocklist,\n\t\t\t\"github.com/u-root/u-root/pkg/strace\",\n\n\t\t\t// These tests run in 1-2 seconds on x86, but run\n\t\t\t// beyond their huge timeout under arm64 in the VM. Not\n\t\t\t// sure why. Slow emulation?\n\t\t\t\"github.com/u-root/u-root/cmds/core/pci\",\n\t\t\t\"github.com/u-root/u-root/cmds/exp/cbmem\",\n\t\t\t\"github.com/u-root/u-root/pkg/vfile\",\n\t\t)\n\t}\n\tfor i := 0; i < len(pkgs); i++ {\n\t\tfor _, b := range blocklist {\n\t\t\tif pkgs[i] == b {\n\t\t\t\tpkgs = append(pkgs[:i], pkgs[i+1:]...)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn pkgs\n}", "func loadFunctions() (err error) {\n\tsuccessfulCount := len(conf.functionFiles)\n\terrors := make([]string, 0)\n\tbypass := make(map[string]bool)\n\n\tfiles, err := resolveDependencies(conf.functionFiles, conf.sqlDirPath+\"functions\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfunctions := make([]*function, 0)\n\tfor i := len(files) - 1; i >= 0; i-- {\n\t\tfile := files[i]\n\t\tf := function{}\n\t\tf.path = file\n\t\tfunctions = append(functions, &f)\n\n\t\terr = downPass(&f, f.path)\n\t\tif err != nil {\n\t\t\tsuccessfulCount--\n\t\t\terrors = append(errors, fmt.Sprintf(\"%v\\n\", err))\n\t\t\tbypass[f.path] = true\n\t\t}\n\t}\n\n\tfor i := len(functions) - 1; i >= 0; i-- {\n\t\tf := functions[i]\n\t\tif _, ignore := bypass[f.path]; !ignore {\n\t\t\terr = upPass(f, f.path)\n\t\t\tif err != nil {\n\t\t\t\tsuccessfulCount--\n\t\t\t\terrors = append(errors, fmt.Sprintf(\"%v\\n\", err))\n\t\t\t}\n\t\t}\n\t}\n\n\treport(\"functions\", successfulCount, len(conf.functionFiles), errors)\n\n\treturn\n}", "func (kmc KernelModuleCheck) Check() (warnings, errorList []error) {\n\t_, _, exit, err := kmc.Execf(\"modinfo %s\", kmc.Module)\n\tif err != nil || exit != 0 {\n\t\terrorList = append(errorList, errors.Errorf(\"%s is required\", kmc.Module))\n\t}\n\n\treturn nil, errorList\n}", "func tracefsKprobe(symbol string, ret bool) (*perfEvent, error) {\n\treturn tracefsProbe(kprobeType, symbol, \"\", 0, perfAllThreads, ret)\n}", "func isResctrlAvailableByKernelCmd(path string) (bool, bool, error) {\n\tisCatFlagSet := false\n\tisMbaFlagSet := false\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn false, false, err\n\t}\n\tdefer f.Close()\n\ts := bufio.NewScanner(f)\n\tfor s.Scan() {\n\t\tif err := s.Err(); err != nil {\n\t\t\treturn false, false, err\n\t\t}\n\t\tline := s.Text()\n\t\tl3Reg, regErr := regexp.Compile(\".* rdt=.*l3cat.*\")\n\t\tif regErr == nil && l3Reg.Match([]byte(line)) {\n\t\t\tisCatFlagSet = true\n\t\t}\n\n\t\tmbaReg, regErr := regexp.Compile(\".* rdt=.*mba.*\")\n\t\tif regErr == nil && mbaReg.Match([]byte(line)) {\n\t\t\tisMbaFlagSet = true\n\t\t}\n\t}\n\treturn isCatFlagSet, isMbaFlagSet, nil\n}", "func (kc KernelCheck) Check() (warnings, errorList []error) {\n\tresult, err := kc.CombinedOutput(\"uname -r\")\n\tif err != nil {\n\t\terrorList = append(errorList, err)\n\t\treturn\n\t}\n\tversionStr := strings.TrimSpace(string(result))\n\tversions := strings.Split(strings.TrimSpace(string(result)), \".\")\n\tif len(versions) < 2 {\n\t\terrorList = append(errorList, errors.Errorf(\"parse version error:%s\", versionStr))\n\t\treturn\n\t}\n\tkernelVersion, err := strconv.Atoi(versions[0])\n\tif err != nil {\n\t\terrorList = append(errorList, err)\n\t\treturn\n\t}\n\tmajorVersion, err := strconv.Atoi(versions[1])\n\tif err != nil {\n\t\terrorList = append(errorList, err)\n\t\treturn\n\t}\n\tif (kernelVersion < kc.MinKernelVersion) ||\n\t\t(kernelVersion == kc.MinKernelVersion && majorVersion < kc.MinMajorVersion) {\n\t\terrorList = append(errorList, errors.Errorf(\"kernel version(%s) must not lower than %d.%d\", versionStr, kc.MinKernelVersion, kc.MinMajorVersion))\n\t}\n\n\treturn nil, errorList\n}", "func checkRequire() error {\n result, err := cmd.Run(\"command -v ktutil\")\n if err != nil {\n return err\n }\n if result.ExitCode != 0 {\n return errors.New(\"ktutil binaire not found. Maybee you need to install krb5-workstation (redhat) or krb5-user (debian) package.\")\n }\n \n result, err = cmd.Run(\"command -v klist\")\n if err != nil {\n return err\n }\n if result.ExitCode != 0 {\n return errors.New(\"ktutil binaire not found. Maybee you need to install krb5-workstation (redhat) or krb5-user (debian) package.\")\n }\n \n return nil\n}", "func checkForFunctionExpr(fexpr *ast.CallExpr, pass *analysis.Pass, c *config) {\n\n\tfun := fexpr.Fun\n\targs := fexpr.Args\n\n\t/* we are extracting external package function calls e.g. klog.Infof fmt.Printf\n\t and eliminating calls like setLocalHost()\n\t basically function calls that has selector expression like .\n\t*/\n\tif selExpr, ok := fun.(*ast.SelectorExpr); ok {\n\t\t// extracting function Name like Infof\n\t\tfName := selExpr.Sel.Name\n\n\t\t// for nested function cases klog.V(1).Infof scenerios\n\t\t// if selExpr.X contains one more caller expression which is selector expression\n\t\t// we are extracting klog and discarding V(1)\n\t\tif n, ok := selExpr.X.(*ast.CallExpr); ok {\n\t\t\tif _, ok = n.Fun.(*ast.SelectorExpr); ok {\n\t\t\t\tselExpr = n.Fun.(*ast.SelectorExpr)\n\t\t\t}\n\t\t}\n\n\t\t// extracting package name\n\t\tpName, ok := selExpr.X.(*ast.Ident)\n\n\t\tif ok && pName.Name == \"klog\" {\n\t\t\t// Matching if any unstructured logging function is used.\n\t\t\tif !isUnstructured((fName)) {\n\t\t\t\t// if format specifier is used, check for arg length will most probably fail\n\t\t\t\t// so check for format specifier first and skip if found\n\t\t\t\tif checkForFormatSpecifier(fexpr, pass) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif fName == \"InfoS\" {\n\t\t\t\t\tisKeysValid(args[1:], fun, pass, fName)\n\t\t\t\t} else if fName == \"ErrorS\" {\n\t\t\t\t\tisKeysValid(args[2:], fun, pass, fName)\n\t\t\t\t}\n\t\t\t} else if !c.allowUnstructured {\n\t\t\t\tmsg := fmt.Sprintf(\"unstructured logging function %q should not be used\", fName)\n\t\t\t\tpass.Report(analysis.Diagnostic{\n\t\t\t\t\tPos: fun.Pos(),\n\t\t\t\t\tMessage: msg,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n}", "func keys(f func(reflect.Value, ctx) error) func(reflect.Value, ctx) error {\n\treturn func(v reflect.Value, c ctx) error {\n\t\tif v.Kind() != reflect.Map {\n\t\t\treturn fmt.Errorf(\"keys validator used on %s; only allowed on maps\", v.Type())\n\t\t}\n\t\tfor _, vk := range v.MapKeys() {\n\t\t\tc := c.enterKey(vk)\n\t\t\tif err := c.validateInterface(vk); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := f(vk, c); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func isK8s(utils detectorUtils) bool {\n\treturn utils.fileExists(k8sTokenPath) && utils.fileExists(k8sCertPath)\n}", "func checkCrossDevice(absPaths []string, mountsPath string) error {\n\tmounts, err := readProcMounts(mountsPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, path := range absPaths {\n\t\tif err := mounts.checkCrossMounts(path); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func VerifyFunctionNameExists(contractType string, funcName string) bool {\n\tallFunctions := ContractNamesToFuncNames[contractType][\"all\"]\n\tfor _, v := range allFunctions {\n\t\tif v == funcName {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func isBlockDeviceInUseByKernel(path string) (bool, error) {\n\tf, err := os.OpenFile(filepath.Clean(path), os.O_EXCL, 0444)\n\n\tif errors.Is(err, syscall.EBUSY) {\n\t\treturn true, nil\n\t}\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer f.Close()\n\treturn false, nil\n}", "func TestSymbols(t *testing.T) {\n\tdo := func(file string, ts []Symbol, getfunc func(*File) ([]Symbol, error)) {\n\t\tvar f *File\n\t\tvar err error\n\t\tif path.Ext(file) == \".gz\" {\n\t\t\tvar r io.ReaderAt\n\t\t\tif r, err = decompress(file); err == nil {\n\t\t\t\tf, err = NewFile(r)\n\t\t\t}\n\t\t} else {\n\t\t\tf, err = Open(file)\n\t\t}\n\t\tif err != nil {\n\t\t\tt.Errorf(\"TestSymbols: cannot open file %s: %v\", file, err)\n\t\t\treturn\n\t\t}\n\t\tdefer f.Close()\n\t\tfs, err := getfunc(f)\n\t\tif err != nil && err != ErrNoSymbols {\n\t\t\tt.Error(err)\n\t\t\treturn\n\t\t} else if err == ErrNoSymbols {\n\t\t\tfs = []Symbol{}\n\t\t}\n\t\tif !reflect.DeepEqual(ts, fs) {\n\t\t\tt.Errorf(\"%s: Symbols = %v, want %v\", file, ts, fs)\n\t\t}\n\t}\n\tfor file, ts := range symbolsGolden {\n\t\tdo(file, ts, (*File).Symbols)\n\t}\n\tfor file, ts := range dynamicSymbolsGolden {\n\t\tdo(file, ts, (*File).DynamicSymbols)\n\t}\n}", "func (m *Meta) CheckFkeys(ts *schema.Schema) {\n\tidxs := ts.Indexes\n\tfor i := range idxs {\n\t\tfk := &idxs[i].Fk\n\t\tif fk.Table == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\ttsi := ts.IIndex(idxs[i].Columns)\n\t\tfk = &ts.Indexes[tsi].Fk\n\t\tfkCols := fk.Columns\n\t\tif len(fkCols) == 0 {\n\t\t\tfkCols = idxs[i].Columns\n\t\t}\n\t\ttarget, ok := m.schema.Get(fk.Table)\n\t\tif !ok {\n\t\t\tpanic(\"can't create foreign key to nonexistent table: \" +\n\t\t\t\tts.Table + \" -> \" + fk.Table)\n\t\t}\n\t\tfound := false\n\t\tfor j := range target.Indexes {\n\t\t\tix := &target.Indexes[j]\n\t\t\tif slices.Equal(fkCols, ix.Columns) {\n\t\t\t\tif ix.Mode != 'k' {\n\t\t\t\t\tpanic(\"foreign key must point to key: \" +\n\t\t\t\t\t\tts.Table + \" -> \" + fk.Table + str.Join(\"(,)\", fkCols))\n\t\t\t\t}\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tpanic(\"can't create foreign key to nonexistent index: \" +\n\t\t\t\tts.Table + \" -> \" + fk.Table + str.Join(\"(,)\", fkCols))\n\t\t}\n\t}\n}", "func validateClassLoaderContextRec(sdkVer int, clcs []*ClassLoaderContext) (bool, error) {\n\tfor _, clc := range clcs {\n\t\tif clc.Host == nil || clc.Device == UnknownInstallLibraryPath {\n\t\t\tif sdkVer == AnySdkVersion {\n\t\t\t\t// Return error if dexpreopt doesn't know paths to one of the <uses-library>\n\t\t\t\t// dependencies. In the future we may need to relax this and just disable dexpreopt.\n\t\t\t\tif clc.Host == nil {\n\t\t\t\t\treturn false, fmt.Errorf(\"invalid build path for <uses-library> \\\"%s\\\"\", clc.Name)\n\t\t\t\t} else {\n\t\t\t\t\treturn false, fmt.Errorf(\"invalid install path for <uses-library> \\\"%s\\\"\", clc.Name)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// No error for compatibility libraries, as Soong doesn't know if they are needed\n\t\t\t\t// (this depends on the targetSdkVersion in the manifest), but the CLC is invalid.\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t}\n\t\tif valid, err := validateClassLoaderContextRec(sdkVer, clc.Subcontexts); !valid || err != nil {\n\t\t\treturn valid, err\n\t\t}\n\t}\n\treturn true, nil\n}", "func XSPathExists(Paths map[string]string, path string) (ok bool) {\n\t_, ok = Paths[path]\n\treturn\n}", "func isVfAllocated(pf string, vfi uint) (bool, error) {\n\tvfDir := fmt.Sprintf(\"/sys/class/net/%s/device/virtfn%d/net\", pf, vfi)\n\tif _, err := os.Stat(vfDir); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\t//file does not exist\n\t\t\treturn false, fmt.Errorf(\"failed to open the virtfn%d dir of the device %s, vfDir[%s] could not be opened: %s\", vfi, pf, vfDir, err)\n\t\t}\n\t}\n\tinfos, err := ioutil.ReadDir(vfDir)\n\tif err != nil || len(infos) == 0 {\n\t\t//assume if there are no directories in this directory than VF is in use/allocated\n\t\treturn true, nil\n\t}\n\t//if one or more directories are found, than the VF is available for use\n\treturn false, nil\n}", "func SymbolResolve(symbols string) (fmap []gtutils.SymbolFuncInfo) {\n\tfmap = make([]gtutils.SymbolFuncInfo, 0)\n\tlines := bufio.NewScanner(strings.NewReader(symbols))\n\tfor lines.Scan() {\n\t\tfields := strings.Split(lines.Text(), \"|\")\n\t\tfor i := range fields {\n\t\t\tfields[i] = strings.TrimSpace(fields[i])\n\t\t}\n\t\tif len(fields) != 7 {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.ToLower(fields[3]) != \"func\" {\n\t\t\tcontinue\n\t\t}\n\t\toff64, _ := strconv.ParseUint(fields[1], 16, 64)\n\t\toff := int(off64)\n\t\tsize64, _ := strconv.ParseUint(fields[4], 16, 64)\n\t\tsize := int(size64)\n\t\tfName := fields[0]\n\t\tsecTab := strings.Index(fields[6], \"\\t\")\n\t\tif secTab < 0 {\n\t\t\tfmap = append(fmap, gtutils.SymbolFuncInfo{\n\t\t\t\tFunction: fName,\n\t\t\t\tHaveSource: false,\n\t\t\t\tSource: \"\",\n\t\t\t\tOffset: int(off),\n\t\t\t\tSize: size,\n\t\t\t\tLine: 0,\n\t\t\t\tSection: fields[6]})\n\t\t} else {\n\t\t\tsecTabSeqLast := secTab\n\t\t\tfor ; fields[6][secTabSeqLast] == '\\t'; secTabSeqLast++ {\n\t\t\t}\n\t\t\tsecName := fields[6][:secTab]\n\t\t\tsrcFile := fields[6][secTabSeqLast:]\n\t\t\tfSrc, line := findSrcFile(srcFile)\n\t\t\tfmap = append(fmap, gtutils.SymbolFuncInfo{\n\t\t\t\tFunction: fName,\n\t\t\t\tHaveSource: true,\n\t\t\t\tSource: fSrc,\n\t\t\t\tOffset: int(off),\n\t\t\t\tSize: size,\n\t\t\t\tLine: line,\n\t\t\t\tSection: secName})\n\t\t}\n\t}\n\treturn\n}", "func (t *ManualConversionsTracker) findManualConversionFunctions(context *generator.Context, packagePath string) (errors []error) {\n\tif e, present := t.processedPackages[packagePath]; present {\n\t\t// already processed\n\t\treturn e\n\t}\n\n\tpkg, err := context.AddDirectory(packagePath)\n\tif err != nil {\n\t\treturn []error{fmt.Errorf(\"unable to add directory %q to context: %v\", packagePath, err)}\n\t}\n\tif pkg == nil {\n\t\tklog.Warningf(\"Skipping nil package passed to getManualConversionFunctions\")\n\t\treturn\n\t}\n\tklog.V(5).Infof(\"Scanning for conversion functions in %v\", pkg.Path)\n\n\tfor _, function := range pkg.Functions {\n\t\tif function.Underlying == nil || function.Underlying.Kind != types.Func {\n\t\t\terrors = append(errors, fmt.Errorf(\"malformed function: %#v\", function))\n\t\t\tcontinue\n\t\t}\n\t\tif function.Underlying.Signature == nil {\n\t\t\terrors = append(errors, fmt.Errorf(\"function without signature: %#v\", function))\n\t\t\tcontinue\n\t\t}\n\n\t\tklog.V(8).Infof(\"Considering function %s\", function.Name)\n\n\t\tisConversionFunc, inType, outType := t.isConversionFunction(function)\n\t\tif !isConversionFunc {\n\t\t\tif strings.HasPrefix(function.Name.Name, conversionFunctionPrefix) {\n\t\t\t\terrors = append(errors, fmt.Errorf(\"function %s %s does not match expected conversion signature\",\n\t\t\t\t\tfunction.Name.Package, function.Name.Name))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// it is a conversion function\n\t\tkey := ConversionPair{inType.Elem, outType.Elem}\n\t\tif previousConversionFunc, present := t.conversionFunctions[key]; present {\n\t\t\terrors = append(errors, fmt.Errorf(\"duplicate static conversion defined: %s -> %s from:\\n%s.%s\\n%s.%s\",\n\t\t\t\tinType, outType, previousConversionFunc.Name.Package, previousConversionFunc.Name.Name, function.Name.Package, function.Name.Name))\n\t\t\tcontinue\n\t\t}\n\t\tt.conversionFunctions[key] = function\n\t}\n\n\tt.processedPackages[packagePath] = errors\n\treturn\n}", "func (h *cmdlineHandler) verifyTools(tList map[string]string) {\n\t// We want to stat a file, and continue if it exists :\n\n\tfor k, v := range tList {\n\n\t\t_, err := os.Stat(v)\n\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\t// file does not exist, do something\n\t\t\t\tfmt.Println(\"Error encountered:\", k, \"cannot be found at:\", v)\n\t\t\t\tos.Exit(1)\n\t\t\t} else {\n\t\t\t\t// more serious errors\n\t\t\t\tfmt.Println(\"Error encountered while attempting to execute\", k, \"at\", v, \"\\r\\n\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t}\n\t}\n\t// fmt.Printf(\"Verified that the files exist.\\r\\n-------------\\r\\n\\r\\n\")\n}", "func checkNestedFunctions(fn *ast.FuncDecl) error {\n\tif !astutil.IsDef(fn) {\n\t\treturn nil\n\t}\n\tcheck := func(n ast.Node) error {\n\t\tif n, ok := n.(*ast.FuncDecl); ok {\n\t\t\treturn errors.Newf(n.FuncName.Start(), \"nested functions not allowed\")\n\t\t}\n\t\treturn nil\n\t}\n\tnop := func(ast.Node) error { return nil }\n\tif err := astutil.WalkBeforeAfter(fn.Body, check, nop); err != nil {\n\t\treturn errutil.Err(err)\n\t}\n\treturn nil\n}", "func (ctx *Context) checkPreRequisites() error {\n\tvar err error\n\textmissing := false\n\tmissing := make([]string, 0)\n\n\tfor _, ext := range ctx.reqext {\n\t\tcmd, err := exec.LookPath(ext)\n\t\tctx.extstatus[ext] = External{\n\t\t\tcmd: cmd,\n\t\t\terr: err,\n\t\t}\n\t}\n\n\tfor k, ext := range ctx.extstatus {\n\t\tif ext.err == nil {\n\t\t\tctx.msg.Debugf(\"%s: Found %q\\n\", k, ext.cmd)\n\t\t\tcontinue\n\t\t}\n\t\tctx.msg.Infof(\"%s: Missing - trying compensatory measure\\n\", k)\n\t\tfix, ok := ctx.extfix[k]\n\t\tif !ok {\n\t\t\textmissing = true\n\t\t\tmissing = append(missing, k)\n\t\t\tcontinue\n\t\t}\n\n\t\terr = fix(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcmd, err := exec.LookPath(k)\n\t\tctx.extstatus[k] = External{\n\t\t\tcmd: cmd,\n\t\t\terr: err,\n\t\t}\n\t\tif err == nil {\n\t\t\tctx.msg.Debugf(\"%s: Found %q\\n\", k, cmd)\n\t\t\tcontinue\n\t\t}\n\t\tctx.msg.Infof(\"%s: Missing\\n\", k)\n\t\textmissing = true\n\t\tmissing = append(missing, k)\n\t}\n\n\tif extmissing {\n\t\terr = fmt.Errorf(\"missing external(s): %v\", missing)\n\t}\n\treturn err\n}", "func (kc KernelParameterCheck) Check() (warnings, errorList []error) {\n\tfor _, kp := range kc.KernelParameter {\n\t\t_, _, exit, err := kc.Exec(fmt.Sprintf(\"cat /boot/config-$(uname -r) | grep '%s='\", kp))\n\t\tif err != nil {\n\t\t\terrorList = append(errorList, err)\n\t\t\treturn\n\t\t}\n\t\tif exit != 0 {\n\t\t\terrorList = append(errorList, errors.Errorf(\"Parameter %s is not set\", kp))\n\t\t}\n\t}\n\n\treturn nil, errorList\n}", "func removeInitFuncs(pkgs []string) {\n\tfor _, pkg := range pkgs {\n\t\tparsedPkgs, _ := parser.ParseDir(token.NewFileSet(), path.Join(PluginFolder, pkg), nil, parser.ParseComments)\n\n\t\tfor _, parsedPkg := range parsedPkgs {\n\t\t\tfor filePath, file := range parsedPkg.Files {\n\t\t\t\tfor _, decl := range file.Decls {\n\t\t\t\t\tswitch decl.(type) {\n\t\t\t\t\tcase *ast.FuncDecl:\n\t\t\t\t\t\tremoveInitFunc(filePath, decl.(*ast.FuncDecl))\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func cleanSSHKeyPaths() error {\n\toldKeyExists, err := fileExists(constants.RHCOS8SSHKeyPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !oldKeyExists {\n\t\treturn nil\n\t}\n\n\tif err := os.RemoveAll(constants.RHCOS8SSHKeyPath); err != nil {\n\t\treturn fmt.Errorf(\"failed to remove path '%s': %w\", constants.RHCOS8SSHKeyPath, err)\n\t}\n\n\treturn nil\n}", "func validateClassLoaderContext(clcMap ClassLoaderContextMap) (bool, error) {\n\tfor sdkVer, clcs := range clcMap {\n\t\tif valid, err := validateClassLoaderContextRec(sdkVer, clcs); !valid || err != nil {\n\t\t\treturn valid, err\n\t\t}\n\t}\n\treturn true, nil\n}", "func (info *Info) FindFunc(path string) (*ssa.Function, error) {\n\tpkgPath, fnName := parseFuncPath(path)\n\tgraph, err := info.BuildCallGraph(\"rta\", false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfuncs, err := graph.UsedFunctions()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, f := range funcs {\n\t\tif f.Pkg.Pkg.Path() == pkgPath && f.Name() == fnName {\n\t\t\treturn f, nil\n\t\t}\n\t}\n\treturn nil, nil\n}", "func ListFunctionsForDir(vlog, events metrics.Metrics, dir string, ctx build.Context) (PackageFunctionList, error) {\n\tvar pkgFuncs PackageFunctionList\n\tpkgFuncs.Path = dir\n\tpkgFuncs.Package, _ = srcpath.RelativeToSrc(dir)\n\n\tpkgs, err := ast.FilteredPackageWithBuildCtx(vlog, dir, ctx)\n\tif err != nil {\n\t\tif _, ok := err.(*build.NoGoError); ok {\n\t\t\treturn pkgFuncs, ErrSkipDir\n\t\t}\n\n\t\tevents.Emit(metrics.Error(err), metrics.With(\"dir\", dir))\n\t\treturn pkgFuncs, err\n\t}\n\n\tif len(pkgs) == 0 {\n\t\treturn pkgFuncs, ErrSkipDir\n\t}\n\n\tpkgItem := pkgs[0]\n\tif pkgItem.HasAnnotation(\"@ignore\") {\n\t\treturn pkgFuncs, ErrSkipDir\n\t}\n\n\tpkgHash, err := generateHash(pkgItem.Files)\n\tif err != nil {\n\t\treturn pkgFuncs, err\n\t}\n\n\tbinaryName := pkgItem.Name\n\n\tvar binaryDesc string\n\tif binAnnon, _, ok := pkgItem.AnnotationFirstFor(\"@binaryName\"); ok {\n\t\tbinaryName = binAnnon.Param(\"name\")\n\t\tif binaryName == \"\" {\n\t\t\tbinaryName = pkgItem.Name\n\t\t}\n\n\t\tif desc, ok := binAnnon.Attr(\"desc\").(string); ok {\n\t\t\tif desc != \"\" && !strings.HasSuffix(desc, \".\") {\n\t\t\t\tdesc += \".\"\n\t\t\t\tbinaryDesc = doc.Synopsis(desc)\n\t\t\t}\n\t\t}\n\t}\n\n\tif binaryDesc == \"\" {\n\t\tbinaryDesc = haiku()\n\t}\n\n\tpkgFuncs.Name = binaryName\n\tpkgFuncs.Desc = binaryDesc\n\n\tfns, err := pullFunctions(pkgItem)\n\tif err != nil {\n\t\treturn pkgFuncs, err\n\t}\n\n\tfns.Hash = pkgHash\n\tpkgFuncs.List = append(pkgFuncs.List, fns)\n\n\treturn pkgFuncs, nil\n}", "func (c *Compiler) makeGCStackSlots() bool {\n\t// Check whether there are allocations at all.\n\talloc := c.mod.NamedFunction(\"runtime.alloc\")\n\tif alloc.IsNil() {\n\t\t// Nothing to. Make sure all remaining bits and pieces for stack\n\t\t// chains are neutralized.\n\t\tfor _, call := range getUses(c.mod.NamedFunction(\"runtime.trackPointer\")) {\n\t\t\tcall.EraseFromParentAsInstruction()\n\t\t}\n\t\tstackChainStart := c.mod.NamedGlobal(\"runtime.stackChainStart\")\n\t\tif !stackChainStart.IsNil() {\n\t\t\tstackChainStart.SetInitializer(llvm.ConstNull(stackChainStart.Type().ElementType()))\n\t\t\tstackChainStart.SetGlobalConstant(true)\n\t\t}\n\t}\n\n\ttrackPointer := c.mod.NamedFunction(\"runtime.trackPointer\")\n\tif trackPointer.IsNil() || trackPointer.FirstUse().IsNil() {\n\t\treturn false // nothing to do\n\t}\n\n\t// Look at *all* functions to see whether they are free of function pointer\n\t// calls.\n\t// This takes less than 5ms for ~100kB of WebAssembly but would perhaps be\n\t// faster when written in C++ (to avoid the CGo overhead).\n\tfuncsWithFPCall := map[llvm.Value]struct{}{}\n\tn := 0\n\tfor fn := c.mod.FirstFunction(); !fn.IsNil(); fn = llvm.NextFunction(fn) {\n\t\tn++\n\t\tif _, ok := funcsWithFPCall[fn]; ok {\n\t\t\tcontinue // already found\n\t\t}\n\t\tdone := false\n\t\tfor bb := fn.FirstBasicBlock(); !bb.IsNil() && !done; bb = llvm.NextBasicBlock(bb) {\n\t\t\tfor call := bb.FirstInstruction(); !call.IsNil() && !done; call = llvm.NextInstruction(call) {\n\t\t\t\tif call.IsACallInst().IsNil() {\n\t\t\t\t\tcontinue // only looking at calls\n\t\t\t\t}\n\t\t\t\tcalled := call.CalledValue()\n\t\t\t\tif !called.IsAFunction().IsNil() {\n\t\t\t\t\tcontinue // only looking for function pointers\n\t\t\t\t}\n\t\t\t\tfuncsWithFPCall[fn] = struct{}{}\n\t\t\t\tmarkParentFunctions(funcsWithFPCall, fn)\n\t\t\t\tdone = true\n\t\t\t}\n\t\t}\n\t}\n\n\t// Determine which functions need stack objects. Many leaf functions don't\n\t// need it: it only causes overhead for them.\n\t// Actually, in one test it was only able to eliminate stack object from 12%\n\t// of functions that had a call to runtime.trackPointer (8 out of 68\n\t// functions), so this optimization is not as big as it may seem.\n\tallocatingFunctions := map[llvm.Value]struct{}{} // set of allocating functions\n\n\t// Work from runtime.alloc and trace all parents to check which functions do\n\t// a heap allocation (and thus which functions do not).\n\tmarkParentFunctions(allocatingFunctions, alloc)\n\n\t// Also trace all functions that call a function pointer.\n\tfor fn := range funcsWithFPCall {\n\t\t// Assume that functions that call a function pointer do a heap\n\t\t// allocation as a conservative guess because the called function might\n\t\t// do a heap allocation.\n\t\tallocatingFunctions[fn] = struct{}{}\n\t\tmarkParentFunctions(allocatingFunctions, fn)\n\t}\n\n\t// Collect some variables used below in the loop.\n\tstackChainStart := c.mod.NamedGlobal(\"runtime.stackChainStart\")\n\tif stackChainStart.IsNil() {\n\t\tpanic(\"stack chain start not found!\")\n\t}\n\tstackChainStartType := stackChainStart.Type().ElementType()\n\tstackChainStart.SetInitializer(llvm.ConstNull(stackChainStartType))\n\n\t// Iterate until runtime.trackPointer has no uses left.\n\tfor use := trackPointer.FirstUse(); !use.IsNil(); use = trackPointer.FirstUse() {\n\t\t// Pick the first use of runtime.trackPointer.\n\t\tcall := use.User()\n\t\tif call.IsACallInst().IsNil() {\n\t\t\tpanic(\"expected runtime.trackPointer use to be a call\")\n\t\t}\n\n\t\t// Pick the parent function.\n\t\tfn := call.InstructionParent().Parent()\n\n\t\tif _, ok := allocatingFunctions[fn]; !ok {\n\t\t\t// This function nor any of the functions it calls (recursively)\n\t\t\t// allocate anything from the heap, so it will not trigger a garbage\n\t\t\t// collection cycle. Thus, it does not need to track local pointer\n\t\t\t// values.\n\t\t\t// This is a useful optimization but not as big as you might guess,\n\t\t\t// as described above (it avoids stack objects for ~12% of\n\t\t\t// functions).\n\t\t\tcall.EraseFromParentAsInstruction()\n\t\t\tcontinue\n\t\t}\n\n\t\t// Find all calls to runtime.trackPointer in this function.\n\t\tvar calls []llvm.Value\n\t\tvar returns []llvm.Value\n\t\tfor bb := fn.FirstBasicBlock(); !bb.IsNil(); bb = llvm.NextBasicBlock(bb) {\n\t\t\tfor inst := bb.FirstInstruction(); !inst.IsNil(); inst = llvm.NextInstruction(inst) {\n\t\t\t\tswitch inst.InstructionOpcode() {\n\t\t\t\tcase llvm.Call:\n\t\t\t\t\tif inst.CalledValue() == trackPointer {\n\t\t\t\t\t\tcalls = append(calls, inst)\n\t\t\t\t\t}\n\t\t\t\tcase llvm.Ret:\n\t\t\t\t\treturns = append(returns, inst)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Determine what to do with each call.\n\t\tvar allocas, pointers []llvm.Value\n\t\tfor _, call := range calls {\n\t\t\tptr := call.Operand(0)\n\t\t\tcall.EraseFromParentAsInstruction()\n\t\t\tif ptr.IsAInstruction().IsNil() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Some trivial optimizations.\n\t\t\tif ptr.IsAInstruction().IsNil() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch ptr.InstructionOpcode() {\n\t\t\tcase llvm.PHI, llvm.GetElementPtr:\n\t\t\t\t// These values do not create new values: the values already\n\t\t\t\t// existed locally in this function so must have been tracked\n\t\t\t\t// already.\n\t\t\t\tcontinue\n\t\t\tcase llvm.ExtractValue, llvm.BitCast:\n\t\t\t\t// These instructions do not create new values, but their\n\t\t\t\t// original value may not be tracked. So keep tracking them for\n\t\t\t\t// now.\n\t\t\t\t// With more analysis, it should be possible to optimize a\n\t\t\t\t// significant chunk of these away.\n\t\t\tcase llvm.Call, llvm.Load, llvm.IntToPtr:\n\t\t\t\t// These create new values so must be stored locally. But\n\t\t\t\t// perhaps some of these can be fused when they actually refer\n\t\t\t\t// to the same value.\n\t\t\tdefault:\n\t\t\t\t// Ambiguous. These instructions are uncommon, but perhaps could\n\t\t\t\t// be optimized if needed.\n\t\t\t}\n\n\t\t\tif !ptr.IsAAllocaInst().IsNil() {\n\t\t\t\tif typeHasPointers(ptr.Type().ElementType()) {\n\t\t\t\t\tallocas = append(allocas, ptr)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpointers = append(pointers, ptr)\n\t\t\t}\n\t\t}\n\n\t\tif len(allocas) == 0 && len(pointers) == 0 {\n\t\t\t// This function does not need to keep track of stack pointers.\n\t\t\tcontinue\n\t\t}\n\n\t\t// Determine the type of the required stack slot.\n\t\tfields := []llvm.Type{\n\t\t\tstackChainStartType, // Pointer to parent frame.\n\t\t\tc.uintptrType, // Number of elements in this frame.\n\t\t}\n\t\tfor _, alloca := range allocas {\n\t\t\tfields = append(fields, alloca.Type().ElementType())\n\t\t}\n\t\tfor _, ptr := range pointers {\n\t\t\tfields = append(fields, ptr.Type())\n\t\t}\n\t\tstackObjectType := c.ctx.StructType(fields, false)\n\n\t\t// Create the stack object at the function entry.\n\t\tc.builder.SetInsertPointBefore(fn.EntryBasicBlock().FirstInstruction())\n\t\tstackObject := c.builder.CreateAlloca(stackObjectType, \"gc.stackobject\")\n\t\tinitialStackObject := llvm.ConstNull(stackObjectType)\n\t\tnumSlots := (c.targetData.TypeAllocSize(stackObjectType) - c.targetData.TypeAllocSize(c.i8ptrType)*2) / uint64(c.targetData.ABITypeAlignment(c.uintptrType))\n\t\tnumSlotsValue := llvm.ConstInt(c.uintptrType, numSlots, false)\n\t\tinitialStackObject = llvm.ConstInsertValue(initialStackObject, numSlotsValue, []uint32{1})\n\t\tc.builder.CreateStore(initialStackObject, stackObject)\n\n\t\t// Update stack start.\n\t\tparent := c.builder.CreateLoad(stackChainStart, \"\")\n\t\tgep := c.builder.CreateGEP(stackObject, []llvm.Value{\n\t\t\tllvm.ConstInt(c.ctx.Int32Type(), 0, false),\n\t\t\tllvm.ConstInt(c.ctx.Int32Type(), 0, false),\n\t\t}, \"\")\n\t\tc.builder.CreateStore(parent, gep)\n\t\tstackObjectCast := c.builder.CreateBitCast(stackObject, stackChainStartType, \"\")\n\t\tc.builder.CreateStore(stackObjectCast, stackChainStart)\n\n\t\t// Replace all independent allocas with GEPs in the stack object.\n\t\tfor i, alloca := range allocas {\n\t\t\tgep := c.builder.CreateGEP(stackObject, []llvm.Value{\n\t\t\t\tllvm.ConstInt(c.ctx.Int32Type(), 0, false),\n\t\t\t\tllvm.ConstInt(c.ctx.Int32Type(), uint64(2+i), false),\n\t\t\t}, \"\")\n\t\t\talloca.ReplaceAllUsesWith(gep)\n\t\t\talloca.EraseFromParentAsInstruction()\n\t\t}\n\n\t\t// Do a store to the stack object after each new pointer that is created.\n\t\tfor i, ptr := range pointers {\n\t\t\tc.builder.SetInsertPointBefore(llvm.NextInstruction(ptr))\n\t\t\tgep := c.builder.CreateGEP(stackObject, []llvm.Value{\n\t\t\t\tllvm.ConstInt(c.ctx.Int32Type(), 0, false),\n\t\t\t\tllvm.ConstInt(c.ctx.Int32Type(), uint64(2+len(allocas)+i), false),\n\t\t\t}, \"\")\n\t\t\tc.builder.CreateStore(ptr, gep)\n\t\t}\n\n\t\t// Make sure this stack object is popped from the linked list of stack\n\t\t// objects at return.\n\t\tfor _, ret := range returns {\n\t\t\tc.builder.SetInsertPointBefore(ret)\n\t\t\tc.builder.CreateStore(parent, stackChainStart)\n\t\t}\n\t}\n\n\treturn true\n}", "func sanityCheckScope(astScope *types.Scope, binaryTypes *types.Package, binaryScope *types.Scope, astToBinary map[types.Object]types.Object) error {\n\tfor _, x := range astScope.Names() {\n\t\tfe := astScope.Lookup(x)\n\t\tpath, err := objectpath.For(fe)\n\t\tif err != nil {\n\t\t\tcontinue // Not an encoded object.\n\t\t}\n\t\tse, err := objectpath.Object(binaryTypes, path)\n\t\tif err != nil {\n\t\t\tcontinue // May be unused, see below.\n\t\t}\n\t\tif fe.Id() != se.Id() {\n\t\t\t// These types are incompatible. This means that when\n\t\t\t// this objectpath is loading from the binaryTypes (for\n\t\t\t// dependencies) it will resolve to a fact for that\n\t\t\t// type. We don't actually care about this error since\n\t\t\t// we do the rewritten, but may as well alert.\n\t\t\tlog.Printf(\"WARNING: Object %s is a victim of go/issues/44195.\", fe.Id())\n\t\t}\n\t\tse = binaryScope.Lookup(x)\n\t\tif se == nil {\n\t\t\t// The fact may not be exported in the objectdata, if\n\t\t\t// it is package internal. This is fine, as nothing out\n\t\t\t// of this package can use these symbols.\n\t\t\tcontinue\n\t\t}\n\t\t// Save the translation.\n\t\tastToBinary[fe] = se\n\t}\n\tfor i := 0; i < astScope.NumChildren(); i++ {\n\t\tif err := sanityCheckScope(astScope.Child(i), binaryTypes, binaryScope, astToBinary); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func isWellKnownFS(fn string) bool {\n\tvar fs syscall.Statfs_t\n\terr := syscall.Statfs(fn, &fs)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif fs.Type == EXT4_SUPER_MAGIC || fs.Type == TMPFS_MAGIC {\n\t\treturn true\n\t}\n\treturn false\n}", "func assertFnAndFnIn(fnv reflect.Value, inTypes []reflect.Type) {\n\tassertFn(fnv)\n\tassertFnIn(fnv, inTypes)\n}", "func (r *QuayRegistryReconciler) checkManagedKeys(\n\tctx context.Context, qctx *quaycontext.QuayRegistryContext, quay *v1.QuayRegistry,\n) error {\n\n\tnsn := types.NamespacedName{\n\t\tName: fmt.Sprintf(\"%s-%s\", quay.Name, v1.ManagedKeysName),\n\t\tNamespace: quay.Namespace,\n\t}\n\n\tvar secret corev1.Secret\n\tif err := r.Get(ctx, nsn, &secret); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn r.checkDeprecatedManagedKeys(ctx, qctx, quay)\n\t\t}\n\t\treturn err\n\t}\n\n\tqctx.DatabaseSecretKey = string(secret.Data[databaseSecretKey])\n\tqctx.SecretKey = string(secret.Data[secretKey])\n\tqctx.DbUri = string(secret.Data[dbURI])\n\tqctx.DbRootPw = string(secret.Data[dbRootPw])\n\tqctx.ConfigEditorPw = string(secret.Data[configEditorPw])\n\tqctx.SecurityScannerV4PSK = string(secret.Data[securityScannerV4PSK])\n\treturn nil\n}", "func KnownPackagePaths(ctx context.Context, snapshot Snapshot, fh VersionedFileHandle) ([]PackagePath, error) {\n\t// TODO(adonovan): this whole algorithm could be more\n\t// simply expressed in terms of Metadata, not Packages.\n\t// All we need below is:\n\t// - for fh: Metadata.{DepsByPkgPath,Path,Name}\n\t// - for all cached packages: Metadata.{Path,Name,ForTest,DepsByPkgPath}.\n\tpkg, pgf, err := GetParsedFile(ctx, snapshot, fh, NarrowestPackage)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GetParsedFile: %w\", err)\n\t}\n\talreadyImported := map[PackagePath]struct{}{}\n\tfor _, imp := range pkg.Imports() {\n\t\talreadyImported[imp.PkgPath()] = struct{}{}\n\t}\n\tpkgs, err := snapshot.CachedImportPaths(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar (\n\t\tseen = make(map[PackagePath]struct{})\n\t\tpaths []PackagePath\n\t)\n\tfor path, knownPkg := range pkgs {\n\t\t// package main cannot be imported\n\t\tif knownPkg.Name() == \"main\" {\n\t\t\tcontinue\n\t\t}\n\t\t// test packages cannot be imported\n\t\tif knownPkg.ForTest() != \"\" {\n\t\t\tcontinue\n\t\t}\n\t\t// no need to import what the file already imports\n\t\tif _, ok := alreadyImported[path]; ok {\n\t\t\tcontinue\n\t\t}\n\t\t// snapshot.CachedImportPaths could have multiple versions of a pkg\n\t\tif _, ok := seen[path]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tseen[path] = struct{}{}\n\t\t// make sure internal packages are importable by the file\n\t\tif !IsValidImport(pkg.PkgPath(), path) {\n\t\t\tcontinue\n\t\t}\n\t\t// naive check on cyclical imports\n\t\tif isDirectlyCyclical(pkg, knownPkg) {\n\t\t\tcontinue\n\t\t}\n\t\tpaths = append(paths, path)\n\t\tseen[path] = struct{}{}\n\t}\n\terr = snapshot.RunProcessEnvFunc(ctx, func(o *imports.Options) error {\n\t\tvar mu sync.Mutex\n\t\tctx, cancel := context.WithTimeout(ctx, time.Millisecond*80)\n\t\tdefer cancel()\n\t\treturn imports.GetAllCandidates(ctx, func(ifix imports.ImportFix) {\n\t\t\tmu.Lock()\n\t\t\tdefer mu.Unlock()\n\t\t\t// TODO(adonovan): what if the actual package path has a vendor/ prefix?\n\t\t\tpath := PackagePath(ifix.StmtInfo.ImportPath)\n\t\t\tif _, ok := seen[path]; ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpaths = append(paths, path)\n\t\t\tseen[path] = struct{}{}\n\t\t}, \"\", pgf.URI.Filename(), string(pkg.Name()), o.Env)\n\t})\n\tif err != nil {\n\t\t// if an error occurred, we still have a decent list we can\n\t\t// show to the user through snapshot.CachedImportPaths\n\t\tevent.Error(ctx, \"imports.GetAllCandidates\", err)\n\t}\n\tsort.Slice(paths, func(i, j int) bool {\n\t\timportI, importJ := paths[i], paths[j]\n\t\tiHasDot := strings.Contains(string(importI), \".\")\n\t\tjHasDot := strings.Contains(string(importJ), \".\")\n\t\tif iHasDot != jHasDot {\n\t\t\treturn jHasDot // dot-free paths (standard packages) compare less\n\t\t}\n\t\treturn importI < importJ\n\t})\n\treturn paths, nil\n}", "func Kexec(kernel, append, initrd string) {\n\tlog.Infof(\"kexec - %s %s %s\", kernel, append, initrd)\n\n\t// kexec -l -cmdline args -i initramfs kernel following u-root/golang-flag parsing\n\tout, err := exec.Command(\"kexec\", \"-l\", \"-cmdline\", append,\n\t\t\"-i\", initrd, kernel).CombinedOutput()\n\tif err != nil {\n\t\tlog.Fatalf(\"kexec load failed - %v : %s\", err, out)\n\t}\n\n\tout, err = exec.Command(\"kexec\", \"-e\").CombinedOutput()\n\tif err != nil {\n\t\tlog.Fatalf(\"kexec execute failed - %v : %s\", err, out)\n\t}\n\tlog.Fatal(\"kexec did not exec ....\")\n\n}", "func validateOpenFDs(passFDs []boot.FDMapping) {\n\tpassHostFDs := make(map[int]struct{})\n\tfor _, passFD := range passFDs {\n\t\tpassHostFDs[passFD.Host] = struct{}{}\n\t}\n\tconst selfFDDir = \"/proc/self/fd\"\n\tif err := filepath.WalkDir(selfFDDir, func(path string, d os.DirEntry, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif d.Type() != os.ModeSymlink {\n\t\t\t// All entries are symlinks. Ignore the callback for fd directory itself.\n\t\t\treturn nil\n\t\t}\n\t\tif fdInfo, err := os.Stat(path); err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\t// Ignore FDs that are now closed. For example, the FD to selfFDDir that\n\t\t\t\t// was opened by filepath.WalkDir() to read dirents.\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"os.Stat(%s) failed: %v\", path, err)\n\t\t} else if !fdInfo.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\t// Uh-oh. This is a directory FD.\n\t\tfdNo, err := strconv.Atoi(d.Name())\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"strconv.Atoi(%s) failed: %v\", d.Name(), err)\n\t\t}\n\t\tdirLink, err := os.Readlink(path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"os.Readlink(%s) failed: %v\", path, err)\n\t\t}\n\t\tif _, ok := passHostFDs[fdNo]; ok {\n\t\t\t// Passed FDs are allowed to be directories. The user must be knowing\n\t\t\t// what they are doing. Log a warning regardless.\n\t\t\tlog.Warningf(\"Sandbox has access to FD %d, which is a directory for %s\", fdNo, dirLink)\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"FD %d is a directory for %s\", fdNo, dirLink)\n\t}); err != nil {\n\t\tutil.Fatalf(\"WalkDir(%s) failed: %v\", selfFDDir, err)\n\t}\n}", "func TestValidation(t *testing.T) {\n\t// Find all the keps\n\tfiles := []string{}\n\terr := filepath.Walk(\n\t\tfilepath.Join(\"..\", \"..\", kepsDir),\n\t\tfunc(path string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif info.IsDir() {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tdir := filepath.Dir(path)\n\t\t\t// true if the file is a symlink\n\t\t\tif info.Mode()&os.ModeSymlink != 0 {\n\t\t\t\t// assume symlink from old KEP location to new\n\t\t\t\tnewLocation, err := os.Readlink(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfiles = append(files, filepath.Join(dir, filepath.Dir(newLocation), kepMetadata))\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif ignore(dir, info.Name()) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tfiles = append(files, path)\n\t\t\treturn nil\n\t\t},\n\t)\n\t// This indicates a problem walking the filepath, not a validation error.\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(files) == 0 {\n\t\tt.Fatal(\"must find more than 0 keps\")\n\t}\n\n\t// Overwrite the command line argument for the run() function\n\tos.Args = []string{\"\", \"\"}\n\tfor _, file := range files {\n\t\tt.Run(file, func(t *testing.T) {\n\t\t\tos.Args[1] = file\n\t\t\tif exit := run(); exit != 0 {\n\t\t\t\tt.Fatalf(\"exit code was %d and not 0. Please see output.\", exit)\n\t\t\t}\n\t\t})\n\t}\n}", "func TestFuncMaps(t *testing.T) {\n\n\t// Test FuncValue map\n\tfor fName, fValue := range goHamlib.FuncValue {\n\t\t_, ok := goHamlib.FuncName[fValue]\n\t\tif !ok {\n\t\t\tt.Fatalf(\"Func %d does not exist in FuncName map\", fValue)\n\t\t}\n\t\tif fName != goHamlib.FuncName[fValue] {\n\t\t\tt.Fatalf(\"Name of Func inconsisted: %s\", fName)\n\t\t}\n\t}\n\n\t// Test FuncName map\n\tfor fValue, fName := range goHamlib.FuncName {\n\t\t_, ok := goHamlib.FuncValue[fName]\n\t\tif !ok {\n\t\t\tt.Fatalf(\"Func %s does not exist in FuncValue map\", fName)\n\t\t}\n\t\tif fValue != goHamlib.FuncValue[fName] {\n\t\t\tt.Fatalf(\"Value of Func inconsisted: %s\", fName)\n\t\t}\n\t}\n}", "func (c *jsiiProxy_CfnFileSystem) Validate() *[]*string {\n\tvar returns *[]*string\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"validate\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (s *SymbolStore) locateLibraryPaths(path string, library string, inputFile *elf.File) ([]string, error) {\n\tvar ret []string\n\tvar searchPath []string\n\n\t// Does it got RPATH?\n\trpaths, err := inputFile.DynString(elf.DT_RPATH)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, rpath := range rpaths {\n\t\tsearchPath = append(searchPath, s.rpathEscaped(rpath, path)...)\n\t}\n\n\t// TODO: Be unstupid and accept DT_RUNPATH foo as well as faked LD_LIBRARY_PATH\n\tsearchPath = append(searchPath, s.systemLibraries...)\n\n\t// Run path is always after system paths\n\trunpaths, err := inputFile.DynString(elf.DT_RUNPATH)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, runpath := range runpaths {\n\t\tsearchPath = append(searchPath, s.rpathEscaped(runpath, path)...)\n\t}\n\n\tfor _, p := range searchPath {\n\t\t// Find out if the guy exists.\n\t\tfullPath := filepath.Join(p, library)\n\t\tst, err := os.Stat(fullPath)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Using stat not lstat..\n\t\tif !st.Mode().IsRegular() {\n\t\t\tcontinue\n\t\t}\n\t\tret = append(ret, fullPath)\n\n\t}\n\treturn ret, nil\n}", "func CheckUEFI() error {\n\tcmd := exec.Command(\"dmesg\")\n\n\tout, err := cmd.Output()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tkernelRingBuffer := strings.Split(string(out),\"\\n\")\n\tkernelRingBuffer = kernelRingBuffer[:len(kernelRingBuffer)-1]\n\n\tfor _, line := range kernelRingBuffer {\n\t\tif strings.Contains(line, \"UEFI\") {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"no entry in the kernel ring buffer refers to UEFI\")\n}", "func verifyAndDispatch(params Params, args []string) (actionFunc, string, error) {\n\tcmds := map[string]bool{\n\t\t\"sc\": true,\n\t\t\"skim\": true,\n\t\t\"vc\": true,\n\t\t\"verify-chain\": true,\n\t\t\"vk\": true,\n\t\t\"verify-key\": true,\n\t}\n\tvar invalidAction bool\n\tif len(args) > 1 {\n\t\tif _, ok := cmds[args[1]]; !ok {\n\t\t\tinvalidAction = true\n\t\t}\n\t}\n\n\tswitch {\n\tcase params.help:\n\t\treturn nil, usage, nil\n\tcase params.progVersion:\n\t\treturn nil, \"certmin, \" + version, nil\n\tcase len(args) == 1:\n\t\treturn nil, usage, nil\n\tcase invalidAction:\n\t\treturn nil, \"\", errors.New(\"invalid action\")\n\tcase params.leaf && params.follow:\n\t\treturn nil, \"\", errors.New(\"--leaf and --follow are mutually exclusive\")\n\tcase params.sort && params.rsort:\n\t\treturn nil, \"\", errors.New(\"--sort and --rsort are mutually exclusive\")\n\tcase params.once && !(params.sort || params.rsort):\n\t\treturn nil, \"\", errors.New(\"--once requires --sort and --rsort\")\n\tcase len(args) < 3:\n\t\treturn nil, \"\", errors.New(\"no certificate location given\")\n\n\tcase args[1] == \"skim\" || args[1] == \"sc\":\n\t\t// Add them quietly\n\t\tlocs := args[2:]\n\t\tlocs = append(locs, params.roots...)\n\t\tlocs = append(locs, params.inters...)\n\t\treturn func() (string, error) { return skimCerts(locs, params) }, \"\", nil\n\n\tcase args[1] == \"verify-chain\" || args[1] == \"vc\":\n\t\treturn func() (string, error) { return verifyChain(args[2:], params) }, \"\", nil\n\n\tcase (args[1] == \"verify-key\" || args[1] == \"vk\") && len(args) < 4:\n\t\treturn nil, \"\", errors.New(\"verify-key needs 1 key file and at least 1 location\")\n\tcase args[1] == \"verify-key\" || args[1] == \"vk\":\n\t\treturn func() (string, error) { return verifyKey(args[2], args[3:], params) }, \"\", nil\n\n\tdefault:\n\t\treturn nil, \"\", errors.New(\"unknown command\")\n\t}\n}", "func (r *Requester) checkBackPressureFunctions() bool {\n\tfor _, f := range r.backPFuncs {\n\t\tif f() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func verifierForKeyRef(ctx context.Context, keyRef string, hashAlgorithm crypto.Hash, k8s kubernetes.Interface) (verifiers []signature.Verifier, err error) {\n\tvar raw []byte\n\tverifiers = []signature.Verifier{}\n\t// if the ref is secret then we fetch the keys from the secrets\n\tif strings.HasPrefix(keyRef, keyReference) {\n\t\ts, err := getKeyPairSecret(ctx, keyRef, k8s)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, raw := range s.Data {\n\t\t\tpubKey, err := cryptoutils.UnmarshalPEMToPublicKey(raw)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"pem to public key: %w\", err)\n\t\t\t}\n\t\t\tv, _ := signature.LoadVerifier(pubKey, hashAlgorithm)\n\t\t\tverifiers = append(verifiers, v)\n\t\t}\n\t\tif len(verifiers) == 0 {\n\t\t\treturn verifiers, fmt.Errorf(\"no public keys are founded for verification\")\n\t\t}\n\t\treturn verifiers, nil\n\t}\n\t// read the key from mounted file\n\traw, err = os.ReadFile(filepath.Clean(keyRef))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// PEM encoded file.\n\tpubKey, err := cryptoutils.UnmarshalPEMToPublicKey(raw)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"pem to public key: %w\", err)\n\t}\n\tv, _ := signature.LoadVerifier(pubKey, hashAlgorithm)\n\tverifiers = append(verifiers, v)\n\n\treturn verifiers, nil\n}", "func (s *SymbolStore) scanELF(path string, file *elf.File) error {\n\tname := filepath.Base(path)\n\n\t// Figure out who we actually import\n\tlibs, err := file.ImportedLibraries()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Make sure we've got a bucket for the Machine\n\tif _, ok := s.symbols[file.FileHeader.Machine]; !ok {\n\t\ts.symbols[file.FileHeader.Machine] = make(map[string]map[string]bool)\n\t}\n\n\t// Find out what we actually expose..\n\tprovidesSymbols, err := file.DynamicSymbols()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(providesSymbols) > 0 {\n\t\ts.symbols[file.FileHeader.Machine][name] = make(map[string]bool)\n\t}\n\n\tfor i := range providesSymbols {\n\t\t// TODO: Filter symbols out if they're janky/weak\n\t\t// Store hit table\n\t\ts.storeSymbol(name, file, &providesSymbols[i])\n\t}\n\n\t// At this point, we'd load all relevant libs\n\tfor _, l := range libs {\n\t\tif s.hasLibrary(l, file.FileHeader.Machine) {\n\t\t\tfmt.Fprintf(os.Stderr, \"Already loaded: %v\\n\", l)\n\t\t\tcontinue\n\t\t}\n\t\t// Try and find the relevant guy. Basically, its an ELF and machine is matched\n\t\tlib, libPath, err := s.locateLibrary(path, l, file)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Recurse into this Thing\n\t\tif err = s.scanELF(libPath, lib); err != nil {\n\t\t\tlib.Close()\n\t\t\treturn err\n\t\t}\n\t\tlib.Close()\n\t}\n\n\t// Figure out what symbols we end up using\n\tsyms, err := file.ImportedSymbols()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// At this point, we'd resolve all symbols..\n\t// The \"Library\" may actually be empty, so we need to go looking through\n\t// a symbol store for this process to find out who actually owns it\n\tfor i := range syms {\n\t\tsym := &syms[i]\n\t\tif !s.resolveSymbol(path, file, sym) {\n\t\t\treturn fmt.Errorf(\"failed to resolve symbol: %s %s\", sym.Name, path)\n\t\t}\n\t}\n\n\treturn nil\n}", "func getSecretRelatedFuncs(ctx context.Context, logger *zap.Logger, m *metav1.ObjectMeta, fissionClient versioned.Interface) ([]fv1.Function, error) {\n\tfuncList, err := fissionClient.CoreV1().Functions(m.Namespace).List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// In future a cache that populates at start and is updated on changes might be better solution\n\trelatedFunctions := make([]fv1.Function, 0)\n\tfor _, f := range funcList.Items {\n\t\tfor _, secret := range f.Spec.Secrets {\n\t\t\tif (secret.Name == m.Name) && (secret.Namespace == m.Namespace) {\n\t\t\t\trelatedFunctions = append(relatedFunctions, f)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn relatedFunctions, nil\n}", "func (r *QuayRegistryReconciler) checkDeprecatedManagedKeys(\n\tctx context.Context, qctx *quaycontext.QuayRegistryContext, quay *v1.QuayRegistry,\n) error {\n\tlistOptions := &client.ListOptions{\n\t\tNamespace: quay.GetNamespace(),\n\t\tLabelSelector: labels.SelectorFromSet(\n\t\t\tmap[string]string{\n\t\t\t\tkustomize.QuayRegistryNameLabel: quay.GetName(),\n\t\t\t},\n\t\t),\n\t}\n\n\tvar secrets corev1.SecretList\n\tif err := r.List(ctx, &secrets, listOptions); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, secret := range secrets.Items {\n\t\tif !v1.IsManagedKeysSecretFor(quay, &secret) {\n\t\t\tcontinue\n\t\t}\n\n\t\tqctx.DatabaseSecretKey = string(secret.Data[databaseSecretKey])\n\t\tqctx.SecretKey = string(secret.Data[secretKey])\n\t\tqctx.DbUri = string(secret.Data[dbURI])\n\t\tqctx.DbRootPw = string(secret.Data[dbRootPw])\n\t\tqctx.ConfigEditorPw = string(secret.Data[configEditorPw])\n\t\tqctx.SecurityScannerV4PSK = string(secret.Data[securityScannerV4PSK])\n\t\tbreak\n\t}\n\n\treturn nil\n}", "func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) {\n\tpkg.defs = make(map[*ast.Ident]types.Object)\n\terrFn := func(err error) {\n\t\tcErr := err.(types.Error)\n\t\tif cErr.Soft {\n\t\t\treturn\n\t\t}\n\t\tif strings.Contains(cErr.Msg, \"has no field or method\") ||\n\t\t\tstrings.Contains(cErr.Msg, \"invalid operation: cannot call non-function\") ||\n\t\t\t//2016-01-11: Try and skip past issues with VendorExperiment\n\t\t\tstrings.Contains(cErr.Msg, \"vendor\") {\n\t\t\tlog.Printf(\"IGNORED: during package check: %s\", cErr.Msg)\n\t\t\treturn\n\t\t}\n\t\tlog.Fatalf(\"checking package: %s\", cErr.Msg)\n\t}\n\tconfig := types.Config{FakeImportC: true, Error: errFn, Importer: importer.ForCompiler(fs, \"source\", nil)}\n\tinfo := &types.Info{\n\t\tDefs: pkg.defs,\n\t}\n\ttypesPkg, _ := config.Check(pkg.dir, fs, astFiles, info)\n\tpkg.typesPkg = typesPkg\n}", "func findAuthKeys() (pathsToKeys []string, err error) {\n\tkeyPath, err := DataPath()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm, err := filepath.Glob(filepath.Join(keyPath, \"charm_*\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(m) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tvar found []string\n\tfor _, f := range m {\n\t\tswitch filepath.Base(f) {\n\t\tcase \"charm_rsa\":\n\t\t\tfallthrough\n\t\tcase \"charm_ecdsa\":\n\t\t\tfallthrough\n\t\tcase \"charm_ed25519\":\n\t\t\tfound = append(found, f)\n\t\t}\n\t}\n\n\treturn found, nil\n}", "func loadTestFuncs(ptest *build.Package) (*testFuncs, error) {\n\tt := &testFuncs{\n\t\tPackage: ptest,\n\t}\n\tlog.Debugf(\"loadTestFuncs: %v, %v\", ptest.TestGoFiles, ptest.XTestGoFiles)\n\tfor _, file := range ptest.TestGoFiles {\n\t\tif err := t.load(filepath.Join(ptest.Dir, file), \"_test\", &t.ImportTest, &t.NeedTest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tfor _, file := range ptest.XTestGoFiles {\n\t\tif err := t.load(filepath.Join(ptest.Dir, file), \"_xtest\", &t.ImportXtest, &t.NeedXtest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn t, nil\n}", "func checkCalledFromInit() {\n\tfor skip := 3; ; skip++ {\n\t\t_, funcName, ok := callerName(skip)\n\t\tif !ok {\n\t\t\tpanic(\"not called from an init func\")\n\t\t}\n\n\t\tif funcName == \"init\" || strings.HasPrefix(funcName, \"init·\") ||\n\t\t\tstrings.HasPrefix(funcName, \"init.\") {\n\t\t\treturn\n\t\t}\n\t}\n}", "func inK8s(file string) bool {\n\t_, err := os.Stat(file)\n\n\treturn !os.IsNotExist(err)\n}", "func checkHelperScripts() {\n\tvar path, msg string\n\tvar err error\n\n\tpath, err = exec.LookPath(CMD_ALERT)\n\tif err != nil {\n\t\tmsg = \"Could not find executable '\" + CMD_ALERT + \"' in your path. This is needed if you run loftus in the background.\\n\"\n\t\tmsg += \"Suggested contents:\\n---\\n\" + SUGGEST_CMD_ALERT + \"\\n---\"\n\t\tlog.Println(msg)\n\t} else {\n\t\tlog.Println(\"Found alert helper:\", path)\n\t}\n\n\tpath, err = exec.LookPath(CMD_INFO)\n\tif err != nil {\n\t\tmsg = \"Could not find executable '\" + CMD_INFO + \"' in your path. This is needed if you run loftus in the background.\\n\"\n\t\tmsg += \"Suggested contents:\\n---\\n\" + SUGGEST_CMD_INFO + \"\\n---\"\n\t\tlog.Println(msg)\n\t} else {\n\t\tlog.Println(\"Found info helper:\", path)\n\t}\n}", "func InitTfmBins(osPath *string) map[string]string {\n\ttfmBins := make(map[string]string)\n\tpathDelimeter := \":\"\n\ttfmRegexStr := `^(.*)/terraform-([0-9]*\\.[0-9]*\\.[0-9]*)$`\n\tif runtime.GOOS == \"windows\" {\n\t\tpathDelimeter = \";\"\n\t\ttfmRegexStr = `^(.*)\\\\terraform-([0-9]*\\.[0-9]*\\.[0-9]*)\\.exe$`\n\t}\n\texecPaths := strings.Split(*osPath, pathDelimeter)\n\tmyDebug(\"Paths to locate terraform: %v\", execPaths)\n\tfor i, oneDir := range execPaths {\n\t\tmyDebug(\"%d) %s\", i, oneDir)\n\t\tif f, err := os.Open(oneDir); err == nil {\n\t\t\tmatches, _ := filepath.Glob(fmt.Sprintf(\"%s/terraform-*\", oneDir))\n\t\t\tfor _, match := range matches {\n\t\t\t\tif fileInfo, err := os.Lstat(match); err == nil {\n\t\t\t\t\tif fileInfo.Mode().IsRegular() && (fileInfo.Mode().Perm()&0111 == 0111) {\n\t\t\t\t\t\ttfmVersionRegex := regexp.MustCompile(tfmRegexStr)\n\t\t\t\t\t\tif tfmVersionRegex.MatchString(match) {\n\t\t\t\t\t\t\ttfmVersion := tfmVersionRegex.ReplaceAllString(match, \"$2\")\n\t\t\t\t\t\t\tif tfmBins[tfmVersion] == \"\" {\n\t\t\t\t\t\t\t\ttfmBins[tfmVersion] = match\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tf.Close()\n\t\t}\n\t}\n\tif FlagDebug {\n\t\tfor verStr, file := range tfmBins {\n\t\t\tmyDebug(\"version: %s, file: %s\", verStr, file)\n\t\t}\n\t}\n\treturn tfmBins\n}", "func CephCFunctions(pkg string, ii *Inspector) error {\n\tlogger.Printf(\"getting C AST for %s\", pkg)\n\tf, err := stubCFunctions(pkg)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ii.SetExpected(funcPrefix[pkg], f)\n}", "func Floadfs(name string) bool {\n\tif Floadf(name) {\n\t\ts := Fslistf(name)\n\t\tfor _, i := range s {\n\t\t\tFloadf(i)\n\t\t}\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "func verifyPathIsSafeForExec(execPath string) (string, error) {\n\tif unsafe, err := regexp.MatchString(ExecPathBlackListRegex, execPath); err != nil {\n\t\treturn \"\", err\n\t} else if unsafe {\n\t\treturn \"\", fmt.Errorf(\"Unsafe execution path: %q \", execPath)\n\t} else if _, statErr := os.Stat(execPath); statErr != nil {\n\t\treturn \"\", statErr\n\t}\n\n\treturn execPath, nil\n}", "func SetupFunctions(t *testing.T) {\n\tconfig := &struct {\n\t\tGenerators []functions.Spec `yam:\"generators\"`\n\t}{}\n\tinitConfig(t, config)\n\tif len(functions.CallGenerators()) == 0 {\n\t\tt.Fatalf(\"no call generators found\")\n\t}\n}", "func Check(file *ast.File) error {\n\tfor _, decl := range file.Decls {\n\t\tswitch decl := decl.(type) {\n\t\tcase *ast.FuncDecl:\n\t\t\t// Check for nested functions.\n\t\t\tif NoNestedFunctions {\n\t\t\t\tif err := checkNestedFunctions(decl); err != nil {\n\t\t\t\t\treturn errutil.Err(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func CheckSigs(sigs ...Sig) Match {\n\tvar errs []error\n\tsubs := newSubs()\n\tfor i, s := range sigs {\n\t\tfun := reflect.TypeOf(s.Function)\n\t\tif fun.Kind() != reflect.Func {\n\t\t\tpanic(fmt.Errorf(\"Signature for '%v' requires a function for Function\", s.Name))\n\t\t}\n\t\tiface := reflect.TypeOf(s.Interface)\n\t\tif iface.Kind() != reflect.Func {\n\t\t\tpanic(fmt.Errorf(\"Signature for '%v' requires a function for Interface\", s.Name))\n\t\t}\n\n\t\toM := reflect.Method{Name: s.Name, Type: fun, Index: i}\n\t\tiM := reflect.Method{Name: s.Name, Type: iface, Index: i}\n\t\tif err := checkMethod(oM, iM, subs, false); err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\treturn Match{errs, subs}\n}", "func isKrmFile(path string) (bool, error) {\n\tfor _, g := range krmFilesGlob {\n\t\tif match, err := filepath.Match(g, filepath.Base(path)); err != nil {\n\t\t\treturn false, errors.Wrap(err)\n\t\t} else if match {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "func Fexistx(mname string) bool {\n\tif _, err := fmethods[mname]; err {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "func (config *Config) Validate() error {\n\n\tif _, err := os.Stat(filepath.Join(config.KirdPath, config.KernelFile)); os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"kernel '%s' not found\", filepath.Join(config.KirdPath, config.KernelFile))\n\t}\n\tif _, err := os.Stat(filepath.Join(config.KirdPath, config.InitrdFile)); os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"initrd '%s' not found\", filepath.Join(config.KirdPath, config.InitrdFile))\n\t}\n\n\t// Ensure all the MappedVirtualDisks exist on the host\n\tfor _, mvd := range config.MappedVirtualDisks {\n\t\tif _, err := os.Stat(mvd.HostPath); err != nil {\n\t\t\treturn fmt.Errorf(\"mapped virtual disk '%s' not found\", mvd.HostPath)\n\t\t}\n\t\tif mvd.ContainerPath == \"\" {\n\t\t\treturn fmt.Errorf(\"mapped virtual disk '%s' requested without a container path\", mvd.HostPath)\n\t\t}\n\t}\n\n\treturn nil\n}", "func findVMLinux() (*internal.SafeELFFile, error) {\n\trelease, err := internal.KernelRelease()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// use same list of locations as libbpf\n\t// https://github.com/libbpf/libbpf/blob/9a3a42608dbe3731256a5682a125ac1e23bced8f/src/btf.c#L3114-L3122\n\tlocations := []string{\n\t\t\"/boot/vmlinux-%s\",\n\t\t\"/lib/modules/%s/vmlinux-%[1]s\",\n\t\t\"/lib/modules/%s/build/vmlinux\",\n\t\t\"/usr/lib/modules/%s/kernel/vmlinux\",\n\t\t\"/usr/lib/debug/boot/vmlinux-%s\",\n\t\t\"/usr/lib/debug/boot/vmlinux-%s.debug\",\n\t\t\"/usr/lib/debug/lib/modules/%s/vmlinux\",\n\t}\n\n\tfor _, loc := range locations {\n\t\tfile, err := internal.OpenSafeELFFile(fmt.Sprintf(loc, release))\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\tcontinue\n\t\t}\n\t\treturn file, err\n\t}\n\n\treturn nil, fmt.Errorf(\"no BTF found for kernel version %s: %w\", release, internal.ErrNotSupported)\n}", "func assertValuesAreValidPaths(vars *varMap) bool {\n\tret := true\n\tfor key, value := range *vars {\n\t\tfor _, line := range value {\n\t\t\tif isPathInvalid(line) {\n\t\t\t\tlog.Print(fmt.Sprintf(\"Invalid path in section [%s]: %s\\n\", key, line))\n\t\t\t\tret = false\n\t\t\t}\n\t\t}\n\t}\n\treturn ret\n}", "func FindUsableFunctionsForUser(userID uint) ([]UsableFunction, error) {\n\tvar foundFuncs []UsableFunction;\n\tdb := util.DBAccessorFunc()\n\tdb = db.Table(\"usable_functions\").Select(\"id\", \"content\", \"created_at\").Where(\"user_id = ?\", userID).Find(&foundFuncs)\n\tif db.Error != nil {\n\t\treturn foundFuncs, ErrFailedFuncFind\n\t}\n\treturn foundFuncs, nil\n}", "func CheckCrossDevice(absPaths []string) error {\n\treturn checkCrossDevice(absPaths, procMountsPath)\n}", "func findFuncs(name string) ([]*FuncExtent, error) {\n\tfset := token.NewFileSet()\n\tparsedFile, err := parser.ParseFile(fset, name, nil, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvisitor := &FuncVisitor{\n\t\tfset: fset,\n\t\tname: name,\n\t\tastFile: parsedFile,\n\t}\n\tast.Walk(visitor, visitor.astFile)\n\treturn visitor.funcs, nil\n}", "func KBFSBinPath(runMode libkb.RunMode, binPath string) (string, error) {\n\treturn kbfsBinPathDefault(runMode, binPath)\n}", "func (s *Storage) VerifyTables() (err error) {\n\ttype TableCheck struct {\n\t\tFunc func() (err error)\n\t\tName string\n\t}\n\n\ttables := []TableCheck{\n\t\t{\n\t\t\tFunc: s.createTableAccount,\n\t\t\tName: \"Account\",\n\t\t},\n\t\t{\n\t\t\tFunc: s.createTableCharacter,\n\t\t\tName: \"Character\",\n\t\t},\n\t\t{\n\t\t\tFunc: s.createTableForum,\n\t\t\tName: \"Forum\",\n\t\t},\n\t\t{\n\t\t\tFunc: s.createTableRule,\n\t\t\tName: \"Rule\",\n\t\t},\n\t\t{\n\t\t\tFunc: s.createTableRuleEntry,\n\t\t\tName: \"RuleEntry\",\n\t\t},\n\t\t{\n\t\t\tFunc: s.createTableUser,\n\t\t\tName: \"User\",\n\t\t},\n\t\t{\n\t\t\tFunc: s.createTableUserAccount,\n\t\t\tName: \"UserAccount\",\n\t\t},\n\t\t{\n\t\t\tFunc: s.createTableUserLink,\n\t\t\tName: \"UserLink\",\n\t\t},\n\t\t{\n\t\t\tFunc: s.createTableVariable,\n\t\t\tName: \"Variable\",\n\t\t},\n\t\t{\n\t\t\tFunc: s.createTableZone,\n\t\t\tName: \"Zone\",\n\t\t},\n\t}\n\n\tfor _, table := range tables {\n\t\terr = table.Func()\n\t\tif err != nil && !isExistErr(err) {\n\t\t\treturn\n\t\t}\n\t\tif err == nil {\n\t\t\ts.log.Println(\"Created table for\", table.Name)\n\t\t}\n\t}\n\terr = nil\n\treturn\n}", "func VerifyWalletsPath() string {\n\n\treturn fmt.Sprintf(\"/v1/wallets/verify\")\n}", "func loadConfig(funcs []func() error) error {\n\tvar err error\n\n\tfor _, f := range funcs {\n\t\terr = f()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn err\n}", "func (m *lispMachine) checkRoots() (err error) {\n\tif !m.checkedRoots && m.runBwd() {\n\t\tmachineLogf(\"Checking if provided graph is sensible\")\n\t\tm.logf(\"roots: %v\", m.g.Roots())\n\t\tfor _, root := range m.g.Roots() {\n\t\t\tswitch {\n\t\t\tcase m.setRootGrad() && !root.isStmt:\n\t\t\t\t// check root's value\n\t\t\t\t// if _, ok := root.boundTo.(*dualValue); !ok {\n\t\t\t\t// \terr = errors.Errorf(\"Expected root %v to have a boundTo of a dualValue\", root)\n\t\t\t\t// \treturn\n\t\t\t\t// }\n\t\t\tcase !m.setRootGrad() && !root.IsScalar() && !root.isStmt:\n\t\t\t\terr = errors.Errorf(\"Expected cost to be a scalar. Got %v with shape %v instead\", root, root.Shape())\n\t\t\t\tioutil.WriteFile(\"err.dot\", []byte(root.RestrictedToDot(2, 10)), 0644)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func verifyKeys(prevEntry *tpb.Entry, data interface{}, update *tpb.SignedKV, entry *tpb.Entry) error {\n\tvar verifiers map[string]signatures.Verifier\n\tvar err error\n\tif prevEntry == nil {\n\t\tverifiers, err = verifiersFromKeys(entry.GetAuthorizedKeys())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tverifiers, err = verifiersFromKeys(prevEntry.GetAuthorizedKeys())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := verifyAuthorizedKeys(data, verifiers, update.GetSignatures()); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func checkHCLKeys(node ast.Node, valid []string) error {\n\tvar list *ast.ObjectList\n\tswitch n := node.(type) {\n\tcase *ast.ObjectList:\n\t\tlist = n\n\tcase *ast.ObjectType:\n\t\tlist = n.List\n\tdefault:\n\t\treturn fmt.Errorf(\"cannot check HCL keys of type %T\", n)\n\t}\n\n\tvalidMap := make(map[string]struct{}, len(valid))\n\tfor _, v := range valid {\n\t\tvalidMap[v] = struct{}{}\n\t}\n\n\tvar result error\n\tfor _, item := range list.Items {\n\t\tkey := item.Keys[0].Token.Value().(string)\n\t\tif _, ok := validMap[key]; !ok {\n\t\t\tresult = multierror.Append(result, fmt.Errorf(\n\t\t\t\t\"invalid key '%s' in line %+v\", key, item.Keys[0].Token.Pos))\n\t\t}\n\t}\n\n\treturn result\n}", "func TestKeyServerLocalTLFCryptKeyServerHalves(t *testing.T) {\n\t// simulate two users\n\tvar userName1, userName2 libkb.NormalizedUsername = \"u1\", \"u2\"\n\tconfig1, uid1, ctx, cancel := kbfsOpsConcurInit(t, userName1, userName2)\n\tdefer kbfsConcurTestShutdown(t, config1, ctx, cancel)\n\n\tconfig2 := ConfigAsUser(config1, userName2)\n\tdefer CheckConfigAndShutdown(ctx, t, config2)\n\t_, uid2, err := config2.KBPKI().GetCurrentUserInfo(context.Background())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpublicKey1, err := config1.KBPKI().GetCurrentCryptPublicKey(ctx)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tpublicKey2, err := config2.KBPKI().GetCurrentCryptPublicKey(ctx)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tserverHalf1 := kbfscrypto.MakeTLFCryptKeyServerHalf([32]byte{1})\n\tserverHalf2 := kbfscrypto.MakeTLFCryptKeyServerHalf([32]byte{2})\n\tserverHalf3 := kbfscrypto.MakeTLFCryptKeyServerHalf([32]byte{3})\n\tserverHalf4 := kbfscrypto.MakeTLFCryptKeyServerHalf([32]byte{4})\n\n\t// write 1\n\tkeyHalves := make(UserDeviceKeyServerHalves)\n\tdeviceHalves := make(DeviceKeyServerHalves)\n\tdeviceHalves[publicKey1] = serverHalf1\n\tkeyHalves[uid1] = deviceHalves\n\n\terr = config1.KeyOps().PutTLFCryptKeyServerHalves(ctx, keyHalves)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// write 2\n\tkeyHalves = make(UserDeviceKeyServerHalves)\n\tdeviceHalves = make(DeviceKeyServerHalves)\n\tdeviceHalves[publicKey1] = serverHalf2\n\tkeyHalves[uid1] = deviceHalves\n\n\terr = config1.KeyOps().PutTLFCryptKeyServerHalves(ctx, keyHalves)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// write 3 and 4 together\n\tkeyHalves = make(UserDeviceKeyServerHalves)\n\tdeviceHalves1 := make(DeviceKeyServerHalves)\n\tdeviceHalves2 := make(DeviceKeyServerHalves)\n\tdeviceHalves1[publicKey1] = serverHalf3\n\tkeyHalves[uid1] = deviceHalves1\n\tdeviceHalves2[publicKey2] = serverHalf4\n\tkeyHalves[uid2] = deviceHalves2\n\n\terr = config1.KeyOps().PutTLFCryptKeyServerHalves(ctx, keyHalves)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tserverHalfID1, err :=\n\t\tconfig1.Crypto().GetTLFCryptKeyServerHalfID(uid1, publicKey1, serverHalf1)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tserverHalfID2, err :=\n\t\tconfig1.Crypto().GetTLFCryptKeyServerHalfID(uid1, publicKey1, serverHalf2)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tserverHalfID3, err :=\n\t\tconfig1.Crypto().GetTLFCryptKeyServerHalfID(uid1, publicKey1, serverHalf3)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tserverHalfID4, err :=\n\t\tconfig1.Crypto().GetTLFCryptKeyServerHalfID(uid2, publicKey2, serverHalf4)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\thalf1, err := config1.KeyOps().GetTLFCryptKeyServerHalf(ctx, serverHalfID1, publicKey1)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif half1 != serverHalf1 {\n\t\tt.Errorf(\"Expected %v, got %v\", serverHalf1, half1)\n\t}\n\n\thalf2, err := config1.KeyOps().GetTLFCryptKeyServerHalf(ctx, serverHalfID2, publicKey1)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif half2 != serverHalf2 {\n\t\tt.Errorf(\"Expected %v, got %v\", serverHalf2, half2)\n\t}\n\n\thalf3, err := config1.KeyOps().GetTLFCryptKeyServerHalf(ctx, serverHalfID3, publicKey1)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif half3 != serverHalf3 {\n\t\tt.Errorf(\"Expected %v, got %v\", serverHalf3, half3)\n\t}\n\n\thalf4, err := config1.KeyOps().GetTLFCryptKeyServerHalf(ctx, serverHalfID4, publicKey1)\n\t_, unauthorized := err.(MDServerErrorUnauthorized)\n\tif !unauthorized {\n\t\tt.Errorf(\"Expected unauthorized, got %v\", err)\n\t}\n\n\t// try to get uid2's key now as uid2\n\thalf4, err = config2.KeyOps().GetTLFCryptKeyServerHalf(ctx, serverHalfID4, publicKey2)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif half4 != serverHalf4 {\n\t\tt.Errorf(\"Expected %v, got %v\", serverHalf4, half4)\n\t}\n\n\tserverHalfIDNope, err := config1.Crypto().GetTLFCryptKeyServerHalfID(uid1, publicKey1, serverHalf4)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t_, err = config1.KeyOps().GetTLFCryptKeyServerHalf(ctx, serverHalfIDNope, publicKey1)\n\tif err == nil {\n\t\tt.Error(\"GetTLFCryptKeyServerHalf(id2, keyGen2, publicKey2) unexpectedly succeeded\")\n\t}\n}", "func (me *XsdGoPkgHasElems_Kml) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElems_Kml; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor _, x := range me.Kmls {\r\n\t\t\tif err = x.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func xfsSupported() error {\n\t// Make sure mkfs.xfs is available\n\tif _, err := exec.LookPath(\"mkfs.xfs\"); err != nil {\n\t\treturn err // error text is descriptive enough\n\t}\n\n\t// Check if kernel supports xfs filesystem or not.\n\texec.Command(\"modprobe\", xfs).Run()\n\n\tf, err := os.Open(\"/proc/filesystems\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"checking for xfs support: %w\", err)\n\t}\n\tdefer f.Close()\n\n\ts := bufio.NewScanner(f)\n\tfor s.Scan() {\n\t\tif strings.HasSuffix(s.Text(), \"\\txfs\") {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tif err := s.Err(); err != nil {\n\t\treturn fmt.Errorf(\"checking for xfs support: %w\", err)\n\t}\n\n\treturn errors.New(`kernel does not support xfs, or \"modprobe xfs\" failed`)\n}", "func (Bpf) Kernels() error {\n\n\tfmt.Println(\"Fetching and configuring kernels ..\")\n\n\tvar eg errgroup.Group\n\n\tfor _, k := range kernel.Builds {\n\n\t\t// https://golang.org/doc/faq#closures_and_goroutines\n\t\tk := k\n\n\t\teg.Go(func() error {\n\t\t\t// Get and unarchive the kernel.\n\t\t\tif err := k.Fetch(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Configure the kernel with its specified parameters.\n\t\t\tif err := k.Configure(nil); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\t}\n\n\tif err := eg.Wait(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (mts mountInfos) checkCrossMounts(path string) error {\n\tif !filepath.IsAbs(path) {\n\t\treturn fmt.Errorf(\"Invalid argument, path (%s) is expected to be absolute\", path)\n\t}\n\tvar crossMounts mountInfos\n\tfor _, mount := range mts {\n\t\t// Add a separator to indicate that this is a proper mount-point.\n\t\t// This is to avoid a situation where prefix is '/tmp/fsmount'\n\t\t// and mount path is /tmp/fs. In such a scenario we need to check for\n\t\t// `/tmp/fs/` to be a common prefix amount other mounts.\n\t\tmpath := strings.TrimSuffix(mount.Path, \"/\") + \"/\"\n\t\tppath := strings.TrimSuffix(path, \"/\") + \"/\"\n\t\tif strings.HasPrefix(mpath, ppath) {\n\t\t\t// At this point if the mount point has a common prefix two conditions can happen.\n\t\t\t// - mount.Path matches exact with `path` means we can proceed no error here.\n\t\t\t// - mount.Path doesn't match (means cross-device mount), should error out.\n\t\t\tif mount.Path != path {\n\t\t\t\tcrossMounts = append(crossMounts, mount)\n\t\t\t}\n\t\t}\n\t}\n\tmsg := `Cross-device mounts detected on path (%s) at following locations %s. Export path should not have any sub-mounts, refusing to start.`\n\tif len(crossMounts) > 0 {\n\t\t// if paths didn't match then we do have cross-device mount.\n\t\treturn fmt.Errorf(msg, path, crossMounts)\n\t}\n\treturn nil\n}", "func keyIsFunction(key string) bool {\n\treturn functionMap[key] != nil\n}", "func verifyTerraformAndKopsMatch(kopsName string, terraformClient *terraform.Cmd, logger log.FieldLogger) error {\n\tout, ok, err := terraformClient.Output(\"cluster_name\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !ok {\n\t\tlogger.Warn(\"No cluster_name in terraform config, skipping check\")\n\t\treturn nil\n\t}\n\tif out != kopsName {\n\t\treturn errors.Errorf(\"terraform cluster_name (%s) does not match kops_name from provided ID (%s)\", out, kopsName)\n\t}\n\n\treturn nil\n}", "func (s *Server) watchKernelRoute() error {\n\terr := s.loadKernelRoute()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tch := make(chan netlink.RouteUpdate)\n\terr = netlink.RouteSubscribe(ch, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor update := range ch {\n\t\ts.log.Debugf(\"kernel update: %s\", update)\n\t\tif update.Table == syscall.RT_TABLE_MAIN &&\n\t\t\t(update.Protocol == syscall.RTPROT_KERNEL || update.Protocol == syscall.RTPROT_BOOT) {\n\t\t\t// TODO: handle ipPool deletion. RTM_DELROUTE message\n\t\t\t// can belong to previously valid ipPool.\n\t\t\tif s.ipam.match(*update.Dst) == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tisWithdrawal := false\n\t\t\tswitch update.Type {\n\t\t\tcase syscall.RTM_DELROUTE:\n\t\t\t\tisWithdrawal = true\n\t\t\tcase syscall.RTM_NEWROUTE:\n\t\t\tdefault:\n\t\t\t\ts.log.Debugf(\"unhandled rtm type: %d\", update.Type)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpath, err := s.makePath(update.Dst.String(), isWithdrawal)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ts.log.Debugf(\"made path from kernel update: %s\", path)\n\t\t\tif _, err = s.bgpServer.AddPath(context.Background(), &bgpapi.AddPathRequest{\n\t\t\t\tTableType: bgpapi.TableType_GLOBAL,\n\t\t\t\tPath: path,\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if update.Table == syscall.RT_TABLE_LOCAL {\n\t\t\t// This means the interface address is updated\n\t\t\t// Some routes we injected may be deleted by the kernel\n\t\t\t// Reload routes from BGP RIB and inject again\n\t\t\tip, _, _ := net.ParseCIDR(update.Dst.String())\n\t\t\tfamily := \"4\"\n\t\t\tif ip.To4() == nil {\n\t\t\t\tfamily = \"6\"\n\t\t\t}\n\t\t\ts.reloadCh <- family\n\t\t}\n\t}\n\treturn fmt.Errorf(\"netlink route subscription ended\")\n}", "func (ctl *Ctl) CheckSpecFlags() error {\n\tfor _, registryJSON := range ctl.ScannerPodImageFacadeInternalRegistriesJSONSlice {\n\t\tregistry := &opssightv1.RegistryAuth{}\n\t\terr := json.Unmarshal([]byte(registryJSON), registry)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Invalid Registry Format\")\n\t\t}\n\t}\n\treturn nil\n}", "func checkPaths(paths []string) {\n\n\tfor _, path := range paths {\n\n\t\tif path == \".\" {\n\t\t\tfmt.Println(\"Relative paths, like '.', are not supported!\")\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t_, err := os.Stat(path)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Path '%v' does not exists!\\n\", path)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "func getSystemTimes(idleTime, kernelTime, userTime *FileTime) bool {\n\tret, _, _ := procGetSystemTimes.Call(\n\t\tuintptr(unsafe.Pointer(idleTime)),\n\t\tuintptr(unsafe.Pointer(kernelTime)),\n\t\tuintptr(unsafe.Pointer(userTime)))\n\n\treturn ret != 0\n}", "func init() {\n\ttesting.AddTest(&testing.Test{\n\t\tFunc: KeysetTiedToTPM1,\n\t\tDesc: \"Verifies that, for TPMv1.2 devices, the keyset is tied to TPM regardless of when it's created and if a reboot happens\",\n\t\tContacts: []string{\n\t\t\t\"[email protected]\",\n\t\t\t\"[email protected]\",\n\t\t},\n\t\tSoftwareDeps: []string{\"tpm1\"},\n\t\tAttr: []string{\"group:hwsec_destructive_func\"},\n\t})\n}", "func getKnownHostPaths(fo fileOpener) ([]string, error) {\n\tu, err := user.Current()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get user for known_hosts file\")\n\t}\n\tuserKH := filepath.Join(u.HomeDir, \".ssh\", \"known_hosts\")\n\tuserF, userErr := fo(userKH)\n\tif userErr == nil {\n\t\terr = userF.Close()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to close user known_hosts\")\n\t\t}\n\t}\n\n\tglobalF, globalErr := fo(globalKnownHosts)\n\tif globalErr == nil {\n\t\terr = globalF.Close()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to close global known_hosts\")\n\t\t}\n\t}\n\n\tif userErr != nil && globalErr != nil {\n\t\t// Just wrapping one error here, for simplicity.\n\t\treturn nil, errors.Wrap(userErr, \"unable to find usable known_hosts file\")\n\t} else if userErr != nil {\n\t\treturn []string{globalKnownHosts}, nil\n\t} else if globalErr != nil {\n\t\treturn []string{userKH}, nil\n\t}\n\treturn []string{globalKnownHosts, userKH}, nil\n}", "func HashPackages(vlog, events metrics.Metrics, dir string, ctx build.Context) (HashList, error) {\n\tvar pkgFuncs HashList\n\tpkgFuncs.Path = dir\n\tpkgFuncs.Packages = make(map[string]string)\n\tpkgFuncs.Package, _ = srcpath.RelativeToSrc(dir)\n\n\tpkgs, err := ast.FilteredPackageWithBuildCtx(vlog, dir, ctx)\n\tif err != nil {\n\t\tif _, ok := err.(*build.NoGoError); ok {\n\t\t\treturn pkgFuncs, ErrSkipDir\n\t\t}\n\n\t\tevents.Emit(metrics.Error(err), metrics.With(\"dir\", dir))\n\t\treturn pkgFuncs, err\n\t}\n\n\tif len(pkgs) == 0 {\n\t\treturn pkgFuncs, ErrSkipDir\n\t}\n\n\tpkgItem := pkgs[0]\n\tif pkgItem.HasAnnotation(\"@shogunIgnore\") {\n\t\treturn pkgFuncs, ErrSkipDir\n\t}\n\n\tpkgHash, err := generateHash(pkgItem.Files)\n\tif err != nil {\n\t\treturn pkgFuncs, err\n\t}\n\n\tpkgFuncs.Packages[pkgItem.Path] = pkgHash\n\n\tpkgFuncs.Hash = string(pkgHash)\n\n\treturn pkgFuncs, nil\n}", "func (_m *mockImportSteps) CheckSystem(path string) error {\n\tret := _m.Called(path)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(path)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "func (me *TxsdRegistryHandle) Walk() (err error) {\n\tif fn := WalkHandlers.TxsdRegistryHandle; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err = me.XsdGoPkgHasCdata.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}" ]
[ "0.5810912", "0.56941", "0.50123656", "0.49670783", "0.49068767", "0.48901004", "0.4828156", "0.47901693", "0.47355244", "0.4671794", "0.464097", "0.45577005", "0.45487243", "0.45286778", "0.45235217", "0.4497253", "0.4477965", "0.44733608", "0.44454762", "0.4389121", "0.43702537", "0.43065628", "0.4301478", "0.4294681", "0.4288653", "0.42882285", "0.4279885", "0.4274913", "0.4271474", "0.42639238", "0.42564452", "0.4241113", "0.42214283", "0.42110568", "0.4204809", "0.41939336", "0.41787854", "0.41752413", "0.41740638", "0.41739509", "0.41662928", "0.41565531", "0.4151525", "0.41480345", "0.4145837", "0.41419348", "0.41389605", "0.41359848", "0.41348797", "0.41250297", "0.4122285", "0.41200522", "0.41173673", "0.41048092", "0.40977135", "0.4082758", "0.40751946", "0.4049732", "0.40491205", "0.4048756", "0.40306294", "0.4026925", "0.40265596", "0.40253583", "0.4020475", "0.40161318", "0.40130147", "0.4010125", "0.40041667", "0.39903337", "0.3986733", "0.39858678", "0.39617416", "0.3958806", "0.3953306", "0.39509308", "0.39425126", "0.3936494", "0.3930801", "0.39306575", "0.39258578", "0.39231652", "0.39176673", "0.39162955", "0.39102626", "0.3909666", "0.3888491", "0.3880545", "0.38782692", "0.38749632", "0.3872832", "0.3868992", "0.38668987", "0.38656715", "0.3863972", "0.38546827", "0.38532522", "0.38531187", "0.38521013", "0.38438714" ]
0.6932155
0
GetEnv function provides a safe lookup for environment variables
func GetEnv(key string) (string, error) { if len(key) == 0 { return "", errors.New("Env variable name must be provided to getEnv") } val, ok := os.LookupEnv(key) if !ok { return "", fmt.Errorf("Could not find environment variable: %s", key) } return val, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Getenv(key string, fallbacks ...string) (value string) {\n\tvalue, _ = LookupEnv(key, fallbacks...)\n\treturn\n}", "func getEnv(key, fallback string) string {\r\n\tif value, ok := os.LookupEnv(key); ok {\r\n\t\treturn value\r\n\t}\r\n\treturn fallback\r\n}", "func GetEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func GetEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func GetEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func GetEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func GetEnv(key string, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func GetEnv(key string, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func GetEnv(key string, fallback ...string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\n\treturn fallback[0]\n}", "func getEnv(key string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn \"\"\n}", "func getEnv(envVar string, require bool) (val string, ok bool) {\n\tif val, ok = os.LookupEnv(envVar); !ok {\n\t\tif require {\n\t\t\tpanic(fmt.Sprintf(\"env: missing required environment variable: %s\", envVar))\n\t\t}\n\t}\n\n\treturn\n}", "func getEnv(key string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\tpanic(fmt.Errorf(\"Env Variable is not defined %v\", key))\n}", "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func getEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func GetEnv(k, def string) string {\n\tv, found := os.LookupEnv(k)\n\tif !found {\n\t\tv = def\n\t}\n\treturn v\n}", "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "func getEnv(key string, defaultVal string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\n\treturn defaultVal\n}", "func GetEnv(key string, fallback string) string {\n\tvalue, ok := os.LookupEnv(key)\n\tif !ok {\n\t\treturn fallback\n\t}\n\n\treturn value\n}", "func GetEnv(params ...string) string {\n\tvalue := os.Getenv(params[0])\n\tif value == \"\" && len(params) == 2 {\n\t\treturn params[1]\n\t}\n\treturn value\n}", "func getEnv(key string) string {\r\n\tvalue, exists := os.LookupEnv(key)\r\n\tif !exists {\r\n\t\tvalue = readInput(key)\r\n\t}\r\n\treturn value\r\n}", "func getEnv(key string, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\tif value != \"\" {\n\t\t\treturn value\n\t\t}\n\t}\n\treturn fallback\n}", "func getEnv(key, fallback string) string {\n\tvalue, exists := os.LookupEnv(key)\n\tif !exists {\n\t\tvalue = fallback\n\t}\n\treturn value\n}", "func Getenv(key string, def ...string) string {\n\tfsys := datafs.WrapWdFS(osfs.NewFS())\n\treturn getenvVFS(fsys, key, def...)\n}", "func GetEnv(key string, fallback string) string {\n\tvar result = os.Getenv(key)\n\n\tif result == \"\" {\n\t\tresult = fallback\n\t}\n\n\treturn result\n}", "func getEnv(env, fallback string) string {\n\tif value, ok := os.LookupEnv(env); ok {\n\t\treturn value\n\t}\n\treturn fallback\n}", "func GetEnv(key string, fallback string) string {\n\tvalue := os.Getenv(key)\n\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\n\treturn value\n}", "func (lkp OsEnvVariableLookuper) GetEnv(envVarName string) string {\n\tif TestingEnvVariableLookup != nil {\n\t\treturn TestingEnvVariableLookup.GetEnv(envVarName)\n\t}\n\n\treturn GetEnv(envVarName)\n}", "func GetEnv(key string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t}\n\tpanic(\"Missing env var: \" + key)\n}", "func GetEnv(key string, fallback string) string {\n\tenv := os.Getenv(key)\n\n\tif len(env) == 0 {\n\t\tenv = fallback\n\t}\n\n\treturn env\n}", "func Getenv(key, fallback string) string {\n\tv := os.Getenv(key)\n\tif len(v) == 0 {\n\t\tos.Setenv(key, fallback)\n\t\treturn os.Getenv(key)\n\t}\n\treturn v\n}", "func getEnv(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\n\treturn value\n}", "func getEnv(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\n\treturn value\n}", "func getEnv(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\n\treturn value\n}", "func getEnv(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\n\treturn value\n}", "func Getenv(key string, d ...string) string {\n\tv := os.Getenv(key)\n\tif v != \"\" {\n\t\treturn v\n\t}\n\tif len(d) != 0 {\n\t\treturn d[0]\n\t}\n\treturn \"\"\n}", "func GetEnv(variable string, fallback string) string {\r\n\tgodotenv.Load()\r\n\tresponse := os.Getenv(variable)\r\n\tif response != \"\" {\r\n\t\treturn response\r\n\t}\r\n\treturn fallback\r\n}", "func GetEnv(key string, defaultVal string) string {\n\tif envVal, ok := os.LookupEnv(key); ok {\n\t\treturn envVal\n\t}\n\treturn defaultVal\n}", "func Getenv(keys string) string {\n\tif os.Getenv(keys) == \"\" {\n\t\treturn \"\"\n\t}\n\treturn os.Getenv(keys)\n}", "func GetEnv(name, fallback string) string {\n\tenv, ok := os.LookupEnv(name)\n\tif !ok {\n\t\tenv = fallback\n\t}\n\n\treturn env\n}", "func Getenv(key string) string", "func GetEnv(name string, defaultValue string) string {\n\tif strVal, ok := os.LookupEnv(name); ok && len(strVal) > 0 {\n\t\treturn strVal\n\t}\n\n\treturn defaultValue\n}", "func GetEnv(name string, def ...string) string {\n\tval := os.Getenv(name)\n\tif val == \"\" && len(def) > 0 {\n\t\tval = def[0]\n\t}\n\treturn val\n}", "func Getenv(name string, def ...string) string {\n\tval := os.Getenv(name)\n\tif val == \"\" && len(def) > 0 {\n\t\tval = def[0]\n\t}\n\n\treturn val\n}", "func Getenv(key string) string {\n\treturn c.Getenv(key)\n}", "func getEnv(key, defaultVal string) string {\n\tval := os.Getenv(key)\n\tif val != \"\" {\n\t\treturn val\n\t}\n\treturn defaultVal\n}", "func GetEnv(key string, dfault string, combineWith ...string) string {\n\tvalue := os.Getenv(key)\n\tif value == \"\" {\n\t\tvalue = dfault\n\t}\n\n\tswitch len(combineWith) {\n\tcase 0:\n\t\treturn value\n\tcase 1:\n\t\treturn filepath.Join(value, combineWith[0])\n\tdefault:\n\t\tall := make([]string, len(combineWith)+1)\n\t\tall[0] = value\n\t\tcopy(all[1:], combineWith)\n\t\treturn filepath.Join(all...)\n\t}\n}", "func GetEnv(key string, dfault string, combineWith ...string) string {\n\tvalue := os.Getenv(key)\n\tif value == \"\" {\n\t\tvalue = dfault\n\t}\n\n\tswitch len(combineWith) {\n\tcase 0:\n\t\treturn value\n\tcase 1:\n\t\treturn filepath.Join(value, combineWith[0])\n\tdefault:\n\t\tall := make([]string, len(combineWith)+1)\n\t\tall[0] = value\n\t\tcopy(all[1:], combineWith)\n\t\treturn filepath.Join(all...)\n\t}\n}", "func getEnv(env string) string {\n\tvalue := os.Getenv(env)\n\tif len(value) == 0 {\n\t\tlog.Printf(\"Environment variable %s not found!\", env)\n\t}\n\treturn value\n}", "func GetEnv(key, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\treturn value\n\t} else if value, ok := os.LookupEnv(key + \"_FILE\"); ok {\n\t\tdat, err := ioutil.ReadFile(filepath.Clean(value))\n\t\tif err == nil {\n\t\t\treturn string(dat)\n\t\t}\n\t}\n\treturn fallback\n}", "func GetEnv(key string) string {\n\treturn envHash[key]\n}", "func Getenv(dst interface{}, key string) error {\n\treturn DefaultReader.Getenv(dst, key)\n}", "func getEnv(env, value string) string {\n\tif v := os.Getenv(env); v != \"\" {\n\t\treturn v\n\t}\n\n\treturn value\n}", "func getEnv(env, devaultValue string) string {\n\tvalue := os.Getenv(env)\n\tif value == \"\" {\n\t\treturn devaultValue\n\t}\n\treturn value\n}", "func getEnv(env, devaultValue string) string {\n\tvalue := os.Getenv(env)\n\tif value == \"\" {\n\t\treturn devaultValue\n\t}\n\treturn value\n}", "func (s *Scope) GetEnv(key string) (string, bool) {\n\treturn os.LookupEnv(key)\n}", "func (s *Scope) GetEnv(key string) (string, bool) {\n\treturn os.LookupEnv(key)\n}", "func (c *Config) Getenv(key string) string {\n\treturn os.ExpandEnv(c.GetString(key))\n}", "func Getenv(key, defaultValue string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn defaultValue\n\t}\n\treturn value\n}", "func GetENV(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\treturn value\n}", "func GetEnv(key, defaultValue string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn defaultValue\n\t}\n\treturn value\n}", "func GetEnv(key, defaultValue string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn defaultValue\n\t}\n\treturn value\n}", "func GetEnv(key string) (value string) {\n\tvalue = os.Getenv(key)\n\tif value == \"\" {\n\t\tlogFatalf(\"$%s must be set. See config.\", key)\n\t}\n\treturn\n}", "func getEnv(envKey ENVKey) string {\n\treturn strings.TrimSpace(os.Getenv(string(envKey)))\n}", "func Getenv(env []string, key string) string {\n\tif len(key) == 0 {\n\t\treturn \"\"\n\t}\n\n\tprefix := strings.ToLower(key + \"=\")\n\tfor _, pair := range env {\n\t\tif len(pair) > len(prefix) && prefix == strings.ToLower(pair[:len(prefix)]) {\n\t\t\treturn pair[len(prefix):]\n\t\t}\n\t}\n\treturn \"\"\n}", "func GetEnv(key string) string {\n\t// load .env file\n\terr := godotenv.Load(\".env\")\n\tCheckErr(err)\n\treturn os.Getenv(key)\n}", "func (e *OverlayEnv) Getenv(key string) string {\n\t// do we have a variable backing store to work with?\n\tif e == nil {\n\t\treturn \"\"\n\t}\n\n\t// search for this variable\n\tfor _, env := range e.envs {\n\t\tvalue, ok := env.LookupEnv(key)\n\t\tif ok {\n\t\t\treturn value\n\t\t}\n\t}\n\n\t// if we get here, then it doesn't exist\n\treturn \"\"\n}", "func (e *ProgramEnv) Getenv(key string) string {\n\treturn os.Getenv(key)\n}", "func Getenv(key string, defaultValue string) string {\n\tvalue := os.Getenv(key)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func GetEnv(key, defaultValue string) string {\n\tvalue := os.Getenv(key)\n\tif value != \"\" {\n\t\treturn value\n\t}\n\n\treturn defaultValue\n}", "func GetEnv(name string) string {\n\treturn os.Getenv(name)\n}", "func getEnv(depotTools string) []string {\n\treturn []string{\n\t\tfmt.Sprintf(\"PATH=%s:%s\", depotTools, os.Getenv(\"PATH\")),\n\t\tfmt.Sprintf(\"HOME=%s\", os.Getenv(\"HOME\")),\n\t}\n}", "func (context *Context) GetEnv(target string) (string, bool) {\n\tv, ok := context.Env.Get(target)\n\tif !ok {\n\t\treturn context.Global.GEnv.Get(target)\n\t}\n\treturn v, ok\n}", "func GetEnv(key string, defaultValue string) string {\n\tv := os.Getenv(key)\n\tif v == \"\" {\n\t\treturn defaultValue\n\t}\n\treturn v\n}", "func getRequiredEnv(key string) string {\n\tvalue, exists := os.LookupEnv(key)\n\tif !exists {\n\t\tlogrus.Fatalf(\"Environment variable not set: %s\", key)\n\t}\n\treturn value\n}", "func getEnv(name, def string) (value string) {\n\tif value = os.Getenv(name); value == \"\" {\n\t\tvalue = def\n\t}\n\treturn\n}", "func GetEnv(en []map[string]string, key string) string {\n\ts := \"\"\n\tfor _, e := range en {\n\t\tif v, ok := e[key]; ok {\n\t\t\ts = v\n\t\t}\n\t}\n\treturn s\n}", "func GetENV(key string) (string, bool) {\n\treturn os.LookupEnv(fmt.Sprintf(\"%s_%s\", EnvPrefix, strings.ToUpper(key)))\n}", "func getEnvString(key string, defaultVal string) string {\n if value, exists := os.LookupEnv(key); exists {\n\t return value\n }\n\n return defaultVal\n}", "func GetEnvStr(key, def string) string {\n\tif value := os.Getenv(key); value != \"\" {\n\t\treturn value\n\t}\n\treturn def\n}", "func getEnv(env, defaultValue string) string {\n\tval := os.Getenv(env)\n\tif val == \"\" {\n\t\tval = defaultValue\n\t}\n\treturn val\n}", "func GetEnv(w http.ResponseWriter, r *http.Request, status int) error {\n\tvar env string\n\tvname, ok := r.URL.Query()[\"vname\"]\n\tif ok && len(vname) > 0 {\n\t\tenv = os.Getenv(vname[0])\n\t}\n\n\tw.Header().Add(\"Content-Type\", \"text/plain\")\n\tw.WriteHeader(status)\n\tw.Write([]byte(env))\n\n\treturn nil\n}", "func Get(envKey, defaultVal string) string {\n\t// Check for an environment variable\n\tenvVal, envPresent := os.LookupEnv(envKey)\n\tif envPresent && envVal != \"\" {\n\t\treturn envVal\n\t}\n\t// Check the loaded vars\n\tif val, ok := envVars[envKey]; ok && val != \"\" {\n\t\treturn val\n\t}\n\treturn defaultVal\n}", "func LookUpEnv(key string) string {\n\tif val, ok := os.LookupEnv(key); ok {\n\t\treturn val\n\t}\n\n\treturn \"\"\n}", "func getenv(key string, def ...string) string {\n\tif v, ok := os.LookupEnv(key); ok {\n\t\treturn v\n\t}\n\tif len(def) == 0 {\n\t\tlog.Fatalf(\"%s not defined in environment\", key)\n\t}\n\treturn def[0]\n}", "func (helpers *Helpers) GetEnv() string {\n\tenv := os.Getenv(constants.EnvVariableName)\n\n\tif len(env) == 0 {\n\t\tenv = constants.ProductionEnv\n\t}\n\n\treturn env\n}", "func Getenv(key string) (string, error) {\n\tfor _, b := range []byte(key) {\n\t\tif b == '(' || b == ')' || b == '_' ||\n\t\t\t'0' <= b && b <= '9' ||\n\t\t\t'a' <= b && b <= 'z' ||\n\t\t\t'A' <= b && b <= 'Z' {\n\t\t\tcontinue\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"wine: invalid character %q in variable name\", b)\n\t}\n\n\tserver.wg.Wait()\n\tout, err := exec.Command(\"wine\", \"cmd\", \"/c\", \"if defined\", key, \"echo\", \"%\"+key+\"%\").Output()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(bytes.TrimSuffix(out, []byte(\"\\r\\n\"))), nil\n}", "func getEnv(envPrefix, flagName string) string {\n\t// If we haven't set an EnvPrefix, don't lookup vals in the ENV\n\tif envPrefix == \"\" {\n\t\treturn \"\"\n\t}\n\tif !strings.HasSuffix(envPrefix, \"_\") {\n\t\tenvPrefix += \"_\"\n\t}\n\tflagName = strings.Replace(flagName, \".\", \"_\", -1)\n\tflagName = strings.Replace(flagName, \"-\", \"_\", -1)\n\tenvKey := strings.ToUpper(envPrefix + flagName)\n\treturn os.Getenv(envKey)\n}", "func (c *Client) EnvGet(ctx context.Context) (map[string]string, error) {\n\tvar resp EnvGetResponse\n\tif err := c.client.Do(ctx, \"GET\", envURL, nil, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.Env, nil\n}", "func LookupEnv(key string) (string, bool)", "func requireEnv(envVar string) string {\n\tval, _ := getEnv(envVar, true)\n\treturn val\n}", "func GetenvString(key, fallback string) string {\n\tif v, ok := syscall.Getenv(key); ok {\n\t\treturn v\n\t}\n\treturn fallback\n}", "func mustGetEnv(name string) string {\n\tenv, ok := os.LookupEnv(name)\n\tif !ok {\n\t\tlog.WithField(\"env\", name).Fatalf(\"missing required environment variable for configuration\")\n\t}\n\tlog.WithField(name, env).Info(\"using env variable\")\n\treturn env\n}" ]
[ "0.82368356", "0.8094579", "0.8079793", "0.8079793", "0.8079793", "0.8079793", "0.80576396", "0.80576396", "0.80386716", "0.8027734", "0.80172455", "0.80171585", "0.801612", "0.801612", "0.801612", "0.801612", "0.801612", "0.801612", "0.801612", "0.801612", "0.801612", "0.8010784", "0.8008962", "0.8008962", "0.8008962", "0.8000743", "0.7956747", "0.79537016", "0.79397786", "0.7933565", "0.7925756", "0.79053205", "0.7903891", "0.78910357", "0.78561556", "0.78330284", "0.7830116", "0.782738", "0.7823572", "0.7823572", "0.7823572", "0.7823572", "0.7818707", "0.77786416", "0.77675295", "0.77573633", "0.77489674", "0.77349305", "0.7732318", "0.7707575", "0.77068985", "0.7672851", "0.76688725", "0.76587045", "0.76587045", "0.7651832", "0.7637662", "0.76301765", "0.7625134", "0.7579221", "0.7567926", "0.7567926", "0.7548095", "0.7548095", "0.752773", "0.7525973", "0.75164765", "0.75044996", "0.75044996", "0.75017285", "0.74996537", "0.7499588", "0.74982387", "0.7491992", "0.7479152", "0.7471239", "0.7461957", "0.74580634", "0.74302554", "0.74135923", "0.741312", "0.73980004", "0.73967695", "0.73771816", "0.7355902", "0.73518234", "0.7345607", "0.73391", "0.7320877", "0.73107415", "0.7310597", "0.73013663", "0.72905344", "0.72645205", "0.72631586", "0.7253555", "0.7252111", "0.7251598", "0.72372854", "0.7236234" ]
0.7273841
93
CreateFeedBadRequest runs the method Create of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} if tags != nil { sliceVal := []string{*tags} query["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} query["title"] = sliceVal } { sliceVal := []string{url_} query["url"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds"), RawQuery: query.Encode(), } req, err := http.NewRequest("POST", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} if tags != nil { sliceVal := []string{*tags} prms["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} prms["title"] = sliceVal } { sliceVal := []string{url_} prms["url"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) createCtx, _err := app.NewCreateFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } return nil, e } // Perform action _err = ctrl.Create(createCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 400 { t.Errorf("invalid response status code: got %+v, expected 400", rw.Code) } var mt error if resp != nil { var _ok bool mt, _ok = resp.(error) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of error", resp, resp) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewCreateFeedBadRequest() *CreateFeedBadRequest {\n\treturn &CreateFeedBadRequest{}\n}", "func CreateBadRequestResponse(w http.ResponseWriter, err error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tbytes, _ := json.Marshal(err.Error())\n\tw.Write(bytes)\n}", "func CreateTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, body string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateFeedCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateBadRequest(errorMessage string) BadRequest {\n\treturn BadRequest{Error: errorMessage}\n}", "func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func DeleteFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateContainerBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, command []string, entrypoint []string, env []string, image string, name string, sslRedirect bool, volumes []string, workingDir *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := command\n\t\tquery[\"command\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := entrypoint\n\t\tquery[\"entrypoint\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := env\n\t\tquery[\"env\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{image}\n\t\tquery[\"image\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{name}\n\t\tquery[\"name\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", sslRedirect)}\n\t\tquery[\"sslRedirect\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := volumes\n\t\tquery[\"volumes\"] = sliceVal\n\t}\n\tif workingDir != nil {\n\t\tsliceVal := []string{*workingDir}\n\t\tquery[\"workingDir\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/create\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := command\n\t\tprms[\"command\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := entrypoint\n\t\tprms[\"entrypoint\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := env\n\t\tprms[\"env\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{image}\n\t\tprms[\"image\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{name}\n\t\tprms[\"name\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", sslRedirect)}\n\t\tprms[\"sslRedirect\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := volumes\n\t\tprms[\"volumes\"] = sliceVal\n\t}\n\tif workingDir != nil {\n\t\tsliceVal := []string{*workingDir}\n\t\tprms[\"workingDir\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewCreateServiceBadRequest() *CreateServiceBadRequest {\n\treturn &CreateServiceBadRequest{}\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewServiceCreateBadRequest() *ServiceCreateBadRequest {\n\treturn &ServiceCreateBadRequest{}\n}", "func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *CreateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewCreateCategoryBadRequest() *CreateCategoryBadRequest {\n\treturn &CreateCategoryBadRequest{}\n}", "func NewCreateBadRequestResponseBody(res *goa.ServiceError) *CreateBadRequestResponseBody {\n\tbody := &CreateBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func RenderBadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\treturn\n}", "func CreateFeedCreatedTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func RenderBadRequest(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, BadRequest(message...))\n}", "func CreateFeedCreatedLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *CreateDogContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func (ctx *StopFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *StartFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *GetFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewCreateFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*CreateFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := CreateFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamTags := req.Params[\"tags\"]\n\tif len(paramTags) > 0 {\n\t\trawTags := paramTags[0]\n\t\trctx.Tags = &rawTags\n\t}\n\tparamTitle := req.Params[\"title\"]\n\tif len(paramTitle) > 0 {\n\t\trawTitle := paramTitle[0]\n\t\trctx.Title = &rawTitle\n\t}\n\tparamURL := req.Params[\"url\"]\n\tif len(paramURL) == 0 {\n\t\terr = goa.MergeErrors(err, goa.MissingParamError(\"url\"))\n\t} else {\n\t\trawURL := paramURL[0]\n\t\trctx.URL = rawURL\n\t\tif err2 := goa.ValidateFormat(goa.FormatURI, rctx.URL); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidFormatError(`url`, rctx.URL, goa.FormatURI, err2))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func RunBadRequest(response http.ResponseWriter, request *http.Request, container interface{}) {\n\terrorController := BadRequest{}\n\terrorController.Init(container, []string{}, request)\n\terrorController.Run(response, request)\n}", "func NewCreateDocumentBadRequest() *CreateDocumentBadRequest {\n\n\treturn &CreateDocumentBadRequest{}\n}", "func NewCreateBadRequest() *CreateBadRequest {\n\n\treturn &CreateBadRequest{}\n}", "func NewCreateFnBadRequest() *CreateFnBadRequest {\n\treturn &CreateFnBadRequest{}\n}", "func NewCreateBadRequest(body *CreateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func (ctx *CreateOutputContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewCreateRuleSetBadRequest() *CreateRuleSetBadRequest {\n\treturn &CreateRuleSetBadRequest{}\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *CreateFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (c *globalThreatFeeds) Create(ctx context.Context, globalThreatFeed *v3.GlobalThreatFeed, opts v1.CreateOptions) (result *v3.GlobalThreatFeed, err error) {\n\tresult = &v3.GlobalThreatFeed{}\n\terr = c.client.Post().\n\t\tResource(\"globalthreatfeeds\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(globalThreatFeed).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func NewCreateMTOServiceItemBadRequest() *CreateMTOServiceItemBadRequest {\n\treturn &CreateMTOServiceItemBadRequest{}\n}", "func (ctx *CreateFeedContext) Created(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func BadRequest(message string, w http.ResponseWriter) {\n\tbody := createBodyWithMessage(message)\n\twriteResponse(400, body, w)\n}", "func NewBadRequest(field string, message string, args ...interface{}) *AppError {\n\treturn NewError(InvalidArgument, field, message, args...)\n}", "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewCreateChannelBadRequest() *CreateChannelBadRequest {\n\treturn &CreateChannelBadRequest{}\n}", "func NewCreateThemeBadRequest() *CreateThemeBadRequest {\n\treturn &CreateThemeBadRequest{}\n}", "func (ctx *CreateHostContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func (ctx *DeleteFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (o *V1CreateHelloBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func CreateQuizzesBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.QuizzesController, payload *app.QuizPayload) (http.ResponseWriter, *app.StandardError) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Validate payload\n\terr := payload.Validate()\n\tif err != nil {\n\t\te, ok := err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(err) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected payload validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/quizzes\"),\n\t}\n\treq, _err := http.NewRequest(\"POST\", u.String(), nil)\n\tif _err != nil {\n\t\tpanic(\"invalid test \" + _err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"QuizzesTest\"), rw, req, prms)\n\tcreateCtx, __err := app.NewCreateQuizzesContext(goaCtx, req, service)\n\tif __err != nil {\n\t\t_e, _ok := __err.(goa.ServiceError)\n\t\tif !_ok {\n\t\t\tpanic(\"invalid test data \" + __err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", _e)\n\t\treturn nil, nil\n\t}\n\tcreateCtx.Payload = payload\n\n\t// Perform action\n\t__err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif __err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", __err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt *app.StandardError\n\tif resp != nil {\n\t\tvar __ok bool\n\t\tmt, __ok = resp.(*app.StandardError)\n\t\tif !__ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.StandardError\", resp, resp)\n\t\t}\n\t\t__err = mt.Validate()\n\t\tif __err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", __err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ServeBadRequest(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Bad Request\", http.StatusBadRequest)\n}", "func (c *SeaterController) TraceBadRequestf(err error, format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tc.traceJSONAbort(nil, 400, msg)\n}", "func ShowTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func BadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(\"400 - Bad Request\"))\n}", "func (ctx *ListFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (o *PutProjectProjectNameStageStageNameServiceServiceNameResourceBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func NewCreateProgramBadRequest() *CreateProgramBadRequest {\n\n\treturn &CreateProgramBadRequest{}\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (o *ServiceAddBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func BadRequest(format string, args ...interface{}) error {\n\treturn New(http.StatusBadRequest, format, args...)\n}", "func NewCreateFlowBadRequest() *CreateFlowBadRequest {\n\treturn &CreateFlowBadRequest{}\n}", "func New(ctx *sweetygo.Context) error {\n\ttitle := ctx.Param(\"title\")\n\tcat := ctx.Param(\"cat\")\n\thtml := ctx.Param(\"html\")\n\tmd := ctx.Param(\"md\")\n\tif title != \"\" && cat != \"\" && html != \"\" && md != \"\" {\n\t\terr := model.NewPost(title, cat, html, md)\n\t\tif err != nil {\n\t\t\treturn ctx.JSON(500, 0, \"create post error\", nil)\n\t\t}\n\t\treturn ctx.JSON(201, 1, \"success\", nil)\n\t}\n\treturn ctx.JSON(406, 0, \"I can't understand what u want\", nil)\n}", "func (o *ClientPermissionCreateBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *ServiceInstanceLastOperationGetBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func ListTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *CreateItemContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func CreateLogEndPoint(w http.ResponseWriter, r *http.Request) {\n\tenableCors(&w)\n\tdefer r.Body.Close()\n\tvar log model.LogMessage\n\tif err := json.NewDecoder(r.Body).Decode(&log); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Payload inválido\")\n\t\treturn\n\t}\n\tif len(log.DescricaoErro) > 400 {\n\t\tlog.DescricaoErro = string(log.DescricaoErro[0:400])\n\t}\n\tif len(log.ConteudoMensagemErro) > 10000000 {\n\t\tlog.ConteudoMensagemErro = string(log.ConteudoMensagemErro[0:10000000])\n\t}\n\tif err := logDAO.Insert(log); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\trespondWithJSON(w, http.StatusCreated, log)\n}", "func ErrBadRequestf(format string, arguments ...interface{}) *Status {\n\treturn &Status{Code: http.StatusBadRequest, Text: fmt.Sprintf(format, arguments...)}\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *CreateMessageContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (t *RestController) Create(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RestController\", \"Create\")\n\n\t{\n\t\terr := r.ParseForm()\n\n\t\tif err != nil {\n\n\t\t\tt.Log.Handle(w, r, err, \"parseform\", \"error\", \"RestController\", \"Create\")\n\t\t\tt.embed.Finalizer(w, r, err)\n\n\t\t\treturn\n\t\t}\n\n\t}\n\tvar postColor *string\n\tif _, ok := r.Form[\"color\"]; ok {\n\t\txxTmppostColor := r.FormValue(\"color\")\n\t\tt.Log.Handle(w, r, nil, \"input\", \"form\", \"color\", xxTmppostColor, \"RestController\", \"Create\")\n\t\tpostColor = &xxTmppostColor\n\t}\n\n\tjsonResBody, err := t.embed.Create(postColor)\n\n\tif err != nil {\n\n\t\tt.Log.Handle(w, r, err, \"business\", \"error\", \"RestController\", \"Create\")\n\t\tt.embed.Finalizer(w, r, err)\n\n\t\treturn\n\t}\n\n\t{\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(200)\n\t\tencErr := json.NewEncoder(w).Encode(jsonResBody)\n\n\t\tif encErr != nil {\n\n\t\t\tt.Log.Handle(w, r, encErr, \"res\", \"json\", \"encode\", \"error\", \"RestController\", \"Create\")\n\t\t\tt.embed.Finalizer(w, r, encErr)\n\n\t\t\treturn\n\t\t}\n\n\t}\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RestController\", \"Create\")\n\n}", "func (ctx *CreateCommentContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewBadRequest(err error, msg ...string) *Errs {\n\tif err == nil {\n\t\terr = ErrBadRequest\n\t}\n\n\treturn &Errs{\n\t\tcodeHTTP: http.StatusBadRequest,\n\t\terr: err,\n\t\tkind: trace(2),\n\t\tmessage: msg,\n\t}\n}", "func (ctx *UpdateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func SendBadRequest(w http.ResponseWriter, opts ...ErrorOpts) {\n\tres := errorResponse{\n\t\tCode: CodeBadRequest,\n\t\tMessage: \"Bad request\",\n\t}\n\tres.apply(opts)\n\tSendJSON(w, 400, &res)\n}", "func (o *GetTaskTaskIDBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *GetTeamsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (c MoviesController) CreateMovieEndPoint(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvar movie Movie\n\tif err := json.NewDecoder(r.Body).Decode(&movie); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\tid, err := c.moviesService.InsertMovie(movie)\n\tif err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tlog.Printf(\"film creato con id: %#+v\\n\", id)\n\tmovie, _ = c.moviesService.GetMovieById(id)\n\trespondWithJson(w, http.StatusCreated, movie)\n}", "func BadRequest(w http.ResponseWriter, text string, err error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(text))\n\tfmt.Println(text, \", Bad request with error:\", err)\n}", "func NewCreateInputPortBadRequest() *CreateInputPortBadRequest {\n\treturn &CreateInputPortBadRequest{}\n}", "func (ctx *CreateProfileContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *GetFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (_obj *DataService) CreateApplyWithContext(tarsCtx context.Context, wx_id string, club_id string, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"createApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func NewCreateSpoeBadRequest() *CreateSpoeBadRequest {\n\n\treturn &CreateSpoeBadRequest{}\n}", "func BadRequest(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"400 Bad Request\")\n\t}\n\treturn Response{\n\t\tStatus: http.StatusBadRequest,\n\t\tData: data,\n\t\tLogging: logging,\n\t}\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, err *Error) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusBadRequest]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tr = ctxSetErr(r, err)\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultBadRequest(w, r, err)\n\t}\n}", "func NewPostGocardlessBadRequest() *PostGocardlessBadRequest {\n\treturn &PostGocardlessBadRequest{}\n}", "func (o *CreateUserBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func BadRequest(w http.ResponseWriter, err error) {\n\tError(w, http.StatusBadRequest, err)\n}", "func (ctx *CreateSecretsContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\th.RenderHTMLStatus(w, http.StatusBadRequest, \"400\", nil)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusBadRequest, apiErrorBadRequest)\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t}\n}", "func (o *GetDocumentBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func NewCreateUserBadRequest() *CreateUserBadRequest {\n\n\treturn &CreateUserBadRequest{}\n}", "func NewCreateUserBadRequest() *CreateUserBadRequest {\n\n\treturn &CreateUserBadRequest{}\n}", "func (r *Responder) BadRequest() { r.write(http.StatusBadRequest) }", "func NewPostFeedbacksBadRequest() *PostFeedbacksBadRequest {\n\treturn &PostFeedbacksBadRequest{}\n}", "func TestHandleFunc_POST_BadRequest(t *testing.T) {\n\t//arrange\n\tw := httptest.NewRecorder()\n\treq := postArrange(\"\", \"\", \"[email protected]\", \"\")\n\n\t//act\n\thandleFunc(w, req)\n\n\t//assert\n\tif w.Code != http.StatusBadRequest {\n\t\tt.Fail()\n\t\tt.Logf(\"Expected status code to be 400\")\n\t}\n\n\t//cleanup\n\tioutil.WriteFile(dataFile, []byte(\"[]\"), os.ModeAppend)\n}", "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func RespondBadRequest(err error) events.APIGatewayProxyResponse {\n\treturn Respond(http.StatusBadRequest, Error{Error: err.Error()})\n}", "func (o *GetIndexSearchBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}" ]
[ "0.61698353", "0.6043954", "0.5685576", "0.56453574", "0.5577991", "0.55441993", "0.55191666", "0.5417865", "0.5401191", "0.5340334", "0.52940905", "0.52692384", "0.523116", "0.5220215", "0.5218243", "0.52164644", "0.50912166", "0.5073511", "0.501365", "0.49884433", "0.49616933", "0.49054682", "0.483421", "0.4823177", "0.48227063", "0.47793752", "0.4758229", "0.4746814", "0.47460732", "0.47350013", "0.47266635", "0.4716122", "0.47140515", "0.47048762", "0.4701836", "0.46878347", "0.4679245", "0.46518853", "0.4645572", "0.46436346", "0.4639309", "0.46384475", "0.46283644", "0.45975617", "0.45896918", "0.45733133", "0.45559922", "0.45530418", "0.4545805", "0.4543837", "0.45418873", "0.4538667", "0.4526901", "0.45267564", "0.4504601", "0.44895437", "0.44888628", "0.44693488", "0.4464748", "0.4458815", "0.44521302", "0.44479465", "0.4447462", "0.44408363", "0.44307676", "0.4428021", "0.44240066", "0.44197083", "0.4418718", "0.44084635", "0.4407466", "0.44014403", "0.4401362", "0.43974712", "0.43918824", "0.43855423", "0.43822172", "0.4368438", "0.43682894", "0.4351039", "0.4344868", "0.43427834", "0.43387994", "0.43315145", "0.4329818", "0.4324626", "0.43245286", "0.43191358", "0.43074504", "0.43043146", "0.4300786", "0.42998043", "0.42996025", "0.42996025", "0.42993557", "0.42949465", "0.42931542", "0.4286474", "0.42830268", "0.4279122" ]
0.7400036
0
CreateFeedCreated runs the method Create of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func CreateFeedCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.Feed) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} if tags != nil { sliceVal := []string{*tags} query["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} query["title"] = sliceVal } { sliceVal := []string{url_} query["url"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds"), RawQuery: query.Encode(), } req, err := http.NewRequest("POST", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} if tags != nil { sliceVal := []string{*tags} prms["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} prms["title"] = sliceVal } { sliceVal := []string{url_} prms["url"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) createCtx, _err := app.NewCreateFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.Create(createCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 201 { t.Errorf("invalid response status code: got %+v, expected 201", rw.Code) } var mt *app.Feed if resp != nil { var _ok bool mt, _ok = resp.(*app.Feed) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.Feed", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *CreateFeedContext) Created(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func CreateFeedCreatedLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateFeedCreatedTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func Created(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": false, \"msg\": \"`+msg+`\"}`, 201, service, \"application/json\")\n\treturn nil\n}", "func CreateTodosCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, body string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *CreateDogContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func Created(w http.ResponseWriter, data interface{}) {\n\tsuccessResponse := BuildSuccess(data, \"Created\", MetaInfo{HTTPStatus: http.StatusCreated})\n\tWrite(w, successResponse, http.StatusCreated)\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *CreateMessageContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func Created(ctx *fiber.Ctx, msg string, data interface{}) error {\n\treturn Success(ctx, msg, data, http.StatusCreated)\n}", "func CreateCreatedResponse(w http.ResponseWriter, data interface{}) {\n\tif data != nil {\n\t\tbytes, err := json.Marshal(data)\n\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tw.Write(bytes)\n\t}\n}", "func (ctx *CreateCommentContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (ctx *CreateCommentContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (ctx *CreateSecretsContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func NewCreateFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*CreateFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := CreateFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamTags := req.Params[\"tags\"]\n\tif len(paramTags) > 0 {\n\t\trawTags := paramTags[0]\n\t\trctx.Tags = &rawTags\n\t}\n\tparamTitle := req.Params[\"title\"]\n\tif len(paramTitle) > 0 {\n\t\trawTitle := paramTitle[0]\n\t\trctx.Title = &rawTitle\n\t}\n\tparamURL := req.Params[\"url\"]\n\tif len(paramURL) == 0 {\n\t\terr = goa.MergeErrors(err, goa.MissingParamError(\"url\"))\n\t} else {\n\t\trawURL := paramURL[0]\n\t\trctx.URL = rawURL\n\t\tif err2 := goa.ValidateFormat(goa.FormatURI, rctx.URL); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidFormatError(`url`, rctx.URL, goa.FormatURI, err2))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func (ctx *CreateOutputContext) Created(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func (ctx *CreateFilterContext) Created(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func (ctx *CreateProfileContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (a *CampaignsApiService) CreateChannel(ctx _context.Context) ApiCreateChannelRequest {\n\treturn ApiCreateChannelRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (c *TrackerController) Create(ctx *app.CreateTrackerContext) error {\n\tresult := application.Transactional(c.db, func(appl application.Application) error {\n\t\tt, err := appl.Trackers().Create(ctx.Context, ctx.Payload.URL, ctx.Payload.Type)\n\t\tif err != nil {\n\t\t\tswitch err := err.(type) {\n\t\t\tcase remoteworkitem.BadParameterError, remoteworkitem.ConversionError:\n\t\t\t\treturn goa.ErrBadRequest(err.Error())\n\t\t\tdefault:\n\t\t\t\treturn goa.ErrInternal(err.Error())\n\t\t\t}\n\t\t}\n\t\tctx.ResponseData.Header().Set(\"Location\", app.TrackerHref(t.ID))\n\t\treturn ctx.Created(t)\n\t})\n\tc.scheduler.ScheduleAllQueries()\n\treturn result\n}", "func (c *Controller) Create(w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\ttoken := r.FormValue(\"token\")\n\tmaxPlayers := r.FormValue(\"maxPlayers\")\n\tname := r.FormValue(\"name\")\n\tservice, err := createDSTService(token, maxPlayers, name)\n\tif c.CheckError(err, http.StatusBadRequest, w) {\n\t\treturn\n\t}\n\tc.SendJSON(\n\t\tw,\n\t\tr,\n\t\tservice,\n\t\thttp.StatusOK,\n\t)\n}", "func (ctx *CreateHostContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (ctx *CreateItemContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func PostCreateEndpoint(creator creating.Service) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tvar post model.Post\n\t\terr := json.NewDecoder(r.Body).Decode(&post)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error decoding request body: %v: %s\", r, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tcreated, err := creator.PostCreate(post)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error creating post:\", post, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tjson.NewEncoder(w).Encode(created)\n\t}\n}", "func (ctx *ShowSecretsContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func Created(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"201 Created\")\n\t}\n\treturn Response{Status: http.StatusCreated, Data: data, Logging: logging}\n}", "func (ctx *CreateFeedContext) CreatedTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func (ctx *CreateOfferContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (r *Responder) Created() { r.write(http.StatusCreated) }", "func PostsCreateHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Posts create\")\n}", "func Created() Response {\n\treturn Response{\n\t\tStatusCode: http.StatusCreated,\n\t}\n}", "func Create(objectName string, payload interface{}) *Writer {\n\treturn &Writer{\n\t\tCmd: \"create\",\n\t\tObjectName: objectName,\n\t\tPayload: payload,\n\t}\n}", "func (r Response) Created(code string, payload Payload, header ...ResponseHeader) {\n\tr.Response(code, http.Created, payload, header...)\n}", "func (ctx *UploadOpmlContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (server *Server) CreateChannel(ctx *gin.Context) {\n\tvar rss createParams\n\tif err := ctx.ShouldBindJSON(&rss); err == nil {\n\t\tif err := server.DB.ChannelTable.Create(rss.Link); err != nil {\n\t\t\tctx.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\t} else {\n\t\t\tctx.JSON(http.StatusOK, gin.H{\"success\": \"successfully created a new Channel\"})\n\t\t}\n\t} else {\n\t\tctx.JSON(http.StatusBadRequest, gin.H{\"error\": \"Request body doesn't match the api... Please read our api docs\"})\n\t}\n}", "func CreateChannel(ctx *iris.Context) {\n\tvar body map[string]interface{}\n\tctx.ReadJSON(&body)\n\t/*\n\tif validateJsonSchema(\"channel\", body) != true {\n\t\tprintln(\"Invalid schema\")\n\t\tctx.JSON(iris.StatusBadRequest, iris.Map{\"response\": \"invalid json schema in request\"})\n\t\treturn\n\t}\n\t*/\n\n\t// Init new Mongo session\n\t// and get the \"channels\" collection\n\t// from this new session\n\tDb := db.MgoDb{}\n\tDb.Init()\n\tdefer Db.Close()\n\n\n\tc := models.Channel{}\n\tjson.Unmarshal(ctx.RequestCtx.Request.Body(), &c)\n\n\t// Creating UUID Version 4\n\tuuid := uuid.NewV4()\n\tfmt.Println(uuid.String())\n\n\tc.Id = uuid.String()\n\n\t// Insert reference to DeviceId\n\tdid := ctx.Param(\"device_id\")\n\tc.Device = did\n\n\t// Timestamp\n\tt := time.Now().UTC().Format(time.RFC3339)\n\tc.Created, c.Updated = t, t\n\n\t// Insert Channel\n\terr := Db.C(\"channels\").Insert(c)\n\tif err != nil {\n\t\tctx.JSON(iris.StatusInternalServerError, iris.Map{\"response\": \"cannot create device\"})\n\t\treturn\n\t}\n\n\tctx.JSON(iris.StatusCreated, iris.Map{\"response\": \"created\", \"id\": c.Id})\n}", "func (a API) Created(data interface{}) (int, model.MessageResponse) {\n\treturn http.StatusCreated, model.MessageResponse{\n\t\tData: data,\n\t\tMessages: model.Responses{{Code: RecordCreated, Message: \"¡listo!\"}},\n\t}\n}", "func (c Client) Create(input *CreateActivityInput) (*CreateActivityResponse, error) {\n\treturn c.CreateWithContext(context.Background(), input)\n}", "func (controller *ActivityController) Create(res http.ResponseWriter, req *http.Request) {\n\tif !controller.auth.IsLogin(res, req) {\n\t\thttp.Redirect(res, req, \"/login\", http.StatusSeeOther)\n\t\treturn\n\t}\n\tcontroller.render(res, req, \"activity_create.gohtml\", nil, 2)\n}", "func (c client) CreateService(service corev1.Service) error {\n\treturn c.Create(context.TODO(), &service)\n}", "func (t *RestController) Create(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RestController\", \"Create\")\n\n\t{\n\t\terr := r.ParseForm()\n\n\t\tif err != nil {\n\n\t\t\tt.Log.Handle(w, r, err, \"parseform\", \"error\", \"RestController\", \"Create\")\n\t\t\tt.embed.Finalizer(w, r, err)\n\n\t\t\treturn\n\t\t}\n\n\t}\n\tvar postColor *string\n\tif _, ok := r.Form[\"color\"]; ok {\n\t\txxTmppostColor := r.FormValue(\"color\")\n\t\tt.Log.Handle(w, r, nil, \"input\", \"form\", \"color\", xxTmppostColor, \"RestController\", \"Create\")\n\t\tpostColor = &xxTmppostColor\n\t}\n\n\tjsonResBody, err := t.embed.Create(postColor)\n\n\tif err != nil {\n\n\t\tt.Log.Handle(w, r, err, \"business\", \"error\", \"RestController\", \"Create\")\n\t\tt.embed.Finalizer(w, r, err)\n\n\t\treturn\n\t}\n\n\t{\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(200)\n\t\tencErr := json.NewEncoder(w).Encode(jsonResBody)\n\n\t\tif encErr != nil {\n\n\t\t\tt.Log.Handle(w, r, encErr, \"res\", \"json\", \"encode\", \"error\", \"RestController\", \"Create\")\n\t\t\tt.embed.Finalizer(w, r, encErr)\n\n\t\t\treturn\n\t\t}\n\n\t}\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RestController\", \"Create\")\n\n}", "func HandleCreate(wf workflow.CreateFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tvar requestDTO CreateRequestDTO\n\t\terr := decoder.Decode(&requestDTO)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tcreateRequest := createRequestFromCreateRequestDTO(requestDTO)\n\t\tcustomer, err := wf(createRequest)\n\t\tif err != nil {\n\t\t\thandleWorkflowError(err, w)\n\t\t\treturn\n\t\t}\n\t\tresponse := createResponseDTOFromCustomer(*customer)\n\t\tencodeErr := json.NewEncoder(w).Encode(response)\n\t\tif encodeErr != nil {\n\t\t\tlog.Fatal(encodeErr)\n\t\t}\n\t}\n}", "func Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprint(w, \"Welcome!\\n\")\n}", "func NewServiceCreateCreated() *ServiceCreateCreated {\n\treturn &ServiceCreateCreated{}\n}", "func (c *globalThreatFeeds) Create(ctx context.Context, globalThreatFeed *v3.GlobalThreatFeed, opts v1.CreateOptions) (result *v3.GlobalThreatFeed, err error) {\n\tresult = &v3.GlobalThreatFeed{}\n\terr = c.client.Post().\n\t\tResource(\"globalthreatfeeds\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(globalThreatFeed).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func (client PublishedBlueprintsClient) CreateSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "func NewCreateServiceCreated() *CreateServiceCreated {\n\treturn &CreateServiceCreated{}\n}", "func (r *ProjectsCollectdTimeSeriesService) Create(name string, createcollectdtimeseriesrequest *CreateCollectdTimeSeriesRequest) *ProjectsCollectdTimeSeriesCreateCall {\n\tc := &ProjectsCollectdTimeSeriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\tc.createcollectdtimeseriesrequest = createcollectdtimeseriesrequest\n\treturn c\n}", "func (c *Client) CreateService(namespace, repoName string, in *api.CreateServiceRequest) (*api.Service, error) {\n\tout := &api.Service{}\n\trawURL := fmt.Sprintf(pathServices, c.base.String(), namespace, repoName)\n\terr := c.post(rawURL, true, http.StatusCreated, in, out)\n\treturn out, errio.Error(err)\n}", "func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToReceiverCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\tresp, err := client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{200, 201, 202},\n\t})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func StartFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func CreatePostHandler(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tresponse, err := restClient.Post(postsUrl, r, r.Header)\n\n\tif err != nil {\n\t\trestClient.WriteErrorResponse(w, \"server_error\", \"Server error occured\")\n\t\treturn\n\t}\n\n\tvar post Post\n\trestClient.WriteJSONResponse(w, response, post)\n}", "func (a *API) Create(s *funkmasta.Service) error {\n\tv := url.Values{}\n\tv.Set(\"name\", s.Name)\n\tv.Set(\"endpoint\", s.Endpoint)\n\tv.Set(\"payload\", s.Payload)\n\tv.Set(\"env\", s.EnvSetup)\n\n\t_, err := a.PostForm(CREATE, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (a *Client) CreateDC(params *CreateDCParams, authInfo runtime.ClientAuthInfoWriter) (*CreateDCCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateDCParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createDC\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/api/v1/seed/{seed_name}/dc\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &CreateDCReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*CreateDCCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*CreateDCDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (a *DefaultApiService) CreateConsumer(consumerInput Consumer) ( *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/consumers\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &consumerInput\n\tr, err := a.client.prepareRequest(nil, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t localVarHttpResponse, err := a.client.callAPI(r)\n\t if err != nil || localVarHttpResponse == nil {\n\t\t return localVarHttpResponse, err\n\t }\n\t defer localVarHttpResponse.Body.Close()\n\t if localVarHttpResponse.StatusCode >= 300 {\n\t\treturn localVarHttpResponse, reportError(localVarHttpResponse.Status)\n\t }\n\n\treturn localVarHttpResponse, err\n}", "func NewCreateDogContext(ctx context.Context, r *http.Request, service *goa.Service) (*CreateDogContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := CreateDogContext{Context: ctx, ResponseData: resp, RequestData: req}\n\treturn &rctx, err\n}", "func (c *todoController) Create(ctx *fiber.Ctx) error {\n\tb := new(CreateDTO)\n\n\tif err := utils.ParseBodyAndValidate(ctx, b); err != nil {\n\t\treturn err\n\t}\n\n\tuser := utils.GetUser(ctx)\n\ttodo, err := c.useCase.Create(b, user)\n\n\tif err != nil {\n\t\treturn fiber.NewError(fiber.StatusConflict, err.Error())\n\t}\n\n\treturn ctx.JSON(&TodoCreateResponse{\n\t\tTodo: &TodoResponse{\n\t\t\tID: todo.ID,\n\t\t\tTask: todo.Task,\n\t\t\tCompleted: todo.Completed,\n\t\t},\n\t})\n}", "func MakeCreateEndpoint(s service.FilesCreatorService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(CreateRequest)\n\t\ts0 := s.Create(ctx, req.FileDescriptor)\n\t\treturn CreateResponse{S0: s0}, nil\n\t}\n}", "func CreateTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, body string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (c *Controller) WorkspaceCreated(w *WorkspaceData) error {\n\n\tevent, err := c.prepareEvent(createWSEvent, w.AccountId)\n\tif err == ErrDisabled {\n\t\treturn nil\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tevent.Properties[\"groupName\"] = w.GroupName\n\tevent.Properties[\"message\"] = CreateWSBody\n\n\treturn c.exporter.Send(event)\n}", "func (h *Http) Create(wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\n\tapp := fiber.New()\n\n\t// Swagger\n\tapp.Get(\"/\", func (c *fiber.Ctx) error { return c.Redirect(\"/docs/index.html\") })\n\tapp.Get(\"/docs/*\", swagger.New(swagger.Config{DeepLinking: true, URL:\"/swagger.yaml\"}))\n\tapp.Static(\"/swagger.yaml\", \"./swagger.yaml\")\n\n\t// Routes\n\tapp.Get(\"/top/confirmed\", getTopConfirmed(&cont.TopConfirmed{}))\n\n\t// Run http server\n\tapp.Listen(fmt.Sprintf(\":%d\", h.Port))\n}", "func (__receiver_OService *OutgoingCallerIDService) Create() *OutgoingCallerIDService {\n\t__receiver_OService.action = types.CREATE\n\t__receiver_OService.data = resources.OutgoingCallerIDDetails{}\n\t__receiver_OService.url = resources.OutgoingCallerIDURLS[types.CREATE]\n\treturn __receiver_OService\n}", "func CreateTaskController(w http.ResponseWriter, r *http.Request) {\n\tvar task Task\n\n\terr := json.NewDecoder(r.Body).Decode(&task)\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\ttask.Status = \"P\"\n\terr = task.Create()\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresponse, _ := json.Marshal(task)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(response)\n}", "func (c Client) Create(input *CreateServiceInput) (*CreateServiceResponse, error) {\n\treturn c.CreateWithContext(context.Background(), input)\n}", "func (c Client) Create(input *CreateServiceInput) (*CreateServiceResponse, error) {\n\treturn c.CreateWithContext(context.Background(), input)\n}", "func (c *SeriesController) Create(ctx *app.CreateSeriesContext) error {\n\t// SeriesController_Create: start_implement\n\tm, err := c.fm()\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`unable to get model`, `error`, err.Error())\n\t\treturn ctx.ServiceUnavailable()\n\t}\n\tdefer func() { m.Close() }()\n\n\tv, err := m.InsertSeries(ctx.Payload.SeriesName, ctx.Payload.CategoryID)\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`failed to insert series`, `error`, err.Error())\n\t\tswitch err {\n\t\tcase model.ErrDuplicateKey:\n\t\t\treturn ctx.UnprocessableEntity()\n\t\tcase model.ErrInvalidID:\n\t\t\treturn ctx.UnprocessableEntity()\n\t\tdefault:\n\t\t\treturn ctx.InternalServerError()\n\t\t}\n\t}\n\n\tctx.ResponseData.Header().Set(\"Location\", app.SeriesHref(v.ID))\n\treturn ctx.Created()\n\t// SeriesController_Create: end_implement\n}", "func (a DoctorApi) CreateDoctor(writer http.ResponseWriter, request *http.Request) {\n\tdoctor := new(data.Doctors)\n\terr := json.NewDecoder(request.Body).Decode(&doctor)\n\tif err != nil {\n\t\tlog.Printf(\"failed reading JSON: %s\", err)\n\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tif doctor == nil {\n\t\tlog.Printf(\"failed empty JSON\")\n\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\t_, err = a.data.CreateDoctor(*doctor)\n\tif err != nil {\n\t\tlog.Println(\"doctor hasn't been created\")\n\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\twriter.WriteHeader(http.StatusCreated)\n}", "func (c *SeaterController) Created(data interface{}) {\n\tc.Code(201)\n\tc.jsonResp(data)\n}", "func CreateService(ctx *gin.Context) {\n\tlog := logger.RuntimeLog\n\tvar svcModel *model.Service\n\tif err := ctx.BindJSON(&svcModel); err != nil {\n\t\tSendResponse(ctx, err, \"Request Body Invalid\")\n\t}\n\n\tsvcNamespace := strings.ToLower(svcModel.SvcMeta.Namespace)\n\tsvcZone := svcModel.SvcMeta.AppMeta.ZoneName\n\tsvcName := svcModel.SvcMeta.Name\n\n\t// fetch k8s-client hander by zoneName\n\tkclient, err := GetClientByAzCode(svcZone)\n\tif err != nil {\n\t\tlog.WithError(err)\n\t\tSendResponse(ctx, errno.ErrTokenInvalid, nil)\n\t\treturn\n\t}\n\n\tstartAt := time.Now() // used to record operation time cost\n\t_, err = kclient.CoreV1().Services(svcNamespace).Create(makeupServiceData(ctx, svcModel))\n\tif err != nil {\n\t\tSendResponse(ctx, err, \"create Service fail.\")\n\t\treturn\n\t}\n\tlogger.MetricsEmit(\n\t\tSVC_CONST.K8S_LOG_Method_CreateService,\n\t\tutil.GetReqID(ctx),\n\t\tfloat32(time.Since(startAt)/time.Millisecond),\n\t\terr == err,\n\t)\n\tSendResponse(ctx, errno.OK, fmt.Sprintf(\"Create Service %s success.\", svcName))\n}", "func (t *ThreadController) Create(c *gin.Context) {\n\tc.HTML(http.StatusOK, \"thread/create.html\", gin.H{\n\t\t\"title\": \"Welcome go forum\",\n\t\t\"content\": \"You are logged in!\",\n\t\t\"ginContext\": c,\n\t})\n}", "func (client Client) CreateService(svc api.Service) (api.Service, error) {\n\tvar result api.Service\n\tbody, err := json.Marshal(svc)\n\tif err == nil {\n\t\t_, err = client.rawRequest(\"POST\", \"services\", bytes.NewBuffer(body), &result)\n\t}\n\treturn result, err\n}", "func Create(c *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToNamespaceCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\treqOpt := &golangsdk.RequestOpts{OkCodes: []int{201}}\n\t_, r.Err = c.Post(rootURL(c), b, &r.Body, reqOpt)\n\treturn\n}", "func Create(writer http.ResponseWriter, request *http.Request) {\n\ttemplate_html.ExecuteTemplate(writer, \"Create\", nil)\n}", "func New(ctx *sweetygo.Context) error {\n\ttitle := ctx.Param(\"title\")\n\tcat := ctx.Param(\"cat\")\n\thtml := ctx.Param(\"html\")\n\tmd := ctx.Param(\"md\")\n\tif title != \"\" && cat != \"\" && html != \"\" && md != \"\" {\n\t\terr := model.NewPost(title, cat, html, md)\n\t\tif err != nil {\n\t\t\treturn ctx.JSON(500, 0, \"create post error\", nil)\n\t\t}\n\t\treturn ctx.JSON(201, 1, \"success\", nil)\n\t}\n\treturn ctx.JSON(406, 0, \"I can't understand what u want\", nil)\n}", "func CreateTrade(w http.ResponseWriter, r *http.Request) {\n\tdata := &TradeRequest{}\n\tif err := render.Bind(r, data); err != nil {\n\t\trender.Render(w, r, ErrInvalidRequest(err))\n\t\treturn\n\t}\n\n\t// request auth is from initiator\n\t_, claims, _ := jwtauth.FromContext(r.Context())\n\ttrade, err := NewTrade(data, claims[\"userID\"].(string))\n\tif err != nil {\n\t\trender.Render(w, r, ErrInvalidRequest(err))\n\t\treturn\n\t}\n\n\tschID, err := primitive.ObjectIDFromHex(data.ScheduleID)\n\tif err != nil {\n\t\trender.Render(w, r, ErrServer(err))\n\t\treturn\n\t}\n\tif err = mh.InsertTrade(trade, schID); err != nil {\n\t\trender.Render(w, r, ErrServer(err))\n\t\treturn\n\t}\n\trender.Status(r, http.StatusCreated)\n\trender.Render(w, r, NewTradeResponse(*trade))\n}", "func (a *Client) CreateChannel(params *CreateChannelParams, authInfo runtime.ClientAuthInfoWriter) (*CreateChannelCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateChannelParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createChannel\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/channels\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &CreateChannelReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*CreateChannelCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for createChannel: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (w *ServerInterfaceWrapper) CreateCategory(ctx echo.Context) error {\n\tvar err error\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.CreateCategory(ctx)\n\treturn err\n}", "func Create(ctx *gin.Context, data interface{}) {\n\tctx.JSON(http.StatusCreated, gin.H{\"code\": merrors.ErrSuccess, \"data\": nil})\n\treturn\n}", "func (this *ActivityREST) Create(c *hera.Context) error {\n\t\tparams\t\t:= c.Params\n\t\tuid\t\t\t:= params[\"uid\"]\n\t\ttitle\t\t:= params[\"title\"]\n\t\ttime\t\t:= params[\"time\"]\n\t\tsite\t\t:= params[\"site\"]\n\t\tis_discuss\t:= params[\"is_discuss\"]\n\t\ttags\t\t:= params[\"tags\"]\n\t\tremark\t\t:= params[\"remark\"]\n\t\tsex\t\t\t:= params[\"sex\"]\n\t\tpeople_num\t:= params[\"people_num\"]\n\t\tlongitude, _ \t:= strconv.ParseFloat(params[\"longitude\"], 64) //jingdu\n\t\tlatitude, _\t:= strconv.ParseFloat(params[\"latitude\"], 64) //weidu\n\n\t\tentity_obj := NewActivity()\n\t\tentity_obj.Create(uid, title, time, site, is_discuss, tags, remark, sex, people_num, longitude, latitude)\n\t\treturn c.Success(\"\")\n}", "func CreateHandler(svc ServiceModel) *http.Server {\n\treturn http.NewServer(\n\t\tmakeCreateEndpoint(svc),\n\t\tdecodeCreateRequest,\n\t\thttp.EncodeJSONResponse,\n\t)\n}", "func Create(c blogpb.BlogServiceClient) {\n\tblog := &blogpb.Blog{\n\t\tAuthorId: \"Rad\",\n\t\tTitle: \"Rad First Blog\",\n\t\tContent: \"Content of the first blog\",\n\t}\n\tres, err := c.CreateBlog(context.Background(), &blogpb.CreateBlogRequest{Blog: blog})\n\tif err != nil {\n\t\tlog.Fatalln(\"Unexpected error:\", err)\n\t}\n\tfmt.Println(\"Blog has been created\", res)\n}", "func (h *JSONWriter) WriteCreated(w http.ResponseWriter, r *http.Request, location string, e interface{}) {\n\tw.Header().Set(\"Location\", location)\n\th.WriteCode(w, r, http.StatusCreated, e)\n}", "func CreateCreateFabricChannelResponse() (response *CreateFabricChannelResponse) {\n\tresponse = &CreateFabricChannelResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (c MoviesController) CreateMovieEndPoint(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvar movie Movie\n\tif err := json.NewDecoder(r.Body).Decode(&movie); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\tid, err := c.moviesService.InsertMovie(movie)\n\tif err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tlog.Printf(\"film creato con id: %#+v\\n\", id)\n\tmovie, _ = c.moviesService.GetMovieById(id)\n\trespondWithJson(w, http.StatusCreated, movie)\n}", "func (s *Server) CreateChart() {\n\tlog.Println(\"Opening chart.html\")\n\tos.Create(\"./resources/chart.html\")\n\n\tlog.Println(\"Creating begginning of chart\")\n\tRewriteFile(\"./resources/chart_beg\", \"./resources/chart.html\")\n\n\tlog.Println(\"Building chart\")\n\ts.BuildChart()\n\n\tlog.Println(\"Creating ending of chart\")\n\tRewriteFile(\"./resources/chart_end\", \"./resources/chart.html\")\n}", "func MakeCreateActivity(activityID *url.URL) vocab.ActivityStreamsCreate {\n\tactivity := streams.NewActivityStreamsCreate()\n\tid := streams.NewJSONLDIdProperty()\n\tid.Set(activityID)\n\tactivity.SetJSONLDId(id)\n\n\treturn activity\n}", "func NewEndpointCreated() filters.Spec {\n\tvar ec endpointCreated\n\treturn ec\n}", "func returnCreatedRecordResponse(w http.ResponseWriter) {\n\tformatResponseWriter(w, http.StatusCreated, \"text/plain\", []byte(OKResponseBodyMessage))\n}", "func PostServiceHandlerFunc(params service.PostProjectProjectNameServiceParams, principal *models.Principal) middleware.Responder {\n\n\tkeptnContext := uuid.New().String()\n\tl := keptnutils.NewLogger(keptnContext, \"\", \"api\")\n\tl.Info(\"API received create for service\")\n\n\ttoken, err := ws.CreateChannelInfo(keptnContext)\n\tif err != nil {\n\t\tl.Error(fmt.Sprintf(\"Error creating channel info %s\", err.Error()))\n\t\treturn getServiceInternalError(err)\n\t}\n\n\teventContext := models.EventContext{KeptnContext: &keptnContext, Token: &token}\n\n\tdeploymentStrategies, err := mapDeploymentStrategies(params.Service.DeploymentStrategies)\n\tif err != nil {\n\t\tl.Error(fmt.Sprintf(\"Cannot map dep %s\", err.Error()))\n\t\treturn getServiceInternalError(err)\n\t}\n\n\tserviceData := keptnevents.ServiceCreateEventData{\n\t\tProject: params.ProjectName,\n\t\tService: *params.Service.ServiceName,\n\t\tHelmChart: params.Service.HelmChart,\n\t\tDeploymentStrategies: deploymentStrategies,\n\t}\n\tforwardData := serviceCreateEventData{ServiceCreateEventData: serviceData, EventContext: eventContext}\n\n\terr = utils.SendEvent(keptnContext, \"\", keptnevents.InternalServiceCreateEventType, \"\", forwardData, l)\n\n\tif err != nil {\n\t\tl.Error(fmt.Sprintf(\"Error sending CloudEvent %s\", err.Error()))\n\t\treturn getServiceInternalError(err)\n\t}\n\n\treturn service.NewPostProjectProjectNameServiceOK().WithPayload(&eventContext)\n}", "func (ctx *CreateFeedContext) CreatedLink(r *FeedLink) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func (c APIClient) CreateDataFeed(df *DataFeed) error {\n\treturn c.doHTTPBoth(\"PUT\", fmt.Sprintf(\"https://api.nsone.net/v1/data/feeds/%s\", df.SourceId), df)\n}", "func (s *toDoServiceServer) Create(ctx context.Context, req *v1.CreateRequest) (*v1.CreateResponse, error) {\n\t// check if the API version requested by app is supported by server\n\tif err := s.checkAPI(req.Api); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// get SQL connection\n\tc, err := s.connect(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\n\treminder, err := ptypes.Timestamp(req.ToDo.Reminder)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"Reminder field has invalid format %v\", err.Error())\n\t}\n\n\t// insert To-Do entity data\n\tres, err := c.ExecContext(ctx, \"INSERT INTO to_do_db.to_do(`title`, `description`, `reminder`) VALUES(?,?,?)\",\n\t\treq.ToDo.Title, req.ToDo.Description, reminder)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unknown, \"Failed to insert into to_do with err: %v\", err.Error())\n\t}\n\n\t// get ID of created to_do\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unknown, \"Failed to retrieve ID for created to_do with err: %v\", err.Error())\n\t}\n\n\treturn &v1.CreateResponse{\n\t\tApi: apiVersion,\n\t\tId: id,\n\t}, nil\n}", "func forwardCreateAccount(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) {\n\tw.WriteHeader(http.StatusCreated)\n\truntime.ForwardResponseMessage(ctx, mux, marshaler, w, req, resp, opts...)\n}", "func MakeCreateTodoEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(CreateTodoRequest)\n\n\t\tid, err := service.CreateTodo(ctx, req.Text)\n\n\t\tif err != nil {\n\t\t\tif endpointErr := endpointError(nil); errors.As(err, &endpointErr) && endpointErr.EndpointError() {\n\t\t\t\treturn CreateTodoResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tId: id,\n\t\t\t\t}, err\n\t\t\t}\n\n\t\t\treturn CreateTodoResponse{\n\t\t\t\tErr: err,\n\t\t\t\tId: id,\n\t\t\t}, nil\n\t\t}\n\n\t\treturn CreateTodoResponse{Id: id}, nil\n\t}\n}", "func (_obj *DataService) CreateActivity(activityInfo *ActivityInfo, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = activityInfo.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"createActivity\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func NewCreateChannelCreated() *CreateChannelCreated {\n\treturn &CreateChannelCreated{}\n}", "func CreateService(cr characterRepository, pr playerRepository) *Service {\n\treturn &Service{\n\t\tcharacter: cr,\n\t\tplayer: pr,\n\t}\n}", "func CreateChannel(service *service.Service, name, botName string) (*models.Channel, error) {\n\t// Call create channel\n\tres, err := service.SimpleCall(\"private.channel.create\", nil, wamp.Dict{\"name\": name, \"botName\": botName})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//Check and return result\n\tif len(res.Arguments) > 0 {\n\t\tchannel, err := conv.ToStringMap(res.Arguments[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tignored, err := conv.ToBool(channel[\"ignored\"])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &models.Channel{\n\t\t\tName: conv.ToString(channel[\"name\"]),\n\t\t\tBotName: conv.ToString(channel[\"bot_name\"]),\n\t\t\tNotes: conv.ToString(channel[\"notes\"]),\n\t\t\tIgnored: ignored,\n\t\t}, nil\n\t}\n\treturn nil, nil\n}", "func (t *StreamService) CreateChannel(request *CreateChannelRequest) (*CreateChannelResponse, error) {\n\n\trsp := &CreateChannelResponse{}\n\treturn rsp, t.client.Call(\"stream\", \"CreateChannel\", request, rsp)\n\n}", "func CreateService(ar authRepository, pr playerRepository) *Service {\n\treturn &Service{\n\t\tauth: ar,\n\t\tplayer: pr,\n\t}\n}" ]
[ "0.64461946", "0.6151894", "0.6101821", "0.6008945", "0.59648687", "0.57612437", "0.55915004", "0.5510246", "0.5465934", "0.5429004", "0.5424184", "0.5389779", "0.5389779", "0.53594583", "0.53313375", "0.5329701", "0.5278943", "0.5271997", "0.5163241", "0.51443195", "0.51384723", "0.5128135", "0.5095771", "0.5087374", "0.50755477", "0.50721455", "0.5070622", "0.5067556", "0.5046036", "0.50406355", "0.5035059", "0.50169533", "0.5002515", "0.49860862", "0.49579206", "0.49270374", "0.49191794", "0.49148515", "0.4895158", "0.4894819", "0.48873416", "0.4878774", "0.48787656", "0.48753664", "0.48655993", "0.48623368", "0.4841472", "0.4816572", "0.4793263", "0.47901186", "0.47895336", "0.47867873", "0.47758552", "0.47690138", "0.47581768", "0.47514588", "0.4751055", "0.47425982", "0.47402936", "0.47332245", "0.47290656", "0.47273237", "0.47221947", "0.47170374", "0.47170374", "0.47150576", "0.47124293", "0.4706735", "0.46979496", "0.46964723", "0.46903035", "0.46883336", "0.468544", "0.46843967", "0.46819437", "0.46818727", "0.46762872", "0.46607298", "0.4648495", "0.46441022", "0.46380457", "0.46342215", "0.4632351", "0.4620746", "0.46058464", "0.4600509", "0.45931354", "0.45917872", "0.45881855", "0.4586898", "0.45773023", "0.457562", "0.4571463", "0.45650715", "0.45649955", "0.45636246", "0.45561263", "0.45540905", "0.45528656", "0.45496142" ]
0.7307442
0
CreateFeedCreatedLink runs the method Create of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func CreateFeedCreatedLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedLink) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} if tags != nil { sliceVal := []string{*tags} query["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} query["title"] = sliceVal } { sliceVal := []string{url_} query["url"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds"), RawQuery: query.Encode(), } req, err := http.NewRequest("POST", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} if tags != nil { sliceVal := []string{*tags} prms["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} prms["title"] = sliceVal } { sliceVal := []string{url_} prms["url"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) createCtx, _err := app.NewCreateFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.Create(createCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 201 { t.Errorf("invalid response status code: got %+v, expected 201", rw.Code) } var mt *app.FeedLink if resp != nil { var _ok bool mt, _ok = resp.(*app.FeedLink) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateFeedCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *CreateFeedContext) CreatedLink(r *FeedLink) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func (ctx *CreateFeedContext) Created(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func CreateFeedCreatedTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (controller *LinkController) Create(w http.ResponseWriter, r *http.Request) {\n\tvar link models.Link\n\tuser, err := models.NewUserFromContext(r.Context())\n\n\tif err != nil {\n\t\tutils.RespondWithError(&w, http.StatusBadRequest, models.NewError(err.Error()))\n\t\treturn\n\t}\n\n\terr = link.Populate(r)\n\tlink.UserID = user.ID\n\n\tif err != nil {\n\t\tutils.RespondWithError(&w, http.StatusBadRequest, models.NewError(err.Error()))\n\t\treturn\n\t}\n\n\tlinkRef, err := controller.linkRepository.CreateWithContext(r.Context(), link)\n\n\tif err != nil {\n\t\tutils.RespondWithError(&w, http.StatusBadRequest, models.NewError(err.Error()))\n\t\treturn\n\t}\n\n\tutils.RespondWithJSON(&w, http.StatusCreated, linkRef)\n}", "func NewCreateFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*CreateFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := CreateFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamTags := req.Params[\"tags\"]\n\tif len(paramTags) > 0 {\n\t\trawTags := paramTags[0]\n\t\trctx.Tags = &rawTags\n\t}\n\tparamTitle := req.Params[\"title\"]\n\tif len(paramTitle) > 0 {\n\t\trawTitle := paramTitle[0]\n\t\trctx.Title = &rawTitle\n\t}\n\tparamURL := req.Params[\"url\"]\n\tif len(paramURL) == 0 {\n\t\terr = goa.MergeErrors(err, goa.MissingParamError(\"url\"))\n\t} else {\n\t\trawURL := paramURL[0]\n\t\trctx.URL = rawURL\n\t\tif err2 := goa.ValidateFormat(goa.FormatURI, rctx.URL); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidFormatError(`url`, rctx.URL, goa.FormatURI, err2))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func Created(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": false, \"msg\": \"`+msg+`\"}`, 201, service, \"application/json\")\n\treturn nil\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateLink(w http.ResponseWriter, r *http.Request) {\n\n\treqBody, _ := ioutil.ReadAll(r.Body)\n\tvar obj Link\n\tjson.Unmarshal(reqBody, &obj)\n\tobj.Hash = hashLink(obj.URL)\n\tres := globals.Database.FirstOrCreate(&obj, obj)\n\tif res.Error != nil {\n\t\tfmt.Println(res.Error)\n\t\tpanic(\"Creation did not work.\")\n\t}\n\tjson.NewEncoder(w).Encode(obj)\n\tif !globals.Prod {\n\t\tfmt.Println(\"request: creation link\")\n\t}\n\treturn\n}", "func CreateTodosCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, body string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (server *Server) CreateChannel(ctx *gin.Context) {\n\tvar rss createParams\n\tif err := ctx.ShouldBindJSON(&rss); err == nil {\n\t\tif err := server.DB.ChannelTable.Create(rss.Link); err != nil {\n\t\t\tctx.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\t} else {\n\t\t\tctx.JSON(http.StatusOK, gin.H{\"success\": \"successfully created a new Channel\"})\n\t\t}\n\t} else {\n\t\tctx.JSON(http.StatusBadRequest, gin.H{\"error\": \"Request body doesn't match the api... Please read our api docs\"})\n\t}\n}", "func (a *CampaignsApiService) CreateChannel(ctx _context.Context) ApiCreateChannelRequest {\n\treturn ApiCreateChannelRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (a *Api) postCreateLink(w http.ResponseWriter, r *http.Request) {\n\tvar m postLinkRequestModel\n\tif err := json.NewDecoder(r.Body).Decode(&m); err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tshortLink, err := a.LinkUseCases.LoggerCutLink(a.LinkUseCases.CutLink)(m.Link, nil)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif _, err := w.Write([]byte(shortLink)); err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n}", "func CreateRedirect(c echo.Context) error {\n r := new(Redirection)\n if err := c.Bind(r); err != nil {\n badRequestMessage := &Response{Message: \"Bad Request\"}\n return c.JSON(http.StatusBadRequest, badRequestMessage)\n }\n urlKey, err := Save(r.URL)\n if err != nil {\n return c.JSON(http.StatusInternalServerError, &Response{Message: \"Internal Error\"})\n }\n success := &Response{Message: urlKey}\n return c.JSON(http.StatusCreated, success)\n}", "func (ctx *CreateDogContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func CreateCreatedResponse(w http.ResponseWriter, data interface{}) {\n\tif data != nil {\n\t\tbytes, err := json.Marshal(data)\n\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tw.Write(bytes)\n\t}\n}", "func (r *PropertiesGoogleAdsLinksService) Create(parent string, googleanalyticsadminv1alphagoogleadslink *GoogleAnalyticsAdminV1alphaGoogleAdsLink) *PropertiesGoogleAdsLinksCreateCall {\n\tc := &PropertiesGoogleAdsLinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.googleanalyticsadminv1alphagoogleadslink = googleanalyticsadminv1alphagoogleadslink\n\treturn c\n}", "func Created(w http.ResponseWriter, data interface{}) {\n\tsuccessResponse := BuildSuccess(data, \"Created\", MetaInfo{HTTPStatus: http.StatusCreated})\n\tWrite(w, successResponse, http.StatusCreated)\n}", "func PostsCreateHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Posts create\")\n}", "func (r *AccountsUserLinksService) Create(parent string, googleanalyticsadminv1alphauserlink *GoogleAnalyticsAdminV1alphaUserLink) *AccountsUserLinksCreateCall {\n\tc := &AccountsUserLinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.googleanalyticsadminv1alphauserlink = googleanalyticsadminv1alphauserlink\n\treturn c\n}", "func (ctx *CreateCommentContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (ctx *CreateCommentContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (client PublishedBlueprintsClient) CreateSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "func GetFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (controller *ActivityController) Create(res http.ResponseWriter, req *http.Request) {\n\tif !controller.auth.IsLogin(res, req) {\n\t\thttp.Redirect(res, req, \"/login\", http.StatusSeeOther)\n\t\treturn\n\t}\n\tcontroller.render(res, req, \"activity_create.gohtml\", nil, 2)\n}", "func (ctx *CreateOutputContext) Created(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func CreateLink(_ web.C, w http.ResponseWriter, r *http.Request) {\n\taccount := r.Header.Get(\"X-Remote-User\")\n\tl := Link{\n\t\tShortLink: uniuri.New(),\n\t\tTarget: r.FormValue(\"t\"),\n\t\tOwner: account,\n\t}\n\tlinks[l.ShortLink] = l\n\n\tfmt.Fprintf(w, \"%s\\n\", l.ShortLink)\n}", "func PostCreateEndpoint(creator creating.Service) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tvar post model.Post\n\t\terr := json.NewDecoder(r.Body).Decode(&post)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error decoding request body: %v: %s\", r, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tcreated, err := creator.PostCreate(post)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error creating post:\", post, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tjson.NewEncoder(w).Encode(created)\n\t}\n}", "func (c *cloudChannelRESTClient) CreateChannelPartnerLink(ctx context.Context, req *channelpb.CreateChannelPartnerLinkRequest, opts ...gax.CallOption) (*channelpb.ChannelPartnerLink, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tbody := req.GetChannelPartnerLink()\n\tjsonReq, err := m.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v/channelPartnerLinks\", req.GetParent())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"parent\", url.QueryEscape(req.GetParent()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\topts = append((*c.CallOptions).CreateChannelPartnerLink[0:len((*c.CallOptions).CreateChannelPartnerLink):len((*c.CallOptions).CreateChannelPartnerLink)], opts...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &channelpb.ChannelPartnerLink{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"POST\", baseUrl.String(), bytes.NewReader(jsonReq))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn resp, nil\n}", "func (b *BookmarksHandler) Create() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tuser := ensureUser(r)\n\n\t\tpayload := &BookmarkRequest{}\n\t\tif err := render.Bind(r, payload); err != nil {\n\t\t\tb.App.Logger.ErrorRequest(fmt.Sprintf(\"cannot bind payload: '%v'\", err), r)\n\t\t\tencodeError(app.ErrValidation(err.Error()), b.App.Logger, w, r)\n\t\t\treturn\n\t\t}\n\n\t\tb.App.Logger.InfoRequest(fmt.Sprintf(\"will try to create a new bookmark entry: '%s'\", payload), r)\n\n\t\tbm, err := b.App.CreateBookmark(*payload.Bookmark, *user)\n\t\tif err != nil {\n\t\t\tencodeError(err, b.App.Logger, w, r)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusCreated)\n\t\trespondJSON(w, Result{\n\t\t\tSuccess: true,\n\t\t\tMessage: fmt.Sprintf(\"Bookmark created with ID '%s'\", bm.ID),\n\t\t\tValue: bm.ID,\n\t\t})\n\n\t}\n}", "func (m *ItemItemsDriveItemItemRequestBuilder) CreateLink()(*ItemItemsItemCreateLinkRequestBuilder) {\n return NewItemItemsItemCreateLinkRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (r repository) Create(ctx context.Context, link entity.Link) error {\n\treturn r.db.With(ctx).Model(&link).Insert()\n}", "func CreateChannel(ctx *iris.Context) {\n\tvar body map[string]interface{}\n\tctx.ReadJSON(&body)\n\t/*\n\tif validateJsonSchema(\"channel\", body) != true {\n\t\tprintln(\"Invalid schema\")\n\t\tctx.JSON(iris.StatusBadRequest, iris.Map{\"response\": \"invalid json schema in request\"})\n\t\treturn\n\t}\n\t*/\n\n\t// Init new Mongo session\n\t// and get the \"channels\" collection\n\t// from this new session\n\tDb := db.MgoDb{}\n\tDb.Init()\n\tdefer Db.Close()\n\n\n\tc := models.Channel{}\n\tjson.Unmarshal(ctx.RequestCtx.Request.Body(), &c)\n\n\t// Creating UUID Version 4\n\tuuid := uuid.NewV4()\n\tfmt.Println(uuid.String())\n\n\tc.Id = uuid.String()\n\n\t// Insert reference to DeviceId\n\tdid := ctx.Param(\"device_id\")\n\tc.Device = did\n\n\t// Timestamp\n\tt := time.Now().UTC().Format(time.RFC3339)\n\tc.Created, c.Updated = t, t\n\n\t// Insert Channel\n\terr := Db.C(\"channels\").Insert(c)\n\tif err != nil {\n\t\tctx.JSON(iris.StatusInternalServerError, iris.Map{\"response\": \"cannot create device\"})\n\t\treturn\n\t}\n\n\tctx.JSON(iris.StatusCreated, iris.Map{\"response\": \"created\", \"id\": c.Id})\n}", "func Create(client *occlient.Client, cmp string) (*URL, error) {\n\n\tapp, err := application.GetCurrentOrDefault(client)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get current application\")\n\t}\n\n\tlabels, err := component.GetLabels(cmp, app, false)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get labels\")\n\t}\n\n\troute, err := client.CreateRoute(cmp, labels)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to create route\")\n\t}\n\n\treturn &URL{\n\t\tName: route.Name,\n\t\tURL: route.Spec.Host,\n\t}, nil\n}", "func (w *ServerInterfaceWrapper) CreateCategory(ctx echo.Context) error {\n\tvar err error\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.CreateCategory(ctx)\n\treturn err\n}", "func (c *TrackerController) Create(ctx *app.CreateTrackerContext) error {\n\tresult := application.Transactional(c.db, func(appl application.Application) error {\n\t\tt, err := appl.Trackers().Create(ctx.Context, ctx.Payload.URL, ctx.Payload.Type)\n\t\tif err != nil {\n\t\t\tswitch err := err.(type) {\n\t\t\tcase remoteworkitem.BadParameterError, remoteworkitem.ConversionError:\n\t\t\t\treturn goa.ErrBadRequest(err.Error())\n\t\t\tdefault:\n\t\t\t\treturn goa.ErrInternal(err.Error())\n\t\t\t}\n\t\t}\n\t\tctx.ResponseData.Header().Set(\"Location\", app.TrackerHref(t.ID))\n\t\treturn ctx.Created(t)\n\t})\n\tc.scheduler.ScheduleAllQueries()\n\treturn result\n}", "func (ctx *CreateMessageContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (c Client) Create(input *CreateActivityInput) (*CreateActivityResponse, error) {\n\treturn c.CreateWithContext(context.Background(), input)\n}", "func (__receiver_OService *OutgoingCallerIDService) Create() *OutgoingCallerIDService {\n\t__receiver_OService.action = types.CREATE\n\t__receiver_OService.data = resources.OutgoingCallerIDDetails{}\n\t__receiver_OService.url = resources.OutgoingCallerIDURLS[types.CREATE]\n\treturn __receiver_OService\n}", "func (c *SeriesController) Create(ctx *app.CreateSeriesContext) error {\n\t// SeriesController_Create: start_implement\n\tm, err := c.fm()\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`unable to get model`, `error`, err.Error())\n\t\treturn ctx.ServiceUnavailable()\n\t}\n\tdefer func() { m.Close() }()\n\n\tv, err := m.InsertSeries(ctx.Payload.SeriesName, ctx.Payload.CategoryID)\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`failed to insert series`, `error`, err.Error())\n\t\tswitch err {\n\t\tcase model.ErrDuplicateKey:\n\t\t\treturn ctx.UnprocessableEntity()\n\t\tcase model.ErrInvalidID:\n\t\t\treturn ctx.UnprocessableEntity()\n\t\tdefault:\n\t\t\treturn ctx.InternalServerError()\n\t\t}\n\t}\n\n\tctx.ResponseData.Header().Set(\"Location\", app.SeriesHref(v.ID))\n\treturn ctx.Created()\n\t// SeriesController_Create: end_implement\n}", "func (t *RestController) Create(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RestController\", \"Create\")\n\n\t{\n\t\terr := r.ParseForm()\n\n\t\tif err != nil {\n\n\t\t\tt.Log.Handle(w, r, err, \"parseform\", \"error\", \"RestController\", \"Create\")\n\t\t\tt.embed.Finalizer(w, r, err)\n\n\t\t\treturn\n\t\t}\n\n\t}\n\tvar postColor *string\n\tif _, ok := r.Form[\"color\"]; ok {\n\t\txxTmppostColor := r.FormValue(\"color\")\n\t\tt.Log.Handle(w, r, nil, \"input\", \"form\", \"color\", xxTmppostColor, \"RestController\", \"Create\")\n\t\tpostColor = &xxTmppostColor\n\t}\n\n\tjsonResBody, err := t.embed.Create(postColor)\n\n\tif err != nil {\n\n\t\tt.Log.Handle(w, r, err, \"business\", \"error\", \"RestController\", \"Create\")\n\t\tt.embed.Finalizer(w, r, err)\n\n\t\treturn\n\t}\n\n\t{\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(200)\n\t\tencErr := json.NewEncoder(w).Encode(jsonResBody)\n\n\t\tif encErr != nil {\n\n\t\t\tt.Log.Handle(w, r, encErr, \"res\", \"json\", \"encode\", \"error\", \"RestController\", \"Create\")\n\t\t\tt.embed.Finalizer(w, r, encErr)\n\n\t\t\treturn\n\t\t}\n\n\t}\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RestController\", \"Create\")\n\n}", "func LinkCreated(r *link.CreatePublicShareResponse, executant *user.UserId) events.LinkCreated {\n\treturn events.LinkCreated{\n\t\tExecutant: executant,\n\t\tShareID: r.Share.Id,\n\t\tSharer: r.Share.Creator,\n\t\tItemID: r.Share.ResourceId,\n\t\tPermissions: r.Share.Permissions,\n\t\tDisplayName: r.Share.DisplayName,\n\t\tExpiration: r.Share.Expiration,\n\t\tPasswordProtected: r.Share.PasswordProtected,\n\t\tCTime: r.Share.Ctime,\n\t\tToken: r.Share.Token,\n\t}\n}", "func forwardCreateAccount(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) {\n\tw.WriteHeader(http.StatusCreated)\n\truntime.ForwardResponseMessage(ctx, mux, marshaler, w, req, resp, opts...)\n}", "func (r *Responder) Created() { r.write(http.StatusCreated) }", "func Create(writer http.ResponseWriter, request *http.Request) {\n\ttemplate_html.ExecuteTemplate(writer, \"Create\", nil)\n}", "func MakeCreateEndpoint(s service.FilesCreatorService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(CreateRequest)\n\t\ts0 := s.Create(ctx, req.FileDescriptor)\n\t\treturn CreateResponse{S0: s0}, nil\n\t}\n}", "func Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprint(w, \"Welcome!\\n\")\n}", "func CreateHandler(svc ServiceModel) *http.Server {\n\treturn http.NewServer(\n\t\tmakeCreateEndpoint(svc),\n\t\tdecodeCreateRequest,\n\t\thttp.EncodeJSONResponse,\n\t)\n}", "func CreateBrowsing(c echo.Context) error {\n\t// TODO: implement create browsing function\n\treturn c.JSON(http.StatusCreated, \"{'hello': 'world'}\")\n}", "func (ctx *CreateItemContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (lm LinksManager) CreateFile(url *url.URL, t resource.Type) (*os.File, resource.Issue) {\n\treturn nil, resource.NewIssue(url.String(), \"NOT_IMPLEMENTED_YET\", \"CreateFile not implemented in graph.LinkLifecyleSettings\", true)\n}", "func (ctx *CreateFeedContext) CreatedTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func CreatePostHandler(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tresponse, err := restClient.Post(postsUrl, r, r.Header)\n\n\tif err != nil {\n\t\trestClient.WriteErrorResponse(w, \"server_error\", \"Server error occured\")\n\t\treturn\n\t}\n\n\tvar post Post\n\trestClient.WriteJSONResponse(w, response, post)\n}", "func (ctx *CreateOfferContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func Created(ctx *fiber.Ctx, msg string, data interface{}) error {\n\treturn Success(ctx, msg, data, http.StatusCreated)\n}", "func Create(objectName string, payload interface{}) *Writer {\n\treturn &Writer{\n\t\tCmd: \"create\",\n\t\tObjectName: objectName,\n\t\tPayload: payload,\n\t}\n}", "func CreateServiceURL(urlPath, urlQuery string) *url.URL {\n\tjoinedURLPath := path.Join(\"service\", config.ServiceName, urlPath)\n\treturn CreateURL(GetDCOSURL(), joinedURLPath, urlQuery)\n}", "func Create(c blogpb.BlogServiceClient) {\n\tblog := &blogpb.Blog{\n\t\tAuthorId: \"Rad\",\n\t\tTitle: \"Rad First Blog\",\n\t\tContent: \"Content of the first blog\",\n\t}\n\tres, err := c.CreateBlog(context.Background(), &blogpb.CreateBlogRequest{Blog: blog})\n\tif err != nil {\n\t\tlog.Fatalln(\"Unexpected error:\", err)\n\t}\n\tfmt.Println(\"Blog has been created\", res)\n}", "func (w *ServerInterfaceWrapper) CreateSecretChannel(ctx echo.Context) error {\n\tvar err error\n\n\tctx.Set(\"OAuth.Scopes\", []string{\"\"})\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.CreateSecretChannel(ctx)\n\treturn err\n}", "func (t *ThreadController) Create(c *gin.Context) {\n\tc.HTML(http.StatusOK, \"thread/create.html\", gin.H{\n\t\t\"title\": \"Welcome go forum\",\n\t\t\"content\": \"You are logged in!\",\n\t\t\"ginContext\": c,\n\t})\n}", "func (a *Client) CreateChannel(params *CreateChannelParams, authInfo runtime.ClientAuthInfoWriter) (*CreateChannelCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateChannelParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createChannel\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/channels\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &CreateChannelReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*CreateChannelCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for createChannel: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (c APIClient) CreateDataFeed(df *DataFeed) error {\n\treturn c.doHTTPBoth(\"PUT\", fmt.Sprintf(\"https://api.nsone.net/v1/data/feeds/%s\", df.SourceId), df)\n}", "func CreateChannel(service *service.Service, name, botName string) (*models.Channel, error) {\n\t// Call create channel\n\tres, err := service.SimpleCall(\"private.channel.create\", nil, wamp.Dict{\"name\": name, \"botName\": botName})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//Check and return result\n\tif len(res.Arguments) > 0 {\n\t\tchannel, err := conv.ToStringMap(res.Arguments[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tignored, err := conv.ToBool(channel[\"ignored\"])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &models.Channel{\n\t\t\tName: conv.ToString(channel[\"name\"]),\n\t\t\tBotName: conv.ToString(channel[\"bot_name\"]),\n\t\t\tNotes: conv.ToString(channel[\"notes\"]),\n\t\t\tIgnored: ignored,\n\t\t}, nil\n\t}\n\treturn nil, nil\n}", "func (ctx *CreateSecretsContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (s *Server) CreateChart() {\n\tlog.Println(\"Opening chart.html\")\n\tos.Create(\"./resources/chart.html\")\n\n\tlog.Println(\"Creating begginning of chart\")\n\tRewriteFile(\"./resources/chart_beg\", \"./resources/chart.html\")\n\n\tlog.Println(\"Building chart\")\n\ts.BuildChart()\n\n\tlog.Println(\"Creating ending of chart\")\n\tRewriteFile(\"./resources/chart_end\", \"./resources/chart.html\")\n}", "func (a *IntegrationApiService) CreateReferral(ctx _context.Context) apiCreateReferralRequest {\n\treturn apiCreateReferralRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (h *Http) Create(wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\n\tapp := fiber.New()\n\n\t// Swagger\n\tapp.Get(\"/\", func (c *fiber.Ctx) error { return c.Redirect(\"/docs/index.html\") })\n\tapp.Get(\"/docs/*\", swagger.New(swagger.Config{DeepLinking: true, URL:\"/swagger.yaml\"}))\n\tapp.Static(\"/swagger.yaml\", \"./swagger.yaml\")\n\n\t// Routes\n\tapp.Get(\"/top/confirmed\", getTopConfirmed(&cont.TopConfirmed{}))\n\n\t// Run http server\n\tapp.Listen(fmt.Sprintf(\":%d\", h.Port))\n}", "func (a *API) Create(s *funkmasta.Service) error {\n\tv := url.Values{}\n\tv.Set(\"name\", s.Name)\n\tv.Set(\"endpoint\", s.Endpoint)\n\tv.Set(\"payload\", s.Payload)\n\tv.Set(\"env\", s.EnvSetup)\n\n\t_, err := a.PostForm(CREATE, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c client) CreateService(service corev1.Service) error {\n\treturn c.Create(context.TODO(), &service)\n}", "func (a *Api) postCreateUserLink(w http.ResponseWriter, r *http.Request) {\n\taid, ok := r.Context().Value(\"account_id\").(string)\n\tif !ok {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\taccountId, ok := vars[\"id\"]\n\tif !ok {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif accountId != aid {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvar m postAccountLinkRequestModel\n\tif err := json.NewDecoder(r.Body).Decode(&m); err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tshortLink, err := a.LinkUseCases.LoggerCutLink(a.LinkUseCases.CutLink)(m.Link, &aid)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif _, err := w.Write([]byte(shortLink)); err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n}", "func createHandler (w http.ResponseWriter, r *http.Request) {\n\terr := create.ExecuteTemplate(w, \"create.html\", nil)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "func createWebhookService(\n\townerReference metav1.OwnerReference,\n\tserviceName string,\n\tnamespace string,\n) error {\n\n\tvar createService = false\n\t_, err := observer.GetService(namespace, serviceName)\n\tif err == nil {\n\t\t// service already present, no need to do anything\n\t\tcreateService = false\n\t} else {\n\t\tif errors.IsNotFound(err) {\n\t\t\tcreateService = true\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !createService {\n\t\treturn nil\n\t}\n\n\t// create service resource that refers to KubeDirector pod\n\tkdName, _ := k8sutil.GetOperatorName()\n\tserviceLabels := map[string]string{\"name\": kdName}\n\tservice := &v1.Service{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Service\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: namespace,\n\t\t\tName: serviceName,\n\t\t\tLabels: map[string]string{\"webhook\": kdName},\n\t\t\tOwnerReferences: []metav1.OwnerReference{ownerReference},\n\t\t},\n\t\tSpec: v1.ServiceSpec{\n\t\t\tSelector: serviceLabels,\n\t\t\tPorts: []v1.ServicePort{\n\t\t\t\t{\n\t\t\t\t\tProtocol: \"TCP\",\n\t\t\t\t\tPort: 443,\n\t\t\t\t\tTargetPort: intstr.FromInt(validationPort),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn shared.Create(context.TODO(), service)\n}", "func (c *Client) CreateFeed(name string) (*Feed, error) {\n\n\tcreateFeed := &CreateFeedRequest{\n\t\tName: name,\n\t}\n\tvar f Feed\n\t_, err := c.sling.Post(\"feeds\").BodyJSON(createFeed).ReceiveSuccess(&f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &f, nil\n}", "func makeCreateBookEndpoint(svc BookService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t// convert request into a createBookRequest\n\t\treq, ok := request.(createBookRequest)\n\t\tif !ok {\n\t\t\tfmt.Println(\"Error creating 'createBookRequest'\")\n\t\t}\n\n\t\t// call actual service with data from the req\n\t\tnewBook, err := svc.CreateBook(\n\t\t\treq.Bearer,\n\t\t\treq.AuthorId,\n\t\t\treq.Description,\n\t\t\treq.FirstPublishedYear,\n\t\t\treq.GoodReadsUrl,\n\t\t\treq.ImageLarge,\n\t\t\treq.ImageMedium,\n\t\t\treq.ImageSmall,\n\t\t\treq.Isbns,\n\t\t\treq.OpenlibraryWorkUrl,\n\t\t\treq.Subjects,\n\t\t\treq.Title)\n\n\t\tfmt.Println(\"[book.transport] got error: \", err)\n\n\t\treturn createBookResponse{\n\t\t\tData: newBook,\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func (ctx *CreateHostContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (ctx *CreateProfileContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func MakeCreateActivity(activityID *url.URL) vocab.ActivityStreamsCreate {\n\tactivity := streams.NewActivityStreamsCreate()\n\tid := streams.NewJSONLDIdProperty()\n\tid.Set(activityID)\n\tactivity.SetJSONLDId(id)\n\n\treturn activity\n}", "func (c *globalThreatFeeds) Create(ctx context.Context, globalThreatFeed *v3.GlobalThreatFeed, opts v1.CreateOptions) (result *v3.GlobalThreatFeed, err error) {\n\tresult = &v3.GlobalThreatFeed{}\n\terr = c.client.Post().\n\t\tResource(\"globalthreatfeeds\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(globalThreatFeed).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func (c *Client) ChannelCreate(ctx context.Context, r ChannelCreateRequest) (*ChannelCreateReply, error) {\r\n\tpayload, err := json.Marshal(r)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treq, err := http.NewRequestWithContext(\r\n\t\tctx,\r\n\t\thttp.MethodPost,\r\n\t\tfmt.Sprintf(\"%s/%s/channel\", c.getChanelBaseEndpoint(), r.AccountID),\r\n\t\tbytes.NewBuffer(payload),\r\n\t)\r\n\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tres := ChannelCreateReply{}\r\n\tif err := c.sendRequest(req, &res); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn &res, nil\r\n}", "func (service *ContrailService) RESTCreateDashboard(c echo.Context) error {\n\trequestData := &models.CreateDashboardRequest{}\n\tif err := c.Bind(requestData); err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"err\": err,\n\t\t\t\"resource\": \"dashboard\",\n\t\t}).Debug(\"bind failed on create\")\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, \"Invalid JSON format\")\n\t}\n\tctx := c.Request().Context()\n\tresponse, err := service.CreateDashboard(ctx, requestData)\n\tif err != nil {\n\t\treturn common.ToHTTPError(err)\n\t}\n\treturn c.JSON(http.StatusCreated, response)\n}", "func (r *PropertiesUserLinksService) Create(parent string, googleanalyticsadminv1alphauserlink *GoogleAnalyticsAdminV1alphaUserLink) *PropertiesUserLinksCreateCall {\n\tc := &PropertiesUserLinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.googleanalyticsadminv1alphauserlink = googleanalyticsadminv1alphauserlink\n\treturn c\n}", "func CreateHandler(c buffalo.Context) error {\n\tcreateStream()\n\treturn c.Render(http.StatusOK, r.HTML(\"index.html\"))\n}", "func NewServiceWriter(conf *config.AgentConfig, InServices <-chan model.ServicesMetadata) *ServiceWriter {\n\tvar endpoint Endpoint\n\n\tif conf.APIEnabled {\n\t\tclient := NewClient(conf)\n\t\tendpoint = NewDatadogEndpoint(client, conf.APIEndpoint, \"/api/v0.2/services\", conf.APIKey)\n\t} else {\n\t\tlog.Info(\"API interface is disabled, flushing to /dev/null instead\")\n\t\tendpoint = &NullEndpoint{}\n\t}\n\n\treturn &ServiceWriter{\n\t\tendpoint: endpoint,\n\n\t\tInServices: InServices,\n\n\t\tserviceBuffer: make(model.ServicesMetadata),\n\n\t\texit: make(chan struct{}),\n\t\texitWG: &sync.WaitGroup{},\n\n\t\tconf: conf,\n\t}\n}", "func (r Response) Created(code string, payload Payload, header ...ResponseHeader) {\n\tr.Response(code, http.Created, payload, header...)\n}", "func (r *ProjectsTraceSinksService) Create(parent string, tracesink *TraceSink) *ProjectsTraceSinksCreateCall {\n\tc := &ProjectsTraceSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.tracesink = tracesink\n\treturn c\n}", "func MakeCreateTodoEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(CreateTodoRequest)\n\n\t\tid, err := service.CreateTodo(ctx, req.Text)\n\n\t\tif err != nil {\n\t\t\tif endpointErr := endpointError(nil); errors.As(err, &endpointErr) && endpointErr.EndpointError() {\n\t\t\t\treturn CreateTodoResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tId: id,\n\t\t\t\t}, err\n\t\t\t}\n\n\t\t\treturn CreateTodoResponse{\n\t\t\t\tErr: err,\n\t\t\t\tId: id,\n\t\t\t}, nil\n\t\t}\n\n\t\treturn CreateTodoResponse{Id: id}, nil\n\t}\n}", "func (c *Controller) Create(w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\ttoken := r.FormValue(\"token\")\n\tmaxPlayers := r.FormValue(\"maxPlayers\")\n\tname := r.FormValue(\"name\")\n\tservice, err := createDSTService(token, maxPlayers, name)\n\tif c.CheckError(err, http.StatusBadRequest, w) {\n\t\treturn\n\t}\n\tc.SendJSON(\n\t\tw,\n\t\tr,\n\t\tservice,\n\t\thttp.StatusOK,\n\t)\n}", "func New(ctx *sweetygo.Context) error {\n\ttitle := ctx.Param(\"title\")\n\tcat := ctx.Param(\"cat\")\n\thtml := ctx.Param(\"html\")\n\tmd := ctx.Param(\"md\")\n\tif title != \"\" && cat != \"\" && html != \"\" && md != \"\" {\n\t\terr := model.NewPost(title, cat, html, md)\n\t\tif err != nil {\n\t\t\treturn ctx.JSON(500, 0, \"create post error\", nil)\n\t\t}\n\t\treturn ctx.JSON(201, 1, \"success\", nil)\n\t}\n\treturn ctx.JSON(406, 0, \"I can't understand what u want\", nil)\n}", "func (v TopicsResource) Create(c buffalo.Context) error {\n\t// Allocate an empty Topic\n\ttopic := &models.Topic{}\n\n\t// Bind topic to the html form elements\n\tif err := c.Bind(topic); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.WithStack(errors.New(\"no transaction found\"))\n\t}\n\n\t// Validate the data from the html form\n\tverrs, err := tx.ValidateAndCreate(topic)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif verrs.HasAny() {\n\t\t// Make the errors available inside the html template\n\t\tc.Set(\"errors\", verrs)\n\n\t\t// Render again the new.html template that the user can\n\t\t// correct the input.\n\t\treturn c.Render(422, r.Auto(c, topic))\n\t}\n\n\t// If there are no errors set a success message\n\tc.Flash().Add(\"success\", \"Topic was created successfully\")\n\n\t// and redirect to the topics index page\n\treturn c.Render(201, r.Auto(c, topic))\n}", "func CorporateCreateTicketEndpoint(svc services.CorporateCreateTicketServices, dbConn lib.DbConnection) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tif req, ok := request.(dt.CorporateCreateTicketJSONRequest); ok {\n\n\t\t\treturn svc.CorporateCreateTicket(ctx, req, dbConn), nil\n\n\t\t}\n\t\tif _, ok := request.(dt.TokenValidation); ok {\n\t\t\tlogger.Error(\"Invalid Token\")\n\t\t\treturn dt.CorporateCreateTicketJSONResponse{ResponseCode: dt.ErrInvalidToken, ResponseDesc: dt.DescInvalidToken}, nil\n\t\t}\n\t\tlogger.Error(\"Unhandled error occured: request is in unknown format\")\n\t\treturn dt.CorporateCreateTicketJSONResponse{ResponseCode: dt.ErrOthers}, nil\n\t}\n}", "func (c *Client) CreateChannel(params map[string]string) (*Channel, error) {\n\tres, err := c.post(createChannelUrl, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar tempData struct {\n\t\t*Status\n\t\tData *Channel `json:\"data\"`\n\t}\n\terr = json.Unmarshal(res.Body(), &tempData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif checkResponse(tempData.Status) != nil {\n\t\treturn nil, checkResponse(tempData.Status)\n\t}\n\treturn tempData.Data, nil\n}", "func (h *handler) CreateURL(response http.ResponseWriter, request *http.Request) {\n\tvar body createURLRequest\n\n\tdecoder := json.NewDecoder(request.Body)\n\tif err := decoder.Decode(&body); err != nil {\n\t\thttp.Error(response, \"Invalid body: \"+err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tpath := getUniquePath(body.URL)\n\n\tlog.Infof(\"Request to shorten URL '%s'. Path assigned: '%s'\", body.URL, path)\n\n\tif err := h.store.Put(path, body.URL); err != nil {\n\t\tlog.Errorf(\"Generated path '%s' cannot be stored due to: %+v\", path, err)\n\t\thttp.Error(response, \"There was a collision with the generated path, please try again\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresponse.Header().Set(\"Location\", \"/\"+path)\n\tresponse.WriteHeader(http.StatusCreated)\n}", "func (lf *ListFactory) CreateLink(caption, url string) ItemInterface {\n\treturn newListLink(caption, url)\n}", "func (ctx *CreateFilterContext) Created(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func (r *CompaniesLeadsService) Create(companyId string, createleadrequest *CreateLeadRequest) *CompaniesLeadsCreateCall {\n\tc := &CompaniesLeadsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.companyId = companyId\n\tc.createleadrequest = createleadrequest\n\treturn c\n}", "func (client DatasetClient) Create(ctx context.Context, conversionID string, datasetID string, descriptionDataset string) (result DatasetCreateFuture, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/DatasetClient.Create\")\n defer func() {\n sc := -1\n if result.FutureAPI != nil && result.FutureAPI.Response() != nil {\n sc = result.FutureAPI.Response().StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n req, err := client.CreatePreparer(ctx, conversionID, datasetID, descriptionDataset)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"creator.DatasetClient\", \"Create\", nil , \"Failure preparing request\")\n return\n }\n\n result, err = client.CreateSender(req)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"creator.DatasetClient\", \"Create\", nil , \"Failure sending request\")\n return\n }\n\n return\n}", "func (a *CheckoutApiService) CreatePaymentLink(ctx context.Context, body CreatePaymentLinkRequest) (CreatePaymentLinkResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue CreatePaymentLinkResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v2/online-checkout/payment-links\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &body\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v CreatePaymentLinkResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func (c *DefaultApiService) CreateSink(params *CreateSinkParams) (*EventsV1Sink, error) {\n\tpath := \"/v1/Sinks\"\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tif params != nil && params.Description != nil {\n\t\tdata.Set(\"Description\", *params.Description)\n\t}\n\tif params != nil && params.SinkConfiguration != nil {\n\t\tv, err := json.Marshal(params.SinkConfiguration)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdata.Set(\"SinkConfiguration\", string(v))\n\t}\n\tif params != nil && params.SinkType != nil {\n\t\tdata.Set(\"SinkType\", *params.SinkType)\n\t}\n\n\tresp, err := c.requestHandler.Post(c.baseURL+path, data, headers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tps := &EventsV1Sink{}\n\tif err := json.NewDecoder(resp.Body).Decode(ps); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ps, err\n}", "func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToReceiverCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\tresp, err := client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{200, 201, 202},\n\t})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func (a *BitlinksApiService) CreateBitlink(ctx _context.Context) ApiCreateBitlinkRequest {\n\treturn ApiCreateBitlinkRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}" ]
[ "0.69229895", "0.6145909", "0.58669114", "0.5844214", "0.55997866", "0.5495686", "0.5459521", "0.5432703", "0.5418106", "0.5390255", "0.528761", "0.5124575", "0.5030803", "0.5028406", "0.49661383", "0.49546888", "0.49511063", "0.49285695", "0.49271077", "0.49094045", "0.4908836", "0.4908836", "0.48403326", "0.48308355", "0.48288766", "0.48224324", "0.4811517", "0.48063907", "0.47999722", "0.4798935", "0.47982812", "0.47658595", "0.47563866", "0.4749721", "0.473856", "0.4735562", "0.47336745", "0.470464", "0.47009128", "0.46965855", "0.46914226", "0.46832025", "0.4681372", "0.46788284", "0.46771726", "0.46754855", "0.46685323", "0.46673012", "0.4667236", "0.4661767", "0.46571815", "0.46527663", "0.4643973", "0.46395946", "0.4638501", "0.46278608", "0.46234715", "0.46205541", "0.4619521", "0.4615559", "0.46086898", "0.46073303", "0.46068233", "0.4603119", "0.4595668", "0.45939466", "0.45867673", "0.45783892", "0.45776963", "0.45776787", "0.4575615", "0.4573061", "0.4569221", "0.45655242", "0.45623764", "0.45622113", "0.4558976", "0.45585752", "0.4552934", "0.45525968", "0.45470074", "0.45426702", "0.45418558", "0.45395738", "0.4534004", "0.45326787", "0.45323777", "0.45292893", "0.45280847", "0.4498729", "0.449708", "0.44945508", "0.44938406", "0.4491303", "0.4489533", "0.44878393", "0.44767207", "0.44718555", "0.44717637", "0.44666052" ]
0.73216164
0
CreateFeedCreatedTiny runs the method Create of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func CreateFeedCreatedTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedTiny) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} if tags != nil { sliceVal := []string{*tags} query["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} query["title"] = sliceVal } { sliceVal := []string{url_} query["url"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds"), RawQuery: query.Encode(), } req, err := http.NewRequest("POST", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} if tags != nil { sliceVal := []string{*tags} prms["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} prms["title"] = sliceVal } { sliceVal := []string{url_} prms["url"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) createCtx, _err := app.NewCreateFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.Create(createCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 201 { t.Errorf("invalid response status code: got %+v, expected 201", rw.Code) } var mt *app.FeedTiny if resp != nil { var _ok bool mt, _ok = resp.(*app.FeedTiny) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateFeedCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *CreateFeedContext) CreatedTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func CreateFeedCreatedLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateTodosCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, body string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *CreateFeedContext) Created(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func Created(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": false, \"msg\": \"`+msg+`\"}`, 201, service, \"application/json\")\n\treturn nil\n}", "func (ctx *CreateDogContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (c *Controller) Create(w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\ttoken := r.FormValue(\"token\")\n\tmaxPlayers := r.FormValue(\"maxPlayers\")\n\tname := r.FormValue(\"name\")\n\tservice, err := createDSTService(token, maxPlayers, name)\n\tif c.CheckError(err, http.StatusBadRequest, w) {\n\t\treturn\n\t}\n\tc.SendJSON(\n\t\tw,\n\t\tr,\n\t\tservice,\n\t\thttp.StatusOK,\n\t)\n}", "func Created(w http.ResponseWriter, data interface{}) {\n\tsuccessResponse := BuildSuccess(data, \"Created\", MetaInfo{HTTPStatus: http.StatusCreated})\n\tWrite(w, successResponse, http.StatusCreated)\n}", "func CreateCreatedResponse(w http.ResponseWriter, data interface{}) {\n\tif data != nil {\n\t\tbytes, err := json.Marshal(data)\n\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tw.Write(bytes)\n\t}\n}", "func CreateTaskController(w http.ResponseWriter, r *http.Request) {\n\tvar task Task\n\n\terr := json.NewDecoder(r.Body).Decode(&task)\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\ttask.Status = \"P\"\n\terr = task.Create()\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresponse, _ := json.Marshal(task)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(response)\n}", "func PostsCreateHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Posts create\")\n}", "func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func PostCreateEndpoint(creator creating.Service) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tvar post model.Post\n\t\terr := json.NewDecoder(r.Body).Decode(&post)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error decoding request body: %v: %s\", r, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tcreated, err := creator.PostCreate(post)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error creating post:\", post, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tjson.NewEncoder(w).Encode(created)\n\t}\n}", "func (ctx *CreateOutputContext) Created(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func (r *RPCTractserverTalker) Create(ctx context.Context, addr string, tsid core.TractserverID, id core.TractID, b []byte, off int64) core.Error {\n\tpri := priorityFromContext(ctx)\n\treq := core.CreateTractReq{TSID: tsid, ID: id, Off: off, Pri: pri}\n\treq.Set(b, false)\n\tvar reply core.Error\n\tif err := r.cc.Send(ctx, addr, core.CreateTractMethod, &req, &reply); err != nil {\n\t\tlog.Errorf(\"CreateTract RPC error for tract (id: %s, offset: %d) on tractserver %s@%s: %s\", id, off, tsid, addr, err)\n\t\treturn core.ErrRPC\n\t}\n\tif reply != core.NoError {\n\t\tlog.Errorf(\"CreateTract error for tract (id: %s, offset: %d) on tractserver %s@%s: %s\", id, off, tsid, addr, reply)\n\t}\n\treturn reply\n}", "func CreateTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, body string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func Create(objectName string, payload interface{}) *Writer {\n\treturn &Writer{\n\t\tCmd: \"create\",\n\t\tObjectName: objectName,\n\t\tPayload: payload,\n\t}\n}", "func (h *Http) Create(wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\n\tapp := fiber.New()\n\n\t// Swagger\n\tapp.Get(\"/\", func (c *fiber.Ctx) error { return c.Redirect(\"/docs/index.html\") })\n\tapp.Get(\"/docs/*\", swagger.New(swagger.Config{DeepLinking: true, URL:\"/swagger.yaml\"}))\n\tapp.Static(\"/swagger.yaml\", \"./swagger.yaml\")\n\n\t// Routes\n\tapp.Get(\"/top/confirmed\", getTopConfirmed(&cont.TopConfirmed{}))\n\n\t// Run http server\n\tapp.Listen(fmt.Sprintf(\":%d\", h.Port))\n}", "func NewCreateFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*CreateFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := CreateFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamTags := req.Params[\"tags\"]\n\tif len(paramTags) > 0 {\n\t\trawTags := paramTags[0]\n\t\trctx.Tags = &rawTags\n\t}\n\tparamTitle := req.Params[\"title\"]\n\tif len(paramTitle) > 0 {\n\t\trawTitle := paramTitle[0]\n\t\trctx.Title = &rawTitle\n\t}\n\tparamURL := req.Params[\"url\"]\n\tif len(paramURL) == 0 {\n\t\terr = goa.MergeErrors(err, goa.MissingParamError(\"url\"))\n\t} else {\n\t\trawURL := paramURL[0]\n\t\trctx.URL = rawURL\n\t\tif err2 := goa.ValidateFormat(goa.FormatURI, rctx.URL); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidFormatError(`url`, rctx.URL, goa.FormatURI, err2))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func New(ctx *sweetygo.Context) error {\n\ttitle := ctx.Param(\"title\")\n\tcat := ctx.Param(\"cat\")\n\thtml := ctx.Param(\"html\")\n\tmd := ctx.Param(\"md\")\n\tif title != \"\" && cat != \"\" && html != \"\" && md != \"\" {\n\t\terr := model.NewPost(title, cat, html, md)\n\t\tif err != nil {\n\t\t\treturn ctx.JSON(500, 0, \"create post error\", nil)\n\t\t}\n\t\treturn ctx.JSON(201, 1, \"success\", nil)\n\t}\n\treturn ctx.JSON(406, 0, \"I can't understand what u want\", nil)\n}", "func (t *RestController) Create(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RestController\", \"Create\")\n\n\t{\n\t\terr := r.ParseForm()\n\n\t\tif err != nil {\n\n\t\t\tt.Log.Handle(w, r, err, \"parseform\", \"error\", \"RestController\", \"Create\")\n\t\t\tt.embed.Finalizer(w, r, err)\n\n\t\t\treturn\n\t\t}\n\n\t}\n\tvar postColor *string\n\tif _, ok := r.Form[\"color\"]; ok {\n\t\txxTmppostColor := r.FormValue(\"color\")\n\t\tt.Log.Handle(w, r, nil, \"input\", \"form\", \"color\", xxTmppostColor, \"RestController\", \"Create\")\n\t\tpostColor = &xxTmppostColor\n\t}\n\n\tjsonResBody, err := t.embed.Create(postColor)\n\n\tif err != nil {\n\n\t\tt.Log.Handle(w, r, err, \"business\", \"error\", \"RestController\", \"Create\")\n\t\tt.embed.Finalizer(w, r, err)\n\n\t\treturn\n\t}\n\n\t{\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(200)\n\t\tencErr := json.NewEncoder(w).Encode(jsonResBody)\n\n\t\tif encErr != nil {\n\n\t\t\tt.Log.Handle(w, r, encErr, \"res\", \"json\", \"encode\", \"error\", \"RestController\", \"Create\")\n\t\t\tt.embed.Finalizer(w, r, encErr)\n\n\t\t\treturn\n\t\t}\n\n\t}\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RestController\", \"Create\")\n\n}", "func Create(writer http.ResponseWriter, request *http.Request) {\n\ttemplate_html.ExecuteTemplate(writer, \"Create\", nil)\n}", "func CreateHandler(svc ServiceModel) *http.Server {\n\treturn http.NewServer(\n\t\tmakeCreateEndpoint(svc),\n\t\tdecodeCreateRequest,\n\t\thttp.EncodeJSONResponse,\n\t)\n}", "func (t *ThreadController) Create(c *gin.Context) {\n\tc.HTML(http.StatusOK, \"thread/create.html\", gin.H{\n\t\t\"title\": \"Welcome go forum\",\n\t\t\"content\": \"You are logged in!\",\n\t\t\"ginContext\": c,\n\t})\n}", "func TodoCreate(w http.ResponseWriter, r *http.Request) {\n\tvar todo Todo\n\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := r.Body.Close(); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := json.Unmarshal(body, &todo); err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json;charset=UTF-8\")\n\t\tw.WriteHeader(422) // unprocessable entity\n\t\tif err := json.NewEncoder(w).Encode(err); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tt := RepoCreateTodo(todo)\n\t\tw.Header().Set(\"Content-Type\", \"application/json;charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tif err := json.NewEncoder(w).Encode(t); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t}\n\n}", "func Created(ctx *fiber.Ctx, msg string, data interface{}) error {\n\treturn Success(ctx, msg, data, http.StatusCreated)\n}", "func (ts *TweetService) CreateTweet(context.Context, *gen.CreateTweetRequest) (*gen.Tweet, error) {\n\treturn nil, nil\n}", "func Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprint(w, \"Welcome!\\n\")\n}", "func (c *TrackerController) Create(ctx *app.CreateTrackerContext) error {\n\tresult := application.Transactional(c.db, func(appl application.Application) error {\n\t\tt, err := appl.Trackers().Create(ctx.Context, ctx.Payload.URL, ctx.Payload.Type)\n\t\tif err != nil {\n\t\t\tswitch err := err.(type) {\n\t\t\tcase remoteworkitem.BadParameterError, remoteworkitem.ConversionError:\n\t\t\t\treturn goa.ErrBadRequest(err.Error())\n\t\t\tdefault:\n\t\t\t\treturn goa.ErrInternal(err.Error())\n\t\t\t}\n\t\t}\n\t\tctx.ResponseData.Header().Set(\"Location\", app.TrackerHref(t.ID))\n\t\treturn ctx.Created(t)\n\t})\n\tc.scheduler.ScheduleAllQueries()\n\treturn result\n}", "func (ctx *CreateMessageContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func CreatePostHandler(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tresponse, err := restClient.Post(postsUrl, r, r.Header)\n\n\tif err != nil {\n\t\trestClient.WriteErrorResponse(w, \"server_error\", \"Server error occured\")\n\t\treturn\n\t}\n\n\tvar post Post\n\trestClient.WriteJSONResponse(w, response, post)\n}", "func (ctx *CreateSecretsContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func makeCreateTagHandler(m *http.ServeMux, endpoints endpoint.Endpoints, options []http1.ServerOption) {\n\tm.Handle(\"/create-tag\", http1.NewServer(endpoints.CreateTagEndpoint, decodeCreateTagRequest, encodeCreateTagResponse, options...))\n}", "func (controller *ActivityController) Create(res http.ResponseWriter, req *http.Request) {\n\tif !controller.auth.IsLogin(res, req) {\n\t\thttp.Redirect(res, req, \"/login\", http.StatusSeeOther)\n\t\treturn\n\t}\n\tcontroller.render(res, req, \"activity_create.gohtml\", nil, 2)\n}", "func (c client) CreateService(service corev1.Service) error {\n\treturn c.Create(context.TODO(), &service)\n}", "func HandleCreate(wf workflow.CreateFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tvar requestDTO CreateRequestDTO\n\t\terr := decoder.Decode(&requestDTO)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tcreateRequest := createRequestFromCreateRequestDTO(requestDTO)\n\t\tcustomer, err := wf(createRequest)\n\t\tif err != nil {\n\t\t\thandleWorkflowError(err, w)\n\t\t\treturn\n\t\t}\n\t\tresponse := createResponseDTOFromCustomer(*customer)\n\t\tencodeErr := json.NewEncoder(w).Encode(response)\n\t\tif encodeErr != nil {\n\t\t\tlog.Fatal(encodeErr)\n\t\t}\n\t}\n}", "func (c *TasteClient) Create() *TasteCreate {\n\tmutation := newTasteMutation(c.config, OpCreate)\n\treturn &TasteCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func MakeCreateTodoEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(CreateTodoRequest)\n\n\t\tid, err := service.CreateTodo(ctx, req.Text)\n\n\t\tif err != nil {\n\t\t\tif endpointErr := endpointError(nil); errors.As(err, &endpointErr) && endpointErr.EndpointError() {\n\t\t\t\treturn CreateTodoResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tId: id,\n\t\t\t\t}, err\n\t\t\t}\n\n\t\t\treturn CreateTodoResponse{\n\t\t\t\tErr: err,\n\t\t\t\tId: id,\n\t\t\t}, nil\n\t\t}\n\n\t\treturn CreateTodoResponse{Id: id}, nil\n\t}\n}", "func createHandler (w http.ResponseWriter, r *http.Request) {\n\terr := create.ExecuteTemplate(w, \"create.html\", nil)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "func CreateHandler(c buffalo.Context) error {\n\tcreateStream()\n\treturn c.Render(http.StatusOK, r.HTML(\"index.html\"))\n}", "func (widgetController WidgetController) CreateWidget(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\t// Stub an widget to be populated from the body\n\twidget := models.Widget{}\n\n\t// Populate the widget data\n\tjson.NewDecoder(r.Body).Decode(&widget)\n\n\t// Add an Id\n\twidget.Id = bson.NewObjectId()\n\n\t// Write the widget to mongo\n\twidgetController.session.DB(common.AppConfig.Database).C(\"widgets\").Insert(widget)\n\n\t// Marshal provided interface into JSON structure\n\twidgetJSON, _ := json.Marshal(widget)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(201)\n\tfmt.Fprintf(w, \"%s\", widgetJSON)\n}", "func (_obj *DataService) CreateActivity(activityInfo *ActivityInfo, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = activityInfo.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"createActivity\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func NewServiceWriter(conf *config.AgentConfig, InServices <-chan model.ServicesMetadata) *ServiceWriter {\n\tvar endpoint Endpoint\n\n\tif conf.APIEnabled {\n\t\tclient := NewClient(conf)\n\t\tendpoint = NewDatadogEndpoint(client, conf.APIEndpoint, \"/api/v0.2/services\", conf.APIKey)\n\t} else {\n\t\tlog.Info(\"API interface is disabled, flushing to /dev/null instead\")\n\t\tendpoint = &NullEndpoint{}\n\t}\n\n\treturn &ServiceWriter{\n\t\tendpoint: endpoint,\n\n\t\tInServices: InServices,\n\n\t\tserviceBuffer: make(model.ServicesMetadata),\n\n\t\texit: make(chan struct{}),\n\t\texitWG: &sync.WaitGroup{},\n\n\t\tconf: conf,\n\t}\n}", "func (c *todoController) Create(ctx *fiber.Ctx) error {\n\tb := new(CreateDTO)\n\n\tif err := utils.ParseBodyAndValidate(ctx, b); err != nil {\n\t\treturn err\n\t}\n\n\tuser := utils.GetUser(ctx)\n\ttodo, err := c.useCase.Create(b, user)\n\n\tif err != nil {\n\t\treturn fiber.NewError(fiber.StatusConflict, err.Error())\n\t}\n\n\treturn ctx.JSON(&TodoCreateResponse{\n\t\tTodo: &TodoResponse{\n\t\t\tID: todo.ID,\n\t\t\tTask: todo.Task,\n\t\t\tCompleted: todo.Completed,\n\t\t},\n\t})\n}", "func (r *Responder) Created() { r.write(http.StatusCreated) }", "func MakeCreateEndpoint(s service.FilesCreatorService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(CreateRequest)\n\t\ts0 := s.Create(ctx, req.FileDescriptor)\n\t\treturn CreateResponse{S0: s0}, nil\n\t}\n}", "func (m *MessagesController) Create(ctx *gin.Context) {\n\tmessageIn := &tat.MessageJSON{}\n\tctx.Bind(messageIn)\n\tout, code, err := m.createSingle(ctx, messageIn)\n\tif err != nil {\n\t\tctx.JSON(code, gin.H{\"error\": err})\n\t\treturn\n\t}\n\tctx.JSON(code, out)\n}", "func CreateToken(ctx *context.Context, resp http.ResponseWriter, req *http.Request) {\n\n\t// Get user from context\n\tuser := ctx.GetUser()\n\tif user == nil {\n\t\tctx.Unauthorized(\"missing user, please login first\")\n\t\treturn\n\t}\n\n\t// Read request body\n\tdefer func() { _ = req.Body.Close() }()\n\n\treq.Body = http.MaxBytesReader(resp, req.Body, 1048576)\n\tbody, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tctx.BadRequest(fmt.Sprintf(\"unable to read request body : %s\", err))\n\t\treturn\n\t}\n\n\t// Create token\n\ttoken := common.NewToken()\n\n\t// Deserialize json body\n\tif len(body) > 0 {\n\t\terr = json.Unmarshal(body, token)\n\t\tif err != nil {\n\t\t\tctx.BadRequest(fmt.Sprintf(\"unable to deserialize request body : %s\", err))\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Generate token uuid and set creation date\n\ttoken.Initialize()\n\ttoken.UserID = user.ID\n\n\t// Save token\n\terr = ctx.GetMetadataBackend().CreateToken(token)\n\tif err != nil {\n\t\tctx.InternalServerError(\"unable to create token : %s\", err)\n\t\treturn\n\t}\n\n\t// Print token in the json response.\n\tvar bytes []byte\n\tif bytes, err = utils.ToJson(token); err != nil {\n\t\tpanic(fmt.Errorf(\"unable to serialize json response : %s\", err))\n\t}\n\n\t_, _ = resp.Write(bytes)\n}", "func StartFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (api *API) CreateComet(ctx context.Context, request *proto.CreateCometRequest) (*proto.CreateCometResponse, error) {\n\n\t// Validate user input\n\tif request.TimeRequested == \"\" {\n\t\treturn &proto.CreateCometResponse{},\n\t\t\tstatus.Error(codes.FailedPrecondition, \"comet duration requried\")\n\t}\n\n\tif request.Size == 0 {\n\t\treturn &proto.CreateCometResponse{},\n\t\t\tstatus.Error(codes.FailedPrecondition, \"size required\")\n\t}\n\n\tname := request.Name\n\tif name == \"\" {\n\t\tname = namegen.GenerateName()\n\t}\n\n\tnewComet := proto.Comet{\n\t\tId: string(utils.GenerateRandString(api.config.Comet.IDLength)),\n\t\tName: name,\n\t\tNotes: request.Notes,\n\t\tSize: proto.Comet_Size(request.Size),\n\t\tStatus: proto.Comet_PENDING,\n\t\tCreated: time.Now().Unix(),\n\t\tModified: time.Now().Unix(),\n\t\t// (TODO) Calculate Deletion time here\n\t\tMetadata: request.Metadata,\n\t}\n\n\tmachineRequest := &backendProto.CreateMachineRequest{\n\t\tId: newComet.Id,\n\t\tName: newComet.Name,\n\t\tSize: backendProto.CreateMachineRequest_Size(newComet.Size),\n\t\tMetadata: newComet.Metadata,\n\t}\n\n\terr := api.storage.AddComet(newComet.Id, &newComet)\n\tif err != nil {\n\t\treturn &proto.CreateCometResponse{},\n\t\t\tstatus.Errorf(codes.Internal, \"could not create comet:%v\", err)\n\t}\n\n\tgo api.spawnComet(machineRequest)\n\n\treturn &proto.CreateCometResponse{Comet: &newComet}, nil\n}", "func (t *TeamsService) Create(opts *TeamRequest) (*TeamResponse, *simpleresty.Response, error) {\n\tvar result *TeamResponse\n\turlStr := t.client.http.RequestURL(\"/teams\")\n\n\t// Set the correct authentication header\n\tt.client.setAuthTokenHeader(t.client.accountAccessToken)\n\n\t// Execute the request\n\tresponse, getErr := t.client.http.Post(urlStr, &result, opts)\n\n\treturn result, response, getErr\n}", "func CreateService(init InitService) (*Canopus, error) {\n\tvalidate := validator.New()\n\n\terr := validate.Struct(init)\n\tif err != nil {\n\t\treturn &Canopus{}, err\n\t}\n\n\tcanType := DefaultType\n\ttimeout := DefaultDuration\n\n\tif init.Type != \"\" {\n\t\tcanType = init.Type\n\t}\n\tif init.TimeOut != 0 {\n\t\ttimeout = init.TimeOut\n\t}\n\n\tclient := &http.Client{Timeout: timeout}\n\treturn &Canopus{\n\t\tType: canType,\n\t\tMerchantKey: init.MerchantKey,\n\t\tMerchantPem: init.MerchantPem,\n\t\tMerchantID: init.MerchantID,\n\t\tSecret: init.Secret,\n\t\tClient: client,\n\t\tValidator: validate,\n\t}, nil\n}", "func NewCreateDogContext(ctx context.Context, r *http.Request, service *goa.Service) (*CreateDogContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := CreateDogContext{Context: ctx, ResponseData: resp, RequestData: req}\n\treturn &rctx, err\n}", "func (ctx *UploadOpmlContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (h *httpHandler) CreateServiceBroker(w http.ResponseWriter, r *http.Request) {\n\tvar sbReq scmodel.CreateServiceBrokerRequest\n\terr := util.BodyToObject(r, &sbReq)\n\tif err != nil {\n\t\tlog.Printf(\"Error unmarshaling: %#v\\n\", err)\n\t\tutil.WriteResponse(w, 400, err)\n\t\treturn\n\t}\n\n\tsb := scmodel.ServiceBroker{\n\t\tGUID: uuid.NewV4().String(),\n\t\tName: sbReq.Name,\n\t\tBrokerURL: sbReq.BrokerURL,\n\t\tAuthUsername: sbReq.AuthUsername,\n\t\tAuthPassword: sbReq.AuthPassword,\n\n\t\tCreated: time.Now().Unix(),\n\t\tUpdated: 0,\n\t}\n\tsb.SelfURL = \"/v2/service_brokers/\" + sb.GUID\n\n\t// TODO: This should just store the record in k8s storage. FIX ME.\n\tcreated, err := h.controller.CreateServiceBroker(&sb)\n\tif err != nil {\n\t\tlog.Printf(\"Error creating a service broker: %v\\n\", err)\n\t\tutil.WriteResponse(w, 400, err)\n\t\treturn\n\t}\n\tsbRes := scmodel.CreateServiceBrokerResponse{\n\t\tMetadata: scmodel.ServiceBrokerMetadata{\n\t\t\tGUID: created.GUID,\n\t\t\tCreatedAt: time.Unix(created.Created, 0).Format(time.RFC3339),\n\t\t\tURL: created.SelfURL,\n\t\t},\n\t\tEntity: scmodel.ServiceBrokerEntity{\n\t\t\tName: created.Name,\n\t\t\tBrokerURL: created.BrokerURL,\n\t\t\tAuthUsername: created.AuthUsername,\n\t\t},\n\t}\n\tutil.WriteResponse(w, 200, sbRes)\n}", "func (a *DefaultApiService) CreateConsumer(consumerInput Consumer) ( *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/consumers\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &consumerInput\n\tr, err := a.client.prepareRequest(nil, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t localVarHttpResponse, err := a.client.callAPI(r)\n\t if err != nil || localVarHttpResponse == nil {\n\t\t return localVarHttpResponse, err\n\t }\n\t defer localVarHttpResponse.Body.Close()\n\t if localVarHttpResponse.StatusCode >= 300 {\n\t\treturn localVarHttpResponse, reportError(localVarHttpResponse.Status)\n\t }\n\n\treturn localVarHttpResponse, err\n}", "func (c *BulkDeletesController) Create(ctx *gin.Context) {\n\trequest := models.BulkDeleteRunRequest{}\n\tif err := ctx.ShouldBindJSON(&request); err != nil {\n\t\tctx.AbortWithError(422, err)\n\t} else if task, err := models.NewBulkDeleteRunTask(request); err != nil {\n\t\tctx.AbortWithError(422, err)\n\t} else if err := c.App.GetStore().Save(task); err != nil {\n\t\tctx.AbortWithError(500, err)\n\t} else if doc, err := jsonapi.Marshal(task); err != nil {\n\t\tctx.AbortWithError(500, err)\n\t} else {\n\t\tc.App.WakeBulkRunDeleter()\n\t\tctx.Data(201, MediaType, doc)\n\t}\n}", "func (h *todoHTTPHandler) CreateTodo(c echo.Context) error {\n todo, err := sanitizer.Todo(c)\n\tif err != nil && err != state.ErrDataNotFound {\n response := helper.TodoResponse()\n\t\tresponse.ErrorMessage = err.Error()\n\t\tresponse.Code = http.StatusInternalServerError\n\t\treturn c.JSON(http.StatusInternalServerError, response)\n }\n response, err := h.TodoUseCase.CreateTodo(todo)\n\tif err != nil && err != state.ErrDataNotFound {\n\t\tresponse.ErrorMessage = err.Error()\n\t\tresponse.Code = http.StatusInternalServerError\n\t\treturn c.JSON(http.StatusInternalServerError, response)\n }\n\tresponse.Code = http.StatusOK\n return c.JSON(http.StatusOK, response)\n}", "func (ctx *CreateCommentContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (ctx *CreateCommentContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (ctx *ShowSecretsContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func (client DatasetClient) Create(ctx context.Context, conversionID string, datasetID string, descriptionDataset string) (result DatasetCreateFuture, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/DatasetClient.Create\")\n defer func() {\n sc := -1\n if result.FutureAPI != nil && result.FutureAPI.Response() != nil {\n sc = result.FutureAPI.Response().StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n req, err := client.CreatePreparer(ctx, conversionID, datasetID, descriptionDataset)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"creator.DatasetClient\", \"Create\", nil , \"Failure preparing request\")\n return\n }\n\n result, err = client.CreateSender(req)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"creator.DatasetClient\", \"Create\", nil , \"Failure sending request\")\n return\n }\n\n return\n}", "func (ctx *CreateProfileContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func Created() Response {\n\treturn Response{\n\t\tStatusCode: http.StatusCreated,\n\t}\n}", "func MakeCreateActivity(activityID *url.URL) vocab.ActivityStreamsCreate {\n\tactivity := streams.NewActivityStreamsCreate()\n\tid := streams.NewJSONLDIdProperty()\n\tid.Set(activityID)\n\tactivity.SetJSONLDId(id)\n\n\treturn activity\n}", "func (s *toDoServiceServer) Create(ctx context.Context, req *v1.CreateRequest) (*v1.CreateResponse, error) {\n\t// check if the API version requested by app is supported by server\n\tif err := s.checkAPI(req.Api); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// get SQL connection\n\tc, err := s.connect(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\n\treminder, err := ptypes.Timestamp(req.ToDo.Reminder)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"Reminder field has invalid format %v\", err.Error())\n\t}\n\n\t// insert To-Do entity data\n\tres, err := c.ExecContext(ctx, \"INSERT INTO to_do_db.to_do(`title`, `description`, `reminder`) VALUES(?,?,?)\",\n\t\treq.ToDo.Title, req.ToDo.Description, reminder)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unknown, \"Failed to insert into to_do with err: %v\", err.Error())\n\t}\n\n\t// get ID of created to_do\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unknown, \"Failed to retrieve ID for created to_do with err: %v\", err.Error())\n\t}\n\n\treturn &v1.CreateResponse{\n\t\tApi: apiVersion,\n\t\tId: id,\n\t}, nil\n}", "func CreateCreateTagTaskResponse() (response *CreateTagTaskResponse) {\n\tresponse = &CreateTagTaskResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CorporateCreateTicketEndpoint(svc services.CorporateCreateTicketServices, dbConn lib.DbConnection) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tif req, ok := request.(dt.CorporateCreateTicketJSONRequest); ok {\n\n\t\t\treturn svc.CorporateCreateTicket(ctx, req, dbConn), nil\n\n\t\t}\n\t\tif _, ok := request.(dt.TokenValidation); ok {\n\t\t\tlogger.Error(\"Invalid Token\")\n\t\t\treturn dt.CorporateCreateTicketJSONResponse{ResponseCode: dt.ErrInvalidToken, ResponseDesc: dt.DescInvalidToken}, nil\n\t\t}\n\t\tlogger.Error(\"Unhandled error occured: request is in unknown format\")\n\t\treturn dt.CorporateCreateTicketJSONResponse{ResponseCode: dt.ErrOthers}, nil\n\t}\n}", "func Created(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"201 Created\")\n\t}\n\treturn Response{Status: http.StatusCreated, Data: data, Logging: logging}\n}", "func PostServiceHandlerFunc(params service.PostProjectProjectNameServiceParams, principal *models.Principal) middleware.Responder {\n\n\tkeptnContext := uuid.New().String()\n\tl := keptnutils.NewLogger(keptnContext, \"\", \"api\")\n\tl.Info(\"API received create for service\")\n\n\ttoken, err := ws.CreateChannelInfo(keptnContext)\n\tif err != nil {\n\t\tl.Error(fmt.Sprintf(\"Error creating channel info %s\", err.Error()))\n\t\treturn getServiceInternalError(err)\n\t}\n\n\teventContext := models.EventContext{KeptnContext: &keptnContext, Token: &token}\n\n\tdeploymentStrategies, err := mapDeploymentStrategies(params.Service.DeploymentStrategies)\n\tif err != nil {\n\t\tl.Error(fmt.Sprintf(\"Cannot map dep %s\", err.Error()))\n\t\treturn getServiceInternalError(err)\n\t}\n\n\tserviceData := keptnevents.ServiceCreateEventData{\n\t\tProject: params.ProjectName,\n\t\tService: *params.Service.ServiceName,\n\t\tHelmChart: params.Service.HelmChart,\n\t\tDeploymentStrategies: deploymentStrategies,\n\t}\n\tforwardData := serviceCreateEventData{ServiceCreateEventData: serviceData, EventContext: eventContext}\n\n\terr = utils.SendEvent(keptnContext, \"\", keptnevents.InternalServiceCreateEventType, \"\", forwardData, l)\n\n\tif err != nil {\n\t\tl.Error(fmt.Sprintf(\"Error sending CloudEvent %s\", err.Error()))\n\t\treturn getServiceInternalError(err)\n\t}\n\n\treturn service.NewPostProjectProjectNameServiceOK().WithPayload(&eventContext)\n}", "func CreateCreateTopicResponse() (response *CreateTopicResponse) {\n\tresponse = &CreateTopicResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func Create(ctx context.Context, reader *Reader, writer *Writer, writeQueueChan chan bytes.Buffer) {\n\tpCtx, cancel := context.WithCancel(ctx)\n\n\tgo func() {\n\t\treader.ReadLoop(pCtx)\n\t\tcancel()\n\t}()\n\n\twriter.Serve(pCtx, writeQueueChan)\n\tcancel()\n}", "func (c Controller) create(client Client, template *Template, nameSpace, instanceID string, deploy *Payload) (*Dispatched, error) {\n\tvar (\n\t\tdispatched = &Dispatched{}\n\t\tstatusKey = StatusKey(instanceID, \"provision\")\n\t)\n\tfor _, ob := range template.Objects {\n\t\tswitch ob.(type) {\n\t\tcase *dc.DeploymentConfig:\n\t\t\tdeployment := ob.(*dc.DeploymentConfig)\n\t\t\tdeployed, err := client.CreateDeployConfigInNamespace(nameSpace, deployment)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdispatched.DeploymentName = deployed.Name\n\t\t\tdispatched.DeploymentLabels = deployed.Labels\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \"deployment created \"+deployed.Name)\n\t\tcase *k8api.Service:\n\t\t\tif _, err := client.CreateServiceInNamespace(nameSpace, ob.(*k8api.Service)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created service definition \")\n\t\tcase *route.Route:\n\t\t\tr, err := client.CreateRouteInNamespace(nameSpace, ob.(*route.Route))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdispatched.Route = r\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created route definition \")\n\t\tcase *image.ImageStream:\n\t\t\tif _, err := client.CreateImageStream(nameSpace, ob.(*image.ImageStream)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created imageStream definition \")\n\t\tcase *bc.BuildConfig:\n\t\t\tbConfig := ob.(*bc.BuildConfig)\n\t\t\tif _, err := client.CreateBuildConfigInNamespace(nameSpace, bConfig); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created buildConfig definition \")\n\t\tcase *k8api.Secret:\n\t\t\tif _, err := client.CreateSecretInNamespace(nameSpace, ob.(*k8api.Secret)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created secret definition \")\n\t\tcase *k8api.PersistentVolumeClaim:\n\t\t\tif _, err := client.CreatePersistentVolumeClaim(nameSpace, ob.(*k8api.PersistentVolumeClaim)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created PersistentVolumeClaim definition \")\n\t\tcase *k8api.Pod:\n\t\t\tif _, err := client.CreatePod(nameSpace, ob.(*k8api.Pod)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created Pod definition \")\n\t\tcase *k8api.ConfigMap:\n\t\t\tfmt.Println(\"creating config map\")\n\t\t\tif _, err := client.CreateConfigMap(nameSpace, ob.(*k8api.ConfigMap)); err != nil {\n\t\t\t\tfmt.Println(\"creating config map\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created ConfigMap definition \")\n\t\t}\n\t}\n\treturn dispatched, nil\n}", "func testDogService_CreateDog(ds *gotoproduction.DogService, fsClient *testx.FsTestingClient) func(t *testing.T) {\n\treturn func(t *testing.T) {\n\t\tfsClient.ClearData(t)\n\t\tctx := context.Background()\n\t\tis := is.New(t)\n\n\t\tcreateDogRequest := &gotoproduction.CreateDogRequest{\n\t\t\tName: \"Oscar\",\n\t\t\tAge: 1,\n\t\t\tType: \"Golden Doodle\",\n\t\t}\n\t\tdog, err := ds.CreateDog(ctx, createDogRequest)\n\t\tis.NoErr(err) // ds.CreateDog error\n\t\tgot := len(dog)\n\t\twant := 20\n\t\tis.Equal(got, want) // must have a document id\n\n\t}\n}", "func (ctx *CreateFilterContext) Created(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func Create(ctx *gin.Context, data interface{}) {\n\tctx.JSON(http.StatusCreated, gin.H{\"code\": merrors.ErrSuccess, \"data\": nil})\n\treturn\n}", "func (w *ServerInterfaceWrapper) CreateCategory(ctx echo.Context) error {\n\tvar err error\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.CreateCategory(ctx)\n\treturn err\n}", "func (a AccessTokens) Create(w http.ResponseWriter, r *http.Request) error {\n\tvar req createAccessTokenRequest\n\n\tlogger, err := middleware.GetLogger(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := jsonapi.UnmarshalPayload(r.Body, &req); err != nil {\n\t\tapi.InvalidJSONError.Render(w, http.StatusBadRequest)\n\t\treturn nil\n\t}\n\n\tstate := req.State\n\n\tcallback := make(chan OAuthCallback)\n\ta.Callbacks[state] = callback\n\n\ttoken, err := waitForCallback(callback)\n\tdelete(a.Callbacks, state)\n\n\tif err != nil {\n\t\tlogger.With(\"error\", err.Error()).Info(\"oauth request failed\")\n\t\tapi.OauthError.Render(w, http.StatusBadRequest) // TODO: improve error\n\t\treturn nil\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n\terr = json.NewEncoder(w).Encode(token)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to encode access token\")\n\t}\n\treturn nil\n}", "func (s *Accounts) CreateFunc(rw http.ResponseWriter, r *http.Request) {\n\t// Decide whether to serve sync or async, default async\n\tsync := r.FormValue(SyncQueryParameter) != \"\"\n\n\tjob, acc, err := s.service.Create(r.Context(), sync)\n\n\tif err != nil {\n\t\thandleError(rw, s.log, err)\n\t\treturn\n\t}\n\n\tvar res interface{}\n\tif sync {\n\t\tres = acc\n\t} else {\n\t\tres = job.ToJSONResponse()\n\t}\n\n\thandleJsonResponse(rw, http.StatusCreated, res)\n}", "func CreateTimelineFile(dataFileName string) *os.File {\n\tfile, err := os.Create(dataFileName)\n\tcheck(err)\n\tfmt.Fprintf(file, \"%s,%s\\n\", \"run\", \"infected\")\n\treturn file\n}", "func CreateService(cr characterRepository, pr playerRepository) *Service {\n\treturn &Service{\n\t\tcharacter: cr,\n\t\tplayer: pr,\n\t}\n}", "func (c *globalThreatFeeds) Create(ctx context.Context, globalThreatFeed *v3.GlobalThreatFeed, opts v1.CreateOptions) (result *v3.GlobalThreatFeed, err error) {\n\tresult = &v3.GlobalThreatFeed{}\n\terr = c.client.Post().\n\t\tResource(\"globalthreatfeeds\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(globalThreatFeed).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func (t *TaskService) Create(w http.ResponseWriter, r *http.Request) {\n\tvar ctx = r.Context()\n\tcurrentUser, err := common.UserFromCtx(ctx)\n\tif err != nil {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantDecodeInputData, \"TaskService.Create: %s\", \"can't get current user. err: %v\", err)\n\t\tcommon.SendBadRequest(w, r, errorcode.ErrorCantDecodeInputData)\n\t\treturn\n\t}\n\tlogger.Log.InfofCtx(r.Context(), currentUserFmt, currentUser)\n\n\ttask, err := t.extractPostTaskPayload(r, w)\n\tif err != nil {\n\t\treturn\n\t}\n\n\ttask.CreatedBy = currentUser.UID\n\ttask.PartnerID = currentUser.PartnerID\n\ttask.IsRequireNOCAccess = currentUser.IsNOCAccess\n\ttask.Schedule.StartRunTime = task.Schedule.StartRunTime.Truncate(time.Minute)\n\ttask.Schedule.EndRunTime = task.Schedule.EndRunTime.Truncate(time.Minute)\n\ttask.ID = gocql.TimeUUID()\n\tif task.TargetsByType == nil {\n\t\ttask.TargetsByType = make(models.TargetsByType)\n\t}\n\n\tif task.Targets.Type != 0 {\n\t\ttask.TargetsByType[task.Targets.Type] = task.Targets.IDs\n\t}\n\n\tfor targetType, targets := range task.TargetsByType {\n\t\ttask.Targets.Type = targetType\n\t\ttask.Targets.IDs = targets\n\t}\n\n\tsiteIDs, err := sites.GetSiteIDs(ctx, t.httpClient, currentUser.PartnerID, config.Config.SitesMsURL, currentUser.Token)\n\tif err != nil {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantCreateNewTask, \"TaskService.Create: User-Site restrictions for dynamic groups, err: %v\", err)\n\t\tcommon.SendInternalServerError(w, r, errorcode.ErrorCantCreateNewTask)\n\t\treturn\n\t}\n\n\tif ids, ok := task.TargetsByType[models.Site]; ok && len(ids) > 0 && !currentUser.IsNOCAccess {\n\t\tsite, ok := isUserSites(ids, siteIDs)\n\t\tif !ok {\n\t\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantCreateNewTask, \"TaskService.Create: User doesn't have access to site with id: %s\", site)\n\t\t\tcommon.SendForbidden(w, r, errorcode.ErrorCantCreateNewTask)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif ids, ok := task.TargetsByType[models.DynamicSite]; ok && len(ids) > 0 && !currentUser.IsNOCAccess {\n\t\tsite, ok := isUserSites(ids, siteIDs)\n\t\tif !ok {\n\t\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantCreateNewTask, \"TaskService.Create: User doesn't have access to site with id: %s\", site)\n\t\t\tcommon.SendForbidden(w, r, errorcode.ErrorCantCreateNewTask)\n\t\t\treturn\n\t\t}\n\t}\n\n\terr = t.userSitesPersistence.InsertUserSites(r.Context(), currentUser.PartnerID, currentUser.UID, siteIDs)\n\tif err != nil {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantCreateNewTask, \"TaskService.Create: User-Site restrictions for dynamic groups, err: %v\", err)\n\t\tcommon.SendInternalServerError(w, r, errorcode.ErrorCantCreateNewTask)\n\t\treturn\n\t}\n\n\tif task.ExternalTask {\n\t\tgo t.createTaskBackground(ctx, task, currentUser.IsNOCAccess, r, siteIDs)\n\t\tcommon.RenderJSONCreated(w, task)\n\t\treturn\n\t}\n\n\tt.createTaskFlow(ctx, task, currentUser, r, w, siteIDs)\n}", "func Create(c *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToNamespaceCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\treqOpt := &golangsdk.RequestOpts{OkCodes: []int{201}}\n\t_, r.Err = c.Post(rootURL(c), b, &r.Body, reqOpt)\n\treturn\n}", "func (a *Client) CreateWidget(params *CreateWidgetParams, authInfo runtime.ClientAuthInfoWriter) (*CreateWidgetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateWidgetParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createWidget\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/content/widgets\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &CreateWidgetReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*CreateWidgetOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for createWidget: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (__receiver_OService *OutgoingCallerIDService) Create() *OutgoingCallerIDService {\n\t__receiver_OService.action = types.CREATE\n\t__receiver_OService.data = resources.OutgoingCallerIDDetails{}\n\t__receiver_OService.url = resources.OutgoingCallerIDURLS[types.CREATE]\n\treturn __receiver_OService\n}", "func (client Client) CreateService(svc api.Service) (api.Service, error) {\n\tvar result api.Service\n\tbody, err := json.Marshal(svc)\n\tif err == nil {\n\t\t_, err = client.rawRequest(\"POST\", \"services\", bytes.NewBuffer(body), &result)\n\t}\n\treturn result, err\n}", "func (_obj *DataService) CreateApply(wx_id string, club_id string, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"createApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func CreateTask(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tt := Task{}\n\tdecoder := json.NewDecoder(r.Body)\n\terr := decoder.Decode(&t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = store.CreateTask(&t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "func (ts *TaskServer) createTaskHandler(rsp http.ResponseWriter, req *http.Request) {\n\ttype RequestTask struct {\n\t\tText string `json:\"text\"`\n\t\tTags []string `json:\"tags\"`\n\t\tDue time.Time `json:\"due\"`\n\t}\n\n\ttype RequestTaskID struct {\n\t\tId int `json:\"id\"`\n\t}\n\n\tcontentType := req.Header.Get(\"Content-Type\")\n\tmediatype, _, err := mime.ParseMediaType(contentType)\n\n\tif err != nil {\n\t\thttp.Error(rsp, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif mediatype != \"application/json\" {\n\t\thttp.Error(rsp, \"expect application/json Content-Type\", http.StatusUnsupportedMediaType)\n\t\treturn\n\t}\n\n\tdecoder := json.NewDecoder(req.Body)\n\tdecoder.DisallowUnknownFields()\n\n\tvar rt RequestTask\n\n\tif err := decoder.Decode(&rt); err != nil {\n\t\thttp.Error(rsp, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tid := ts.Datastore.CreateTask(rt.Text, rt.Tags, rt.Due)\n\n\tMarshalAndPrepareHTTPResponse(RequestTaskID{Id: id}, rsp)\n}", "func (c *Client) CreateService(namespace, repoName string, in *api.CreateServiceRequest) (*api.Service, error) {\n\tout := &api.Service{}\n\trawURL := fmt.Sprintf(pathServices, c.base.String(), namespace, repoName)\n\terr := c.post(rawURL, true, http.StatusCreated, in, out)\n\treturn out, errio.Error(err)\n}", "func (ctx *CreateHostContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "func Create(c blogpb.BlogServiceClient) {\n\tblog := &blogpb.Blog{\n\t\tAuthorId: \"Rad\",\n\t\tTitle: \"Rad First Blog\",\n\t\tContent: \"Content of the first blog\",\n\t}\n\tres, err := c.CreateBlog(context.Background(), &blogpb.CreateBlogRequest{Blog: blog})\n\tif err != nil {\n\t\tlog.Fatalln(\"Unexpected error:\", err)\n\t}\n\tfmt.Println(\"Blog has been created\", res)\n}", "func CreateResponse(w *gin.Context, payload interface{}) {\n\tw.JSON(200, payload)\n}", "func (a *FastlyIntegrationApi) CreateFastlyService(ctx _context.Context, accountId string, body FastlyServiceRequest) (FastlyServiceResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarReturnValue FastlyServiceResponse\n\t)\n\n\tlocalBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, \"v2.FastlyIntegrationApi.CreateFastlyService\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v2/integrations/fastly/accounts/{account_id}/services\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"account_id\"+\"}\", _neturl.PathEscape(datadog.ParameterToString(accountId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tlocalVarHeaderParams[\"Content-Type\"] = \"application/json\"\n\tlocalVarHeaderParams[\"Accept\"] = \"application/json\"\n\n\t// body params\n\tlocalVarPostBody = &body\n\tdatadog.SetAuthKeys(\n\t\tctx,\n\t\t&localVarHeaderParams,\n\t\t[2]string{\"apiKeyAuth\", \"DD-API-KEY\"},\n\t\t[2]string{\"appKeyAuth\", \"DD-APPLICATION-KEY\"},\n\t)\n\treq, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.Client.CallAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := datadog.ReadBody(localVarHTTPResponse)\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := datadog.GenericOpenAPIError{\n\t\t\tErrorBody: localVarBody,\n\t\t\tErrorMessage: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.ErrorModel = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := datadog.GenericOpenAPIError{\n\t\t\tErrorBody: localVarBody,\n\t\t\tErrorMessage: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func returnCreatedRecordResponse(w http.ResponseWriter) {\n\tformatResponseWriter(w, http.StatusCreated, \"text/plain\", []byte(OKResponseBodyMessage))\n}", "func (oo *OmciCC) SendCreateTDVar(ctx context.Context, timeout int, highPrio bool, rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) {\n\ttid := oo.GetNextTid(highPrio)\n\tlogger.Debugw(ctx, \"send TD-Create-msg:\", log.Fields{\"device-id\": oo.deviceID,\n\t\t\"SequNo\": strconv.FormatInt(int64(tid), 16),\n\t\t\"InstId\": strconv.FormatInt(int64(params[0].EntityID), 16)})\n\tmeInstance, omciErr := me.NewTrafficDescriptor(params[0])\n\tif omciErr.GetError() == nil {\n\t\tomciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid))\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot encode TD for create\", log.Fields{\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\t\tpkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot serialize TD create\", log.Fields{\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\t\tomciRxCallbackPair := CallbackPair{\n\t\t\tCbKey: tid,\n\t\t\tCbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true},\n\t\t}\n\t\terr = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair)\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot send TD create\", log.Fields{\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\t\tlogger.Debug(ctx, \"send TD-Create-msg done\")\n\t\treturn meInstance, nil\n\t}\n\tlogger.Errorw(ctx, \"Cannot generate TD Instance\", log.Fields{\"Err\": omciErr.GetError(), \"device-id\": oo.deviceID})\n\treturn nil, omciErr.GetError()\n}", "func (handler *TemperatureHandler) Create(c *gin.Context) {\n\tform := forms.NewStoresTemperature()\n\n\tif c.BindJSON(form) == nil {\n\t\tservice := services.NewTemperatureService(handler.MetricRepository)\n\t\tc.JSON(http.StatusOK, service.StoresTemperature(form))\n\t}\n}" ]
[ "0.696795", "0.62566704", "0.6006205", "0.5863447", "0.5628397", "0.55970556", "0.5495909", "0.52315795", "0.52012855", "0.5158566", "0.51257694", "0.51179165", "0.5007226", "0.49615905", "0.49548805", "0.49520215", "0.49279368", "0.49241263", "0.4918882", "0.48844898", "0.4861808", "0.48504102", "0.48485488", "0.4848184", "0.48477882", "0.4838999", "0.48319292", "0.48248112", "0.4818793", "0.4816036", "0.4802917", "0.47978824", "0.47971842", "0.47770074", "0.47565764", "0.4745763", "0.47436333", "0.474284", "0.47381845", "0.47354445", "0.47315535", "0.47279286", "0.47253516", "0.47216615", "0.47057083", "0.47027454", "0.46968603", "0.46882734", "0.46738476", "0.4650757", "0.46432546", "0.46381485", "0.46335635", "0.46320796", "0.46309704", "0.46274754", "0.46238637", "0.46206248", "0.46175846", "0.46161637", "0.4615549", "0.4615549", "0.4611244", "0.46111396", "0.4594191", "0.4590901", "0.45905763", "0.45894527", "0.45866618", "0.45848024", "0.4578853", "0.45748568", "0.45747566", "0.4571911", "0.4570072", "0.45655873", "0.45601723", "0.4558107", "0.4555828", "0.45508835", "0.45490006", "0.45462817", "0.4546199", "0.45418972", "0.4541156", "0.45395848", "0.4538936", "0.4536362", "0.45343673", "0.45238718", "0.45234847", "0.45231023", "0.45214018", "0.4514002", "0.45110384", "0.45092338", "0.45080814", "0.4505132", "0.44924864", "0.44890714" ]
0.72783166
0
DeleteFeedBadRequest runs the method Delete of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func DeleteFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), } req, err := http.NewRequest("DELETE", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) deleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } return nil, e } // Perform action _err = ctrl.Delete(deleteCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 400 { t.Errorf("invalid response status code: got %+v, expected 400", rw.Code) } var mt error if resp != nil { var _ok bool mt, _ok = resp.(error) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of error", resp, resp) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func DeleteFeedNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func DeleteTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func DeleteAllTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteAllCtx, _err := app.NewDeleteAllTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.DeleteAll(deleteAllCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewDeleteFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*DeleteFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := DeleteFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\treturn &rctx, err\n}", "func DeleteHandler(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\tid := vars[\"id\"]\n\ttoken := r.URL.Query().Get(\"auth\")\n\n\t// parameters OK ?\n\tif isEmpty(id) || isEmpty(token) {\n\t\tstatus := http.StatusBadRequest\n\t\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n\t\treturn\n\t}\n\n\t// validate the token\n\tif authtoken.Validate(config.Configuration.SharedSecret, token) == false {\n\t\tstatus := http.StatusForbidden\n\t\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n\t\treturn\n\t}\n\n\t// get the request details\n\tcount, err := dao.Store.DeleteDepositAuthorizationByID(id)\n\tif err != nil {\n\t\tlogger.Log(fmt.Sprintf(\"ERROR: %s\", err.Error()))\n\t\tstatus := http.StatusInternalServerError\n\t\tencodeStandardResponse(w, status,\n\t\t\tfmt.Sprintf(\"%s (%s)\", http.StatusText(status), err),\n\t\t\tnil)\n\t\treturn\n\t}\n\n\tif count == 0 {\n\t\tstatus := http.StatusNotFound\n\t\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n\t\treturn\n\t}\n\n\tstatus := http.StatusOK\n\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n}", "func DeleteGuestbookBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.GuestbookController, id string) (http.ResponseWriter, *app.GuestbookError) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/guestbook/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"GuestbookTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteGuestbookContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt *app.GuestbookError\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.GuestbookError)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.GuestbookError\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func DeleteBudgetHandlerFactory(ctx context.Context) Handler {\n\treturn func(w http.ResponseWriter, r *http.Request) error {\n\t\tparams := mux.Vars(r)\n\t\terr := ctx.BudgetService.Delete(params[\"id\"])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn ServeContent(w, r, \"Success\", http.StatusOK)\n\t}\n}", "func (s *Server) HandleDeleteService() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\t// Verify token\n\t\t_, err := s.auth.VerifyToken(utils.GetToken(r))\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to apply service\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tserviceID := vars[\"serviceId\"]\n\t\tversion := vars[\"version\"]\n\n\t\tif err := s.driver.DeleteService(ctx, projectID, serviceID, version); err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to apply service\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, http.StatusOK, w)\n\t}\n}", "func NewDeleteBadRequestResponseBody(res *goa.ServiceError) *DeleteBadRequestResponseBody {\n\tbody := &DeleteBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func DeleteItemsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ItemsController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/item/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ItemsTest\"), rw, req, prms)\n\tdeleteCtx, err := app.NewDeleteItemsContext(goaCtx, req, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\n\t// Perform action\n\terr = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func DeleteTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ListFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *DeleteFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func DeleteMovieEndPoint(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvar movie models.Movie\n\n\tif err := json.NewDecoder(r.Body).Decode(&movie); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\n\tif err := movieRepository.Delete(movie); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusOK, map[string]string{\"result\": \"success\"})\n}", "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func DeleteTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func DeleteItemsNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ItemsController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/item/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ItemsTest\"), rw, req, prms)\n\tdeleteCtx, err := app.NewDeleteItemsContext(goaCtx, req, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\n\t// Perform action\n\terr = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewDeleteBadRequest(body *DeleteBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func Delete(c *gin.Context) {\n\ttokenStr := c.Request.Header.Get(\"Authorization\")\n\tif tokenStr == \"\" || len(tokenStr) < 7 {\n\t\tfailUpdate(c, http.StatusUnauthorized, \"Unauthorized\")\n\t\treturn\n\t}\n\t_, admin, valid, err := ParseToken(tokenStr[7:])\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tif !valid || !admin {\n\t\tfailUpdate(c, http.StatusUnauthorized, \"Unauthorized\")\n\t\treturn\n\t}\n\n\tuserid := c.Param(\"userid\")\n\n\terr = model.Delete(userid)\n\tif err != nil {\n\t\tfailUpdate(c, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tc.JSON(http.StatusNoContent, gin.H{\n\t\t\"message\": \"Deleted successfully\",\n\t\t\"status\": http.StatusNoContent,\n\t})\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (projectController *ProjectController) Delete() func(c *gin.Context) {\n\treturn func(c *gin.Context) {\n\n\t\tid := c.Param(\"id\")\n\t\tif id == \"\" {\n\t\t\tc.JSON(http.StatusBadRequest, util.GetError(\"No se encuentra parametro :id\", nil))\n\t\t\treturn\n\t\t}\n\t\tif !bson.IsObjectIdHex(id) {\n\t\t\tc.JSON(http.StatusInternalServerError, util.GetError(\"El id ingresado no es válido\", nil))\n\t\t\treturn\n\t\t}\n\t\terr := projectModel.Delete(id)\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusBadRequest, util.GetError(\"No se pudo encontrar perro\", err))\n\t\t\treturn\n\t\t}\n\t\tc.String(http.StatusOK, \"\")\n\t}\n}", "func (r *ManagedServiceDeleteRequest) SendContext(ctx context.Context) (result *ManagedServiceDeleteResponse, err error) {\n\tquery := helpers.CopyQuery(r.query)\n\theader := helpers.CopyHeader(r.header)\n\turi := &url.URL{\n\t\tPath: r.path,\n\t\tRawQuery: query.Encode(),\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"DELETE\",\n\t\tURL: uri,\n\t\tHeader: header,\n\t}\n\tif ctx != nil {\n\t\trequest = request.WithContext(ctx)\n\t}\n\tresponse, err := r.transport.RoundTrip(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tresult = &ManagedServiceDeleteResponse{}\n\tresult.status = response.StatusCode\n\tresult.header = response.Header\n\treader := bufio.NewReader(response.Body)\n\t_, err = reader.Peek(1)\n\tif err == io.EOF {\n\t\terr = nil\n\t\treturn\n\t}\n\tif result.status >= 400 {\n\t\tresult.err, err = errors.UnmarshalErrorStatus(reader, result.status)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = result.err\n\t\treturn\n\t}\n\treturn\n}", "func NewDeleteDogContext(ctx context.Context, r *http.Request, service *goa.Service) (*DeleteDogContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := DeleteDogContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamDogID := req.Params[\"dogID\"]\n\tif len(paramDogID) > 0 {\n\t\trawDogID := paramDogID[0]\n\t\tif dogID, err2 := uuid.FromString(rawDogID); err2 == nil {\n\t\t\trctx.DogID = dogID\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"dogID\", rawDogID, \"uuid\"))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func ListTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func DeleteItemsForbidden(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ItemsController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/item/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ItemsTest\"), rw, req, prms)\n\tdeleteCtx, err := app.NewDeleteItemsContext(goaCtx, req, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\n\t// Perform action\n\terr = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 403 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 403\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) WithPayload(payload *models.ErrorResponse) *WeaviateSchemaActionsDeleteBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func deleteAppConfigHandler(ctx *gin.Context) {\n log.Info(fmt.Sprintf(\"received request to delete config %s\", ctx.Param(\"appId\")))\n\n // get app ID from path and convert to UUID\n appId, err := uuid.Parse(ctx.Param(\"appId\"))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to app ID: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid app ID\"})\n return\n }\n\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n _, err = db.GetConfigByAppId(appId)\n if err != nil {\n switch err {\n case ErrAppNotFound:\n log.Warn(fmt.Sprintf(\"cannot find config for app %s\", appId))\n ctx.JSON(http.StatusNotFound, gin.H{\n \"http_code\": http.StatusNotFound, \"message\": \"Cannot find config for app\"})\n default:\n log.Error(fmt.Errorf(\"unable to retrieve config from database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n if err := db.DeleteConfigByAppId(appId); err != nil {\n log.Error(fmt.Errorf(\"unable to delete config: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n return\n }\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"message\": \"Successfully delete config\"})\n}", "func (_obj *DataService) DeleteApplyWithContext(tarsCtx context.Context, wx_id string, club_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"deleteApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*affectRows), 3, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (mh *MetadataHandler) HandleDeleteMetadata(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\n\tvars := mux.Vars(r)\n\tvar (\n\t\tappID string\n\t\tok bool\n\t)\n\tif appID, ok = vars[\"appID\"]; !ok {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\treturn\n\t}\n\n\terr := mh.Repository.Delete(appID)\n\tif err != nil {\n\t\tif err == repository.ErrIDNotFound {\n\t\t\tw.WriteHeader(http.StatusConflict) // 409\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusInternalServerError) // 500\n\t\t}\n\t\tyaml.NewEncoder(w).Encode(err.Error())\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusNoContent) // 204\n}", "func (h *Handler) DeleteHandler(w http.ResponseWriter, r *http.Request) {\n\tid := chi.URLParam(r, \"id\")\n\n\tctx, cancel := context.WithCancel(r.Context())\n\tdefer cancel()\n\n\tvar err error\n\n\trole, err := auth.GetRole(r)\n\tif err != nil {\n\t\t_ = response.HTTPError(w, http.StatusBadRequest, response.ErrorBadRequest.Error())\n\t\treturn\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\t\t_ = response.HTTPError(w, http.StatusBadGateway, response.ErrTimeout.Error())\n\t\treturn\n\tdefault:\n\t\terr = h.service.Delete(ctx, role, id)\n\t}\n\tif err != nil {\n\t\th.log.Error(err)\n\t\t_ = response.HTTPError(w, http.StatusNotFound, err.Error())\n\t\treturn\n\t}\n\n\trender.JSON(w, r, render.M{})\n}", "func NewDeleteFilterContext(ctx context.Context, r *http.Request, service *goa.Service) (*DeleteFilterContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := DeleteFilterContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\tif id, err2 := strconv.Atoi(rawID); err2 == nil {\n\t\t\trctx.ID = id\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"id\", rawID, \"integer\"))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func (h DeviceController) Delete(c *gin.Context) {\n\ttenantID := c.Param(\"tenantId\")\n\tdeviceID := c.Param(\"deviceId\")\n\n\tctx := c.Request.Context()\n\tif err := h.app.DeleteDevice(ctx, tenantID, deviceID); err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"error\": errors.Wrap(err, \"error deleting the device\").Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tc.Writer.WriteHeader(http.StatusAccepted)\n}", "func Delete(ctx *gin.Context, data interface{}) {\n\tctx.JSON(http.StatusNoContent, gin.H{\"code\": merrors.ErrSuccess, \"data\": data})\n\treturn\n}", "func NewWeaviateSchemaActionsDeleteBadRequest() *WeaviateSchemaActionsDeleteBadRequest {\n\n\treturn &WeaviateSchemaActionsDeleteBadRequest{}\n}", "func (a *DefaultApiService) DeleteConsumer(consumerInput Consumer) ( *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/consumers\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &consumerInput\n\tr, err := a.client.prepareRequest(nil, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t localVarHttpResponse, err := a.client.callAPI(r)\n\t if err != nil || localVarHttpResponse == nil {\n\t\t return localVarHttpResponse, err\n\t }\n\t defer localVarHttpResponse.Body.Close()\n\t if localVarHttpResponse.StatusCode >= 300 {\n\t\treturn localVarHttpResponse, reportError(localVarHttpResponse.Status)\n\t }\n\n\treturn localVarHttpResponse, err\n}", "func DeleteController(ctx iris.Context) {\n\tu, ok := ctx.Values().Get(middlewares.ContextKey).(*user.User)\n\tif !ok {\n\t\tutils.ResponseErr(ctx, ErrBadUser)\n\t\treturn\n\t}\n\tid := ctx.Params().Get(\"id\")\n\tvar g gost.Gost\n\terr := g.GetGostById(id)\n\tif err != nil {\n\t\tutils.ResponseErr(ctx, ErrGostNotFound)\n\t\treturn\n\t}\n\tif u.Username != g.User.Username {\n\t\tutils.ResponseErr(ctx, ErrNotYourOwn)\n\t\treturn\n\t}\n\terr = g.Remove(true)\n\tif err != nil {\n\t\tutils.ResponseErr(ctx, err)\n\t\treturn\n\t}\n\tutils.ResponseData(ctx, fmt.Sprintf(\"Gost remove success %s!\", g.ID))\n}", "func deleteHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Received a content request. Preparing response\")\n\tresp := response{\n\t\tSuccessful: false,\n\t\tErrMsg: errors.New(\"Unknown failure\"),\n\t}\n\twriter := json.NewEncoder(w)\n\tdefer writer.Encode(resp)\n\n\t// Parse the request.\n\tfmt.Println(\"Parsing request\")\n\tdata := form{}\n\tresp.ErrMsg = json.NewDecoder(r.Body).Decode(&data)\n\n\tfmt.Println(\"Obtained following data: \")\n\tfmt.Printf(\"%+v\\n\", data)\n\n\t// Validate requestor token\n\tvalid := true\n\tvalid, resp.ErrMsg = session.Validate(data.User, data.Token)\n\n\tfilepath = path + data.ID + data.ContentType\n\n\tmodErr = update.ModifyContentFilePath(\"\")\n\tdeleteErr = delete(filepath)\n\n\tif modErr != nil {\n\t\tresp.ErrMsg = modErr\n\t} else {\n\t\tresp.ErrMsg = deleteErr\n\t}\n\n}", "func NewDeleteFeedSpacesBadRequest() *DeleteFeedSpacesBadRequest {\n\treturn &DeleteFeedSpacesBadRequest{}\n}", "func ShowTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (h *todoHandler) Delete(c echo.Context) error {\n\tctx := c.Request().Context()\n\n\tid := c.Param(\"id\")\n\n\tswitch err := h.todoService.Delete(ctx, id); err {\n\tcase serviceErrors.ErrInternal:\n\t\th.logger.Error(\n\t\t\t\"Delete error\",\n\t\t\tzap.Error(err),\n\t\t)\n\n\t\tresponseTodoStatusInternalServerErrorCounter.Inc()\n\t\treturn c.JSON(http.StatusInternalServerError, err.Error())\n\tcase serviceErrors.ErrTodoNotFound:\n\t\th.logger.Debug(\n\t\t\t\"Delete error\",\n\t\t\tzap.Error(err),\n\t\t)\n\n\t\tresponseTodoStatusNotFoundCounter.Inc()\n\t\treturn c.JSON(http.StatusNotFound, err.Error())\n\t}\n\treturn c.NoContent(http.StatusNoContent)\n}", "func (ctx *DeleteFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *DeleteDogContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (h appHandler) deleteAppHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tprojectName := vars[\"project-name\"]\n\tcompositeAppName := vars[\"composite-app-name\"]\n\tcompositeAppVersion := vars[\"version\"]\n\tname := vars[\"app-name\"]\n\n\terr := h.client.DeleteApp(name, projectName, compositeAppName, compositeAppVersion)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusNoContent)\n}", "func (ctx *DeleteOutputContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewDeleteDatasetBadRequest() *DeleteDatasetBadRequest {\n\treturn &DeleteDatasetBadRequest{}\n}", "func (appHandler *ApplicationApiHandler) DeleteApp(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tid := ps.ByName(\"id\")\n\tidint, err := strconv.Atoi(id)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\thttp.Error(w, http.StatusText(404), 404)\n\t\treturn\n\t}\n\tapp, err := appHandler.appService.DeleteApplication(idint)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\thttp.Error(w, http.StatusText(404), 404)\n\t\treturn\n\t}\n\tresponse, err := json.Marshal(app)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\thttp.Error(w, http.StatusText(404), 404)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\t_, err = w.Write(response)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\thttp.Error(w, http.StatusText(404), 404)\n\t\treturn\n\t}\n\n}", "func DeleteGuestbookNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.GuestbookController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/guestbook/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"GuestbookTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteGuestbookContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (client HTTPSuccessClient) Delete202Sender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "func (c MoviesController) DeleteMovieEndPoint(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tid := params[\"id\"]\n\tlog.Printf(\"id: %#+v\\n\", id)\n\tif err := c.moviesService.DeleteMovieById(id); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\trespondWithJson(w, http.StatusCreated, map[string]string{\"result\": \"success\"})\n}", "func (ctx *DeleteDogContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func NewDeleteOutputContext(ctx context.Context, r *http.Request, service *goa.Service) (*DeleteOutputContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := DeleteOutputContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\tif id, err2 := strconv.Atoi(rawID); err2 == nil {\n\t\t\trctx.ID = id\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"id\", rawID, \"integer\"))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func NewDeleteMessageBadRequestResponseBody(res *goa.ServiceError) *DeleteMessageBadRequestResponseBody {\n\tbody := &DeleteMessageBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func makeDeleteBookEndpoint(svc BookService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t// convert request into a bookRequest\n\t\treq := request.(deleteBookRequest)\n\n\t\t// call actual service with data from the req\n\t\terr := svc.DeleteBook(req.BookId)\n\t\treturn deleteBookResponse{\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func DeleteGuestbookNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.GuestbookController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/guestbook/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"GuestbookTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteGuestbookContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (h *Handler) serveDeleteSeries(w http.ResponseWriter, r *http.Request) {}", "func HandleDelete(\n\trepos core.RepositoryStore,\n\tbuilds core.BuildStore,\n\tstages core.StageStore,\n\tsteps core.StepStore,\n\tlogs core.LogStore,\n) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar (\n\t\t\tnamespace = chi.URLParam(r, \"owner\")\n\t\t\tname = chi.URLParam(r, \"name\")\n\t\t)\n\t\tnumber, err := strconv.ParseInt(chi.URLParam(r, \"number\"), 10, 64)\n\t\tif err != nil {\n\t\t\trender.BadRequest(w, err)\n\t\t\treturn\n\t\t}\n\t\tstageNumber, err := strconv.Atoi(chi.URLParam(r, \"stage\"))\n\t\tif err != nil {\n\t\t\trender.BadRequest(w, err)\n\t\t\treturn\n\t\t}\n\t\tstepNumber, err := strconv.Atoi(chi.URLParam(r, \"step\"))\n\t\tif err != nil {\n\t\t\trender.BadRequest(w, err)\n\t\t\treturn\n\t\t}\n\t\trepo, err := repos.FindName(r.Context(), namespace, name)\n\t\tif err != nil {\n\t\t\trender.NotFound(w, err)\n\t\t\treturn\n\t\t}\n\t\tbuild, err := builds.FindNumber(r.Context(), repo.ID, number)\n\t\tif err != nil {\n\t\t\trender.NotFound(w, err)\n\t\t\treturn\n\t\t}\n\t\tstage, err := stages.FindNumber(r.Context(), build.ID, stageNumber)\n\t\tif err != nil {\n\t\t\trender.NotFound(w, err)\n\t\t\treturn\n\t\t}\n\t\tstep, err := steps.FindNumber(r.Context(), stage.ID, stepNumber)\n\t\tif err != nil {\n\t\t\trender.NotFound(w, err)\n\t\t\treturn\n\t\t}\n\t\terr = logs.Delete(r.Context(), step.ID)\n\t\tif err != nil {\n\t\t\trender.InternalError(w, err)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(204)\n\t}\n}", "func (ctrl *RedirCtrl) Delete(c *gin.Context) {\n\tif c.Param(\"redirect\") != \"api\" || c.Param(\"url\") == \"\" {\n\t\tc.JSON(ctrl.Config.STATUS_CODES[\"BAD_REQUEST\"], gin.H{\n\t\t\t\"error\": \"Bad Request\",\n\t\t})\n\t\treturn\n\t}\n\tredir := c.Param(\"url\")\n\t// check if exists\n\tredirect, err := ctrl.RedirService.FindByRedirect(context.TODO(), redir, models.REDIRECTSCOLLECTION)\n\tif err != nil {\n\t\tc.JSON(ctrl.Config.STATUS_CODES[\"INTERNAL_SERVER_ERROR\"], gin.H{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tredirect.Deleted = true\n\tredirDeleteForm := models.DeleteRedirectForm{\n\t\tDeleted: redirect.Deleted,\n\t\tUpdatedAt: time.Now(),\n\t}\n\t// updates deleted field to true\n\t_, err = ctrl.RedirService.Update(context.TODO(), redirect.ID, redirDeleteForm, models.REDIRECTSCOLLECTION)\n\tif err != nil {\n\t\tc.JSON(ctrl.Config.STATUS_CODES[\"INTERNAL_SERVER_ERROR\"], gin.H{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tc.JSON(ctrl.Config.STATUS_CODES[\"OK\"], redirect)\n}", "func Deleted(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": false, \"msg\": \"`+msg+`\"}`, 200, service, \"application/json\")\n\treturn nil\n}", "func (controller *EchoController) Delete(context *qhttp.Context) {\n\tcontroller.Get(context)\n}", "func (rest *RestController) Delete(w http.ResponseWriter, r *http.Request) (Response, error) {\n\terr := rest.Table.Delete(models.NewDBQuery(nil, map[string]string{\"id\": getParams(r).ByName(\"id\")}))\n\tif err != nil {\n\t\treturn nil, &httpError{err, \"\", 500}\n\t}\n\treturn &TextResponse{\"\", 204}, nil\n}", "func (client HTTPSuccessClient) Delete200Sender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "func AppDeleteHandler(context utils.Context, w http.ResponseWriter, r *http.Request) {\n\n\tdbConn := context.DBConn\n\tdbBucket := context.DBBucketApp\n\n\tvars := mux.Vars(r)\n\n\tenv := vars[\"environment\"]\n\tapp := vars[\"application\"]\n\n\tkey := []byte(env + \"_\" + app)\n\n\tif err := database.DeleteDBValue(dbConn, dbBucket, key); err != nil {\n\t\tlog.LogInfo.Printf(\"Failed to read db value: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"200 - OK: valued deleted or was not found\"))\n\n}", "func CreateTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, body string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewDeleteThemeBadRequest() *DeleteThemeBadRequest {\n\treturn &DeleteThemeBadRequest{}\n}", "func (_obj *DataService) DeleteActivityWithContext(tarsCtx context.Context, activity_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(activity_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"deleteActivity\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*affectRows), 2, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func MakeDeleteItemsEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\terr := service.DeleteItems(ctx)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn DeleteItemsResponse{Err: err}, nil\n\t\t\t}\n\n\t\t\treturn DeleteItemsResponse{Err: err}, err\n\t\t}\n\n\t\treturn DeleteItemsResponse{}, nil\n\t}\n}", "func (h *CategoryHandler) Delete(ctx iris.Context) {\n\tid := ctx.Params().GetInt64Default(\"id\", 0)\n\n\taffected, err := h.service.DeleteByID(ctx.Request().Context(), id)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\twriteEntityNotFound(ctx)\n\t\t\treturn\n\t\t}\n\n\t\tdebugf(\"CategoryHandler.Delete(DB): %v\", err)\n\t\twriteInternalServerError(ctx)\n\t\treturn\n\t}\n\n\tstatus := iris.StatusOK // StatusNoContent\n\tif affected == 0 {\n\t\tstatus = iris.StatusNotModified\n\t}\n\n\tctx.StatusCode(status)\n}", "func StopFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (app *App) deleteHandler(w http.ResponseWriter, r *http.Request) {\n\tbaseErr := \"deleteHandler fails: %v\"\n\n\tid, err := app.assets.Tokens.RetrieveAccountIDFromRequest(r.Context(), r)\n\tif err != nil {\n\t\tlog.Printf(baseErr, err)\n\t\tswitch {\n\t\tcase errors.Is(err, tokens.AuthHeaderError):\n\t\t\tapi.Error2(w, api.AuthHeaderError)\n\t\tcase errors.Is(err, tokens.ErrDoesNotExist):\n\t\t\tapi.Error2(w, api.NotExistError)\n\t\tdefault:\n\t\t\tapi.Error2(w, api.DatabaseError)\n\t\t}\n\t\treturn\n\t}\n\n\tif err := app.deleteAccount(r.Context(), id); err != nil {\n\t\tapi.Error2(w, api.DatabaseError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusNoContent)\n}", "func Delete(pattern string, handler func(Context)) {\n\tmux.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method != \"DELETE\" {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\n\t\thandler(Context{\n\t\t\tResponse: w,\n\t\t\tRequest: r,\n\t\t})\n\t})\n}", "func (client HTTPSuccessClient) Delete200Responder(resp *http.Response) (result autorest.Response, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n}", "func (h Handler) Delete(ctx context.Context, request *proto.Identifier) (*proto.Message, error) {\n\terr := h.meta.SetStatus(ctx, request.UserID, deleted)\n\terr = errors.Wrap(err, \"Error while changing status\")\n\treturn &proto.Message{}, err\n}", "func (client DataFlowClient) DeleteDataFlowResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "func (ctl Controller) Delete(ctx *gin.Context) {\n\n\tMethodNotAllowedJSON(ctx)\n}", "func (client HTTPSuccessClient) Delete202Responder(resp *http.Response) (result autorest.Response, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted),\n autorest.ByClosing())\n result.Response = resp\n return\n}", "func (a *App) Delete(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"need a definition of delete on our platform\"))\n}", "func DeleteHandler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\t// Pass the call to the model with params found in the path\n\tid := request.PathParameters[\"id\"]\n\tfmt.Println(\"Path vars: \", id)\n\terr := course.Delete(id)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to find course, %v\", err))\n\t}\n\n\tmsg := fmt.Sprintf(\"Deleted course with id: %s \\n\", id)\n\treturn events.APIGatewayProxyResponse{Body: msg, StatusCode: 200}, nil\n}", "func (_obj *DataService) DeleteApplyOneWayWithContext(tarsCtx context.Context, wx_id string, club_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"deleteApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func MakeDeleteHandler(client rancher.BridgeClient) VarsHandler {\n\treturn func(w http.ResponseWriter, r *http.Request, vars map[string]string) {\n\n\t\tdefer r.Body.Close()\n\n\t\tbody, _ := ioutil.ReadAll(r.Body)\n\n\t\trequest := requests.DeleteFunctionRequest{}\n\t\terr := json.Unmarshal(body, &request)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif len(request.FunctionName) == 0 {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// This makes sure we don't delete non-labelled deployments\n\t\tservice, findErr := client.FindServiceByName(request.FunctionName)\n\t\tif findErr != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t} else if service == nil {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tdelErr := client.DeleteService(service)\n\t\tif delErr != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusOK)\n\n\t}\n}", "func NewDeleteConnectorUsingDELETEBadRequest() *DeleteConnectorUsingDELETEBadRequest {\n\treturn &DeleteConnectorUsingDELETEBadRequest{}\n}", "func DeleteApp(c echo.Context) error {\n\tid := c.Param(\"id\")\n\tsqlStatment := \"DELETE FROM apps WHERE id = $1\"\n\tres, err := d.Query(sqlStatment, id)\n\tif err != nil{\n\t\tfmt.Println(err)\n\t} else {\n\t\tfmt.Println(res)\n\t\treturn c.JSON(http.StatusOK, \"Deleted\")\n\t}\n\treturn c.JSON(http.StatusOK, \"Deleted\")\n}", "func (client ServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"serviceName\": autorest.Encode(\"path\", serviceName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2022-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsDelete(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func MakeDeleteCategoryEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteCategoryRequest)\n\t\terror := s.DeleteCategory(ctx, req.Id)\n\t\treturn DeleteCategoryResponse{Error: error}, nil\n\t}\n}", "func Delete(c *gin.Context) {\n\tid, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\terr = utils.DeleteItem(id)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"status\": \"Item deleted\"})\n}", "func Deleting(c *gin.Context) {\n\tid := c.Param(\"id\")\n\terr := db.GetRepo().Delete(id)\n\n\tif err != nil && err.Error() == \"record not found\" {\n\t\tc.Writer.WriteHeader(404)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tc.Writer.WriteHeader(500)\n\t\treturn\n\t}\n\tc.Writer.WriteHeader(204)\n\treturn\n}", "func DeleteCustomerEndPoint(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"not implemented yet !\")\n}", "func (rm *resourceManager) sdkDelete(\n\tctx context.Context,\n\tr *resource,\n) error {\n\t// TODO(jaypipes): Figure this out...\n\treturn nil\n\n}", "func (ctrl *APIController) deleteURLHandler(c *gin.Context) {\n\tvar uri deleteURLReq\n\tif err := c.ShouldBindUri(&uri); err != nil {\n\t\tfmt.Println(\"failed to bind uri :\", err.Error())\n\t\tc.Status(http.StatusBadRequest)\n\t\treturn\n\t}\n\t// test invalid ID\n\tif !checkValidID(uri.ID) {\n\t\tfmt.Println(\"requested ID is invalid\")\n\t\tc.Status(http.StatusBadRequest)\n\t\treturn\n\t}\n\t// test against bloom filter\n\tif !checkCuckoo(uri.ID, ctrl.filter) {\n\t\tfmt.Println(\"requested ID does not exist\")\n\t\tc.Status(http.StatusNotFound)\n\t\treturn\n\t}\n\tif err := ctrl.db.DeleteURL(c.Request.Context(), uri.ID); err != nil {\n\t\tfmt.Println(\"delete url failed :\", err.Msg)\n\t\tc.Status(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tc.Status(http.StatusOK)\n}", "func MakeDeleteItemEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteItemRequest)\n\n\t\terr := service.DeleteItem(ctx, req.Id)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn DeleteItemResponse{Err: err}, nil\n\t\t\t}\n\n\t\t\treturn DeleteItemResponse{Err: err}, err\n\t\t}\n\n\t\treturn DeleteItemResponse{}, nil\n\t}\n}", "func (as *ActionSuite) Test_Feeds_Delete() {\n\tfeed := &models.Feed{Name: \"TestFeed\"}\n\tres := as.JSON(\"/feeds\").Post(feed)\n\tas.Equal(201, res.Code)\n\n\tcount, err := as.DB.Count(\"feeds\")\n\tas.NoError(err)\n\tas.Equal(1, count)\n\n\terr = as.DB.First(feed)\n\tas.NoError(err)\n\tas.NotZero(feed.ID)\n\n\tw := willie.New(as.App)\n\tres2 := w.Request(\"/feeds/\" + feed.ID.String()).Delete()\n\tas.Equal(200, res2.Code)\n\n\tcount, err = as.DB.Count(\"feeds\")\n\tas.NoError(err)\n\tas.Equal(0, count)\n}", "func (client HTTPSuccessClient) Delete202(booleanValue *bool) (result autorest.Response, err error) {\n req, err := client.Delete202Preparer(booleanValue)\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Delete202\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.Delete202Sender(req)\n if err != nil {\n result.Response = resp\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Delete202\", resp, \"Failure sending request\")\n }\n\n result, err = client.Delete202Responder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Delete202\", resp, \"Failure responding to request\")\n }\n\n return\n}" ]
[ "0.657578", "0.63441384", "0.6298384", "0.5834483", "0.5750665", "0.570651", "0.5554319", "0.55251616", "0.546221", "0.5400804", "0.5363731", "0.5321341", "0.52968895", "0.5254452", "0.52483964", "0.52326703", "0.5230371", "0.5169936", "0.5163978", "0.5157558", "0.51280963", "0.5105228", "0.5095876", "0.5080504", "0.5040717", "0.49859428", "0.4979188", "0.49686256", "0.49590623", "0.49546793", "0.4938589", "0.4938263", "0.49270895", "0.49198014", "0.49124894", "0.49006546", "0.48877484", "0.48862156", "0.48851886", "0.4883746", "0.48571122", "0.48568723", "0.4851537", "0.48488504", "0.48451257", "0.48343325", "0.48295504", "0.48181975", "0.48168713", "0.4815225", "0.47961053", "0.47883546", "0.4782291", "0.47802126", "0.47797194", "0.4777824", "0.47644976", "0.47561103", "0.47508442", "0.47377843", "0.47308564", "0.47275212", "0.47233093", "0.47153774", "0.4714973", "0.47107106", "0.4708666", "0.4702233", "0.46963942", "0.46961826", "0.46903688", "0.46901807", "0.46869433", "0.46862814", "0.46826962", "0.46750635", "0.46734837", "0.46617484", "0.4656474", "0.4652284", "0.46519566", "0.46500424", "0.4645059", "0.4641199", "0.46351296", "0.46317452", "0.46290106", "0.46286097", "0.46249968", "0.46241453", "0.46234155", "0.4620509", "0.4620496", "0.46190172", "0.46117398", "0.46047446", "0.4599818", "0.45980608", "0.45966575", "0.45907715" ]
0.751924
0
DeleteFeedNoContent runs the method Delete of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func DeleteFeedNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter { // Setup service var ( logBuf bytes.Buffer respSetter goatest.ResponseSetterFunc = func(r interface{}) {} ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), } req, err := http.NewRequest("DELETE", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) deleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil } // Perform action _err = ctrl.Delete(deleteCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 204 { t.Errorf("invalid response status code: got %+v, expected 204", rw.Code) } // Return results return rw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteFeedContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "func DeleteFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func DeleteItemsNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ItemsController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/item/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ItemsTest\"), rw, req, prms)\n\tdeleteCtx, err := app.NewDeleteItemsContext(goaCtx, req, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\n\t// Perform action\n\terr = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteFilterContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "func (ctx *DeleteOutputContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "func DeleteTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteCommentContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "func (controller *EchoController) Delete(context *qhttp.Context) {\n\tcontroller.Get(context)\n}", "func DeleteHandler(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\tid := vars[\"id\"]\n\ttoken := r.URL.Query().Get(\"auth\")\n\n\t// parameters OK ?\n\tif isEmpty(id) || isEmpty(token) {\n\t\tstatus := http.StatusBadRequest\n\t\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n\t\treturn\n\t}\n\n\t// validate the token\n\tif authtoken.Validate(config.Configuration.SharedSecret, token) == false {\n\t\tstatus := http.StatusForbidden\n\t\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n\t\treturn\n\t}\n\n\t// get the request details\n\tcount, err := dao.Store.DeleteDepositAuthorizationByID(id)\n\tif err != nil {\n\t\tlogger.Log(fmt.Sprintf(\"ERROR: %s\", err.Error()))\n\t\tstatus := http.StatusInternalServerError\n\t\tencodeStandardResponse(w, status,\n\t\t\tfmt.Sprintf(\"%s (%s)\", http.StatusText(status), err),\n\t\t\tnil)\n\t\treturn\n\t}\n\n\tif count == 0 {\n\t\tstatus := http.StatusNotFound\n\t\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n\t\treturn\n\t}\n\n\tstatus := http.StatusOK\n\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n}", "func Delete(url string, r io.Reader, w io.Writer, clientGenerator func() *http.Client, reqTuner ...func(*http.Request)) error {\n\treturn Request(\"DELETE\", url, r, w, clientGenerator, reqTuner...)\n}", "func NewDeleteFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*DeleteFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := DeleteFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\treturn &rctx, err\n}", "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (c *SeaterController) NoContent(code ...int) {\n\tif len(code) > 0 {\n\t\tc.Code(code[0])\n\t} else {\n\t\tc.Code(204)\n\t}\n\tc.Ctx.Output.Body([]byte(\"\"))\n}", "func (s *Server) HandleDeleteService() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\t// Verify token\n\t\t_, err := s.auth.VerifyToken(utils.GetToken(r))\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to apply service\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tserviceID := vars[\"serviceId\"]\n\t\tversion := vars[\"version\"]\n\n\t\tif err := s.driver.DeleteService(ctx, projectID, serviceID, version); err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to apply service\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, http.StatusOK, w)\n\t}\n}", "func DeleteGuestbookNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.GuestbookController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/guestbook/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"GuestbookTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteGuestbookContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (h *Handler) serveDeleteSeries(w http.ResponseWriter, r *http.Request) {}", "func DeleteTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func Delete(ctx *gin.Context, data interface{}) {\n\tctx.JSON(http.StatusNoContent, gin.H{\"code\": merrors.ErrSuccess, \"data\": data})\n\treturn\n}", "func DeleteBudgetHandlerFactory(ctx context.Context) Handler {\n\treturn func(w http.ResponseWriter, r *http.Request) error {\n\t\tparams := mux.Vars(r)\n\t\terr := ctx.BudgetService.Delete(params[\"id\"])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn ServeContent(w, r, \"Success\", http.StatusOK)\n\t}\n}", "func DeleteController(ctx iris.Context) {\n\tu, ok := ctx.Values().Get(middlewares.ContextKey).(*user.User)\n\tif !ok {\n\t\tutils.ResponseErr(ctx, ErrBadUser)\n\t\treturn\n\t}\n\tid := ctx.Params().Get(\"id\")\n\tvar g gost.Gost\n\terr := g.GetGostById(id)\n\tif err != nil {\n\t\tutils.ResponseErr(ctx, ErrGostNotFound)\n\t\treturn\n\t}\n\tif u.Username != g.User.Username {\n\t\tutils.ResponseErr(ctx, ErrNotYourOwn)\n\t\treturn\n\t}\n\terr = g.Remove(true)\n\tif err != nil {\n\t\tutils.ResponseErr(ctx, err)\n\t\treturn\n\t}\n\tutils.ResponseData(ctx, fmt.Sprintf(\"Gost remove success %s!\", g.ID))\n}", "func DeleteWidget(res http.ResponseWriter, req *http.Request) {\n\tresp := response.New()\n\n\tresp.Render(res, req)\n}", "func (h *CategoryHandler) Delete(ctx iris.Context) {\n\tid := ctx.Params().GetInt64Default(\"id\", 0)\n\n\taffected, err := h.service.DeleteByID(ctx.Request().Context(), id)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\twriteEntityNotFound(ctx)\n\t\t\treturn\n\t\t}\n\n\t\tdebugf(\"CategoryHandler.Delete(DB): %v\", err)\n\t\twriteInternalServerError(ctx)\n\t\treturn\n\t}\n\n\tstatus := iris.StatusOK // StatusNoContent\n\tif affected == 0 {\n\t\tstatus = iris.StatusNotModified\n\t}\n\n\tctx.StatusCode(status)\n}", "func (a *DefaultApiService) DeleteConsumer(consumerInput Consumer) ( *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/consumers\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &consumerInput\n\tr, err := a.client.prepareRequest(nil, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t localVarHttpResponse, err := a.client.callAPI(r)\n\t if err != nil || localVarHttpResponse == nil {\n\t\t return localVarHttpResponse, err\n\t }\n\t defer localVarHttpResponse.Body.Close()\n\t if localVarHttpResponse.StatusCode >= 300 {\n\t\treturn localVarHttpResponse, reportError(localVarHttpResponse.Status)\n\t }\n\n\treturn localVarHttpResponse, err\n}", "func (a *App) Delete(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"need a definition of delete on our platform\"))\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func Delete(h http.Handler) http.Handler {\n\treturn HTTP(h, DELETE)\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (c *echoContext) NoContent(d int) error {\n\treturn c.ctx.NoContent(d)\n}", "func Delete(pattern string, handler func(Context)) {\n\tmux.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method != \"DELETE\" {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\n\t\thandler(Context{\n\t\t\tResponse: w,\n\t\t\tRequest: r,\n\t\t})\n\t})\n}", "func (controller *WidgetController) Delete(context *qhttp.Context) {\n\tcontroller.storage.Delete(context.URIParameters[\"id\"])\n\tcontext.SetResponse(\"\", http.StatusNoContent)\n}", "func (client HTTPSuccessClient) Delete204Sender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "func deleteHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Received a content request. Preparing response\")\n\tresp := response{\n\t\tSuccessful: false,\n\t\tErrMsg: errors.New(\"Unknown failure\"),\n\t}\n\twriter := json.NewEncoder(w)\n\tdefer writer.Encode(resp)\n\n\t// Parse the request.\n\tfmt.Println(\"Parsing request\")\n\tdata := form{}\n\tresp.ErrMsg = json.NewDecoder(r.Body).Decode(&data)\n\n\tfmt.Println(\"Obtained following data: \")\n\tfmt.Printf(\"%+v\\n\", data)\n\n\t// Validate requestor token\n\tvalid := true\n\tvalid, resp.ErrMsg = session.Validate(data.User, data.Token)\n\n\tfilepath = path + data.ID + data.ContentType\n\n\tmodErr = update.ModifyContentFilePath(\"\")\n\tdeleteErr = delete(filepath)\n\n\tif modErr != nil {\n\t\tresp.ErrMsg = modErr\n\t} else {\n\t\tresp.ErrMsg = deleteErr\n\t}\n\n}", "func (ctx *UpdateCommentContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "func Delete() {\n\treqUrl := \"https://jsonplaceholder.typicode.com/posts/1\"\n\n\tclient := http.Client{}\n\n\treq, err := http.NewRequest(http.MethodDelete, reqUrl, bytes.NewBuffer(make([]byte, 0)))\n\n\tcheckError(err)\n\n\tresp, respErr := client.Do(req)\n\n\tcheckError(respErr)\n\n\tfmt.Println(resp.StatusCode)\n}", "func (c *Client) Delete(ctx context.Context, url string, data ...interface{}) (*Response, error) {\n\treturn c.DoRequest(ctx, http.MethodDelete, url, data...)\n}", "func (sc *ServiceController) Delete() (bool, string) {\n\turl := urlService(sc.ID)\n\n\treturn sc.c.boolResponse(\"DELETE\", url, nil)\n}", "func (ctx *DeleteUserContext) NoContent(r *User) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.user+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 204, r)\n}", "func MakeDeleteCategoryEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteCategoryRequest)\n\t\terror := s.DeleteCategory(ctx, req.Id)\n\t\treturn DeleteCategoryResponse{Error: error}, nil\n\t}\n}", "func (h *todoHandler) Delete(c echo.Context) error {\n\tctx := c.Request().Context()\n\n\tid := c.Param(\"id\")\n\n\tswitch err := h.todoService.Delete(ctx, id); err {\n\tcase serviceErrors.ErrInternal:\n\t\th.logger.Error(\n\t\t\t\"Delete error\",\n\t\t\tzap.Error(err),\n\t\t)\n\n\t\tresponseTodoStatusInternalServerErrorCounter.Inc()\n\t\treturn c.JSON(http.StatusInternalServerError, err.Error())\n\tcase serviceErrors.ErrTodoNotFound:\n\t\th.logger.Debug(\n\t\t\t\"Delete error\",\n\t\t\tzap.Error(err),\n\t\t)\n\n\t\tresponseTodoStatusNotFoundCounter.Inc()\n\t\treturn c.JSON(http.StatusNotFound, err.Error())\n\t}\n\treturn c.NoContent(http.StatusNoContent)\n}", "func (ctx *Context) NoContent(code int) error {\n\tctx.ResponseWriter.WriteHeader(code)\n\treturn nil\n}", "func DeleteItemsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ItemsController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/item/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ItemsTest\"), rw, req, prms)\n\tdeleteCtx, err := app.NewDeleteItemsContext(goaCtx, req, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\n\t// Perform action\n\terr = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (rest *RESTService) ApiDELETE(w http.ResponseWriter, r *http.Request) {\n\n}", "func DeleteTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (r *Responder) NoContent() { r.write(http.StatusNoContent) }", "func (client HTTPSuccessClient) Delete200Sender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "func MakeDeleteHandler(cfg *types.Config, back types.ServerlessBackend) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t// First get the Service\n\t\tservice, _ := back.ReadService(c.Param(\"serviceName\"))\n\n\t\tif err := back.DeleteService(c.Param(\"serviceName\")); err != nil {\n\t\t\t// Check if error is caused because the service is not found\n\t\t\tif errors.IsNotFound(err) || errors.IsGone(err) {\n\t\t\t\tc.Status(http.StatusNotFound)\n\t\t\t} else {\n\t\t\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Disable input notifications\n\t\tif err := disableInputNotifications(service.GetMinIOWebhookARN(), service.Input, service.StorageProviders.MinIO[types.DefaultProvider]); err != nil {\n\t\t\tlog.Printf(\"Error disabling MinIO input notifications for service \\\"%s\\\": %v\\n\", service.Name, err)\n\t\t}\n\n\t\t// Remove the service's webhook in MinIO config and restart the server\n\t\tif err := removeMinIOWebhook(service.Name, cfg); err != nil {\n\t\t\tlog.Printf(\"Error removing MinIO webhook for service \\\"%s\\\": %v\\n\", service.Name, err)\n\t\t}\n\n\t\t// Add Yunikorn queue if enabled\n\t\tif cfg.YunikornEnable {\n\t\t\tif err := utils.DeleteYunikornQueue(cfg, back.GetKubeClientset(), service); err != nil {\n\t\t\t\tlog.Println(err.Error())\n\t\t\t}\n\t\t}\n\n\t\tc.Status(http.StatusNoContent)\n\t}\n}", "func (me Comment) Delete(ctx context.Context,\n\treq api.Request,\n\tw *api.Response,\n) (err error) {\n\tme.Before(req, me.Name)\n\tdefer func() { err = me.After(w, err) }()\n\n\tvar (\n\t\torganization = req.PathParameters[CommentOrganizationName]\n\t\tgithub = service.New(ctx, req.Headers[GithubAccessToken])\n\t)\n\n\tif req.Headers[GithubAccessToken] == \"\" {\n\t\terr = fmt.Errorf(errors.ErrorAccessDenied)\n\t\tme.Error(\"Error\", errors.NewMessage(errors.ErrorAccessDenied, \"\"))\n\t\treturn\n\t}\n\n\tif organization == \"\" {\n\t\terr = fmt.Errorf(errors.ErrorResourceNotFound)\n\t\tme.Error(\"Error\", errors.NewMessage(errors.ErrorResourceNotFound, CommentOrganizationName))\n\t\treturn\n\t}\n\n\t_, err = github.GetOrganization(organization)\n\tif err != nil {\n\t\tme.Record(\"Error\", err.Error())\n\t\terr = fmt.Errorf(errors.ErrorResourceNotFound)\n\t\tme.Error(\"Error\", errors.NewMessage(errors.ErrorResourceNotFound, CommentOrganizationName))\n\t\treturn\n\t}\n\n\tif err = database.DeleteComment(ctx, organization); err != nil {\n\t\tme.Record(\"Error\", err.Error())\n\t\terr = fmt.Errorf(errors.ErrorResourceNotFound)\n\t\tme.Error(\"Error\", errors.NewMessage(errors.ErrorResourceNotFound, CommentOrganizationName))\n\t\treturn\n\t}\n\n\tw.Stat(http.StatusNoContent)\n\tw.Output(nil)\n\n\treturn nil\n}", "func NoContent(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNoContent)\n}", "func (__receiver_OService *OutgoingCallerIDService) Delete() *OutgoingCallerIDService {\n\t__receiver_OService.action = types.DELETE\n\t__receiver_OService.data = struct{}{}\n\t__receiver_OService.url = resources.OutgoingCallerIDURLS[types.DELETE]\n\treturn __receiver_OService\n}", "func DeleteCustomerEndPoint(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"not implemented yet !\")\n}", "func (h *Handler) DeleteHandler(w http.ResponseWriter, r *http.Request) {\n\tid := chi.URLParam(r, \"id\")\n\n\tctx, cancel := context.WithCancel(r.Context())\n\tdefer cancel()\n\n\tvar err error\n\n\trole, err := auth.GetRole(r)\n\tif err != nil {\n\t\t_ = response.HTTPError(w, http.StatusBadRequest, response.ErrorBadRequest.Error())\n\t\treturn\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\t\t_ = response.HTTPError(w, http.StatusBadGateway, response.ErrTimeout.Error())\n\t\treturn\n\tdefault:\n\t\terr = h.service.Delete(ctx, role, id)\n\t}\n\tif err != nil {\n\t\th.log.Error(err)\n\t\t_ = response.HTTPError(w, http.StatusNotFound, err.Error())\n\t\treturn\n\t}\n\n\trender.JSON(w, r, render.M{})\n}", "func NewDeleteOutputContext(ctx context.Context, r *http.Request, service *goa.Service) (*DeleteOutputContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := DeleteOutputContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\tif id, err2 := strconv.Atoi(rawID); err2 == nil {\n\t\t\trctx.ID = id\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"id\", rawID, \"integer\"))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func RemoveContainerNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string, force bool) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", force)}\n\t\tquery[\"force\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/remove\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", force)}\n\t\tprms[\"force\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tremoveCtx, _err := app.NewRemoveContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Remove(removeCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (projectController *ProjectController) Delete() func(c *gin.Context) {\n\treturn func(c *gin.Context) {\n\n\t\tid := c.Param(\"id\")\n\t\tif id == \"\" {\n\t\t\tc.JSON(http.StatusBadRequest, util.GetError(\"No se encuentra parametro :id\", nil))\n\t\t\treturn\n\t\t}\n\t\tif !bson.IsObjectIdHex(id) {\n\t\t\tc.JSON(http.StatusInternalServerError, util.GetError(\"El id ingresado no es válido\", nil))\n\t\t\treturn\n\t\t}\n\t\terr := projectModel.Delete(id)\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusBadRequest, util.GetError(\"No se pudo encontrar perro\", err))\n\t\t\treturn\n\t\t}\n\t\tc.String(http.StatusOK, \"\")\n\t}\n}", "func Delete(rest interfaces.Rest) func(*fiber.Ctx) error {\n\treturn func(ctx *fiber.Ctx) error {\n\t\tappController := rest.GetAppController()\n\n\t\treturn appController.Author.GetAuthors(ctx)\n\t}\n}", "func (conn Connection) Delete(cmd string, content, result interface{}) (effect *SideEffect, resp *http.Response, err error) {\n\treturn conn.Send(http.MethodDelete, cmd, content, result)\n}", "func (rest *RestController) Delete(w http.ResponseWriter, r *http.Request) (Response, error) {\n\terr := rest.Table.Delete(models.NewDBQuery(nil, map[string]string{\"id\": getParams(r).ByName(\"id\")}))\n\tif err != nil {\n\t\treturn nil, &httpError{err, \"\", 500}\n\t}\n\treturn &TextResponse{\"\", 204}, nil\n}", "func MakeDeleteHandler(client rancher.BridgeClient) VarsHandler {\n\treturn func(w http.ResponseWriter, r *http.Request, vars map[string]string) {\n\n\t\tdefer r.Body.Close()\n\n\t\tbody, _ := ioutil.ReadAll(r.Body)\n\n\t\trequest := requests.DeleteFunctionRequest{}\n\t\terr := json.Unmarshal(body, &request)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif len(request.FunctionName) == 0 {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// This makes sure we don't delete non-labelled deployments\n\t\tservice, findErr := client.FindServiceByName(request.FunctionName)\n\t\tif findErr != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t} else if service == nil {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tdelErr := client.DeleteService(service)\n\t\tif delErr != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusOK)\n\n\t}\n}", "func (ac *ArticleController) Delete(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tu := models.UserContext(ctx)\n\tif !u.IsAdmin {\n\t\tsendJSON(\"You are not admin\", http.StatusForbidden, w)\n\t\treturn\n\t}\n\n\tp := httptreemux.ContextParams(ctx)\n\tidParam, _ := strconv.Atoi(p[\"id\"])\n\tif idParam <= 0 {\n\t\tsendJSON(\"Input not valid\", http.StatusBadRequest, w)\n\t\treturn\n\t}\n\n\tid := uint(idParam)\n\terr := models.ArticleRemove(id)\n\tif err != nil {\n\t\tif err == models.ErrNotFound {\n\t\t\tsendJSON(\"Article not found\", http.StatusNotFound, w)\n\t\t\treturn\n\t\t}\n\t\tsendJSON(\"Internal Error\", http.StatusInternalServerError, w)\n\t\treturn\n\t}\n\tcache.RemoveURL(r.URL.EscapedPath())\n\n\tsendJSON(\"Delete ok\", http.StatusOK, w)\n}", "func HTTPAPIServerStreamChannelDelete(c *gin.Context) {\n\terr := service.ChannelDelete(c.Param(\"uuid\"), c.Param(\"channel\"))\n\tif err != nil {\n\t\tc.IndentedJSON(500, Message{Status: 0, Payload: err.Error()})\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"module\": \"http_stream\",\n\t\t\t\"stream\": c.Param(\"uuid\"),\n\t\t\t\"channel\": c.Param(\"channel\"),\n\t\t\t\"func\": \"HTTPAPIServerStreamChannelDelete\",\n\t\t\t\"call\": \"StreamChannelDelete\",\n\t\t}).Errorln(err.Error())\n\t\treturn\n\t}\n\tc.IndentedJSON(200, Message{Status: 1, Payload: gss.Success})\n}", "func NoContent(w http.ResponseWriter, r *http.Request) {\n\trender.NoContent(w, r)\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func DeleteMovieEndPoint(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvar movie models.Movie\n\n\tif err := json.NewDecoder(r.Body).Decode(&movie); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\n\tif err := movieRepository.Delete(movie); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusOK, map[string]string{\"result\": \"success\"})\n}", "func Delete(ctx context.Context, url string, body Body, options ...RequestOption) (*Response, error) {\n\tr, err := newRequest(ctx, http.MethodDelete, url, body, options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr.Header.Set(\"Content-Type\", body.ContentType())\n\treturn doRequest(http.DefaultClient, r)\n}", "func MakeDeleteSiteEndpoint(svc service.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (response interface{}, err error) {\n\t\treq := request.(DeleteSiteRequest)\n\t\terr = svc.DeleteSite(ctx, req.SiteID)\n\t\treturn DeleteSiteResponse{Err: err}, nil\n\t}\n}", "func (ctx *AcceptOfferContext) NoContent() error {\n\tctx.ResponseData.WriteHeader(204)\n\treturn nil\n}", "func (v *DCHttpClient) DoWithoutContent(\n\tmethod string, url string, headers map[string]string) (response *DCHttpResponse, err error) {\n\treq, err := http.NewRequest(method, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn v.do(req, headers)\n}", "func (c *ContentCategoriesDeleteCall) Do(opts ...googleapi.CallOption) error {\n\tgensupport.SetOptions(c.urlParams_, opts...)\n\tres, err := c.doRequest(\"json\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer googleapi.CloseBody(res)\n\tif err := googleapi.CheckResponse(res); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n\t// {\n\t// \"description\": \"Deletes an existing content category.\",\n\t// \"flatPath\": \"userprofiles/{profileId}/contentCategories/{id}\",\n\t// \"httpMethod\": \"DELETE\",\n\t// \"id\": \"dfareporting.contentCategories.delete\",\n\t// \"parameterOrder\": [\n\t// \"profileId\",\n\t// \"id\"\n\t// ],\n\t// \"parameters\": {\n\t// \"id\": {\n\t// \"description\": \"Content category ID.\",\n\t// \"format\": \"int64\",\n\t// \"location\": \"path\",\n\t// \"required\": true,\n\t// \"type\": \"string\"\n\t// },\n\t// \"profileId\": {\n\t// \"description\": \"User profile ID associated with this request.\",\n\t// \"format\": \"int64\",\n\t// \"location\": \"path\",\n\t// \"required\": true,\n\t// \"type\": \"string\"\n\t// }\n\t// },\n\t// \"path\": \"userprofiles/{profileId}/contentCategories/{id}\",\n\t// \"scopes\": [\n\t// \"https://www.googleapis.com/auth/dfatrafficking\"\n\t// ]\n\t// }\n\n}", "func Delete(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tuserId, err := strconv.ParseUint(params[\"id\"], 10, 64)\n\tif err != nil {\n\t\tresponses.ERR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\trepository, db, err := OpenDataseConnection()\n\tif err != nil {\n\t\tresponses.ERR(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\terr = repository.DeleteOne(userId)\n\tif err != nil {\n\t\tresponses.ERR(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponses.JSON(w, http.StatusNoContent, nil)\n}", "func (client DataControllersClient) DeleteDataControllerSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "func Delete(c *gin.Context) {\n\ttokenStr := c.Request.Header.Get(\"Authorization\")\n\tif tokenStr == \"\" || len(tokenStr) < 7 {\n\t\tfailUpdate(c, http.StatusUnauthorized, \"Unauthorized\")\n\t\treturn\n\t}\n\t_, admin, valid, err := ParseToken(tokenStr[7:])\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tif !valid || !admin {\n\t\tfailUpdate(c, http.StatusUnauthorized, \"Unauthorized\")\n\t\treturn\n\t}\n\n\tuserid := c.Param(\"userid\")\n\n\terr = model.Delete(userid)\n\tif err != nil {\n\t\tfailUpdate(c, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tc.JSON(http.StatusNoContent, gin.H{\n\t\t\"message\": \"Deleted successfully\",\n\t\t\"status\": http.StatusNoContent,\n\t})\n}", "func TopicDelete(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab url path variables\n\turlVars := mux.Vars(r)\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\trefBrk := gorillaContext.Get(r, \"brk\").(brokers.Broker)\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\t// Get Result Object\n\n\terr := topics.RemoveTopic(projectUUID, urlVars[\"topic\"], refStr)\n\tif err != nil {\n\t\tif err.Error() == \"not found\" {\n\t\t\terr := APIErrorNotFound(\"Topic\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tfullTopic := projectUUID + \".\" + urlVars[\"topic\"]\n\terr = refBrk.DeleteTopic(fullTopic)\n\tif err != nil {\n\t\tlog.Errorf(\"Couldn't delete topic %v from broker, %v\", fullTopic, err.Error())\n\t}\n\n\t// Write empty response if anything ok\n\trespondOK(w, output)\n\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (c *Client) Delete(ctx context.Context, link string) error {\n\n\tauthKey, err := GetAccessTokenFromContext(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Missing token in context\")\n\t}\n\n\treq, err := http.NewRequest(\"DELETE\", link, nil)\n\n\tif err != nil {\n\t\tlog.Error(\"Cannot create request:\", err)\n\t\treturn err\n\t}\n\n\treq.Header.Add(\"X-Requested-With\", \"XMLHttpRequest\")\n\treq.Header.Add(\"authorization\", authKey)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\tresp, err := c.httpClient.Do(req)\n\n\tif err != nil {\n\t\tlog.Error(\"POST request error:\", err)\n\t\treturn err\n\t}\n\t// this is required to properly empty the buffer for the next call\n\tdefer func() {\n\t\tio.Copy(ioutil.Discard, resp.Body)\n\t}()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tlog.Error(err, \": \", string(body))\n\t}\n\n\treturn err\n}", "func Deleted(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": false, \"msg\": \"`+msg+`\"}`, 200, service, \"application/json\")\n\treturn nil\n}", "func NoContent(w http.ResponseWriter) {\n\t// No custom handler since there's no custom behavior.\n\tw.Header().Del(\"Content-Type\")\n\tw.WriteHeader(http.StatusNoContent)\n}", "func ExchangeDelete(service string, urlBase string, urlSuffix string, credentials string, goodHttpCodes []int) (httpCode int) {\n\turl := urlBase + \"/\" + urlSuffix\n\tapiMsg := http.MethodDelete + \" \" + url\n\n\t// get message printer\n\tmsgPrinter := i18n.GetMessagePrinter()\n\n\tVerbose(apiMsg)\n\tif IsDryRun() {\n\t\treturn 204\n\t}\n\n\thttpClient := GetHTTPClient(config.HTTPRequestTimeoutS)\n\n\tresp := InvokeRestApi(httpClient, http.MethodDelete, url, credentials, nil, service, apiMsg, make(map[string]string), true)\n\tif resp.Body != nil {\n\t\tdefer resp.Body.Close()\n\t}\n\n\t// delete never returns a body\n\thttpCode = resp.StatusCode\n\tVerbose(msgPrinter.Sprintf(\"HTTP code: %d\", httpCode))\n\tif !isGoodCode(httpCode, goodHttpCodes) {\n\t\tFatal(HTTP_ERROR, msgPrinter.Sprintf(\"bad HTTP code %d from %s\", httpCode, apiMsg))\n\t}\n\treturn\n}", "func (conn Connection) Delete(cmd string, content, result interface{}) (resp *http.Response, err error) {\n\treturn conn.Send(http.MethodDelete, cmd, content, result)\n}", "func TestChannelDelete(t *testing.T) {\n\t// delete this channel\n\twrt := channels[0]\n\n\t// create the mock repo and controller.\n\t// the deletion itself has no bearing on the test\n\t// so just use the findID function which has the the same signature\n\t// and performs the operation we need\n\trepo := &mock.ChannelRepo{DeleteIDFunc: findChannelID}\n\tcontroller := NewChannel(repo)\n\n\t// create a mock request\n\tp := httprouter.Param{Key: \"id\", Value: \"1\"}\n\treq, e := http.NewRequest(http.MethodDelete, \"/channel/\"+p.Value, nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// embed params necessary for controller function\n\tuf.EmbedParams(req, p)\n\n\t// create a response recorder and call the delete method\n\tw := httptest.NewRecorder()\n\te = controller.Delete(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tres := w.Result()\n\n\t// check if the repo was hit\n\tif !repo.DeleteIDCalled {\n\t\tt.Error(\"Did not call repo.DeleteID\")\n\t}\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// extract the body and check the correct channel was returned\n\tdefer res.Body.Close()\n\tbody, e := io.ReadAll(res.Body)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\treceived := &are_hub.Channel{}\n\te = json.Unmarshal(body, received)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tif received.Name != wrt.Name {\n\t\tt.Fatalf(\"Expected: %v. Actual: %v.\", wrt, received)\n\t}\n\n\t// check delete returns 404 for an invalid ID\n\tp = httprouter.Param{Key: \"id\", Value: \"-1\"}\n\ttest404(t, http.MethodDelete, \"/channel/\"+p.Value, nil, controller.Delete, p)\n}", "func DeletePostController(c *gin.Context) {\n\n\t// Get parameters from validate middleware\n\tparams := c.MustGet(\"params\").([]uint)\n\n\t// get userdata from user middleware\n\tuserdata := c.MustGet(\"userdata\").(user.User)\n\n\tif !c.MustGet(\"protected\").(bool) {\n\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\tc.Error(e.ErrInternalError).SetMeta(\"DeletePostController.protected\")\n\t\treturn\n\t}\n\n\t// Initialize model struct\n\tm := &models.DeletePostModel{\n\t\tIb: params[0],\n\t\tThread: params[1],\n\t\tID: params[2],\n\t}\n\n\t// Check the record id and get further info\n\terr := m.Status()\n\tif err == e.ErrNotFound {\n\t\tc.JSON(e.ErrorMessage(e.ErrNotFound))\n\t\tc.Error(err).SetMeta(\"DeletePostController.Status\")\n\t\treturn\n\t} else if err != nil {\n\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\tc.Error(err).SetMeta(\"DeletePostController.Status\")\n\t\treturn\n\t}\n\n\t// Delete data\n\terr = m.Delete()\n\tif err != nil {\n\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\tc.Error(err).SetMeta(\"DeletePostController.Delete\")\n\t\treturn\n\t}\n\n\t// Delete redis stuff\n\tindexKey := fmt.Sprintf(\"%s:%d\", \"index\", m.Ib)\n\tdirectoryKey := fmt.Sprintf(\"%s:%d\", \"directory\", m.Ib)\n\tthreadKey := fmt.Sprintf(\"%s:%d:%d\", \"thread\", m.Ib, m.Thread)\n\tpostKey := fmt.Sprintf(\"%s:%d:%d\", \"post\", m.Ib, m.Thread)\n\ttagsKey := fmt.Sprintf(\"%s:%d\", \"tags\", m.Ib)\n\timageKey := fmt.Sprintf(\"%s:%d\", \"image\", m.Ib)\n\tnewKey := fmt.Sprintf(\"%s:%d\", \"new\", m.Ib)\n\tpopularKey := fmt.Sprintf(\"%s:%d\", \"popular\", m.Ib)\n\tfavoritedKey := fmt.Sprintf(\"%s:%d\", \"favorited\", m.Ib)\n\n\terr = redis.Cache.Delete(indexKey, directoryKey, threadKey, postKey, tagsKey, imageKey, newKey, popularKey, favoritedKey)\n\tif err != nil {\n\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\tc.Error(err).SetMeta(\"DeletePostController.redis.Cache.Delete\")\n\t\treturn\n\t}\n\n\t// response message\n\tc.JSON(http.StatusOK, gin.H{\"success_message\": audit.AuditDeletePost})\n\n\t// audit log\n\taudit := audit.Audit{\n\t\tUser: userdata.ID,\n\t\tIb: m.Ib,\n\t\tType: audit.ModLog,\n\t\tIP: c.ClientIP(),\n\t\tAction: audit.AuditDeletePost,\n\t\tInfo: fmt.Sprintf(\"%s/%d\", m.Name, m.ID),\n\t}\n\n\t// submit audit\n\terr = audit.Submit()\n\tif err != nil {\n\t\tc.Error(err).SetMeta(\"DeletePostController.audit.Submit\")\n\t}\n\n}", "func (app *App) Delete(url string, handler handlerFunc) {\n\trequestRegexp := app.craterRouter.normalizeRoute(url)\n\tapp.craterRequestHandler.handleDelete(requestRegexp, func(w http.ResponseWriter, r *http.Request) {\n\t\tapp.serveRequest(w, r, handler, requestRegexp)\n\t})\n}", "func (a *ContentHandler) Delete(c echo.Context) error {\n\tidP, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn c.JSON(http.StatusNotFound, domain.ErrNotFound.Error())\n\t}\n\n\tid := int64(idP)\n\tctx := c.Request().Context()\n\n\terr = a.AUsecase.Delete(ctx, id)\n\tif err != nil {\n\t\treturn c.JSON(getStatusCode(err), ResponseError{Message: err.Error()})\n\t}\n\n\treturn c.NoContent(http.StatusNoContent)\n}", "func MakeDeleteEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteRequest)\n\t\terror := s.Delete(ctx, req.Id)\n\t\treturn DeleteResponse{Error: error}, nil\n\t}\n}", "func doNothing(w http.ResponseWriter, r *http.Request) {}", "func emptyHandler(w http.ResponseWriter, req *http.Request) {}", "func EndpointDELETEMe(w http.ResponseWriter, r *http.Request) {\n\t// Retrieve the variables from the endpoint\n\tvars := mux.Vars(r)\n\n\t// Write the HTTP header for the response\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\n\t// Create the actual data response structs of the API call\n\ttype ReturnData struct {\n\t\tSuccess Success\n\t}\n\n\t// Create the response structs\n\tvar success = Success{Success: true, Error: \"\"}\n\tvar returnData ReturnData\n\n\t// Process the API call\n\tif r.URL.Query().Get(\"token\") == \"\" {\n\t\tsuccess.Success = false\n\t\tsuccess.Error = \"Invalid API call. 'token' paramater is required.\"\n\t} else if userID, err := gSessionCache.CheckSession(r.URL.Query().Get(\"token\")); err != nil {\n\t\tsuccess.Success = false\n\t\tsuccess.Error = \"Invalid API call. 'token' paramater must be a valid token.\"\n\t} else {\n\t\tvar _ = vars\n\n\t\t// Delete the User from the local cache and the database (WARNING: This\n\t\t// is as final as it gets. The acount will be gone after this!)\n\t\tgUserCache.DeleteUser(userID)\n\t}\n\n\t// Combine the success and data structs so that they can be returned\n\treturnData.Success = success\n\n\t// Respond with the JSON-encoded return data\n\tif err := json.NewEncoder(w).Encode(returnData); err != nil {\n\t\tpanic(err)\n\t}\n}", "func Delete(c *gin.Context) {\r\n\tpost := getById(c)\r\n\tif post.ID == 0 {\r\n\t\treturn\r\n\t}\r\n\tdb.Unscoped().Delete(&post)\r\n\tc.JSON(http.StatusOK, gin.H{\r\n\t\t\"messege\": \"deleted successfuly\",\r\n\t\t\"data\": \"\",\r\n\t})\r\n}", "func DeleteAllTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteAllCtx, _err := app.NewDeleteAllTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.DeleteAll(deleteAllCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func DeleteEndpoint(serviceAccountProvider provider.ServiceAccountProvider, projectProvider provider.ProjectProvider, userInfoGetter provider.UserInfoGetter) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq, ok := request.(deleteReq)\n\t\tif !ok {\n\t\t\treturn nil, errors.NewBadRequest(\"invalid request\")\n\t\t}\n\t\terr := req.Validate()\n\t\tif err != nil {\n\t\t\treturn nil, errors.NewBadRequest(err.Error())\n\t\t}\n\t\tuserInfo, err := userInfoGetter(ctx, req.ProjectID)\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\t\t// check if project exist\n\t\tif _, err := projectProvider.Get(userInfo, req.ProjectID, &provider.ProjectGetOptions{}); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\t// check if service account exist before deleting it\n\t\tif _, err := serviceAccountProvider.Get(userInfo, req.ServiceAccountID, nil); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\tif err := serviceAccountProvider.Delete(userInfo, req.ServiceAccountID); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\treturn nil, nil\n\t}\n}", "func (a *CustomServicesApiService) Delete(ctx context.Context, technology string, id string) ( *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/customServices/{technology}/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"technology\"+\"}\", fmt.Sprintf(\"%v\", technology), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarQueryParams.Add(\"Api-Token\", key)\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\treturn localVarHttpResponse, err\n}", "func ForceDelete(client *gophercloud.ServiceClient, id string) (r ActionResult) {\n\tresp, err := client.Post(actionURL(client, id), map[string]interface{}{\"forceDelete\": \"\"}, nil, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func NoContent(logging ...interface{}) Response {\n\treturn Response{\n\t\tStatus: http.StatusNoContent,\n\t\tData: Bytes(nil),\n\t\tLogging: logging,\n\t}\n}", "func (client PatternClient) DeletePatternSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "func Delete(w http.ResponseWriter, r *http.Request){\n\n\t//pegando a url atraves da requisiçãp (.Get = pegar )\n\tidDoProduto := r.URL.Query().Get(\"id\") // pegando o id da url\n\n\tmodels.DeletaProduto(idDoProduto)\n\thttp.Redirect(w, r, \"/\", 301)\n}", "func (rc *Ctx) NoContent() NoContentResult {\n\treturn NoContent\n}", "func DeleteProductEndPoint(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"not implemented yet !\")\n}", "func (ctx *DeleteDogContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (client DatasetClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent),\n autorest.ByClosing())\n result.Response = resp\n return\n }" ]
[ "0.63498247", "0.61204004", "0.58327913", "0.55851233", "0.55250496", "0.54509914", "0.52811724", "0.5266764", "0.5208974", "0.51695615", "0.5161694", "0.51376617", "0.51230836", "0.5098964", "0.50784713", "0.5057698", "0.5056348", "0.50472486", "0.5039257", "0.49601212", "0.49369574", "0.49233258", "0.4915888", "0.49021682", "0.4902087", "0.48910162", "0.48898304", "0.4886346", "0.48704776", "0.48432517", "0.48417404", "0.48358756", "0.4832896", "0.4820377", "0.48087788", "0.4808301", "0.47850245", "0.47823462", "0.4780082", "0.47789413", "0.47782066", "0.4772362", "0.4765514", "0.47535476", "0.47404388", "0.4739635", "0.47278887", "0.47256824", "0.47252202", "0.47169527", "0.47105658", "0.47035477", "0.46969157", "0.46916693", "0.46860304", "0.46733707", "0.46632755", "0.46606952", "0.46533856", "0.46462595", "0.46460176", "0.46449745", "0.46366516", "0.4635747", "0.46297652", "0.46275565", "0.46265787", "0.462336", "0.46221244", "0.46193394", "0.46089244", "0.46041322", "0.4599997", "0.4589916", "0.45874926", "0.45865163", "0.45856807", "0.45827755", "0.4582523", "0.4574324", "0.45714027", "0.4566044", "0.4565658", "0.45649755", "0.4563353", "0.45620212", "0.45586836", "0.45564884", "0.45537308", "0.45505807", "0.4550038", "0.45436078", "0.45431763", "0.45421296", "0.45392102", "0.45387208", "0.45378673", "0.45289987", "0.45287278", "0.45221657" ]
0.7058195
0
DeleteFeedNotFound runs the method Delete of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter { // Setup service var ( logBuf bytes.Buffer respSetter goatest.ResponseSetterFunc = func(r interface{}) {} ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), } req, err := http.NewRequest("DELETE", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) deleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil } // Perform action _err = ctrl.Delete(deleteCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 404 { t.Errorf("invalid response status code: got %+v, expected 404", rw.Code) } // Return results return rw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func DeleteFeedNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func DeleteFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func DeleteTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteDogContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *DeleteFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *UpdateFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func DeleteItemsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ItemsController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/item/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ItemsTest\"), rw, req, prms)\n\tdeleteCtx, err := app.NewDeleteItemsContext(goaCtx, req, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\n\t// Perform action\n\terr = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *ListFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": true, \"msg\": \"`+msg+`\"}`, 404, service, \"application/json\")\n\treturn nil\n}", "func (ctx *DeleteLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NewDeleteFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*DeleteFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := DeleteFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\treturn &rctx, err\n}", "func (this *Context) NotFound(message string) {\n\tthis.ResponseWriter.WriteHeader(404)\n\tthis.ResponseWriter.Write([]byte(message))\n}", "func DeleteGuestbookNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.GuestbookController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/guestbook/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"GuestbookTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteGuestbookContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NotFoundHandler() ServiceHttpHandler { return ServiceHttpHandler{Handler: NotFound} }", "func (r *Responder) NotFound() { r.write(http.StatusNotFound) }", "func ShowTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *ShowCommentContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (suite *TenantTestSuite) TestDeleteNotFound() {\n\trequest, _ := http.NewRequest(\"DELETE\", \"/api/v2/admin/tenants/id\", strings.NewReader(\"\"))\n\trequest.Header.Set(\"x-api-key\", suite.clientkey)\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\tresponse := httptest.NewRecorder()\n\n\tsuite.router.ServeHTTP(response, request)\n\n\tcode := response.Code\n\toutput := response.Body.String()\n\n\tsuite.Equal(404, code, \"Internal Server Error\")\n\tsuite.Equal(suite.respTenantNotFound, output, \"Response body mismatch\")\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tjson.NewEncoder(w).Encode(&ServiceError{\n\t\tMessage: \"Endpoint not found\",\n\t\tSolution: \"See / for possible directives\",\n\t\tErrorCode: http.StatusNotFound,\n\t})\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (c *Context) NotFound() {\n\tc.JSON(404, ResponseWriter(404, \"page not found\", nil))\n}", "func (ctx *GetOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func DeleteHandler(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\tid := vars[\"id\"]\n\ttoken := r.URL.Query().Get(\"auth\")\n\n\t// parameters OK ?\n\tif isEmpty(id) || isEmpty(token) {\n\t\tstatus := http.StatusBadRequest\n\t\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n\t\treturn\n\t}\n\n\t// validate the token\n\tif authtoken.Validate(config.Configuration.SharedSecret, token) == false {\n\t\tstatus := http.StatusForbidden\n\t\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n\t\treturn\n\t}\n\n\t// get the request details\n\tcount, err := dao.Store.DeleteDepositAuthorizationByID(id)\n\tif err != nil {\n\t\tlogger.Log(fmt.Sprintf(\"ERROR: %s\", err.Error()))\n\t\tstatus := http.StatusInternalServerError\n\t\tencodeStandardResponse(w, status,\n\t\t\tfmt.Sprintf(\"%s (%s)\", http.StatusText(status), err),\n\t\t\tnil)\n\t\treturn\n\t}\n\n\tif count == 0 {\n\t\tstatus := http.StatusNotFound\n\t\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n\t\treturn\n\t}\n\n\tstatus := http.StatusOK\n\tencodeStandardResponse(w, status, http.StatusText(status), nil)\n}", "func NotFound(w ResponseWriter, r *Request) { Error(w, \"404 page not found\", StatusNotFound) }", "func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request) {\n\twriteResponse(r, w, http.StatusNotFound, &SimpleResponse{\n\t\tTraceID: tracing.FromContext(r.Context()),\n\t\tMessage: \"not found\",\n\t})\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func Delete(pattern string, handler func(Context)) {\n\tmux.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method != \"DELETE\" {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\n\t\thandler(Context{\n\t\t\tResponse: w,\n\t\t\tRequest: r,\n\t\t})\n\t})\n}", "func (ctx *DeleteUserContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (h *Handler) serveDeleteSeries(w http.ResponseWriter, r *http.Request) {}", "func (h *todoHandler) Delete(c echo.Context) error {\n\tctx := c.Request().Context()\n\n\tid := c.Param(\"id\")\n\n\tswitch err := h.todoService.Delete(ctx, id); err {\n\tcase serviceErrors.ErrInternal:\n\t\th.logger.Error(\n\t\t\t\"Delete error\",\n\t\t\tzap.Error(err),\n\t\t)\n\n\t\tresponseTodoStatusInternalServerErrorCounter.Inc()\n\t\treturn c.JSON(http.StatusInternalServerError, err.Error())\n\tcase serviceErrors.ErrTodoNotFound:\n\t\th.logger.Debug(\n\t\t\t\"Delete error\",\n\t\t\tzap.Error(err),\n\t\t)\n\n\t\tresponseTodoStatusNotFoundCounter.Inc()\n\t\treturn c.JSON(http.StatusNotFound, err.Error())\n\t}\n\treturn c.NoContent(http.StatusNoContent)\n}", "func (controller *EchoController) Delete(context *qhttp.Context) {\n\tcontroller.Get(context)\n}", "func NotFound(w http.ResponseWriter) {\n\trenderError(w, http.StatusNotFound, nil)\n}", "func DeleteTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetDogsByHostIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeNotFound, \"not found\")\n}", "func (ctx *GetByIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFoundHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tapi.WriteNotFound(w)\n\t})\n}", "func DeleteEndpoint(serviceAccountProvider provider.ServiceAccountProvider, projectProvider provider.ProjectProvider, userInfoGetter provider.UserInfoGetter) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq, ok := request.(deleteReq)\n\t\tif !ok {\n\t\t\treturn nil, errors.NewBadRequest(\"invalid request\")\n\t\t}\n\t\terr := req.Validate()\n\t\tif err != nil {\n\t\t\treturn nil, errors.NewBadRequest(err.Error())\n\t\t}\n\t\tuserInfo, err := userInfoGetter(ctx, req.ProjectID)\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\t\t// check if project exist\n\t\tif _, err := projectProvider.Get(userInfo, req.ProjectID, &provider.ProjectGetOptions{}); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\t// check if service account exist before deleting it\n\t\tif _, err := serviceAccountProvider.Get(userInfo, req.ServiceAccountID, nil); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\tif err := serviceAccountProvider.Delete(userInfo, req.ServiceAccountID); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\treturn nil, nil\n\t}\n}", "func (h *HandleHelper) NotFound() {\n\terrResponse(http.StatusNotFound,\n\t\t\"the requested resource could not be found\",\n\t)(h.w, h.r)\n}", "func (ctx *ShowSecretsContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\tm := TemplateMapFromContext(r.Context())\n\t\tm.Title(http.StatusText(http.StatusNotFound))\n\t\th.RenderHTMLStatus(w, http.StatusNotFound, \"404\", m)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusNotFound, http.StatusText(http.StatusNotFound))\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t}\n}", "func NotFound(w http.ResponseWriter, err error) {\n\tError(w, http.StatusNotFound, err)\n}", "func (client HTTPSuccessClient) Delete200Sender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "func DeleteTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func MakeDeleteCategoryEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteCategoryRequest)\n\t\terror := s.DeleteCategory(ctx, req.Id)\n\t\treturn DeleteCategoryResponse{Error: error}, nil\n\t}\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func (a *API) getNotFound(ctx context.Context, res *common.HttpResponseWriter) error {\n\tres.WriteHeader(http.StatusNotFound)\n\treturn nil\n}", "func (app *App) NotFound(handler handlerFunc) {\n\tapp.craterRequestHandler.notFoundHandler = func(w http.ResponseWriter, r *http.Request) {\n\t\treq := newRequest(r, make(map[string]string))\n\t\tres := newResponse(w)\n\t\thandler(req, res)\n\n\t\tapp.sendResponse(req, res)\n\t}\n}", "func NotFoundHandler(*Context) error {\n\treturn NewHTTPError(StatusNotFound)\n}", "func (c *Context) NotFound() {\n\tc.Handle(http.StatusNotFound, \"\", nil)\n}", "func (me Comment) Delete(ctx context.Context,\n\treq api.Request,\n\tw *api.Response,\n) (err error) {\n\tme.Before(req, me.Name)\n\tdefer func() { err = me.After(w, err) }()\n\n\tvar (\n\t\torganization = req.PathParameters[CommentOrganizationName]\n\t\tgithub = service.New(ctx, req.Headers[GithubAccessToken])\n\t)\n\n\tif req.Headers[GithubAccessToken] == \"\" {\n\t\terr = fmt.Errorf(errors.ErrorAccessDenied)\n\t\tme.Error(\"Error\", errors.NewMessage(errors.ErrorAccessDenied, \"\"))\n\t\treturn\n\t}\n\n\tif organization == \"\" {\n\t\terr = fmt.Errorf(errors.ErrorResourceNotFound)\n\t\tme.Error(\"Error\", errors.NewMessage(errors.ErrorResourceNotFound, CommentOrganizationName))\n\t\treturn\n\t}\n\n\t_, err = github.GetOrganization(organization)\n\tif err != nil {\n\t\tme.Record(\"Error\", err.Error())\n\t\terr = fmt.Errorf(errors.ErrorResourceNotFound)\n\t\tme.Error(\"Error\", errors.NewMessage(errors.ErrorResourceNotFound, CommentOrganizationName))\n\t\treturn\n\t}\n\n\tif err = database.DeleteComment(ctx, organization); err != nil {\n\t\tme.Record(\"Error\", err.Error())\n\t\terr = fmt.Errorf(errors.ErrorResourceNotFound)\n\t\tme.Error(\"Error\", errors.NewMessage(errors.ErrorResourceNotFound, CommentOrganizationName))\n\t\treturn\n\t}\n\n\tw.Stat(http.StatusNoContent)\n\tw.Output(nil)\n\n\treturn nil\n}", "func DeleteBudgetHandlerFactory(ctx context.Context) Handler {\n\treturn func(w http.ResponseWriter, r *http.Request) error {\n\t\tparams := mux.Vars(r)\n\t\terr := ctx.BudgetService.Delete(params[\"id\"])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn ServeContent(w, r, \"Success\", http.StatusOK)\n\t}\n}", "func Delete(url string, r io.Reader, w io.Writer, clientGenerator func() *http.Client, reqTuner ...func(*http.Request)) error {\n\treturn Request(\"DELETE\", url, r, w, clientGenerator, reqTuner...)\n}", "func (h *CategoryHandler) Delete(ctx iris.Context) {\n\tid := ctx.Params().GetInt64Default(\"id\", 0)\n\n\taffected, err := h.service.DeleteByID(ctx.Request().Context(), id)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\twriteEntityNotFound(ctx)\n\t\t\treturn\n\t\t}\n\n\t\tdebugf(\"CategoryHandler.Delete(DB): %v\", err)\n\t\twriteInternalServerError(ctx)\n\t\treturn\n\t}\n\n\tstatus := iris.StatusOK // StatusNoContent\n\tif affected == 0 {\n\t\tstatus = iris.StatusNotModified\n\t}\n\n\tctx.StatusCode(status)\n}", "func DeleteCustomerEndPoint(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"not implemented yet !\")\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tresponse := response.CreateResponse()\n\tresponse.SendDataWithStatusCode(w, \"not found\", http.StatusOK)\n}", "func (ctx *GetAllHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NewDeleteServiceIDNotFound() *DeleteServiceIDNotFound {\n\n\treturn &DeleteServiceIDNotFound{}\n}", "func (s *Server) HandleDeleteService() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\t// Verify token\n\t\t_, err := s.auth.VerifyToken(utils.GetToken(r))\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to apply service\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tserviceID := vars[\"serviceId\"]\n\t\tversion := vars[\"version\"]\n\n\t\tif err := s.driver.DeleteService(ctx, projectID, serviceID, version); err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to apply service\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, http.StatusOK, w)\n\t}\n}", "func NotFound(w http.ResponseWriter) {\n\thttp.Error(w, \"404 not found!!!\", http.StatusNotFound)\n}", "func TestDeleteNotificationNotFound(t *testing.T) {\n\treq, err := http.NewRequest(\"DELETE\", fmt.Sprintf(\"%s/api/v1/notification/hdhdsjh\", server.URL), nil)\n\treq.SetBasicAuth(\"test\", \"test\")\n\n\tif err != nil {\n\t\tt.Fatal(\"Request failed [DELETE] /api/v1/notification\")\n\t}\n\n\tresp, _ := http.DefaultClient.Do(req)\n\n\tassert.Equal(t, 404, resp.StatusCode)\n}", "func (e EndPoint) Delete(container EndPointContainer) {\n\n\tentity := reflect.New(container.GetPrototype()).Interface()\n\tvar id int64\n\t_, err := fmt.Sscanf(container.GetRequest().URL.Query().Get(\":id\"), \"%d\", &id)\n\tif err != nil {\n\t\tcontainer.Error(err, http.StatusBadRequest)\n\t\treturn\n\t}\n\trepository := container.GetRepository()\n\n\terr = repository.FindByID(id, entity.(Entity))\n\tif err != nil {\n\t\tcontainer.Error(err, http.StatusNotFound)\n\t\treturn\n\t}\n\terr = container.GetSignal().Dispatch(&BeforeResourceDeleteEvent{})\n\tif err != nil {\n\t\tcontainer.Error(err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\terr = repository.Delete(entity.(Entity))\n\tif err != nil {\n\t\tcontainer.Error(err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\terr = container.GetSignal().Dispatch(&AfterResourceDeleteEvent{})\n\tif err != nil {\n\t\tcontainer.Error(err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\tcontainer.GetResponseWriter().WriteHeader(http.StatusOK)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) { Error(w, \"404 page not found\", http.StatusNotFound) }", "func ServeNotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Not Found\", http.StatusNotFound)\n}", "func (response BasicJSONResponse) NotFound(writer http.ResponseWriter) {\n\tNotFound(writer, response)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusNotFound]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultNotFound(w, r)\n\t}\n}", "func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func notFound(resource string) middleware.Responder {\n\tmessage := fmt.Sprintf(\"404 %s not found\", resource)\n\treturn operations.NewGetChartDefault(http.StatusNotFound).WithPayload(\n\t\t&models.Error{Code: helpers.Int64ToPtr(http.StatusNotFound), Message: &message},\n\t)\n}", "func NewDeleteNotFound(body *DeleteNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewDeleteNotFound(body *DeleteNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func DeleteMovieEndPoint(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvar movie models.Movie\n\n\tif err := json.NewDecoder(r.Body).Decode(&movie); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\n\tif err := movieRepository.Delete(movie); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusOK, map[string]string{\"result\": \"success\"})\n}", "func (app *App) Delete(url string, handler handlerFunc) {\n\trequestRegexp := app.craterRouter.normalizeRoute(url)\n\tapp.craterRequestHandler.handleDelete(requestRegexp, func(w http.ResponseWriter, r *http.Request) {\n\t\tapp.serveRequest(w, r, handler, requestRegexp)\n\t})\n}", "func NewDeleteServiceIDNotFound() *DeleteServiceIDNotFound {\n\treturn &DeleteServiceIDNotFound{}\n}", "func NotFound(w http.ResponseWriter, _ error) {\n\t(Response{Error: \"resource not found\"}).json(w, http.StatusNotFound)\n}", "func (ctx *ShowWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 404, message...)\n}", "func (a *App) Delete(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"need a definition of delete on our platform\"))\n}", "func NotFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"Not Found: %s\", r.URL.String())\n\tservice.WriteProblem(w, \"No route found\", \"ERROR_NOT_FOUND\", http.StatusNotFound, errors.New(\"Route not found\"))\n}", "func (rest *RestController) Delete(w http.ResponseWriter, r *http.Request) (Response, error) {\n\terr := rest.Table.Delete(models.NewDBQuery(nil, map[string]string{\"id\": getParams(r).ByName(\"id\")}))\n\tif err != nil {\n\t\treturn nil, &httpError{err, \"\", 500}\n\t}\n\treturn &TextResponse{\"\", 204}, nil\n}", "func RenderNotFound(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, NotFound(message...))\n}", "func (ctx *AcceptOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func ExchangeDelete(service string, urlBase string, urlSuffix string, credentials string, goodHttpCodes []int) (httpCode int) {\n\turl := urlBase + \"/\" + urlSuffix\n\tapiMsg := http.MethodDelete + \" \" + url\n\n\t// get message printer\n\tmsgPrinter := i18n.GetMessagePrinter()\n\n\tVerbose(apiMsg)\n\tif IsDryRun() {\n\t\treturn 204\n\t}\n\n\thttpClient := GetHTTPClient(config.HTTPRequestTimeoutS)\n\n\tresp := InvokeRestApi(httpClient, http.MethodDelete, url, credentials, nil, service, apiMsg, make(map[string]string), true)\n\tif resp.Body != nil {\n\t\tdefer resp.Body.Close()\n\t}\n\n\t// delete never returns a body\n\thttpCode = resp.StatusCode\n\tVerbose(msgPrinter.Sprintf(\"HTTP code: %d\", httpCode))\n\tif !isGoodCode(httpCode, goodHttpCodes) {\n\t\tFatal(HTTP_ERROR, msgPrinter.Sprintf(\"bad HTTP code %d from %s\", httpCode, apiMsg))\n\t}\n\treturn\n}", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }" ]
[ "0.66924393", "0.63764024", "0.62950695", "0.6271811", "0.6086886", "0.60409063", "0.597846", "0.5963825", "0.59416074", "0.58896124", "0.5879985", "0.5750697", "0.5666528", "0.5634331", "0.558775", "0.5577937", "0.557248", "0.5525842", "0.5516137", "0.5281282", "0.5260561", "0.5259779", "0.5198806", "0.5166061", "0.51528925", "0.5139846", "0.5125004", "0.5118323", "0.5104598", "0.5098542", "0.50958914", "0.5091906", "0.5068765", "0.50657445", "0.50629175", "0.50431913", "0.5040846", "0.50234205", "0.5019905", "0.5019905", "0.501258", "0.49946624", "0.49883777", "0.49832156", "0.49731272", "0.4967787", "0.49294075", "0.49270946", "0.49153593", "0.49152854", "0.49115705", "0.49112165", "0.49069932", "0.48963052", "0.48881713", "0.48763356", "0.48731658", "0.48690844", "0.4857656", "0.4855628", "0.4855628", "0.4848842", "0.48455217", "0.48387906", "0.48372787", "0.48311394", "0.48061118", "0.47977206", "0.4794813", "0.47926894", "0.47920072", "0.47895163", "0.4788454", "0.47830793", "0.47819462", "0.47744602", "0.47718138", "0.47644496", "0.47608534", "0.4754614", "0.47505143", "0.47488758", "0.47482556", "0.4739836", "0.47391933", "0.47391933", "0.47282028", "0.4724236", "0.47208273", "0.4719292", "0.47184643", "0.4711118", "0.47077665", "0.47043595", "0.4702882", "0.46964273", "0.4692833", "0.4691221", "0.46910423", "0.46910423" ]
0.7402255
0
GetFeedBadRequest runs the method Get of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) getCtx, _err := app.NewGetFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } return nil, e } // Perform action _err = ctrl.Get(getCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 400 { t.Errorf("invalid response status code: got %+v, expected 400", rw.Code) } var mt error if resp != nil { var _ok bool mt, _ok = resp.(error) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of error", resp, resp) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ListFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func RenderBadRequest(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, BadRequest(message...))\n}", "func (ctx *GetFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func RenderBadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\treturn\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewGetControllerServiceBadRequest() *GetControllerServiceBadRequest {\n\treturn &GetControllerServiceBadRequest{}\n}", "func DeleteFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ServeBadRequest(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Bad Request\", http.StatusBadRequest)\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, err *Error) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusBadRequest]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tr = ctxSetErr(r, err)\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultBadRequest(w, r, err)\n\t}\n}", "func (ctx *StopFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *GetFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *StartFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (c *CommentApiController) GetUserFeed(w http.ResponseWriter, r *http.Request) {\n\tresult, err := c.service.GetUserFeed(r.Context())\n\t// If an error occurred, encode the error with the status code\n\tif err != nil {\n\t\tc.errorHandler(w, r, err, &result)\n\t\treturn\n\t}\n\t// If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, result.Headers, w)\n\n}", "func (ctx *CreateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func ErrBadRequest(w http.ResponseWriter, r *http.Request) {\n\tBadRequestWithErr(w, r, errors.New(\"Bad Request\"))\n}", "func RunBadRequest(response http.ResponseWriter, request *http.Request, container interface{}) {\n\terrorController := BadRequest{}\n\terrorController.Init(container, []string{}, request)\n\terrorController.Run(response, request)\n}", "func NewGetTallyBadRequest() *GetTallyBadRequest {\n\treturn &GetTallyBadRequest{}\n}", "func NewGetRecentFoodsBadRequest() *GetRecentFoodsBadRequest {\n\treturn &GetRecentFoodsBadRequest{}\n}", "func NewGetSelLogServiceBadRequest() *GetSelLogServiceBadRequest {\n\treturn &GetSelLogServiceBadRequest{}\n}", "func GetFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func RespondBadRequest(err error) events.APIGatewayProxyResponse {\n\treturn Respond(http.StatusBadRequest, Error{Error: err.Error()})\n}", "func NewGetDatalinksBadRequest() *GetDatalinksBadRequest {\n\treturn &GetDatalinksBadRequest{}\n}", "func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ListFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewGetfeedsDefault(code int) *GetfeedsDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetfeedsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func GetProfileBadRequestErr() middleware.Responder {\n\treturn si.NewGetProfileByUserIDBadRequest().WithPayload(\n\t\t&si.GetProfileByUserIDBadRequestBody{\n\t\t\tCode: \"400\",\n\t\t\tMessage: \"Bad Request\",\n\t\t})\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func TestBadRequest(t *testing.T) {\n\texpectedCode := http.StatusBadRequest\n\tbody := testEndpoint(t, \"GET\", \"/weather?location=kampala\", expectedCode)\n\n\texpectedBody := `{\"message\":\"No location/date specified\"}`\n\n\tif body != expectedBody {\n\t\tt.Errorf(\"Handler returned wrong body: got %v instead of %v\", body, expectedBody)\n\t}\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func SendBadRequest(w http.ResponseWriter, opts ...ErrorOpts) {\n\tres := errorResponse{\n\t\tCode: CodeBadRequest,\n\t\tMessage: \"Bad request\",\n\t}\n\tres.apply(opts)\n\tSendJSON(w, 400, &res)\n}", "func (ctx *GetFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewGetScannersBadRequest() *GetScannersBadRequest {\n\treturn &GetScannersBadRequest{}\n}", "func NewGetDocumentBadRequest() *GetDocumentBadRequest {\n\n\treturn &GetDocumentBadRequest{}\n}", "func BadRequest(w http.ResponseWriter, err error) {\n\tError(w, http.StatusBadRequest, err)\n}", "func (a *API) getNotFound(ctx context.Context, res *common.HttpResponseWriter) error {\n\tres.WriteHeader(http.StatusNotFound)\n\treturn nil\n}", "func NewGetBadRequestResponseBody(res *goa.ServiceError) *GetBadRequestResponseBody {\n\tbody := &GetBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func (ctx *UpdateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewGetBadRequest(body *GetBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewGetBadRequest(body *GetBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func BadRequest(w http.ResponseWriter, err error) {\n\t(Response{Error: err.Error()}).json(w, http.StatusBadRequest)\n}", "func BadRequest(r *http.ResponseWriter) error {\n\tresponse := *r\n\tresponse.WriteHeader(400)\n\treturn nil\n}", "func NewGetWitnessServicesBadRequest() *GetWitnessServicesBadRequest {\n\treturn &GetWitnessServicesBadRequest{}\n}", "func BadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(\"400 - Bad Request\"))\n}", "func ShowTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewGetWebhookBadRequest() *GetWebhookBadRequest {\n\treturn &GetWebhookBadRequest{}\n}", "func (r *Responder) BadRequest() { r.write(http.StatusBadRequest) }", "func BadRequest(w http.ResponseWriter, r *http.Request, format interface{}, args ...interface{}) {\n\tvar message string\n\tswitch v := format.(type) {\n\tcase string:\n\t\tmessage = v\n\tcase error:\n\t\tmessage = v.Error()\n\tcase fmt.Stringer:\n\t\tmessage = v.String()\n\tdefault:\n\t\tdvid.Criticalf(\"BadRequest called with unknown format type: %v\\n\", format)\n\t\treturn\n\t}\n\tif len(args) > 0 {\n\t\tmessage = fmt.Sprintf(message, args...)\n\t}\n\terrorMsg := fmt.Sprintf(\"%s (%s).\", message, r.URL.Path)\n\tdvid.Errorf(errorMsg + \"\\n\")\n\thttp.Error(w, errorMsg, http.StatusBadRequest)\n}", "func BadRequest(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 400, message...)\n}", "func NewGetEntityFiltersBadRequest() *GetEntityFiltersBadRequest {\n\treturn &GetEntityFiltersBadRequest{}\n}", "func (ctx *DeleteFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewGetEntriesBadRequest() *GetEntriesBadRequest {\n\treturn &GetEntriesBadRequest{}\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\th.RenderHTMLStatus(w, http.StatusBadRequest, \"400\", nil)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusBadRequest, apiErrorBadRequest)\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t}\n}", "func NewGetEndusersBadRequest() *GetEndusersBadRequest {\n\treturn &GetEndusersBadRequest{}\n}", "func NewGetActionBadRequest() *GetActionBadRequest {\n\treturn &GetActionBadRequest{}\n}", "func ListTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewGetAlertsBadRequest() *GetAlertsBadRequest {\n\treturn &GetAlertsBadRequest{}\n}", "func NewLeaderboardGetBadRequest() *LeaderboardGetBadRequest {\n\treturn &LeaderboardGetBadRequest{}\n}", "func (c *SeaterController) TraceBadRequestf(err error, format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tc.traceJSONAbort(nil, 400, msg)\n}", "func BadRequest(w http.ResponseWriter, text string, err error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(text))\n\tfmt.Println(text, \", Bad request with error:\", err)\n}", "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func BadRequest(w http.ResponseWriter, errorType, message string) {\n\terrMsg := ErrorMessage{ErrorType: errorType, Message: message}\n\trenderError(w, http.StatusBadRequest, &errMsg)\n}", "func (ctx *GetOutputContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func BadRequest(message string, w http.ResponseWriter) {\n\tbody := createBodyWithMessage(message)\n\twriteResponse(400, body, w)\n}", "func NewGetBannersBadRequest() *GetBannersBadRequest {\n\treturn &GetBannersBadRequest{}\n}", "func NewVoiceHistoryExportGetBadRequest() *VoiceHistoryExportGetBadRequest {\n\treturn &VoiceHistoryExportGetBadRequest{}\n}", "func (ctx *CreateDogContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func NewGetControllerStatusBadRequest() *GetControllerStatusBadRequest {\n\treturn &GetControllerStatusBadRequest{}\n}", "func NewGetMessagesBadRequest() *GetMessagesBadRequest {\n\treturn &GetMessagesBadRequest{}\n}", "func NewGetBicsIDBadRequest() *GetBicsIDBadRequest {\n\treturn &GetBicsIDBadRequest{}\n}", "func (ctx *CreateFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func BadRequest(format string, args ...interface{}) error {\n\treturn New(http.StatusBadRequest, format, args...)\n}", "func NewGetBicsBadRequest() *GetBicsBadRequest {\n\treturn &GetBicsBadRequest{}\n}", "func (ctx *ListFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetOpmlContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (response BasicJSONResponse) BadRequest(writer http.ResponseWriter) {\n\tBadRequest(writer, response)\n}", "func ReceiveTwitterBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TwitterController, oauthToken string, oauthVerifier string, state string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{oauthToken}\n\t\tquery[\"oauth_token\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{oauthVerifier}\n\t\tquery[\"oauth_verifier\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{state}\n\t\tquery[\"state\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/twitter/receive\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{oauthToken}\n\t\tprms[\"oauth_token\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{oauthVerifier}\n\t\tprms[\"oauth_verifier\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{state}\n\t\tprms[\"state\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TwitterTest\"), rw, req, prms)\n\treceiveCtx, _err := app.NewReceiveTwitterContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Receive(receiveCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewGetActivitiesTrackerResourceByDateRangeBadRequest() *GetActivitiesTrackerResourceByDateRangeBadRequest {\n\treturn &GetActivitiesTrackerResourceByDateRangeBadRequest{}\n}", "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func BadRequest(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"400 Bad Request\")\n\t}\n\treturn Response{\n\t\tStatus: http.StatusBadRequest,\n\t\tData: data,\n\t\tLogging: logging,\n\t}\n}", "func NewGetLatestIntelRuleFileBadRequest() *GetLatestIntelRuleFileBadRequest {\n\treturn &GetLatestIntelRuleFileBadRequest{}\n}", "func TestBadRequest(t *testing.T) {\n\tserver := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tpushError(w, errPaginate, http.StatusBadRequest)\n\t}))\n\tclient := SearchClient{allowedAccessToken, server.URL}\n\tdefer server.Close()\n\n\t_, err := client.FindUsers(SearchRequest{})\n\n\tif err == nil {\n\t\tt.Errorf(\"empty error\")\n\t} else if !strings.Contains(err.Error(), \"unknown bad request error\") {\n\t\tt.Errorf(\"invalid error: %v\", err.Error())\n\t}\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewCreateFeedBadRequest() *CreateFeedBadRequest {\n\treturn &CreateFeedBadRequest{}\n}", "func BadRequest(err error) Response {\n\treturn &errorResponse{\n\t\tcode: http.StatusBadRequest,\n\t\tmsg: err.Error(),\n\t}\n}", "func (c ApiWrapper) BadRequest(msg string, objs ...interface{}) revel.Result {\n\treturn c.renderErrorString(400, fmt.Sprintf(msg, objs))\n}", "func ErrBadRequestf(format string, arguments ...interface{}) *Status {\n\treturn &Status{Code: http.StatusBadRequest, Text: fmt.Sprintf(format, arguments...)}\n}", "func (ctx *UpdateFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func getFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tformat := chi.URLParam(r, \"format\")\n\t\tif format == \"\" {\n\t\t\tformat = \"rss\"\n\t\t}\n\t\ts, err := s.ServeFeed(format, plugin)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error serving the feed\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tswitch format {\n\t\tcase \"atom\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/atom+xml\")\n\t\tcase \"json\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tdefault:\n\t\t\tw.Header().Set(\"Content-Type\", \"application/rss+xml\")\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(s))\n\t}\n}", "func NewGetProfileBadRequest() *GetProfileBadRequest {\n\treturn &GetProfileBadRequest{}\n}", "func NewGetBacsBadRequest() *GetBacsBadRequest {\n\treturn &GetBacsBadRequest{}\n}", "func BadReqErr(w http.ResponseWriter, desc string) {\n\tsetError(w, desc, http.StatusBadRequest)\n}", "func RespondBadRequest(w http.ResponseWriter, message string) {\n\tlog.WithFields(log.Fields{\n\t\t\"time\": time.Now(),\n\t\t\"message\": message,\n\t}).Error(\"Received a bad request\")\n\terrorResponse := ErrorResponse{Error: message}\n\thttp.Error(w, \"\", http.StatusBadRequest)\n\t_ = json.NewEncoder(w).Encode(errorResponse)\n}", "func BadRequest(rw http.ResponseWriter) {\n\tHttpError(rw, \"bad request\", 403)\n}", "func badrequest(out http.ResponseWriter, format string, args ...interface{}) {\n\tsend(http.StatusBadRequest, out, format, args...)\n}" ]
[ "0.6458006", "0.63121974", "0.6183046", "0.5899612", "0.5722619", "0.5601634", "0.55762374", "0.5548114", "0.5481639", "0.5448377", "0.54021513", "0.53644997", "0.5306524", "0.53049064", "0.5263009", "0.5250631", "0.5208837", "0.5205264", "0.5194398", "0.51851016", "0.5171071", "0.5162388", "0.51447153", "0.5089", "0.50704706", "0.50574315", "0.5050626", "0.5030695", "0.50268716", "0.5024738", "0.49997196", "0.49967796", "0.49906248", "0.49541768", "0.4953177", "0.49521357", "0.49520275", "0.49341786", "0.49333045", "0.49151614", "0.4912094", "0.49060884", "0.48968896", "0.4887973", "0.4887973", "0.48851812", "0.48768395", "0.4875391", "0.48546004", "0.48512718", "0.48498717", "0.48496693", "0.48482713", "0.48428482", "0.4842156", "0.48220262", "0.48202577", "0.48096606", "0.4808694", "0.4794399", "0.47901845", "0.47897112", "0.4768996", "0.4762729", "0.47614157", "0.47573867", "0.47557545", "0.4751718", "0.47493693", "0.47427773", "0.47370675", "0.47227612", "0.4708152", "0.47018984", "0.47012013", "0.469586", "0.46860483", "0.46750614", "0.4671544", "0.46696526", "0.4666781", "0.46614", "0.4658909", "0.46479827", "0.46467447", "0.46437898", "0.46275058", "0.4623075", "0.46175522", "0.46168086", "0.46124148", "0.46085286", "0.46023074", "0.4599307", "0.45972034", "0.4595627", "0.45902485", "0.45863652", "0.4585003", "0.45821756" ]
0.7470145
0
GetFeedNotFound runs the method Get of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter { // Setup service var ( logBuf bytes.Buffer respSetter goatest.ResponseSetterFunc = func(r interface{}) {} ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) getCtx, _err := app.NewGetFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil } // Perform action _err = ctrl.Get(getCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 404 { t.Errorf("invalid response status code: got %+v, expected 404", rw.Code) } // Return results return rw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *GetFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ListFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (a *API) getNotFound(ctx context.Context, res *common.HttpResponseWriter) error {\n\tres.WriteHeader(http.StatusNotFound)\n\treturn nil\n}", "func (ctx *UpdateFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NotFound(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": true, \"msg\": \"`+msg+`\"}`, 404, service, \"application/json\")\n\treturn nil\n}", "func (ctx *GetFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (c *Context) NotFound() {\n\tc.JSON(404, ResponseWriter(404, \"page not found\", nil))\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NotFound(w ResponseWriter, r *Request) { Error(w, \"404 page not found\", StatusNotFound) }", "func (r *Responder) NotFound() { r.write(http.StatusNotFound) }", "func (ctx *ShowCommentContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowSecretsContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter) {\n\trenderError(w, http.StatusNotFound, nil)\n}", "func (ctx *ShowProfileContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (h *HandleHelper) NotFound() {\n\terrResponse(http.StatusNotFound,\n\t\t\"the requested resource could not be found\",\n\t)(h.w, h.r)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tjson.NewEncoder(w).Encode(&ServiceError{\n\t\tMessage: \"Endpoint not found\",\n\t\tSolution: \"See / for possible directives\",\n\t\tErrorCode: http.StatusNotFound,\n\t})\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request) {\n\twriteResponse(r, w, http.StatusNotFound, &SimpleResponse{\n\t\tTraceID: tracing.FromContext(r.Context()),\n\t\tMessage: \"not found\",\n\t})\n}", "func (this *Context) NotFound(message string) {\n\tthis.ResponseWriter.WriteHeader(404)\n\tthis.ResponseWriter.Write([]byte(message))\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func notFound(resource string) middleware.Responder {\n\tmessage := fmt.Sprintf(\"404 %s not found\", resource)\n\treturn operations.NewGetChartDefault(http.StatusNotFound).WithPayload(\n\t\t&models.Error{Code: helpers.Int64ToPtr(http.StatusNotFound), Message: &message},\n\t)\n}", "func NotFound(w http.ResponseWriter, _ error) {\n\t(Response{Error: \"resource not found\"}).json(w, http.StatusNotFound)\n}", "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusNotFound]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultNotFound(w, r)\n\t}\n}", "func (app *App) NotFound(handler handlerFunc) {\n\tapp.craterRequestHandler.notFoundHandler = func(w http.ResponseWriter, r *http.Request) {\n\t\treq := newRequest(r, make(map[string]string))\n\t\tres := newResponse(w)\n\t\thandler(req, res)\n\n\t\tapp.sendResponse(req, res)\n\t}\n}", "func NotFoundHandler() ServiceHttpHandler { return ServiceHttpHandler{Handler: NotFound} }", "func (ctx *ShowWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 404, message...)\n}", "func NotFound(w http.ResponseWriter, err error) {\n\tError(w, http.StatusNotFound, err)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) { Error(w, \"404 page not found\", http.StatusNotFound) }", "func (ctx *GetUsersContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (c *Context) NotFound() {\n\tc.Handle(http.StatusNotFound, \"\", nil)\n}", "func NotFound(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\tm := TemplateMapFromContext(r.Context())\n\t\tm.Title(http.StatusText(http.StatusNotFound))\n\t\th.RenderHTMLStatus(w, http.StatusNotFound, \"404\", m)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusNotFound, http.StatusText(http.StatusNotFound))\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t}\n}", "func (web *WebServer) NotFound(handler http.HandlerFunc) {\n\tweb.router.NotFound(handler)\n}", "func (ctx *DeleteDogContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (response BasicJSONResponse) NotFound(writer http.ResponseWriter) {\n\tNotFound(writer, response)\n}", "func (ctx *GetAllHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetByIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tresponse := response.CreateResponse()\n\tresponse.SendDataWithStatusCode(w, \"not found\", http.StatusOK)\n}", "func notfound(out http.ResponseWriter, format string, args ...interface{}) {\n\tsend(http.StatusNotFound, out, format, args...)\n}", "func (ctx *ListOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter) {\n\thttp.Error(w, \"404 not found!!!\", http.StatusNotFound)\n}", "func NotFound(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"404 Not Found\")\n\t}\n\treturn Response{Status: http.StatusNotFound, Data: data, Logging: logging}\n}", "func (ctx *AcceptOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(rw http.ResponseWriter) {\n\tHttpError(rw, \"not found\", 404)\n}", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tapi.WriteNotFound(w)\n\t})\n}", "func (ctx *ListMessageContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *Context) NotFound(err error, message string) *HTTPError {\n\treturn notFoundError(err, message)\n}", "func (ctx *DeleteFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetDogsByHostIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (nse ErrNoSuchEndpoint) NotFound() {}", "func (ctx *UpdateFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (c ApiWrapper) NotFound(msg string, objs ...interface{}) revel.Result {\n\treturn c.renderErrorString(404, fmt.Sprintf(msg, objs))\n}", "func NotFound(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeNotFound, \"not found\")\n}", "func (ctx *PlayLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func RenderNotFound(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, NotFound(message...))\n}", "func (c *CommentApiController) GetUserFeed(w http.ResponseWriter, r *http.Request) {\n\tresult, err := c.service.GetUserFeed(r.Context())\n\t// If an error occurred, encode the error with the status code\n\tif err != nil {\n\t\tc.errorHandler(w, r, err, &result)\n\t\treturn\n\t}\n\t// If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, result.Headers, w)\n\n}", "func (ctx *AddLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(c *gin.Context) {\n\tresponse := types.APIErrResponse{Msg: \"Something went wrong\", Success: false, Err: \"Not found\"}\n\tc.JSON(http.StatusNotFound, response)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\treturn\n}", "func ShowTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func RenderNotFound(w http.ResponseWriter) error {\n\tw.Header().Add(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\treturn template.ExecuteTemplate(w, \"404.amber\", nil)\n}", "func writeInsightNotFound(w http.ResponseWriter, str string) {\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\tio.WriteString(w, str)\n}", "func (he *HTTPErrors) NotFound(ctx *Context) {\n\the.Emit(http.StatusNotFound, ctx)\n}", "func (ctx *ShowUserContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (b *Baa) NotFound(c *Context) {\n\tif b.notFoundHandler != nil {\n\t\tb.notFoundHandler(c)\n\t\treturn\n\t}\n\thttp.NotFound(c.Resp, c.Req)\n}", "func HandleNotFound(lgc *logic.Logic) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlgc.Logger().WithFields(log.Fields{\n\t\t\t\"path\": r.URL.Path, \"method\": r.Method,\n\t\t\t\"message\": \"404 Page Not Found\",\n\t\t}).Info(\"request start\")\n\t\tw.WriteHeader(404)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write([]byte(fmt.Sprintf(\n\t\t\t`{\"message\":\"Page Not Found %s %s\"}`, r.Method, r.URL.Path)))\n\t}\n}", "func NotFound(format string, args ...interface{}) error {\n\targs = append(args, withDefaultMessage(NotFoundDefaultMsg))\n\treturn Errorf(http.StatusNotFound, format, args...)\n}", "func NotFoundHandler(*Context) error {\n\treturn NewHTTPError(StatusNotFound)\n}", "func NotFound(context *gin.Context) {\n\tcontext.JSON(404, gin.H{\n\t\t\"error\": \"404 not found\",\n\t\t\"url\": context.Request.URL,\n\t})\n}", "func (ctx *UpdateOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func ServeNotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Not Found\", http.StatusNotFound)\n}", "func SimpleNotFoundHandler(c *Context) error {\n\thttp.NotFound(c.W, c.R)\n\treturn nil\n}", "func (f WalkFunc) Do(ctx context.Context, call *Call) { call.Reply(http.StatusNotFound, nil) }", "func (r *Router) GetNotFound() RouteHandler {\n\treturn r.notFoundHandler\n}", "func (ctx *DeleteOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(message ...interface{}) Err {\n\treturn Boomify(http.StatusNotFound, message...)\n}", "func (ctx *ShowVerificationContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *MoveLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ListItemContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, message string) {\n\tfhirError(ctx, w, http.StatusNotFound, fhir.IssueSeverityWarning, fhir.IssueTypeNotFound, message)\n}", "func (resp *Response) NotFound(w http.ResponseWriter, queryParam string) {\n\tresp.Error = \"The user with id \" + queryParam + \" was not found\"\n\twrite(resp, w)\n}", "func HandleNotFound(lgc *logic.Logic) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\treq := c.Request()\n\t\tlgc.Logger().WithFields(log.Fields{\n\t\t\t\"path\": req.URL.Path, \"method\": req.Method,\n\t\t\t\"message\": \"404 Page Not Found\",\n\t\t}).Info(\"request start\")\n\t\treturn c.JSON(404, map[string]string{\n\t\t\t\"message\": fmt.Sprintf(\"Page Not Found %s %s\", req.Method, req.URL.Path),\n\t\t})\n\t}\n}", "func (c *Context) NotFound() error {\n\treturn c.M.opt.HandleNotFound(c)\n}", "func notFound(w http.ResponseWriter, req *http.Request) {\n\t// w.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\tapiError := apirouter.ErrorFromRequest(req, fmt.Sprintf(\"404 occurred: %s\", req.RequestURI), \"Whoops - this request is not recognized\", http.StatusNotFound, http.StatusNotFound, \"\")\n\tapirouter.ReturnResponse(w, req, apiError.Code, apiError)\n}", "func NotFound(err error) error {\n\treturn New(http.StatusNotFound, err)\n}" ]
[ "0.6957903", "0.6787745", "0.6521853", "0.6408688", "0.63962245", "0.63843876", "0.63771826", "0.63330346", "0.60727197", "0.6016486", "0.6012649", "0.5975545", "0.5950224", "0.5950224", "0.59441626", "0.5907319", "0.586053", "0.5818043", "0.5771734", "0.57464075", "0.5741363", "0.5741363", "0.57044256", "0.570091", "0.5694285", "0.56828564", "0.5681219", "0.56798506", "0.5658015", "0.56523705", "0.5652343", "0.56243366", "0.56162244", "0.5613396", "0.55910593", "0.55793613", "0.5578113", "0.5575536", "0.5569932", "0.55608207", "0.5557314", "0.55495083", "0.5547213", "0.5546841", "0.5545775", "0.5523679", "0.55211097", "0.5515809", "0.550649", "0.54993296", "0.54981977", "0.54772264", "0.54699314", "0.54642206", "0.5449777", "0.54444474", "0.54380083", "0.5390225", "0.5390225", "0.53793186", "0.53755623", "0.53696775", "0.5367462", "0.5364612", "0.53635573", "0.5349026", "0.5336398", "0.5335603", "0.53262365", "0.5321509", "0.53074306", "0.5306912", "0.53015417", "0.5298967", "0.52924216", "0.52695096", "0.5263206", "0.52590275", "0.52587473", "0.5242814", "0.5242515", "0.52320737", "0.52230626", "0.5219827", "0.5217939", "0.5215684", "0.5205691", "0.5204322", "0.5203921", "0.51990515", "0.5192063", "0.5187491", "0.5154785", "0.5142849", "0.51374847", "0.5136443", "0.51220083", "0.5116775", "0.5116426", "0.5114688" ]
0.7504815
0
GetFeedOK runs the method Get of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) getCtx, _err := app.NewGetFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.Get(getCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 200 { t.Errorf("invalid response status code: got %+v, expected 200", rw.Code) } var mt *app.Feed if resp != nil { var _ok bool mt, _ok = resp.(*app.Feed) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.Feed", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewGetfeedsOK() *GetfeedsOK {\n\treturn &GetfeedsOK{}\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func UpdateFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func getFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tformat := chi.URLParam(r, \"format\")\n\t\tif format == \"\" {\n\t\t\tformat = \"rss\"\n\t\t}\n\t\ts, err := s.ServeFeed(format, plugin)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error serving the feed\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tswitch format {\n\t\tcase \"atom\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/atom+xml\")\n\t\tcase \"json\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tdefault:\n\t\t\tw.Header().Set(\"Content-Type\", \"application/rss+xml\")\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(s))\n\t}\n}", "func (c *CommentApiController) GetUserFeed(w http.ResponseWriter, r *http.Request) {\n\tresult, err := c.service.GetUserFeed(r.Context())\n\t// If an error occurred, encode the error with the status code\n\tif err != nil {\n\t\tc.errorHandler(w, r, err, &result)\n\t\treturn\n\t}\n\t// If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, result.Headers, w)\n\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func Ok(c *routing.Context, msg string, service string) error {\n\tResponse(c, msg, 200, service, \"application/json\")\n\treturn nil\n}", "func (ctx *ListFeedContext) OK(r FeedCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.feed.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FeedCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ShowTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (oc *OAuthConsumer) Get( url string, fparams Params, at *AccessToken) (r *http.Response, err os.Error) {\n\treturn oc.oAuthRequest(url, fparams, at, \"GET\")\n}", "func (ctx *GetOpmlContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/xml\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func (ctx *GetSwaggerContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func NewGetDCForSeedOK() *GetDCForSeedOK {\n\treturn &GetDCForSeedOK{}\n}", "func (ctx *GetFilterContext) OK(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (controller *EchoController) Get(context *qhttp.Context) {\n\tr := context.Request\n\tcontext.Write(fmt.Sprintf(\"Host: %s\\n\", r.Host))\n\tcontext.Write(fmt.Sprintf(\"RequestURI: %s\\n\", r.RequestURI))\n\tcontext.Write(fmt.Sprintf(\"Method: %s\\n\", r.Method))\n\tcontext.Write(fmt.Sprintf(\"RemoteAddr: %s\\n\", r.RemoteAddr))\n\tcontext.Write(fmt.Sprintf(\"Content Length: %d\\n\", r.ContentLength))\n\tcontext.Write(\"Headers:\\n\")\n\tfor k, v := range context.Request.Header {\n\t\tcontext.Write(fmt.Sprintf(\"\\t%s: %s\\n\", k, v))\n\t}\n\n\tif !stringutil.IsWhiteSpace(context.URIParameters[\"toEcho\"]) {\n\t\tcontext.Write(fmt.Sprintf(\"URI:\\n%s\\n\", context.URIParameters[\"toEcho\"]))\n\t}\n\n\tif context.Request.ContentLength > 0 {\n\t\tcontext.Write(\"Body:\\n\")\n\t\tbody, err := context.Read()\n\t\tif err != nil {\n\t\t\tcontext.SetError(qerror.NewRestError(qerror.SystemError, \"\", nil), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tcontext.Response.Write(body)\n\t}\n\n}", "func ListFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedTinyCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedTinyCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedTinyCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTinyCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (controller *APIController) Get(context *qhttp.Context) {\n\tcontext.Response.Header().Add(\"Content-Type\", \"text/html\")\n\tcontext.SetResponse(`<html>\n\t<head>\n\t\t<title>Example API Documenation</title>\n\t</head>\n\t<body>\n\t\t<h3>Endpoints</h3>\n\t\t<ul>\n\t\t\t<li>[GET / POST] /api/widgets</li>\n\t\t\t<li>[GET / PUT / PATCH / DELETE] /api/widgets/{{id}}</li>\n\t\t</ul>\n\t\t<h3>Authentication</h3>\n\t\t<p>Send a header of <b>Authorization</b> with a value of <b>valid</b></p>\n\t</body>\n\t</html>`, http.StatusOK)\n}", "func getResponseOK(args ...interface{}) docs.Response {\n\tdescription := \"OK\"\n\tif args != nil {\n\t\tdescription = args[0].(string)\n\t}\n\n\treturn docs.Response{\n\t\tCode: 200,\n\t\tDescription: description,\n\t}\n}", "func (r *GowebHTTPResponder) WithOK(ctx context.Context) error {\n\treturn r.WithStatus(ctx, http.StatusOK)\n}", "func (ctx *ShowBottleContext) OK(r *GoaExampleBottle) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.example.bottle+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewGetControllerServiceOK() *GetControllerServiceOK {\n\treturn &GetControllerServiceOK{}\n}", "func (ctx *GetOutputContext) OK(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ReceiveTwitterOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TwitterController, oauthToken string, oauthVerifier string, state string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{oauthToken}\n\t\tquery[\"oauth_token\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{oauthVerifier}\n\t\tquery[\"oauth_verifier\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{state}\n\t\tquery[\"state\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/twitter/receive\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{oauthToken}\n\t\tprms[\"oauth_token\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{oauthVerifier}\n\t\tprms[\"oauth_verifier\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{state}\n\t\tprms[\"state\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TwitterTest\"), rw, req, prms)\n\treceiveCtx, _err := app.NewReceiveTwitterContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Receive(receiveCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func UpdateFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ok(w http.ResponseWriter, r *http.Request, c *Context) {\n\tfmt.Fprintln(w, \"ok\")\n}", "func (ctx *ShowBottleContext) OK(r *GoaExampleBottle) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.example.bottle+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (c *requestContext) ok() {\n\tc.Writer.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\tc.Writer.WriteHeader(200)\n\tfmt.Fprintln(c.Writer, \"OK\")\n}", "func (t *RestURL) MaybeGet(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RestURL\", \"MaybeGet\")\n\n\txxRouteVars := mux.Vars(r)\n\n\txxURLValues := r.URL.Query()\n\tvar urlArg1 *string\n\tif false {\n\t} else if _, ok := xxRouteVars[\"arg1\"]; ok {\n\t\txxTmpurlArg1 := xxRouteVars[\"arg1\"]\n\t\turlArg1 = &xxTmpurlArg1\n\t} else if _, ok := xxURLValues[\"arg1\"]; ok {\n\t\txxTmpurlArg1 := xxURLValues.Get(\"arg1\")\n\t\turlArg1 = &xxTmpurlArg1\n\t}\n\n\tt.embed.MaybeGet(urlArg1)\n\n\tw.WriteHeader(200)\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RestURL\", \"MaybeGet\")\n\n}", "func Get(c echo.Context) error {\n\treturn c.JSON(http.StatusOK, http.StatusOK)\n}", "func (ctx *ShowWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/xml\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func ListTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, app.TodoCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.TodoCollection\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(app.TodoCollection)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.TodoCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func Ok(ctx context.Context, w http.ResponseWriter, response interface{}) {\n\treader, err := FormatOk(response)\n\tif err != nil {\n\t\tlog.Error(ctx, \"unable marshal response\", \"err\", err, \"type\", \"reply\")\n\t\tErr(ctx, w, http.StatusInternalServerError, \"internal error\")\n\t\treturn\n\t}\n\n\tFromContext(ctx).Reply(ctx, w, http.StatusOK, reader)\n}", "func (h *Handler) get(c echo.Context) (e error) {\n\tctx := c.(*cuxs.Context)\n\t// get query string from request\n\trq := ctx.RequestQuery()\n\tvar data *[]model.SalesReturn\n\n\tvar tot int64\n\n\tif data, tot, e = GetSalesReturn(rq); e == nil {\n\t\tctx.Data(data, tot)\n\t}\n\n\treturn ctx.Serve(e)\n}", "func makeGoGetEndpoint(svc GoGetterService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(goGetRequest)\n\t\tshow, err := svc.GoGet(req.Channel, req.Date)\n\t\tif err != nil {\n\t\t\treturn goGetResponse{req.Channel, req.Date, show, err.Error()}, nil\n\t\t}\n\t\treturn goGetResponse{req.Channel, req.Date, show, \"\"}, nil\n\t}\n}", "func getChart(w http.ResponseWriter, req *http.Request, params Params) {\n\tdb, closer := dbSession.DB()\n\tdefer closer()\n\tvar chart models.Chart\n\tchartID := fmt.Sprintf(\"%s/%s\", params[\"repo\"], params[\"chartName\"])\n\tif err := db.C(chartCollection).FindId(chartID).One(&chart); err != nil {\n\t\tlog.WithError(err).Errorf(\"could not find chart with id %s\", chartID)\n\t\tresponse.NewErrorResponse(http.StatusNotFound, \"could not find chart\").Write(w)\n\t\treturn\n\t}\n\n\tcr := newChartResponse(&chart)\n\tresponse.NewDataResponse(cr).Write(w)\n}", "func (t *RPCCtx) Get(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RPCCtx\", \"Get\")\n\n\treqCtx := r.Context()\n\twhatever := reqCtx\n\n\tt.embed.Get(whatever)\n\n\tw.WriteHeader(200)\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RPCCtx\", \"Get\")\n\n}", "func get(w http.ResponseWriter, req *http.Request) {\n\tresponse := \"\"\n\tswitch req.RequestURI {\n\t\tcase \"/get/accounts\":\n\t\t\tmapD := map[string]int{\"apple\": 5, \"lettuce\": 7}\n\t\t\tmapB, _ := json.Marshal(mapD)\n\t\t\tresponse = string(mapB)\n\t\t\tbreak\n\t\tdefault:\n\t\t\tr, _ := json.Marshal(\"Request not found\")\n\t\t\tresponse = string(r)\n\t\t\tbreak\n\t}\n\n\tcontext := Context{Title: response}\n\trender(w, \"api\", context)\n}", "func NewGetActivitiesTrackerResourceByDateRangeOK() *GetActivitiesTrackerResourceByDateRangeOK {\n\treturn &GetActivitiesTrackerResourceByDateRangeOK{}\n}", "func OK(r *http.ResponseWriter) error {\n\tresponse := *r\n\tresponse.WriteHeader(200)\n\treturn nil\n}", "func OK(w http.ResponseWriter, r *http.Request, body interface{}) {\n\tbuilder := response.New(w, r)\n\tbuilder.WithHeader(\"Content-Type\", \"text/xml; charset=utf-8\")\n\tbuilder.WithBody(body)\n\tbuilder.Write()\n}", "func Get(url string, r io.Reader, w io.Writer, clientGenerator func() *http.Client, reqTuner ...func(*http.Request)) error {\n\treturn Request(\"GET\", url, r, w, clientGenerator, reqTuner...)\n}", "func NewGetChannelsOK() *GetChannelsOK {\n\treturn &GetChannelsOK{}\n}", "func NewGetTweetsOK() *GetTweetsOK {\n\n\treturn &GetTweetsOK{}\n}", "func (ctx *GetFeedContext) OKTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func getChart(c echo.Context) error {\n\tconfig, err := parseChartConfig(c)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]interface{}{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t}\n\n\tmarket := c.Param(\"market\")\n\tpair := c.Param(\"pair\")\n\n\treturn c.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"market\": market,\n\t\t\"pair\": pair,\n\t\t\"config\": config,\n\t})\n}", "func (ctx *SpecsOutputContext) OK(r OutputSpecCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.output-spec.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = OutputSpecCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *GetDogsByHostIDHostContext) OK(r *Dogs) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"dogs\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (h *Health) Get(w http.ResponseWriter, r *http.Request) {\n\th.router.WriteHeader(r.Context(), w, http.StatusOK)\n}", "func LoginTwitterOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TwitterController, token *uuid.UUID) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif token != nil {\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", *token)}\n\t\tquery[\"token\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/twitter/login\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif token != nil {\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", *token)}\n\t\tprms[\"token\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TwitterTest\"), rw, req, prms)\n\tloginCtx, _err := app.NewLoginTwitterContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Login(loginCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func getAppsHandler(w http.ResponseWriter, r *http.Request) {\n\tvar apps []App\n\terr := getApps(&apps)\n\tcheck(err)\n\trespondWithResult(w, apps)\n}", "func (ctx *GetHealthContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"text/plain\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func NewGetEntityFiltersOK() *GetEntityFiltersOK {\n\treturn &GetEntityFiltersOK{}\n}", "func (o *GetfeedsOK) WithPayload(payload []string) *GetfeedsOK {\n\to.Payload = payload\n\treturn o\n}", "func UpdateFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func Ok(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"200 OK\")\n\t}\n\treturn Response{Status: http.StatusOK, Data: data, Logging: logging}\n}", "func NewGetLogsOK(writer io.Writer) *GetLogsOK {\n\treturn &GetLogsOK{\n\t\tPayload: writer,\n\t}\n}", "func (t *RestPost) MaybeGet(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RestPost\", \"MaybeGet\")\n\n\t{\n\t\terr := r.ParseForm()\n\n\t\tif err != nil {\n\n\t\t\tt.Log.Handle(w, r, err, \"parseform\", \"error\", \"RestPost\", \"MaybeGet\")\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\n\t\t\treturn\n\t\t}\n\n\t}\n\tvar postArg1 *string\n\tif _, ok := r.Form[\"arg1\"]; ok {\n\t\txxTmppostArg1 := r.FormValue(\"arg1\")\n\t\tt.Log.Handle(w, r, nil, \"input\", \"form\", \"arg1\", xxTmppostArg1, \"RestPost\", \"MaybeGet\")\n\t\tpostArg1 = &xxTmppostArg1\n\t}\n\n\tt.embed.MaybeGet(postArg1)\n\n\tw.WriteHeader(200)\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RestPost\", \"MaybeGet\")\n\n}", "func (r *Responder) OK() { r.write(http.StatusOK) }", "func GetChannelInfoController(w http.ResponseWriter, username string) {\n\tfmt.Println(\"Getting channel views \", username)\n\tchannel := services.GetChannelViews(username)\n\tfmt.Println(channel)\n\tif reflect.DeepEqual(models.Channel{}, channel) {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tvar e = fmt.Errorf(\"User not found\")\n\t\tprepareResp(nil, e, w)\n\t} else {\n\t\tjsonResp, err := json.Marshal(channel)\n\t\tprepareResp(jsonResp, err, w)\n\t}\n}", "func first(w http.ResponseWriter,r *http.Request){\n\tif r.Method == \"GET\"{\n\t\tsendRes(202,Example,w)\n\t}\n}", "func (ctx *ListOutputContext) OK(r OutputCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.output.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = OutputCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func StartFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ri *RestInvoker) ContextDo(ctx context.Context, req *rest.Request, options ...InvocationOption) (*rest.Response, error) {\n\topts := getOpts(string(req.GetRequest().Host()), options...)\n\topts.Protocol = common.ProtocolRest\n\tif len(opts.Filters) == 0 {\n\t\topts.Filters = ri.opts.Filters\n\t}\n\tif string(req.GetRequest().URI().Scheme()) != \"cse\" {\n\t\treturn nil, fmt.Errorf(\"Scheme invalid: %s, only support cse://\", req.GetRequest().URI().Scheme())\n\t}\n\tif req.GetHeader(\"Content-Type\") == \"\" {\n\t\treq.SetHeader(\"Content-Type\", \"application/json\")\n\t}\n\tnewReq := req.Copy()\n\tdefer newReq.Close()\n\tresp := rest.NewResponse()\n\tnewReq.SetHeader(common.HeaderSourceName, config.SelfServiceName)\n\tinv := invocation.CreateInvocation()\n\twrapInvocationWithOpts(inv, opts)\n\tinv.AppID = config.GlobalDefinition.AppID\n\tinv.MicroServiceName = string(req.GetRequest().Host())\n\tinv.Args = newReq\n\tinv.Reply = resp\n\tinv.Ctx = ctx\n\tinv.URLPathFormat = req.Req.URI().String()\n\tinv.MethodType = req.GetMethod()\n\tc, err := handler.GetChain(common.Consumer, ri.opts.ChainName)\n\tif err != nil {\n\t\tlager.Logger.Errorf(err, \"Handler chain init err.\")\n\t\treturn nil, err\n\t}\n\tc.Next(inv, func(ir *invocation.InvocationResponse) error {\n\t\terr = ir.Err\n\t\treturn err\n\t})\n\treturn resp, err\n}", "func NewGetPracticesOK() *GetPracticesOK {\n\n\treturn &GetPracticesOK{}\n}", "func (o *GetfeedsDefault) WithStatusCode(code int) *GetfeedsDefault {\n\to._statusCode = code\n\treturn o\n}", "func (ctx *HealthHealthContext) OK(r *JSON) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewGetMarketsGroupsOK() *GetMarketsGroupsOK {\n\treturn &GetMarketsGroupsOK{}\n}", "func NewCatalogGetOK() *CatalogGetOK {\n\treturn &CatalogGetOK{}\n}", "func NewWeaviateThingsGetOK() *WeaviateThingsGetOK {\n\treturn &WeaviateThingsGetOK{}\n}", "func (h *Hello) Get(c *yarf.Context) error {\n\tc.Render(\"Hello world!\")\n\n\treturn nil\n}", "func NewGetPublishersOK() *GetPublishersOK {\n\treturn &GetPublishersOK{}\n}", "func (ctx *GetFeedContext) OKLink(r *FeedLink) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ShowTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (c *HomeController) Get() mvc.Result {\n\treturn mvc.Response{\n\t\tContentType: \"text/html\",\n\t\tText: \"<h1>Welcome</h1>\",\n\t}\n}", "func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewGetDatalinksOK() *GetDatalinksOK {\n\treturn &GetDatalinksOK{}\n}", "func GetNewsFeed(w http.ResponseWriter, _ *http.Request) {\n\tfp := gofeed.NewParser()\n\tctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)\n\tdefer cancel()\n\tfeed, err := fp.ParseURLWithContext(\"https://www.sports.ru/rss/all_news.xml\", ctx)\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot retrieve url and parse\", err)\n\t}\n\n\tm := Message{}\n\tmm := Messages{}\n\tfor _, i := range feed.Items {\n\t\tm.Title = i.Title\n\t\tm.Link = i.Link\n\t\tm.Published = i.Published\n\t\tmm = append(mm, m)\n\t}\n\n\tjs, err := json.MarshalIndent(mm, \" \", \" \")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t_, err = w.Write(js)\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot write response\")\n\t}\n}", "func (c *globalThreatFeeds) Get(ctx context.Context, name string, options v1.GetOptions) (result *v3.GlobalThreatFeed, err error) {\n\tresult = &v3.GlobalThreatFeed{}\n\terr = c.client.Get().\n\t\tResource(\"globalthreatfeeds\").\n\t\tName(name).\n\t\tVersionedParams(&options, scheme.ParameterCodec).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func (h *Handlers) Get(w http.ResponseWriter, r *http.Request) {\n\tinput := &hub.GetPackageInput{\n\t\tPackageName: chi.URLParam(r, \"packageName\"),\n\t\tVersion: chi.URLParam(r, \"version\"),\n\t}\n\tchartRepositoryName := chi.URLParam(r, \"repoName\")\n\tif chartRepositoryName != \"\" {\n\t\tinput.ChartRepositoryName = chartRepositoryName\n\t}\n\tdataJSON, err := h.pkgManager.GetJSON(r.Context(), input)\n\tif err != nil {\n\t\th.logger.Error().Err(err).Interface(\"input\", input).Str(\"method\", \"Get\").Send()\n\t\tif errors.Is(err, pkg.ErrInvalidInput) {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t} else if errors.Is(err, pkg.ErrNotFound) {\n\t\t\thttp.NotFound(w, r)\n\t\t} else {\n\t\t\thttp.Error(w, \"\", http.StatusInternalServerError)\n\t\t}\n\t\treturn\n\t}\n\thelpers.RenderJSON(w, dataJSON, helpers.DefaultAPICacheMaxAge)\n}", "func (o *OfferServiceModel) GetServiceOk() (*EmbeddedServiceModel, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Service, true\n}", "func NewSoftwarePackageGetOK() *SoftwarePackageGetOK {\n\treturn &SoftwarePackageGetOK{}\n}", "func (ctx *SearchHotelsContext) OK(r HotelCollection) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\tif r == nil {\n\t\tr = HotelCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewGetOK() *GetOK {\n\treturn &GetOK{}\n}", "func NewGetAppsOK() *GetAppsOK {\n\treturn &GetAppsOK{}\n}", "func NewGetDocumentOK() *GetDocumentOK {\n\n\treturn &GetDocumentOK{}\n}", "func (c *DefaultApiController) DataGet(w http.ResponseWriter, r *http.Request) {\n\tresult, err := c.service.DataGet(r.Context())\n\t//If an error occured, encode the error with the status code\n\tif err != nil {\n\t\tEncodeJSONResponse(err.Error(), &result.Code, w)\n\t\treturn\n\t}\n\t//If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, w)\n\n}", "func (svc TwitterService) GetTweets(author, fromDate, toDate, nextPage string) (*TweetResponse, error) {\n\tvar authorParam = fmt.Sprintf(\"from:%s lang:pt\", author)\n\tvar output TweetResponse\n\n\tpayload := TweetPayload{\n\t\tQuery: authorParam,\n\t\tMaxResults: svc.MaxResults,\n\t\tFromDate: fromDate,\n\t\tToDate: toDate,\n\t}\n\n\tif nextPage != \"\" {\n\t\tpayload.Next = nextPage\n\t}\n\n\tdata, err := json.Marshal(payload)\n\tif err != nil {\n\t\tlog.Printf(\"Error when trying to parse the payload. %v\", err)\n\t\treturn nil, err\n\t}\n\n\tclient := &http.Client{}\n\tr, err := http.NewRequest(http.MethodPost, svc.URL, bytes.NewBuffer(data))\n\tr.Header.Add(\"Authorization\", svc.TokenBearer)\n\tif err != nil {\n\t\tlog.Printf(\"Error when trying to prepare the post request. %v\", err)\n\t\treturn nil, err\n\t}\n\n\tres, err := client.Do(r)\n\tif err != nil || res.StatusCode != 200 {\n\t\tif err == nil {\n\t\t\terr = fmt.Errorf(res.Status)\n\t\t}\n\n\t\tlog.Printf(\"Error when trying to execute the post request. %v\", err)\n\t\treturn nil, err\n\t}\n\n\tif err := json.NewDecoder(res.Body).Decode(&output); err != nil {\n\t\tlog.Printf(\"Error when trying to parse the api response body. %v\", err)\n\t\treturn nil, err\n\t}\n\n\tdefer res.Body.Close()\n\n\treturn &output, nil\n}", "func CreateFeedCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewGetPrefilterOK() *GetPrefilterOK {\n\n\treturn &GetPrefilterOK{}\n}", "func NewGetFlowOK() *GetFlowOK {\n\n\treturn &GetFlowOK{}\n}", "func OK(data interface{}, w http.ResponseWriter) {\n\tjsonResponse(data, http.StatusOK, w)\n}", "func OK(w http.ResponseWriter, data interface{}, message string) {\n\tsuccessResponse := BuildSuccess(data, message, MetaInfo{HTTPStatus: http.StatusOK})\n\tWrite(w, successResponse, http.StatusOK)\n}", "func (ArticleController) GetAPOD(c *gin.Context) {\n\tarticles, err := models.GetArticleByDate(time.Now().Format(\"01-02-2006\"))\n\tif err != nil {\n\t\tc.JSON(err.Code(), gin.H{\n\t\t\t\"message\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, articles)\n}" ]
[ "0.645337", "0.6250054", "0.6168213", "0.60613585", "0.58005905", "0.5772296", "0.54896456", "0.5162543", "0.51595294", "0.51544863", "0.50428367", "0.5013863", "0.49586725", "0.49487945", "0.49138904", "0.48930493", "0.4884294", "0.48842543", "0.4881559", "0.48719835", "0.47812745", "0.47782138", "0.47770226", "0.4772251", "0.47649917", "0.475837", "0.47576982", "0.47223994", "0.47197092", "0.4717156", "0.47106838", "0.47030747", "0.46797824", "0.46777606", "0.46522754", "0.4647072", "0.46404153", "0.46245283", "0.46054548", "0.45816976", "0.45793995", "0.45511404", "0.45465985", "0.45457894", "0.45408547", "0.45378393", "0.45312718", "0.4476465", "0.44730458", "0.445139", "0.44486302", "0.44278783", "0.4424163", "0.44143543", "0.44084316", "0.43899795", "0.43863297", "0.43794212", "0.4371492", "0.43696988", "0.43670312", "0.43605343", "0.4359947", "0.43508428", "0.43498555", "0.43435675", "0.43387976", "0.4330842", "0.43168497", "0.4316298", "0.43118408", "0.43103844", "0.4300863", "0.42957228", "0.4293154", "0.42923748", "0.4291036", "0.4282705", "0.42821828", "0.42819917", "0.42809385", "0.42775923", "0.4270898", "0.42679092", "0.42614177", "0.42613122", "0.42602435", "0.4255419", "0.4255175", "0.42539477", "0.425245", "0.42505133", "0.4248998", "0.42478538", "0.4245087", "0.42421743", "0.42416412", "0.42412618", "0.42312568", "0.42308706" ]
0.7227446
0
GetFeedOKLink runs the method Get of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func GetFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedLink) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) getCtx, _err := app.NewGetFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.Get(getCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 200 { t.Errorf("invalid response status code: got %+v, expected 200", rw.Code) } var mt *app.FeedLink if resp != nil { var _ok bool mt, _ok = resp.(*app.FeedLink) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetFeedContext) OKLink(r *FeedLink) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *GetFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewGetfeedsOK() *GetfeedsOK {\n\treturn &GetfeedsOK{}\n}", "func (ctx *UpdateFeedContext) OKLink(r *FeedLink) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (oc *OAuthConsumer) Get( url string, fparams Params, at *AccessToken) (r *http.Response, err os.Error) {\n\treturn oc.oAuthRequest(url, fparams, at, \"GET\")\n}", "func NewGetDatalinksOK() *GetDatalinksOK {\n\treturn &GetDatalinksOK{}\n}", "func UpdateFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func Get(url string, r io.Reader, w io.Writer, clientGenerator func() *http.Client, reqTuner ...func(*http.Request)) error {\n\treturn Request(\"GET\", url, r, w, clientGenerator, reqTuner...)\n}", "func makeGoGetEndpoint(svc GoGetterService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(goGetRequest)\n\t\tshow, err := svc.GoGet(req.Channel, req.Date)\n\t\tif err != nil {\n\t\t\treturn goGetResponse{req.Channel, req.Date, show, err.Error()}, nil\n\t\t}\n\t\treturn goGetResponse{req.Channel, req.Date, show, \"\"}, nil\n\t}\n}", "func (s service) Get(ctx context.Context, code string) (Link, error) {\n\tlink, err := s.repo.GetByCode(ctx, code)\n\tif err != nil {\n\t\treturn Link{}, err\n\t}\n\n\treturn Link{Code: link.Code, OriginalURL: link.OriginalURL, CreatedAt: link.CreatedAt}, nil\n}", "func getFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tformat := chi.URLParam(r, \"format\")\n\t\tif format == \"\" {\n\t\t\tformat = \"rss\"\n\t\t}\n\t\ts, err := s.ServeFeed(format, plugin)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error serving the feed\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tswitch format {\n\t\tcase \"atom\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/atom+xml\")\n\t\tcase \"json\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tdefault:\n\t\t\tw.Header().Set(\"Content-Type\", \"application/rss+xml\")\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(s))\n\t}\n}", "func (ctx *ShowBottleContext) OK(r *GoaExampleBottle) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.example.bottle+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (c *CommentApiController) GetUserFeed(w http.ResponseWriter, r *http.Request) {\n\tresult, err := c.service.GetUserFeed(r.Context())\n\t// If an error occurred, encode the error with the status code\n\tif err != nil {\n\t\tc.errorHandler(w, r, err, &result)\n\t\treturn\n\t}\n\t// If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, result.Headers, w)\n\n}", "func (ctx *ShowBottleContext) OK(r *GoaExampleBottle) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.example.bottle+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (r *GowebHTTPResponder) WithOK(ctx context.Context) error {\n\treturn r.WithStatus(ctx, http.StatusOK)\n}", "func (controller *EchoController) Get(context *qhttp.Context) {\n\tr := context.Request\n\tcontext.Write(fmt.Sprintf(\"Host: %s\\n\", r.Host))\n\tcontext.Write(fmt.Sprintf(\"RequestURI: %s\\n\", r.RequestURI))\n\tcontext.Write(fmt.Sprintf(\"Method: %s\\n\", r.Method))\n\tcontext.Write(fmt.Sprintf(\"RemoteAddr: %s\\n\", r.RemoteAddr))\n\tcontext.Write(fmt.Sprintf(\"Content Length: %d\\n\", r.ContentLength))\n\tcontext.Write(\"Headers:\\n\")\n\tfor k, v := range context.Request.Header {\n\t\tcontext.Write(fmt.Sprintf(\"\\t%s: %s\\n\", k, v))\n\t}\n\n\tif !stringutil.IsWhiteSpace(context.URIParameters[\"toEcho\"]) {\n\t\tcontext.Write(fmt.Sprintf(\"URI:\\n%s\\n\", context.URIParameters[\"toEcho\"]))\n\t}\n\n\tif context.Request.ContentLength > 0 {\n\t\tcontext.Write(\"Body:\\n\")\n\t\tbody, err := context.Read()\n\t\tif err != nil {\n\t\t\tcontext.SetError(qerror.NewRestError(qerror.SystemError, \"\", nil), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tcontext.Response.Write(body)\n\t}\n\n}", "func (t *RPCCtx) Get(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RPCCtx\", \"Get\")\n\n\treqCtx := r.Context()\n\twhatever := reqCtx\n\n\tt.embed.Get(whatever)\n\n\tw.WriteHeader(200)\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RPCCtx\", \"Get\")\n\n}", "func (t *RestURL) MaybeGet(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RestURL\", \"MaybeGet\")\n\n\txxRouteVars := mux.Vars(r)\n\n\txxURLValues := r.URL.Query()\n\tvar urlArg1 *string\n\tif false {\n\t} else if _, ok := xxRouteVars[\"arg1\"]; ok {\n\t\txxTmpurlArg1 := xxRouteVars[\"arg1\"]\n\t\turlArg1 = &xxTmpurlArg1\n\t} else if _, ok := xxURLValues[\"arg1\"]; ok {\n\t\txxTmpurlArg1 := xxURLValues.Get(\"arg1\")\n\t\turlArg1 = &xxTmpurlArg1\n\t}\n\n\tt.embed.MaybeGet(urlArg1)\n\n\tw.WriteHeader(200)\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RestURL\", \"MaybeGet\")\n\n}", "func getResponseOK(args ...interface{}) docs.Response {\n\tdescription := \"OK\"\n\tif args != nil {\n\t\tdescription = args[0].(string)\n\t}\n\n\treturn docs.Response{\n\t\tCode: 200,\n\t\tDescription: description,\n\t}\n}", "func Ok(c *routing.Context, msg string, service string) error {\n\tResponse(c, msg, 200, service, \"application/json\")\n\treturn nil\n}", "func (controller *APIController) Get(context *qhttp.Context) {\n\tcontext.Response.Header().Add(\"Content-Type\", \"text/html\")\n\tcontext.SetResponse(`<html>\n\t<head>\n\t\t<title>Example API Documenation</title>\n\t</head>\n\t<body>\n\t\t<h3>Endpoints</h3>\n\t\t<ul>\n\t\t\t<li>[GET / POST] /api/widgets</li>\n\t\t\t<li>[GET / PUT / PATCH / DELETE] /api/widgets/{{id}}</li>\n\t\t</ul>\n\t\t<h3>Authentication</h3>\n\t\t<p>Send a header of <b>Authorization</b> with a value of <b>valid</b></p>\n\t</body>\n\t</html>`, http.StatusOK)\n}", "func (c *Client) Get(ctx context.Context, url string, data ...interface{}) (*Response, error) {\n\treturn c.DoRequest(ctx, http.MethodGet, url, data...)\n}", "func (ctx *AddLinkWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"text/plain\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func (a *Api) getPage(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tlinkId, ok := vars[\"link_id\"]\n\tif !ok {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tl, err := a.LinkUseCases.LoggerGetLinkByLinkId(a.LinkUseCases.GetLinkByLinkId)(linkId)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\thttp.Redirect(w, r, l, http.StatusSeeOther)\n}", "func CreateFeedCreatedLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ShowTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (h *UrlHandler) Get(c *gin.Context) {\n\tqValue, ok := c.GetQuery(\"shortUrl\")\n\tif !ok {\n\t\te := NewAPIError(400, CodeMissingParam, \"\", errors.New(\"Missing 'shortUrl' query parameter\"))\n\t\tc.JSON(e.Status, e)\n\t\treturn\n\t}\n\n\tif !utils.IsRequestURL(qValue) {\n\t\te := NewAPIError(422, CodeInvalidParam, \"\", fmt.Errorf(\"Invalid shortUrl: %s\", qValue))\n\t\tc.JSON(e.Status, e)\n\t\treturn\n\t}\n\n\titem, err := h.service.Get(c, qValue)\n\tif err != nil {\n\t\t// TODO: send errors to logging service\n\t\tif IsNotFound(err) {\n\t\t\tc.JSON(404, ErrAPINotFound)\n\t\t\treturn\n\t\t}\n\n\t\tlogrus.Error(err)\n\t\tc.JSON(500, ErrAPIInternal)\n\t\treturn\n\t}\n\n\tjsonData(c, http.StatusOK, item)\n}", "func (o *OAuthApp) GetLinkOk() (*string, bool) {\n\tif o == nil || o.Link == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Link, true\n}", "func ListFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedTinyCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedTinyCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedTinyCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTinyCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (_obj *Apichannels) Channels_exportMessageLinkOneWayWithContext(tarsCtx context.Context, params *TLchannels_exportMessageLink, _opt ...map[string]string) (ret ExportedMessageLink, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"channels_exportMessageLink\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func NewGetControllerServiceOK() *GetControllerServiceOK {\n\treturn &GetControllerServiceOK{}\n}", "func (ctx *GetOpmlContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/xml\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func get(w http.ResponseWriter, req *http.Request) {\n\tresponse := \"\"\n\tswitch req.RequestURI {\n\t\tcase \"/get/accounts\":\n\t\t\tmapD := map[string]int{\"apple\": 5, \"lettuce\": 7}\n\t\t\tmapB, _ := json.Marshal(mapD)\n\t\t\tresponse = string(mapB)\n\t\t\tbreak\n\t\tdefault:\n\t\t\tr, _ := json.Marshal(\"Request not found\")\n\t\t\tresponse = string(r)\n\t\t\tbreak\n\t}\n\n\tcontext := Context{Title: response}\n\trender(w, \"api\", context)\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteLinkWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"text/plain\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func (cli *Client) Get(targetURL *url.URL) {\n\tvar resp *resty.Response\n\tvar err error\n\n\tif cli.Config.Oauth2Enabled {\n\t\tresp, err = resty.R().\n\t\t\tSetHeader(\"Authorization\", fmt.Sprintf(\"Bearer %s\", cli.AccessToken)).\n\t\t\tGet(targetURL.String())\n\t} else {\n\t\tresp, err = resty.R().Get(targetURL.String())\n\t}\n\tif err != nil {\n\t\tfmt.Printf(\"ERR: Could not GET request, caused by: %s\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tfmt.Print(resp)\n}", "func Handler(_ context.Context, resp *crawl.Response) error {\n\treturn Open(resp)\n}", "func Get(ctx context.Context, url string, options ...RequestOption) (*Response, error) {\n\tr, err := newRequest(ctx, http.MethodGet, url, nil, options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn doRequest(http.DefaultClient, r)\n}", "func (ctx *ListFeedContext) OK(r FeedCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.feed.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FeedCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *GetSwaggerContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func Test_Ctx_Links(t *testing.T) {\n\tt.Parallel()\n\tapp := New()\n\tctx := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(ctx)\n\n\tctx.Links()\n\tutils.AssertEqual(t, \"\", string(ctx.Fasthttp.Response.Header.Peek(HeaderLink)))\n\n\tctx.Links(\n\t\t\"http://api.example.com/users?page=2\", \"next\",\n\t\t\"http://api.example.com/users?page=5\", \"last\",\n\t)\n\tutils.AssertEqual(t, `<http://api.example.com/users?page=2>; rel=\"next\",<http://api.example.com/users?page=5>; rel=\"last\"`, string(ctx.Fasthttp.Response.Header.Peek(HeaderLink)))\n}", "func (ctx *MoveLinkWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"text/plain\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func (t *RestURLDescriptor) MaybeGet() *ggt.MethodDescriptor { return t.methodMaybeGet }", "func Get(c echo.Context) error {\n\treturn c.JSON(http.StatusOK, http.StatusOK)\n}", "func (ri *RestInvoker) ContextDo(ctx context.Context, req *rest.Request, options ...InvocationOption) (*rest.Response, error) {\n\topts := getOpts(string(req.GetRequest().Host()), options...)\n\topts.Protocol = common.ProtocolRest\n\tif len(opts.Filters) == 0 {\n\t\topts.Filters = ri.opts.Filters\n\t}\n\tif string(req.GetRequest().URI().Scheme()) != \"cse\" {\n\t\treturn nil, fmt.Errorf(\"Scheme invalid: %s, only support cse://\", req.GetRequest().URI().Scheme())\n\t}\n\tif req.GetHeader(\"Content-Type\") == \"\" {\n\t\treq.SetHeader(\"Content-Type\", \"application/json\")\n\t}\n\tnewReq := req.Copy()\n\tdefer newReq.Close()\n\tresp := rest.NewResponse()\n\tnewReq.SetHeader(common.HeaderSourceName, config.SelfServiceName)\n\tinv := invocation.CreateInvocation()\n\twrapInvocationWithOpts(inv, opts)\n\tinv.AppID = config.GlobalDefinition.AppID\n\tinv.MicroServiceName = string(req.GetRequest().Host())\n\tinv.Args = newReq\n\tinv.Reply = resp\n\tinv.Ctx = ctx\n\tinv.URLPathFormat = req.Req.URI().String()\n\tinv.MethodType = req.GetMethod()\n\tc, err := handler.GetChain(common.Consumer, ri.opts.ChainName)\n\tif err != nil {\n\t\tlager.Logger.Errorf(err, \"Handler chain init err.\")\n\t\treturn nil, err\n\t}\n\tc.Next(inv, func(ir *invocation.InvocationResponse) error {\n\t\terr = ir.Err\n\t\treturn err\n\t})\n\treturn resp, err\n}", "func (h *Hello) Get(c *yarf.Context) error {\n\tc.Render(\"Hello world!\")\n\n\treturn nil\n}", "func (ctx *GetOutputContext) OK(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func GetRoot(w http.ResponseWriter, r *http.Request) {\n links := []restReps.Link {\n restReps.Link{Rel: articlesReps.GetArticlesRel, Method: http.MethodGet, Uri: constants.GetArticlesUri + \"/\"},\n }\n api := restReps.Api{Links: links}\n json.NewEncoder(w).Encode(api)\n}", "func NewGetChannelsOK() *GetChannelsOK {\n\treturn &GetChannelsOK{}\n}", "func (app *App) Get(url string, handler handlerFunc) {\n\trequestRegexp := app.craterRouter.normalizeRoute(url)\n\tapp.craterRequestHandler.handleGet(requestRegexp, func(w http.ResponseWriter, r *http.Request) {\n\t\tapp.serveRequest(w, r, handler, requestRegexp)\n\t})\n}", "func getChart(w http.ResponseWriter, req *http.Request, params Params) {\n\tdb, closer := dbSession.DB()\n\tdefer closer()\n\tvar chart models.Chart\n\tchartID := fmt.Sprintf(\"%s/%s\", params[\"repo\"], params[\"chartName\"])\n\tif err := db.C(chartCollection).FindId(chartID).One(&chart); err != nil {\n\t\tlog.WithError(err).Errorf(\"could not find chart with id %s\", chartID)\n\t\tresponse.NewErrorResponse(http.StatusNotFound, \"could not find chart\").Write(w)\n\t\treturn\n\t}\n\n\tcr := newChartResponse(&chart)\n\tresponse.NewDataResponse(cr).Write(w)\n}", "func getChart(c echo.Context) error {\n\tconfig, err := parseChartConfig(c)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]interface{}{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t}\n\n\tmarket := c.Param(\"market\")\n\tpair := c.Param(\"pair\")\n\n\treturn c.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"market\": market,\n\t\t\"pair\": pair,\n\t\t\"config\": config,\n\t})\n}", "func (o *Service) GetServiceLinkOk() (string, bool) {\n\tif o == nil || o.ServiceLink == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.ServiceLink, true\n}", "func NewGetLinkInfoOK() *GetLinkInfoOK {\n\n\treturn &GetLinkInfoOK{}\n}", "func NewGetDashboardOK() *GetDashboardOK {\n\treturn &GetDashboardOK{}\n}", "func getLinkPage(title string, targetAPI *Config, plcontinue *string) (*LinkResponse, error) {\n\tu, _ := url.Parse(targetAPI.APIRoot)\n\tu.Scheme = targetAPI.Protocol\n\n\tq := u.Query()\n\tq.Set(\"action\", \"query\")\n\tq.Set(\"titles\", title)\n\tq.Set(\"prop\", \"links\")\n\tq.Set(\"pllimit\", \"max\")\n\tq.Set(\"format\", \"json\")\n\n\tif plcontinue != nil {\n\t\tq.Set(\"plcontinue\", *plcontinue)\n\t}\n\n\tu.RawQuery = q.Encode()\n\n\tres, reqErr := http.Get(u.String())\n\n\tif reqErr != nil {\n\t\tfmt.Println(\"Request failed!\")\n\t\treturn nil, reqErr\n\t}\n\n\tdefer res.Body.Close()\n\n\tbody, readBodyErr := ioutil.ReadAll(res.Body)\n\tif readBodyErr != nil {\n\t\tfmt.Println(\"Can't read response body!\")\n\t\treturn nil, readBodyErr\n\t}\n\n\tdata := LinkResponse{}\n\tjsonParseErr := json.Unmarshal(body, &data)\n\tif jsonParseErr != nil {\n\t\tfmt.Println(\"Invalid json!\")\n\t\treturn nil, readBodyErr\n\t}\n\n\treturn &data, nil\n}", "func (h *Handler) get(c echo.Context) (e error) {\n\tctx := c.(*cuxs.Context)\n\t// get query string from request\n\trq := ctx.RequestQuery()\n\tvar data *[]model.SalesReturn\n\n\tvar tot int64\n\n\tif data, tot, e = GetSalesReturn(rq); e == nil {\n\t\tctx.Data(data, tot)\n\t}\n\n\treturn ctx.Serve(e)\n}", "func ExampleLinkerClient_Get() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armservicelinker.NewClientFactory(cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewLinkerClient().Get(ctx, \"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app\", \"linkName\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.LinkerResource = armservicelinker.LinkerResource{\n\t// \tName: to.Ptr(\"linkName\"),\n\t// \tType: to.Ptr(\"Microsoft.ServiceLinker/links\"),\n\t// \tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app/providers/Microsoft.ServiceLinker/links/linkName\"),\n\t// \tProperties: &armservicelinker.LinkerProperties{\n\t// \t\tAuthInfo: &armservicelinker.SecretAuthInfo{\n\t// \t\t\tAuthType: to.Ptr(armservicelinker.AuthTypeSecret),\n\t// \t\t\tName: to.Ptr(\"name\"),\n\t// \t\t},\n\t// \t\tTargetService: &armservicelinker.AzureResource{\n\t// \t\t\tType: to.Ptr(armservicelinker.TargetServiceTypeAzureResource),\n\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db\"),\n\t// \t\t},\n\t// \t},\n\t// \tSystemData: &armservicelinker.SystemData{\n\t// \t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-07-12T22:05:09Z\"); return t}()),\n\t// \t},\n\t// }\n}", "func (ArticleController) GetAPOD(c *gin.Context) {\n\tarticles, err := models.GetArticleByDate(time.Now().Format(\"01-02-2006\"))\n\tif err != nil {\n\t\tc.JSON(err.Code(), gin.H{\n\t\t\t\"message\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, articles)\n}", "func (d *Doer) Get(url string, response interface{}) (*http.Response, error) {\n\treq, err := d.newRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn d.do(req, response)\n}", "func NewGetOK() *GetOK {\n\treturn &GetOK{}\n}", "func (o *HandleGetAboutUsingGETParams) WithHTTPClient(client *http.Client) *HandleGetAboutUsingGETParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewGetDocumentOK() *GetDocumentOK {\n\n\treturn &GetDocumentOK{}\n}", "func NewGetEveroutePackagesOK() *GetEveroutePackagesOK {\n\treturn &GetEveroutePackagesOK{}\n}", "func NewGetActivitiesTrackerResourceByDateRangeOK() *GetActivitiesTrackerResourceByDateRangeOK {\n\treturn &GetActivitiesTrackerResourceByDateRangeOK{}\n}", "func Get(dst []byte, url string) (statusCode int, body []byte, err error) {\n\treturn defaultClient.Get(dst, url)\n}", "func (c *ComicClient) Get(link, hostname string) (*http.Response, error) {\n\trequest, err := c.PrepareRequest(link, hostname)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.Client.Do(request)\n}", "func NewGetDCForSeedOK() *GetDCForSeedOK {\n\treturn &GetDCForSeedOK{}\n}", "func NewWeaviateThingsGetOK() *WeaviateThingsGetOK {\n\treturn &WeaviateThingsGetOK{}\n}", "func (app *App) GET(url string, handler ...Handler) *App {\n\tapp.routeANY = false\n\tapp.AppendReqAndResp(url, \"get\", handler)\n\treturn app\n}", "func (h *Handlers) Get(w http.ResponseWriter, r *http.Request) {\n\tinput := &hub.GetPackageInput{\n\t\tPackageName: chi.URLParam(r, \"packageName\"),\n\t\tVersion: chi.URLParam(r, \"version\"),\n\t}\n\tchartRepositoryName := chi.URLParam(r, \"repoName\")\n\tif chartRepositoryName != \"\" {\n\t\tinput.ChartRepositoryName = chartRepositoryName\n\t}\n\tdataJSON, err := h.pkgManager.GetJSON(r.Context(), input)\n\tif err != nil {\n\t\th.logger.Error().Err(err).Interface(\"input\", input).Str(\"method\", \"Get\").Send()\n\t\tif errors.Is(err, pkg.ErrInvalidInput) {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t} else if errors.Is(err, pkg.ErrNotFound) {\n\t\t\thttp.NotFound(w, r)\n\t\t} else {\n\t\t\thttp.Error(w, \"\", http.StatusInternalServerError)\n\t\t}\n\t\treturn\n\t}\n\thelpers.RenderJSON(w, dataJSON, helpers.DefaultAPICacheMaxAge)\n}", "func getStory(w http.ResponseWriter, r *http.Request) {\n\t// read the id\n\tid := mux.Vars(r)[\"id\"]\n\t// format the url\n\tstoryURL := fmtURL(id)\n\t// Make request and get response body\n\tdata := fmtRes(storyURL)\n\tfmt.Println(\"data:\", data)\n\tw.Write([]byte(data))\n}", "func ListTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, app.TodoCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.TodoCollection\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(app.TodoCollection)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.TodoCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func OpenContext(ctx context.Context, url string, options *Options) (*File, error) {\n\n\tif ctx == nil {\n\t\tpanic(\"nil context\")\n\t}\n\n\tf := &File{\n\t\turl: url,\n\t\tbaseName: filepath.Base(url),\n\t\toptions: options,\n\t}\n\n\treq, err := http.NewRequest(http.MethodHead, f.url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif f.options != nil && f.options.Request != nil {\n\t\tf.options.Request(req)\n\t}\n\n\tvar client http.Client\n\tif f.options != nil && f.options.Client != nil {\n\t\tclient = f.options.Client()\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\t// not all services support HEAD requests\n\t\t// so if this fails just move along to the\n\t\t// GET portion, with a warning\n\t\tlog.Printf(\"notice: unexpected HEAD response code '%d', proceeding with download.\\n\", resp.StatusCode)\n\t\terr = f.download(ctx)\n\t} else {\n\t\tf.size = resp.ContentLength\n\t\tif f.options != nil && f.options.MaxSize > 0 && f.size > f.options.MaxSize {\n\t\t\treturn nil, fmt.Errorf(\"%w: %s (%s)\", ErrMaximumSizeExceeded, com.HumaneFileSize(uint64(f.options.MaxSize)), com.HumaneFileSize(uint64(f.size)))\n\t\t}\n\t\tif t := resp.Header.Get(\"Accept-Ranges\"); t == \"bytes\" {\n\t\t\terr = f.downloadRangeBytes(ctx)\n\t\t} else {\n\t\t\terr = f.download(ctx)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\tf.closeFileHandles()\n\t\treturn nil, err\n\t}\n\n\treturn f, nil\n}", "func (o *WeaviateThingsGetOK) WithPayload(payload *models.ThingGetResponse) *WeaviateThingsGetOK {\n\to.Payload = payload\n\treturn o\n}", "func Ok(ctx context.Context, w http.ResponseWriter, response interface{}) {\n\treader, err := FormatOk(response)\n\tif err != nil {\n\t\tlog.Error(ctx, \"unable marshal response\", \"err\", err, \"type\", \"reply\")\n\t\tErr(ctx, w, http.StatusInternalServerError, \"internal error\")\n\t\treturn\n\t}\n\n\tFromContext(ctx).Reply(ctx, w, http.StatusOK, reader)\n}", "func (launcher *echoLauncherImpl) GetEcho(ctx fidl.Context, prefix string) (examples.EchoWithCtxInterface, error) {\n\t// In the non-pipelined case, the server is responsible for initializing the channel. It\n\t// then binds an Echo implementation to the server end, and responds with\n\t// the client end\n\tserverEnd, clientEnd, err := examples.NewEchoWithCtxInterfaceRequest()\n\tif err != nil {\n\t\treturn examples.EchoWithCtxInterface{}, err\n\t}\n\n\tstub := examples.EchoWithCtxStub{Impl: &echoImpl{prefix: prefix}}\n\tgo component.Serve(context.Background(), &stub, serverEnd.ToChannel(), component.ServeOptions{\n\t\tOnError: func(err error) {\n\t\t\tlog.Println(err)\n\t\t},\n\t})\n\n\treturn *clientEnd, nil\n}", "func UpdateFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func first(w http.ResponseWriter,r *http.Request){\n\tif r.Method == \"GET\"{\n\t\tsendRes(202,Example,w)\n\t}\n}", "func (z *Zoidberg) getIt(t *testing.T, req *http.Request, reqBody interface{}, resp *http.Response, body []byte, r Request) {\n\tquery := \"\"\n\tif req.URL.RawQuery != \"\" {\n\t\tquery = fmt.Sprintf(\"?%s\", req.URL.RawQuery)\n\t}\n\tfmt.Fprintf(z.w, \".. http:%s:: %s\\n\\n\", strings.ToLower(req.Method), req.URL.Path)\n\tfmt.Fprintf(z.w, \" %s\\n\\n\", r.Description)\n\n\t// Write in the response codes\n\tif r.ResponseCodes != nil {\n\t\tresponseCodesOrdered := []int{}\n\t\tfor k := range r.ResponseCodes {\n\t\t\tresponseCodesOrdered = append(responseCodesOrdered, k)\n\t\t}\n\t\tsort.Ints(responseCodesOrdered)\n\t\tfmt.Fprintf(z.w, \" **Response Code**\\n\\n\")\n\t\tfor _, code := range responseCodesOrdered {\n\t\t\tfmt.Fprintf(z.w, \" - %d: %s\\n\\n\", code, r.ResponseCodes[code])\n\t\t}\n\t}\n\tfmt.Fprintf(z.w, \"\\n\\n\")\n\n\t// Write in the parameters\n\tif r.ParameterValues != nil {\n\t\tparameterValuesOrdered := []string{}\n\t\tfor k := range r.ParameterValues {\n\t\t\tparameterValuesOrdered = append(parameterValuesOrdered, k)\n\t\t}\n\t\tsort.Strings(parameterValuesOrdered)\n\t\tfmt.Fprintf(z.w, \" **Query Parameters**\\n\\n\")\n\t\tfor _, param := range parameterValuesOrdered {\n\t\t\tfmt.Fprintf(z.w, \" - **%s**: %s\\n\\n\", param, r.ParameterValues[param])\n\t\t}\n\t}\n\tfmt.Fprintf(z.w, \"\\n\\n\")\n\n\t// Write in the response codes\n\tif r.ResponseJSONObjects != nil {\n\t\tresponseJSONObjectsOrdered := []string{}\n\t\tfor k := range r.ResponseJSONObjects {\n\t\t\tresponseJSONObjectsOrdered = append(responseJSONObjectsOrdered, k)\n\t\t}\n\t\tsort.Strings(responseJSONObjectsOrdered)\n\t\tfmt.Fprintf(z.w, \" **Response JSON Object**\\n\\n\")\n\t\tfor _, code := range responseJSONObjectsOrdered {\n\t\t\tfmt.Fprintf(z.w, \" - **%s**: %s\\n\\n\", code, r.ResponseJSONObjects[code])\n\t\t}\n\t}\n\tfmt.Fprintf(z.w, \"\\n\\n\")\n\n\tfmt.Fprintf(z.w, \" Example request:\\n\\n\")\n\tfmt.Fprintf(z.w, \" .. sourcecode:: http\\n\\n\")\n\tfmt.Fprintf(z.w, \" %s %s%s %s\\n\", req.Method, req.URL.Path, query, req.Proto)\n\tfor k := range req.Header {\n\t\tfmt.Fprintf(z.w, \" %s: %s\\n\", k, req.Header.Get(k))\n\t}\n\n\tif reqBody != nil {\n\t\tb, err := json.MarshalIndent(reqBody, \" \", \" \")\n\t\trequire.NoError(t, err)\n\t\tfmt.Fprintf(z.w, \"\\n\")\n\t\tfmt.Fprintf(z.w, \" %s\\n\\n\", b)\n\t}\n\n\tfmt.Fprintf(z.w, \"\\n\")\n\tfmt.Fprintf(z.w, \" Example response:\\n\\n\")\n\tfmt.Fprintf(z.w, \" .. sourcecode:: http\\n\\n\")\n\tfmt.Fprintf(z.w, \" %s %s\\n\", resp.Proto, resp.Status)\n\tfor k := range resp.Header {\n\t\tfmt.Fprintf(z.w, \" %s: %s\\n\", k, resp.Header.Get(k))\n\t}\n\tfmt.Fprintf(z.w, \"\\n\")\n\n\tvar jb interface{}\n\tif len(body) > 0 {\n\t\trequire.NoError(t, json.Unmarshal(body, &jb))\n\t\tb, err := json.MarshalIndent(jb, \" \", \" \")\n\t\trequire.NoError(t, err)\n\t\tfmt.Fprintf(z.w, \" %s\\n\\n\", b)\n\t}\n\n}", "func (b *Builder) Get(url string) *Builder {\n\tb.Url = url\n\tb.Method = http.MethodGet\n\treturn b\n}", "func (ri *RestInvoker) ContextDo(ctx context.Context, req *rest.Request, options ...InvocationOption) (*rest.Response, error) {\n\tif string(req.GetRequest().URL.Scheme) != \"cse\" {\n\t\treturn nil, fmt.Errorf(\"scheme invalid: %s, only support cse://\", req.GetRequest().URL.Scheme)\n\t}\n\n\topts := getOpts(req.GetRequest().Host, options...)\n\topts.Protocol = common.ProtocolRest\n\n\tresp := rest.NewResponse()\n\n\tinv := invocation.New(ctx)\n\twrapInvocationWithOpts(inv, opts)\n\tinv.MicroServiceName = req.GetRequest().Host\n\t// TODO load from openAPI schema\n\t// inv.SchemaID = schemaID\n\t// inv.OperationID = operationID\n\tinv.Args = req\n\tinv.Reply = resp\n\tinv.URLPathFormat = req.Req.URL.Path\n\n\tinv.SetMetadata(common.RestMethod, req.GetMethod())\n\n\terr := ri.invoke(inv)\n\treturn resp, err\n}", "func (a *Router) Get(pattern string, hs ...func(*Context) error) *Router {\n\treturn a.Handle(http.MethodGet, pattern, hs...)\n}", "func (cl *Client) Get(c context.Context, url string, opts ...RequestOption) (*Response, error) {\n\treq, err := cl.NewRequest(c, http.MethodGet, url, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cl.Do(c, req)\n}", "func wrappedHandler(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tgg, ok := r.URL.Query()[\"go-get\"]\n\t\tif ok && len(gg) == 1 && gg[0] == \"1\" {\n\t\t\t// Serve a trivial html page.\n\t\t\tw.Write([]byte(goGetHTML5))\n\t\t\treturn\n\t\t}\n\t\t// Fallthrough.\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func NewGetAPIOK() *GetAPIOK {\n\treturn &GetAPIOK{}\n}", "func (c *Client) Do(ctx context.Context, req *http.Request, fn Parser, v interface{}) (*http.Response, error) {\n\treq = req.WithContext(ctx)\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ctx.Err()\n\t\tdefault:\n\t\t}\n\n\t\t// If the error type is *url.Error, sanitize its URL before returning.\n\t\tif e, ok := err.(*url.Error); ok {\n\t\t\tif u, err := url.Parse(e.URL); err == nil {\n\t\t\t\te.URL = sanitizeURL(u).String()\n\t\t\t\treturn nil, e\n\t\t\t}\n\t\t}\n\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif err := CheckResponse(resp); err != nil {\n\t\treturn resp, err\n\t}\n\n\tif err := fn(resp.Body, v); err != nil {\n\t\treturn resp, err\n\t}\n\n\treturn resp, nil\n}", "func makeGetBookEndpoint(svc BookService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t// convert request into a bookRequest\n\t\treq := request.(getBookRequest)\n\n\t\t// call actual service with data from the req\n\t\tbook, err := svc.GetBook(req.Bearer, req.BookId)\n\t\treturn bookResponse{\n\t\t\tData: book,\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func (ctx *GetFeedContext) OKTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (client *Client) Get(c context.Context, uri string, params interface{}, res interface{}) (err error) {\n\treq, err := client.NewRequest(xhttp.MethodGet, uri, params)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn client.client.Do(c, req, res)\n}", "func echoAiGetHandler(e echo.Context) error {\n\t// Create response object\n\tbody := &StatusResponse{\n\t\tStatus: \"Hello world from echo!\",\n\t\tAI: e.Param(\"ai\"),\n\t}\n\n\t// In this case we can return the JSON function with our body as errors\n\t// thrown by this will be handled\n\treturn e.JSON(http.StatusOK, body)\n}", "func (api ResourcesAPI) Get(w http.ResponseWriter, r *http.Request) {\n\t// uncomment below line to add header\n\t// w.Header().Set(\"key\",\"value\")\n\tfmt.Fprintf(w, \"Actual implementation should return a resource\")\n}", "func (widgetController WidgetController) GetWidget(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\n\t// Grab id\n\tvars := mux.Vars(r)\n\tid := vars[\"id\"]\n\n\t// Verify id is ObjectId, otherwise bail\n\tif !bson.IsObjectIdHex(id) {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Grab id\n\toid := bson.ObjectIdHex(id)\n\n\t// Stub widget\n\twidget := models.Widget{}\n\n\t// Fetch widget\n\tif err := widgetController.session.DB(common.AppConfig.Database).C(\"widgets\").FindId(oid).One(&widget); err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Marshal provided interface into JSON structure\n\twidgetJSON, _ := json.Marshal(widget)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\tfmt.Fprintf(w, \"%s\", widgetJSON)\n}" ]
[ "0.6496912", "0.5805249", "0.5754004", "0.5724534", "0.55789983", "0.5438612", "0.5168263", "0.51556456", "0.50967133", "0.4941615", "0.49298826", "0.49228907", "0.48217368", "0.47913963", "0.46849155", "0.4676267", "0.46603617", "0.46588925", "0.46425873", "0.46346062", "0.46139", "0.459624", "0.45687976", "0.45608938", "0.4548782", "0.4541065", "0.45248666", "0.45047495", "0.45014217", "0.44933435", "0.448611", "0.44687602", "0.44608623", "0.44536144", "0.44415677", "0.44102323", "0.43926758", "0.4390939", "0.43807727", "0.4377001", "0.43707123", "0.4355411", "0.4333183", "0.43318528", "0.43280312", "0.4322695", "0.43045133", "0.43035468", "0.42968708", "0.42910427", "0.42904964", "0.42859116", "0.4271164", "0.42685765", "0.42659315", "0.42620465", "0.42522505", "0.42479858", "0.42479372", "0.4233003", "0.42287183", "0.42228165", "0.42142296", "0.42136073", "0.42015824", "0.41975", "0.41898477", "0.41830745", "0.41815096", "0.41735265", "0.41668308", "0.4164371", "0.41583633", "0.41565228", "0.41462386", "0.41437346", "0.4137559", "0.41278392", "0.4124273", "0.41181085", "0.41110444", "0.41109633", "0.4107536", "0.41056228", "0.4102746", "0.4102633", "0.41007128", "0.4098006", "0.4096412", "0.40941253", "0.40910348", "0.40861112", "0.4081595", "0.40789598", "0.40763655", "0.40722603", "0.40708286", "0.40692896", "0.4065528", "0.4060414" ]
0.7301832
0
GetFeedOKTiny runs the method Get of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) getCtx, _err := app.NewGetFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.Get(getCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 200 { t.Errorf("invalid response status code: got %+v, expected 200", rw.Code) } var mt *app.FeedTiny if resp != nil { var _ok bool mt, _ok = resp.(*app.FeedTiny) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedTinyCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedTinyCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedTinyCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTinyCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetFeedContext) OKTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (t *RPCCtx) Get(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RPCCtx\", \"Get\")\n\n\treqCtx := r.Context()\n\twhatever := reqCtx\n\n\tt.embed.Get(whatever)\n\n\tw.WriteHeader(200)\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RPCCtx\", \"Get\")\n\n}", "func getFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tformat := chi.URLParam(r, \"format\")\n\t\tif format == \"\" {\n\t\t\tformat = \"rss\"\n\t\t}\n\t\ts, err := s.ServeFeed(format, plugin)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error serving the feed\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tswitch format {\n\t\tcase \"atom\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/atom+xml\")\n\t\tcase \"json\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tdefault:\n\t\t\tw.Header().Set(\"Content-Type\", \"application/rss+xml\")\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(s))\n\t}\n}", "func Get(url string, r io.Reader, w io.Writer, clientGenerator func() *http.Client, reqTuner ...func(*http.Request)) error {\n\treturn Request(\"GET\", url, r, w, clientGenerator, reqTuner...)\n}", "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ReceiveTwitterOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TwitterController, oauthToken string, oauthVerifier string, state string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{oauthToken}\n\t\tquery[\"oauth_token\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{oauthVerifier}\n\t\tquery[\"oauth_verifier\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{state}\n\t\tquery[\"state\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/twitter/receive\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{oauthToken}\n\t\tprms[\"oauth_token\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{oauthVerifier}\n\t\tprms[\"oauth_verifier\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{state}\n\t\tprms[\"state\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TwitterTest\"), rw, req, prms)\n\treceiveCtx, _err := app.NewReceiveTwitterContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Receive(receiveCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (svc TwitterService) GetTweets(author, fromDate, toDate, nextPage string) (*TweetResponse, error) {\n\tvar authorParam = fmt.Sprintf(\"from:%s lang:pt\", author)\n\tvar output TweetResponse\n\n\tpayload := TweetPayload{\n\t\tQuery: authorParam,\n\t\tMaxResults: svc.MaxResults,\n\t\tFromDate: fromDate,\n\t\tToDate: toDate,\n\t}\n\n\tif nextPage != \"\" {\n\t\tpayload.Next = nextPage\n\t}\n\n\tdata, err := json.Marshal(payload)\n\tif err != nil {\n\t\tlog.Printf(\"Error when trying to parse the payload. %v\", err)\n\t\treturn nil, err\n\t}\n\n\tclient := &http.Client{}\n\tr, err := http.NewRequest(http.MethodPost, svc.URL, bytes.NewBuffer(data))\n\tr.Header.Add(\"Authorization\", svc.TokenBearer)\n\tif err != nil {\n\t\tlog.Printf(\"Error when trying to prepare the post request. %v\", err)\n\t\treturn nil, err\n\t}\n\n\tres, err := client.Do(r)\n\tif err != nil || res.StatusCode != 200 {\n\t\tif err == nil {\n\t\t\terr = fmt.Errorf(res.Status)\n\t\t}\n\n\t\tlog.Printf(\"Error when trying to execute the post request. %v\", err)\n\t\treturn nil, err\n\t}\n\n\tif err := json.NewDecoder(res.Body).Decode(&output); err != nil {\n\t\tlog.Printf(\"Error when trying to parse the api response body. %v\", err)\n\t\treturn nil, err\n\t}\n\n\tdefer res.Body.Close()\n\n\treturn &output, nil\n}", "func GetWidget(res http.ResponseWriter, req *http.Request) {\n\tresp := response.New()\n\n\tresp.Render(res, req)\n}", "func makeGoGetEndpoint(svc GoGetterService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(goGetRequest)\n\t\tshow, err := svc.GoGet(req.Channel, req.Date)\n\t\tif err != nil {\n\t\t\treturn goGetResponse{req.Channel, req.Date, show, err.Error()}, nil\n\t\t}\n\t\treturn goGetResponse{req.Channel, req.Date, show, \"\"}, nil\n\t}\n}", "func (s *Server) Get(ctx context.Context, req *pb.GetTweetRequest) (*pb.GetTweetResponse, error) {\n\t// get user infos from context\n\tuserInfos, err := auth.GetUserInfosFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, err.Error())\n\t}\n\n\tid := req.GetId()\n\ttweet, err := s.tweetStore.Get(ctx, userInfos.ID, id)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"Could not get tweet: %v\", err)\n\t}\n\tres := &pb.GetTweetResponse{\n\t\tTweet: tweet,\n\t}\n\treturn res, nil\n}", "func (oc *OAuthConsumer) Get( url string, fparams Params, at *AccessToken) (r *http.Response, err os.Error) {\n\treturn oc.oAuthRequest(url, fparams, at, \"GET\")\n}", "func (controller *APIController) Get(context *qhttp.Context) {\n\tcontext.Response.Header().Add(\"Content-Type\", \"text/html\")\n\tcontext.SetResponse(`<html>\n\t<head>\n\t\t<title>Example API Documenation</title>\n\t</head>\n\t<body>\n\t\t<h3>Endpoints</h3>\n\t\t<ul>\n\t\t\t<li>[GET / POST] /api/widgets</li>\n\t\t\t<li>[GET / PUT / PATCH / DELETE] /api/widgets/{{id}}</li>\n\t\t</ul>\n\t\t<h3>Authentication</h3>\n\t\t<p>Send a header of <b>Authorization</b> with a value of <b>valid</b></p>\n\t</body>\n\t</html>`, http.StatusOK)\n}", "func (ctx *GetFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (this *AppController) Get() {\n\tthis.TplName = \"index.html\"\n\tthis.Data[\"IsHome\"] = true\n\tthis.Data[\"IsLogin\"] = checkAccount(this.Ctx)\n\t_, topics, err := models.GetAllTopics(\"\", this.GetString(\"label\"), this.GetString(\"cate\"), \"created\", \"-\", 5, 0)\n\n\tfor _, topic := range topics {\n\t\ttopic.Content = getMainContent(topic.Content)\n\t}\n\n\tif err != nil {\n\t\tbeego.Error(err)\n\t}\n\tthis.Data[\"Topics\"] = topics\n\tstickTopics, err := models.GetAllTopicsByStick()\n\tif err != nil {\n\t\tbeego.Error(err)\n\t}\n\tthis.Data[\"StickTopics\"] = stickTopics\n\n\tcategroies, err := models.GetAllCategory()\n\tif err != nil {\n\t\tbeego.Error(err)\n\t}\n\tthis.Data[\"Categories\"] = categroies\n\n}", "func CreateFeedCreatedTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetHandler(repository repository.Repository) gin.HandlerFunc {\n\treturn func(ctx *gin.Context) {\n\t\tgr := &getRequest{}\n\n\t\tif err := ctx.BindJSON(gr); err != nil {\n\t\t\tctx.JSON(http.StatusBadRequest, err.Error())\n\t\t\treturn\n\n\t\t}\n\n\t\t// TODO: Create an interface for returning a json.\n\t\tgresponse, err := service.Get(gr.TaskName, gr.TaskLabel, gr.TaskStartDate, gr.TaskEndDate, gr.Limit, repository)\n\n\t\tif err != nil {\n\t\t\tctx.JSON(http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tctx.JSON(200, gin.H{\"message\": gresponse})\n\n\t}\n\n}", "func (s *server) GetTweet(req *pb.TwitterRequest, stream pb.TweetService_GetTweetServer) error { // service/method Server\n\tgrpclog.Println(\" **** TwitterService ******\")\n\n\t// we need to authorize client before we can stream tweets\n\tgrpclog.Println(\"consumerKey -> \", req.ConsumerKey)\n\tgrpclog.Println(\"consumerSecret -> \", req.ConsumerSecret)\n\tgrpclog.Println(\"accessToken -> \", req.AccessToken)\n\tgrpclog.Println(\"accessSecret -> \", req.AccessSecret)\n\tgrpclog.Println(\"filter -> \", req.Filter)\n\n\tif req.ConsumerKey == \"\" || req.ConsumerSecret == \"\" || req.AccessToken == \"\" || req.AccessSecret == \"\" {\n\t\tlog.Fatal(\"error, Consumer key/secret and Access token/secret required\")\n\t}\n\n\t// twitter setup api with authorization\n\tanaconda.SetConsumerKey(req.ConsumerKey)\n\tanaconda.SetConsumerSecret(req.ConsumerSecret)\n\tapi := anaconda.NewTwitterApi(req.AccessToken, req.AccessSecret)\n\n\tvar err error\n\tif api.Credentials == nil {\n\t\tlog.Println(\"Twitter Api client has empty (nil) credentials\")\n\t\terr = nil\n\t\treturn err\n\t}\n\n\tfmt.Printf(\" ** api.Credentials -> %v\\n\\n \", *api.Credentials)\n\n\tfor {\n\t\tsearch_result, err := api.GetSearch(req.Filter, nil) // search for tweets that match filter\n\t\tif err != nil {\n\t\t\tlog.Println(\"error, GetSearch failed! \",err)\n\t\t\treturn err\n\t\t}\n \n\t\tfor _, tweet := range search_result.Statuses { // send to client results of tweet search\n\n\t\t\tt,_ := tweet.CreatedAtTime() // time of tweet\n\t\t\tt1 := t.String() \n\t\t\tt2 := tweet.Text // the tweet\n\t\t\t// tweets := t1.String()\n\t\t\tlog.Printf(\"filter: [%s] time: [%s] tweet: [%s]\\n\\n\",req.Filter, t1, t2)\n\t\t\tTimeTweet := t1 + \" \" + t2\n\n\t\t\t// mpw\n\t\t\tb := []byte(TimeTweet)\n\t\t\terr := stream.Send(&pb.TwitterReply{Tweet: b}) // send the tweet and time of tweet to client\n\t\t\t\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"error, possible client closed connection !!\")\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttime.Sleep(time.Millisecond * 12000) // sleep for 10 seconds between sending results to client\n\t\t}\n\t}\n\treturn err\n}", "func ShowTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func get(w http.ResponseWriter, req *http.Request) {\n\tresponse := \"\"\n\tswitch req.RequestURI {\n\t\tcase \"/get/accounts\":\n\t\t\tmapD := map[string]int{\"apple\": 5, \"lettuce\": 7}\n\t\t\tmapB, _ := json.Marshal(mapD)\n\t\t\tresponse = string(mapB)\n\t\t\tbreak\n\t\tdefault:\n\t\t\tr, _ := json.Marshal(\"Request not found\")\n\t\t\tresponse = string(r)\n\t\t\tbreak\n\t}\n\n\tcontext := Context{Title: response}\n\trender(w, \"api\", context)\n}", "func MakeGetThemesEndpoint(svc service.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (response interface{}, err error) {\n\t\treq := request.(GetThemesRequest)\n\t\tthemes, err := svc.GetThemes(ctx, req.SiteID)\n\t\treturn GetThemesResponse{Themes: themes, Err: err}, nil\n\t}\n}", "func (ts *TweetService) GetTweet(context.Context, *gen.GetTweetRequest) (*gen.Tweet, error) {\n\treturn nil, nil\n}", "func (r *TrendingRequest) Get(ctx context.Context) (resObj *Trending, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "func (widgetController WidgetController) GetWidget(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\n\t// Grab id\n\tvars := mux.Vars(r)\n\tid := vars[\"id\"]\n\n\t// Verify id is ObjectId, otherwise bail\n\tif !bson.IsObjectIdHex(id) {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Grab id\n\toid := bson.ObjectIdHex(id)\n\n\t// Stub widget\n\twidget := models.Widget{}\n\n\t// Fetch widget\n\tif err := widgetController.session.DB(common.AppConfig.Database).C(\"widgets\").FindId(oid).One(&widget); err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Marshal provided interface into JSON structure\n\twidgetJSON, _ := json.Marshal(widget)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\tfmt.Fprintf(w, \"%s\", widgetJSON)\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (controller *EchoController) Get(context *qhttp.Context) {\n\tr := context.Request\n\tcontext.Write(fmt.Sprintf(\"Host: %s\\n\", r.Host))\n\tcontext.Write(fmt.Sprintf(\"RequestURI: %s\\n\", r.RequestURI))\n\tcontext.Write(fmt.Sprintf(\"Method: %s\\n\", r.Method))\n\tcontext.Write(fmt.Sprintf(\"RemoteAddr: %s\\n\", r.RemoteAddr))\n\tcontext.Write(fmt.Sprintf(\"Content Length: %d\\n\", r.ContentLength))\n\tcontext.Write(\"Headers:\\n\")\n\tfor k, v := range context.Request.Header {\n\t\tcontext.Write(fmt.Sprintf(\"\\t%s: %s\\n\", k, v))\n\t}\n\n\tif !stringutil.IsWhiteSpace(context.URIParameters[\"toEcho\"]) {\n\t\tcontext.Write(fmt.Sprintf(\"URI:\\n%s\\n\", context.URIParameters[\"toEcho\"]))\n\t}\n\n\tif context.Request.ContentLength > 0 {\n\t\tcontext.Write(\"Body:\\n\")\n\t\tbody, err := context.Read()\n\t\tif err != nil {\n\t\t\tcontext.SetError(qerror.NewRestError(qerror.SystemError, \"\", nil), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tcontext.Response.Write(body)\n\t}\n\n}", "func Get(c echo.Context) error {\n\treturn c.JSON(http.StatusOK, http.StatusOK)\n}", "func (c *CommentApiController) GetUserFeed(w http.ResponseWriter, r *http.Request) {\n\tresult, err := c.service.GetUserFeed(r.Context())\n\t// If an error occurred, encode the error with the status code\n\tif err != nil {\n\t\tc.errorHandler(w, r, err, &result)\n\t\treturn\n\t}\n\t// If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, result.Headers, w)\n\n}", "func getChart(w http.ResponseWriter, req *http.Request, params Params) {\n\tdb, closer := dbSession.DB()\n\tdefer closer()\n\tvar chart models.Chart\n\tchartID := fmt.Sprintf(\"%s/%s\", params[\"repo\"], params[\"chartName\"])\n\tif err := db.C(chartCollection).FindId(chartID).One(&chart); err != nil {\n\t\tlog.WithError(err).Errorf(\"could not find chart with id %s\", chartID)\n\t\tresponse.NewErrorResponse(http.StatusNotFound, \"could not find chart\").Write(w)\n\t\treturn\n\t}\n\n\tcr := newChartResponse(&chart)\n\tresponse.NewDataResponse(cr).Write(w)\n}", "func (h *Handler) get(c echo.Context) (e error) {\n\tctx := c.(*cuxs.Context)\n\t// get query string from request\n\trq := ctx.RequestQuery()\n\tvar data *[]model.SalesReturn\n\n\tvar tot int64\n\n\tif data, tot, e = GetSalesReturn(rq); e == nil {\n\t\tctx.Data(data, tot)\n\t}\n\n\treturn ctx.Serve(e)\n}", "func MakeGetEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tt, error := s.Get(ctx)\n\t\treturn GetResponse{\n\t\t\tError: error,\n\t\t\tT: t,\n\t\t}, nil\n\t}\n}", "func LoginTwitterOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TwitterController, token *uuid.UUID) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif token != nil {\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", *token)}\n\t\tquery[\"token\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/twitter/login\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif token != nil {\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", *token)}\n\t\tprms[\"token\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TwitterTest\"), rw, req, prms)\n\tloginCtx, _err := app.NewLoginTwitterContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Login(loginCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewGetTallyOK() *GetTallyOK {\n\treturn &GetTallyOK{}\n}", "func (s *Server) Get(ctx context.Context, message *todopb.GetRequest) (*todopb.GetResponse, error) {\n\tctx = context.WithValue(ctx, goa.MethodKey, \"get\")\n\tctx = context.WithValue(ctx, goa.ServiceKey, \"todo\")\n\tresp, err := s.GetH.Handle(ctx, message)\n\tif err != nil {\n\t\treturn nil, goagrpc.EncodeError(err)\n\t}\n\treturn resp.(*todopb.GetResponse), nil\n}", "func getChart(c echo.Context) error {\n\tconfig, err := parseChartConfig(c)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]interface{}{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t}\n\n\tmarket := c.Param(\"market\")\n\tpair := c.Param(\"pair\")\n\n\treturn c.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"market\": market,\n\t\t\"pair\": pair,\n\t\t\"config\": config,\n\t})\n}", "func UpdateFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (_handler_ *HttpTodoHandler) Get(_c echo.Context) error {\n\t/*\n\t\tSe obtiene y setea el context de la peticion en la variable ctx\n\n\t\tIt obtains and sets the context of the request in the variable ctx\n\t*/\n\tctx := _c.Request().Context()\n\tif ctx == nil {\n\t\t/*\n\t\t\tEn caso de que el contexto sea nulo se crea un contexto de tipo background\n\n\t\t\tIf the context is null, a background context is created.\n\t\t*/\n\t\tctx = context.Background()\n\t}\n\n\t/*\n\t\tConsultamos el caso de uso del metodo Get para obtener los valores de la entidad,\n\t\ten caso de retornar algun error lo almacenamos en la variable err\n\n\t\tWe consulted the case of use of the Get method to obtain the values of the entity,\n\t\tin case of returning some error we store it in the variable err\n\t*/\n\ttodos, err := _handler_.TodoUsecase.Get(ctx)\n\n\tif err != nil {\n\t\t/*\n\t\t\tSi la peticion retorna un error retornamos una respuesta JSON con el error recibido y con una ertructura\n\t\t\testablecida en el metodo ReturnErrorJSON\n\n\t\t\tIf the request returns an error we return a JSON response with the error received and an ertructure.\n\t\t\testablished in the ReturnErrorJSON method\n\t\t*/\n\t\treturn utils.ReturnErrorJSON(_c, \"Find Failure\", err)\n\t}\n\n\t/*\n\t\tSi la peticion es correcta retornamos los datos de la entridad en formato JSON con los recibidos y con una\n\t\tertructura establecida en el metodo ReturnRespondJSON\n\n\t\tIf the request is correct we return the data of the entry in JSON format with the received ones and with a\n\t\tthe structure established in the ReturnRespondJSON method\n\t*/\n\treturn utils.ReturnRespondJSON(_c, http.StatusOK, todos)\n}", "func MakeGetCategoryEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tc, error := s.GetCategory(ctx)\n\t\treturn GetCategoryResponse{\n\t\t\tC: c,\n\t\t\tError: error,\n\t\t}, nil\n\t}\n}", "func NewGetfeedsOK() *GetfeedsOK {\n\treturn &GetfeedsOK{}\n}", "func (tc *tclient) get() error {\n\t// 1 -- timeout via context.\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\treq, err := http.NewRequestWithContext(ctx,\n\t\t\"GET\", tc.url+\"/ping\", nil)\n\n\tresp, err := tc.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"SUCCESS: '%s'\", string(body))\n\treturn nil\n}", "func getStory(w http.ResponseWriter, r *http.Request) {\n\t// read the id\n\tid := mux.Vars(r)[\"id\"]\n\t// format the url\n\tstoryURL := fmtURL(id)\n\t// Make request and get response body\n\tdata := fmtRes(storyURL)\n\tfmt.Println(\"data:\", data)\n\tw.Write([]byte(data))\n}", "func MyTweets(res http.ResponseWriter, req *http.Request) {\n\tid := req.URL.Query().Get(\"id\")\n\tif len(id) == 0 {\n\t\thttp.Error(res, \"El parametro ID es obligatorio\", 400)\n\t\treturn\n\t}\n\tif len(req.URL.Query().Get(\"pagina\")) == 0 {\n\t\thttp.Error(res, \"El parametro pagina es obligatorio\", 400)\n\t\treturn\n\t}\n\t//Transformar el parametro URL de string a int con Atoi\n\t_page, error := strconv.Atoi(req.URL.Query().Get(\"pagina\"))\n\tif error != nil {\n\t\thttp.Error(res, \"Error, el parametro pagina no tiene el formato correcto\"+error.Error(), 400)\n\t\treturn\n\t}\n\t//Pasar de int a int64\n\tpage := int64(_page)\n\tresults, status, err := db.ReadMyTweets(id, page)\n\tif err != nil {\n\t\thttp.Error(res, \"Error, no se ha podido leer los tweets: \"+err.Error(), 400)\n\t\treturn\n\t}\n\tif status == false {\n\t\thttp.Error(res, \"Error, no se ha podido leer los tweets\", 400)\n\t\treturn\n\t}\n\tres.Header().Set(\"Content-type\", \"application/json\")\n\tres.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(res).Encode(results)\n}", "func (c *Client) Get(ctx context.Context, url string, data ...interface{}) (*Response, error) {\n\treturn c.DoRequest(ctx, http.MethodGet, url, data...)\n}", "func (h *Hello) Get(c *yarf.Context) error {\n\tc.Render(\"Hello world!\")\n\n\treturn nil\n}", "func (client HTTPSuccessClient) Get200() (result Bool, err error) {\n req, err := client.Get200Preparer()\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Get200\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.Get200Sender(req)\n if err != nil {\n result.Response = autorest.Response{Response: resp}\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Get200\", resp, \"Failure sending request\")\n }\n\n result, err = client.Get200Responder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Get200\", resp, \"Failure responding to request\")\n }\n\n return\n}", "func (h *handler) Get(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tid, err := request.IDOf(r)\n\tif err != nil {\n\t\thttperror.InternalServerError(w, err)\n\t\treturn\n\t}\n\n\tdaoStatus := h.app.Dao.Status() // domain/repository の取得\n\tstatus, err := daoStatus.FindByID(ctx, id)\n\n\tif err != nil {\n\t\thttperror.InternalServerError(w, err)\n\t\treturn\n\t}\n\n\tdaoAccount := h.app.Dao.Account()\n\taccount, err := daoAccount.FindByID(ctx, status.AccountID)\n\tif err != nil {\n\t\thttperror.InternalServerError(w, err)\n\t\treturn\n\t}\n\n\tres := map[string]interface{}{\n\t\t\"id\": status.ID,\n\t\t\"account\": account,\n\t\t\"content\": status.Content,\n\t\t\"create_at\": status.CreateAt,\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tif err := json.NewEncoder(w).Encode(res); err != nil {\n\t\thttperror.InternalServerError(w, err)\n\t\treturn\n\t}\n}", "func (api *OsctrlAPI) GetGeneric(url string, body io.Reader) ([]byte, error) {\n\treturn api.ReqGeneric(http.MethodGet, url, body)\n}", "func (a *TokensApiService) MeGet(ctx context.Context) (Me, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Me\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/me\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v Me\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 401 {\n\t\t\tvar v ModelError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 500 {\n\t\t\tvar v ModelError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func (ctx *UpdateFeedContext) OKTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (launcher *echoLauncherImpl) GetEcho(ctx fidl.Context, prefix string) (examples.EchoWithCtxInterface, error) {\n\t// In the non-pipelined case, the server is responsible for initializing the channel. It\n\t// then binds an Echo implementation to the server end, and responds with\n\t// the client end\n\tserverEnd, clientEnd, err := examples.NewEchoWithCtxInterfaceRequest()\n\tif err != nil {\n\t\treturn examples.EchoWithCtxInterface{}, err\n\t}\n\n\tstub := examples.EchoWithCtxStub{Impl: &echoImpl{prefix: prefix}}\n\tgo component.Serve(context.Background(), &stub, serverEnd.ToChannel(), component.ServeOptions{\n\t\tOnError: func(err error) {\n\t\t\tlog.Println(err)\n\t\t},\n\t})\n\n\treturn *clientEnd, nil\n}", "func NewGetTweetsOK() *GetTweetsOK {\n\n\treturn &GetTweetsOK{}\n}", "func (em *entityManager) Get(ctx context.Context, entityPath string, mw ...MiddlewareFunc) (*http.Response, error) {\n\tctx, span := em.startSpanFromContext(ctx, \"sb.EntityManger.Get\")\n\tdefer span.End()\n\n\treturn em.Execute(ctx, http.MethodGet, entityPath, http.NoBody, mw...)\n}", "func (a *ArticleController) Get() {\n\n\tcommon(0, a)\n\n}", "func (ctx *ShowBottleContext) OK(r *GoaExampleBottle) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.example.bottle+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ListTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, app.TodoCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.TodoCollection\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(app.TodoCollection)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.TodoCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (tapi *TwitterAPI) GetTweets(token, user, start string, rts bool) []map[string]interface{} {\n\n\treqParam := \"?screen_name=\" + user + \"&count=200&include_rts=\" + strconv.FormatBool(rts) + \"&tweet_mode=extended\"\n\tif start != \"0\" {\n\t\treqParam += \"&max_id=\" + start\n\t}\n\n\treq, err := http.NewRequest(\"GET\", \"https://api.twitter.com/1.1/statuses/user_timeline.json\"+reqParam, nil)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treq.Header.Add(\"Authorization\", \"Bearer \"+token)\n\n\tresp, err := tapi.Client.Do(req)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\tdefer resp.Body.Close()\n\tcontent, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\t// fmt.Println(string(content))\n\n\tvar jsonResp []map[string]interface{}\n\tif resp.StatusCode == 200 {\n\t\tjson.Unmarshal(content, &jsonResp)\n\t\treturn jsonResp\n\t}\n\n\terrorMsg := \"Error! resp.StatusCode = \" + strconv.Itoa(resp.StatusCode)\n\tlog.Error(errorMsg)\n\tfmt.Println(errorMsg)\n\treturn jsonResp\n}", "func (c orderController) get(ctx *routing.Context) error {\n\tid, err := ozzo_routing.ParseUintParam(ctx, \"id\")\n\tif err != nil {\n\t\terrorshandler.BadRequest(\"ID is required to be uint\")\n\t}\n\n\tentity, err := c.Service.Get(ctx.Request.Context(), id)\n\tif err != nil {\n\t\tif err == apperror.ErrNotFound {\n\t\t\tc.Logger.With(ctx.Request.Context()).Info(err)\n\t\t\treturn errorshandler.NotFound(\"not found\")\n\t\t}\n\t\tc.Logger.With(ctx.Request.Context()).Error(err)\n\t\treturn errorshandler.InternalServerError(\"\")\n\t}\n\n\treturn ctx.Write(entity)\n}", "func GetDefault(w http.ResponseWriter, r *http.Request) {\n\tio.WriteString(w, \"btc-price-restful\")\n}", "func boolGetHandler(get func() bool) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tjsonResult(w, get())\n\t}\n}", "func (h *Handlers) Get(w http.ResponseWriter, r *http.Request) {\n\tinput := &hub.GetPackageInput{\n\t\tPackageName: chi.URLParam(r, \"packageName\"),\n\t\tVersion: chi.URLParam(r, \"version\"),\n\t}\n\tchartRepositoryName := chi.URLParam(r, \"repoName\")\n\tif chartRepositoryName != \"\" {\n\t\tinput.ChartRepositoryName = chartRepositoryName\n\t}\n\tdataJSON, err := h.pkgManager.GetJSON(r.Context(), input)\n\tif err != nil {\n\t\th.logger.Error().Err(err).Interface(\"input\", input).Str(\"method\", \"Get\").Send()\n\t\tif errors.Is(err, pkg.ErrInvalidInput) {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t} else if errors.Is(err, pkg.ErrNotFound) {\n\t\t\thttp.NotFound(w, r)\n\t\t} else {\n\t\t\thttp.Error(w, \"\", http.StatusInternalServerError)\n\t\t}\n\t\treturn\n\t}\n\thelpers.RenderJSON(w, dataJSON, helpers.DefaultAPICacheMaxAge)\n}", "func Get(r *http.Request) context.Context {\n\tif c, ok := r.Body.(*decoratedReadCloser); ok {\n\t\treturn c.context\n\t}\n\treturn context.Background()\n}", "func (app *App) Get(url string, handler handlerFunc) {\n\trequestRegexp := app.craterRouter.normalizeRoute(url)\n\tapp.craterRequestHandler.handleGet(requestRegexp, func(w http.ResponseWriter, r *http.Request) {\n\t\tapp.serveRequest(w, r, handler, requestRegexp)\n\t})\n}", "func (s *PetShopServer) GetKitten(ctx context.Context, req *pb.GetKittenRequest) (*pb.GetKittenResponse, error) {\n\treturn &pb.GetKittenResponse{Kitten: ProvideKitten()}, nil\n}", "func GetTodo(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tusername := context.Get(r, \"username\")\n\n\ttodos, err := models.ReadTodos(username.(string))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tw.Write(toJSON(todos))\n}", "func (client *Client) Get(action string, params url.Values, header http.Header) (*Response, error) {\r\n\treturn client.Request(\"GET\", action, params, header, nil)\r\n}", "func (s *EchoServer) Get(ctx context.Context, r *pb.EchoRequest) (*pb.EchoResponse, error) {\n\tresponse := &pb.EchoResponse{}\n\tresponse.Text = \"Go nonstreaming echo \" + r.Text\n\tfmt.Printf(\"Get received: %s\\n\", r.Text)\n\treturn response, nil\n}", "func (dc DefaultContainer) GetResponseWriter() http.ResponseWriter { return dc.ResponseWriter }", "func (c *DefaultV2) Get() freedom.Result {\n\tc.Worker.Logger().Info(\"I'm v2 Controller\")\n\tremote := c.DefServiceV2.RemoteInfo()\n\treturn &infra.JSONResponse{Object: remote}\n}", "func (ctx *ShowBottleContext) OK(r *GoaExampleBottle) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.example.bottle+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (h *TodoServiceHandler) GetTodos() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\n\t\ttodos, err := h.usecase.GetTodos(ctx)\n\t\tif err != nil {\n\t\t\tlog.Println(\"failed to get todos:\", err)\n\t\t\thttp.Error(w, \"500 Internal Server Error\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tres, err := json.Marshal(todos)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tfmt.Fprint(w, string(res))\n\t}\n}", "func (t *RestURL) MaybeGet(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RestURL\", \"MaybeGet\")\n\n\txxRouteVars := mux.Vars(r)\n\n\txxURLValues := r.URL.Query()\n\tvar urlArg1 *string\n\tif false {\n\t} else if _, ok := xxRouteVars[\"arg1\"]; ok {\n\t\txxTmpurlArg1 := xxRouteVars[\"arg1\"]\n\t\turlArg1 = &xxTmpurlArg1\n\t} else if _, ok := xxURLValues[\"arg1\"]; ok {\n\t\txxTmpurlArg1 := xxURLValues.Get(\"arg1\")\n\t\turlArg1 = &xxTmpurlArg1\n\t}\n\n\tt.embed.MaybeGet(urlArg1)\n\n\tw.WriteHeader(200)\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RestURL\", \"MaybeGet\")\n\n}", "func NewGetControllerServiceOK() *GetControllerServiceOK {\n\treturn &GetControllerServiceOK{}\n}", "func GetController(ctx iris.Context) {\n\tid := ctx.Params().Get(\"id\")\n\tvar g gost.Gost\n\terr := g.GetGostById(id)\n\tif err != nil {\n\t\tutils.ResponseErr(ctx, err)\n\t\treturn\n\t}\n\tlog.Debugf(\"find gost %#v\", g)\n\tutils.ResponseData(ctx, g)\n}", "func (e Endpoints) Get(ctx context.Context) (t []io.Todo, error error) {\n\trequest := GetRequest{}\n\tresponse, err := e.GetEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(GetResponse).T, response.(GetResponse).Error\n}", "func Get(opts ...Option) ([]byte, error) {\n\treturn request(\"GET\", opts...)\n}", "func Get(dst []byte, url string) (statusCode int, body []byte, err error) {\n\treturn defaultClient.Get(dst, url)\n}", "func (client *Client) Get(c context.Context, uri string, params interface{}, res interface{}) (err error) {\n\treq, err := client.NewRequest(xhttp.MethodGet, uri, params)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn client.client.Do(c, req, res)\n}", "func (s *TweetsService) Show(params *TweetsShowParams) (Tweets, *http.Response, error) {\n\ttweets := new(Tweets)\n\tif params == nil {\n\t\treturn *tweets, nil, nil\n\t}\n\tif len(params.IDs) == 0 {\n\t\treturn *tweets, nil, nil\n\t}\n\n\ttype params2 struct {\n\t\tIDs string `url:\"ids,omitempty\"`\n\t\tTweetFields *string `url:\"tweet.fields,omitempty\"`\n\t\tMediaFields *string `url:\"media.fields,omitempty\"`\n\t\tExpansions *string `url:\"expansions,omitempty\"`\n\t}\n\n\t_true := true\n\t_false := false\n\tif params.IncludeMedia == nil {\n\t\tparams.IncludeMedia = &_false\n\t}\n\tif params.IncludeTweetPublicMetrics == nil {\n\t\tparams.IncludeTweetPublicMetrics = &_true\n\t}\n\tif params.IncludeTweetNonPublicMetrics == nil {\n\t\tparams.IncludeTweetNonPublicMetrics = &_false\n\t}\n\tif params.IncludeTweetOrganicMetrics == nil {\n\t\tparams.IncludeTweetOrganicMetrics = &_false\n\t}\n\tif params.IncludeMediaPublicMetrics == nil {\n\t\tparams.IncludeMediaPublicMetrics = &_true\n\t}\n\tif params.IncludeMediaNonPublicMetrics == nil {\n\t\tparams.IncludeMediaNonPublicMetrics = &_false\n\t}\n\tif params.IncludeMediaOrganicMetrics == nil {\n\t\tparams.IncludeMediaOrganicMetrics = &_false\n\t}\n\n\t_params := new(params2)\n\t_ids := []string{}\n\tfor _, i := range params.IDs {\n\t\t_ids = append(_ids, fmt.Sprintf(\"%v\", i))\n\t}\n\t_params.IDs = strings.Join(_ids, \",\")\n\t_tweetFields := []string{\"id\", \"created_at\", \"author_id\"}\n\tif *params.IncludeTweetPublicMetrics {\n\t\t_tweetFields = append(_tweetFields, \"public_metrics\")\n\t}\n\tif *params.IncludeTweetNonPublicMetrics {\n\t\t_tweetFields = append(_tweetFields, \"non_public_metrics\")\n\t}\n\tif *params.IncludeTweetOrganicMetrics {\n\t\t_tweetFields = append(_tweetFields, \"organic_metrics\")\n\t}\n\tif len(_tweetFields) > 0 {\n\t\t__tweetFields := strings.Join(_tweetFields, \",\")\n\t\t_params.TweetFields = &__tweetFields\n\t}\n\t_mediaFields := []string{}\n\tif *params.IncludeMedia {\n\t\t_mediaFields = append(_mediaFields, \"duration_ms\")\n\t\t_mediaFields = append(_mediaFields, \"height\")\n\t\t_mediaFields = append(_mediaFields, \"preview_image_url\")\n\t\t_mediaFields = append(_mediaFields, \"media_key\")\n\t\t_mediaFields = append(_mediaFields, \"type\")\n\t\t_mediaFields = append(_mediaFields, \"url\")\n\t\t_mediaFields = append(_mediaFields, \"width\")\n\t}\n\tif *params.IncludeMediaPublicMetrics {\n\t\t_mediaFields = append(_mediaFields, \"public_metrics\")\n\t}\n\tif *params.IncludeMediaNonPublicMetrics {\n\t\t_mediaFields = append(_mediaFields, \"non_public_metrics\")\n\t}\n\tif *params.IncludeMediaOrganicMetrics {\n\t\t_mediaFields = append(_mediaFields, \"organic_metrics\")\n\t}\n\tif len(_mediaFields) > 0 {\n\t\t__mediaFields := strings.Join(_mediaFields, \",\")\n\t\t_params.MediaFields = &__mediaFields\n\t\t_expansions := \"attachments.media_keys\"\n\t\t_params.Expansions = &_expansions\n\t}\n\n\tapiError := new(APIError)\n\tresp, err := s.sling.New().Get(\"\").QueryStruct(_params).Receive(tweets, apiError)\n\n\treturn *tweets, resp, relevantError(err, *apiError)\n}", "func GetCat(catsService service.Cats) echo.HandlerFunc {\n\treturn func(ctx echo.Context) error {\n\t\tidParam := ctx.Param(\"id\")\n\t\tid, err := uuid.Parse(idParam)\n\t\tif err != nil {\n\t\t\treturn echo.NewHTTPError(http.StatusBadRequest)\n\t\t}\n\n\t\tcat, err := catsService.GetOne(ctx.Request().Context(), id)\n\t\tif errors.Is(err, repository.ErrNotFound) {\n\t\t\treturn echo.NewHTTPError(http.StatusNotFound)\n\t\t} else if err != nil {\n\t\t\treturn echo.NewHTTPError(http.StatusInternalServerError, err.Error())\n\t\t}\n\n\t\tresponse := GetCatResponse(mapCat(cat))\n\t\treturn ctx.JSON(http.StatusOK, response)\n\t}\n}", "func SimpleGet(w http.ResponseWriter, req *http.Request) {\n\tlog.Println(\"Get Succeeded\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(os.Getenv(\"COPILOT_APPLICATION_NAME\") + \"-\" + os.Getenv(\"COPILOT_ENVIRONMENT_NAME\") + \"-\" + os.Getenv(\"COPILOT_SERVICE_NAME\")))\n}", "func (c *HTTPDebuginfodClient) Get(ctx context.Context, buildID string) (io.ReadCloser, error) {\n\treturn c.request(ctx, c.upstreamServer, buildID)\n}", "func Get(ctx context.Context, url string, options ...RequestOption) (*Response, error) {\n\tr, err := newRequest(ctx, http.MethodGet, url, nil, options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn doRequest(http.DefaultClient, r)\n}", "func (t *RestPost) MaybeGet(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RestPost\", \"MaybeGet\")\n\n\t{\n\t\terr := r.ParseForm()\n\n\t\tif err != nil {\n\n\t\t\tt.Log.Handle(w, r, err, \"parseform\", \"error\", \"RestPost\", \"MaybeGet\")\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\n\t\t\treturn\n\t\t}\n\n\t}\n\tvar postArg1 *string\n\tif _, ok := r.Form[\"arg1\"]; ok {\n\t\txxTmppostArg1 := r.FormValue(\"arg1\")\n\t\tt.Log.Handle(w, r, nil, \"input\", \"form\", \"arg1\", xxTmppostArg1, \"RestPost\", \"MaybeGet\")\n\t\tpostArg1 = &xxTmppostArg1\n\t}\n\n\tt.embed.MaybeGet(postArg1)\n\n\tw.WriteHeader(200)\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RestPost\", \"MaybeGet\")\n\n}", "func (c *MainController) Get() {\n\tposts, err := c.getAllPosts()\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"Can not load posts\")\n\t\thttp.Error(c.Ctx.ResponseWriter, err.Error(), http.StatusInternalServerError)\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\n\tc.Data[\"Title\"] = \"Blog\"\n\tc.Data[\"Posts\"] = posts\n\tc.TplName = \"index.tpl\"\n}", "func makeGetBookEndpoint(svc BookService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t// convert request into a bookRequest\n\t\treq := request.(getBookRequest)\n\n\t\t// call actual service with data from the req\n\t\tbook, err := svc.GetBook(req.Bearer, req.BookId)\n\t\treturn bookResponse{\n\t\t\tData: book,\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func (e *Endpoints) GetAttackEndpoint(c *gin.Context) {\n\tfilterMap := make(models.FilterParams)\n\tfilterMap[\"status\"] = c.DefaultQuery(\"status\", \"\")\n\tfilterMap[\"created_before\"] = c.DefaultQuery(\"created_before\", \"\")\n\tfilterMap[\"created_after\"] = c.DefaultQuery(\"created_after\", \"\")\n\tresp := e.dispatcher.List(\n\t\t//models.StatusFilter(status),\n\t\tfilterMap,\n\t)\n\n\tc.JSON(http.StatusOK, resp)\n}", "func MakeGetEndpoint(s service.DepartmentService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\td, error := s.Get(ctx)\n\t\treturn GetResponse{\n\t\t\tD: d,\n\t\t\tError: error,\n\t\t}, nil\n\t}\n}", "func getService(config *oauth2.Config) *gmail.Service {\n\tctx := context.Background()\n\n\tconfigDir := configdir.LocalConfig(\"oled-controller\")\n\terr := configdir.MakePath(configDir)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to create configuration path %s: %v\\n\", configDir, err)\n\t\treturn nil\n\t}\n\ttokenFile := filepath.Join(configDir, \"token.json\")\n\ttoken, err := getTokenFromFile(tokenFile)\n\tif err != nil {\n\t\ttoken := getTokenFromWeb(config)\n\t\tif token == nil {\n\t\t\treturn nil\n\t\t}\n\t\tsaveTokenToFile(tokenFile, token)\n\t}\n\n\tgmailService, err := gmail.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))\n\tif err != nil {\n\t\tlog.Println(\"Failed to create GMail service:\", err)\n\t\treturn nil\n\t}\n\n\treturn gmailService\n}", "func GetService() *gitkit.Server {\n\t// Configure git hooks\n\thooks := &gitkit.HookScripts{\n\t\tPreReceive: `echo \"Push Requests Received!\"`,\n\t}\n\tservice := gitkit.New(gitkit.Config{\n\t\tDir: utilities.GetFolder(utilities.MODELSFOLDER),\n\t\tAutoCreate: true,\n\t\tAutoHooks: true,\n\t\tHooks: hooks,\n\t})\n\tif err := service.Setup(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn service\n}", "func (ri *RestInvoker) ContextDo(ctx context.Context, req *rest.Request, options ...InvocationOption) (*rest.Response, error) {\n\topts := getOpts(string(req.GetRequest().Host()), options...)\n\topts.Protocol = common.ProtocolRest\n\tif len(opts.Filters) == 0 {\n\t\topts.Filters = ri.opts.Filters\n\t}\n\tif string(req.GetRequest().URI().Scheme()) != \"cse\" {\n\t\treturn nil, fmt.Errorf(\"Scheme invalid: %s, only support cse://\", req.GetRequest().URI().Scheme())\n\t}\n\tif req.GetHeader(\"Content-Type\") == \"\" {\n\t\treq.SetHeader(\"Content-Type\", \"application/json\")\n\t}\n\tnewReq := req.Copy()\n\tdefer newReq.Close()\n\tresp := rest.NewResponse()\n\tnewReq.SetHeader(common.HeaderSourceName, config.SelfServiceName)\n\tinv := invocation.CreateInvocation()\n\twrapInvocationWithOpts(inv, opts)\n\tinv.AppID = config.GlobalDefinition.AppID\n\tinv.MicroServiceName = string(req.GetRequest().Host())\n\tinv.Args = newReq\n\tinv.Reply = resp\n\tinv.Ctx = ctx\n\tinv.URLPathFormat = req.Req.URI().String()\n\tinv.MethodType = req.GetMethod()\n\tc, err := handler.GetChain(common.Consumer, ri.opts.ChainName)\n\tif err != nil {\n\t\tlager.Logger.Errorf(err, \"Handler chain init err.\")\n\t\treturn nil, err\n\t}\n\tc.Next(inv, func(ir *invocation.InvocationResponse) error {\n\t\terr = ir.Err\n\t\treturn err\n\t})\n\treturn resp, err\n}", "func Get(url string) (resp *http.Response, err error) {\n\treturn DefaultClient.Get(url)\n}", "func Get(url string) (*http.Response, error) {\n\treturn DefaultClient.Get(url)\n}", "func (a *Client) GetWidget(params *GetWidgetParams, authInfo runtime.ClientAuthInfoWriter) (*GetWidgetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetWidgetParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getWidget\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/content/widgets/{uuid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetWidgetReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetWidgetOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for getWidget: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func Get(url, token string) {\n\t// Create a Resty Client\n\tclient := resty.New()\n\tclient.SetAuthToken(token)\n\n\tresp, err := client.R().\n\t\tEnableTrace().\n\t\tGet(url)\n\n\t// Explore response object\n\tfmt.Println(\"Response Info:\")\n\tfmt.Println(\" Error :\", err)\n\tfmt.Println(\" Status Code:\", resp.StatusCode())\n\tfmt.Println(\" Status :\", resp.Status())\n\tfmt.Println(\" Proto :\", resp.Proto())\n\tfmt.Println(\" Time :\", resp.Time())\n\tfmt.Println(\" Received At:\", resp.ReceivedAt())\n\tfmt.Println(\" Body :\\n\", resp)\n\tfmt.Println()\n}", "func (ctl *APIController) GetInfo(w http.ResponseWriter, r *http.Request) {\n\n\t// transform\n\ttr := transformers.APITransformer{\n\t\tName: \"Catalyst\",\n\t\tVersion: \"v2.5.1\",\n\t\tPurpose: \"A REST API base written in Golang\",\n\t}\n\n\t// send response\n\tctl.sendResponse(r.Context(), w, http.StatusOK, tr)\n}", "func Get(h http.Handler) http.Handler {\n\treturn HTTP(h, GET)\n}" ]
[ "0.61598563", "0.5776092", "0.5553494", "0.53850067", "0.53501177", "0.51670575", "0.5146045", "0.51158667", "0.51038903", "0.5083878", "0.50067854", "0.4996768", "0.49864098", "0.4980796", "0.4950761", "0.4941586", "0.48750022", "0.48540118", "0.48176828", "0.4813132", "0.48087737", "0.47904167", "0.4789655", "0.47710812", "0.47632146", "0.4752528", "0.47159666", "0.47052315", "0.46993655", "0.469285", "0.4691904", "0.46832234", "0.4647782", "0.4643686", "0.46394002", "0.46364263", "0.46358305", "0.46266666", "0.46182603", "0.4613781", "0.46092895", "0.46083543", "0.45996025", "0.45833927", "0.45741647", "0.45647803", "0.4516832", "0.45103368", "0.4496998", "0.44934902", "0.4493331", "0.4486546", "0.44770223", "0.44763434", "0.4470322", "0.44643915", "0.44595146", "0.4448145", "0.44418213", "0.4435718", "0.44337457", "0.44317156", "0.4428137", "0.44268388", "0.4422684", "0.44224504", "0.44197628", "0.44167757", "0.44126138", "0.44045338", "0.440244", "0.43941167", "0.43880314", "0.43845156", "0.43830043", "0.43826294", "0.43617755", "0.43607923", "0.43581057", "0.4354061", "0.4350917", "0.43500736", "0.43498743", "0.4346219", "0.4345288", "0.4342612", "0.4337798", "0.43325767", "0.43258813", "0.4325769", "0.43204403", "0.43149278", "0.43129736", "0.43113446", "0.43098015", "0.43049943", "0.43042806", "0.43003348", "0.42962578", "0.42956153" ]
0.71034104
0
ListFeedBadRequest runs the method List of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func ListFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, error) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} { sliceVal := []string{strconv.Itoa(limit)} query["limit"] = sliceVal } { sliceVal := []string{strconv.Itoa(page)} query["page"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds"), RawQuery: query.Encode(), } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} { sliceVal := []string{strconv.Itoa(limit)} prms["limit"] = sliceVal } { sliceVal := []string{strconv.Itoa(page)} prms["page"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) listCtx, _err := app.NewListFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } return nil, e } // Perform action _err = ctrl.List(listCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 400 { t.Errorf("invalid response status code: got %+v, expected 400", rw.Code) } var mt error if resp != nil { var _ok bool mt, _ok = resp.(error) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of error", resp, resp) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ListTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewListServicesBadRequest() *ListServicesBadRequest {\n\treturn &ListServicesBadRequest{}\n}", "func ListGuestbookBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.GuestbookController) (http.ResponseWriter, *app.GuestbookError) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/guestbook/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"GuestbookTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListGuestbookContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt *app.GuestbookError\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.GuestbookError)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.GuestbookError\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListQuizzesBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.QuizzesController) (http.ResponseWriter, *app.StandardError) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/quizzes\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"QuizzesTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListQuizzesContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt *app.StandardError\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.StandardError)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.StandardError\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewListFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := ListFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamLimit := req.Params[\"limit\"]\n\tif len(paramLimit) == 0 {\n\t\trctx.Limit = 10\n\t} else {\n\t\trawLimit := paramLimit[0]\n\t\tif limit, err2 := strconv.Atoi(rawLimit); err2 == nil {\n\t\t\trctx.Limit = limit\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"limit\", rawLimit, \"integer\"))\n\t\t}\n\t\tif rctx.Limit < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`limit`, rctx.Limit, 1, true))\n\t\t}\n\t}\n\tparamPage := req.Params[\"page\"]\n\tif len(paramPage) == 0 {\n\t\trctx.Page = 1\n\t} else {\n\t\trawPage := paramPage[0]\n\t\tif page, err2 := strconv.Atoi(rawPage); err2 == nil {\n\t\t\trctx.Page = page\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"page\", rawPage, \"integer\"))\n\t\t}\n\t\tif rctx.Page < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`page`, rctx.Page, 1, true))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ListFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewListBadRequestResponseBody(res *goa.ServiceError) *ListBadRequestResponseBody {\n\tbody := &ListBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func NewListBadRequest(body *ListBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewThingsListBadRequest() *ThingsListBadRequest {\n\treturn &ThingsListBadRequest{}\n}", "func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewListEventsBadRequest() *ListEventsBadRequest {\n\treturn &ListEventsBadRequest{}\n}", "func ShowTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ListFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func ValidateListBadRequestResponseBody(body *ListBadRequestResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "func DeleteFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func RenderBadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\treturn\n}", "func NewListSelLogServiceEntriesBadRequest() *ListSelLogServiceEntriesBadRequest {\n\treturn &ListSelLogServiceEntriesBadRequest{}\n}", "func NewListReportDefinitionBadRequest() *ListReportDefinitionBadRequest {\n\treturn &ListReportDefinitionBadRequest{}\n}", "func ListFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedTinyCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedTinyCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedTinyCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTinyCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func RenderBadRequest(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, BadRequest(message...))\n}", "func (ctx *ListMessageContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func ListFeeds(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(GetFeeds()))\n}", "func (feed *Feed) FeedList(w http.ResponseWriter, r *http.Request) {\n\tfed :=service.NewFeed()\n\tw.Header().Set(\"Content-Type\", \"applcation/json; charset=UTF-8\")\n\tw.Write(fed.FeedList())\n\n}", "func NewListLoadBalancerServicesBadRequest() *ListLoadBalancerServicesBadRequest {\n\treturn &ListLoadBalancerServicesBadRequest{}\n}", "func NewListPermissionBadRequest() *ListPermissionBadRequest {\n\treturn &ListPermissionBadRequest{}\n}", "func CreateTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, body string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *StopFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *GetFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (o *ObjectsListBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func NewListPaginatedBadRequest() *ListPaginatedBadRequest {\n\treturn &ListPaginatedBadRequest{}\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (c *SeaterController) TraceBadRequestf(err error, format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tc.traceJSONAbort(nil, 400, msg)\n}", "func NewGetAccountsListBadRequest() *GetAccountsListBadRequest {\n\n\treturn &GetAccountsListBadRequest{}\n}", "func (ctx *ListListenContext) BadRequest(r *AntError) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.error+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewObjectsListBadRequest() *ObjectsListBadRequest {\n\n\treturn &ObjectsListBadRequest{}\n}", "func (client AppsClient) List(ctx context.Context, skip *int32, take *int32) (result ListApplicationInfoResponse, err error) {\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: skip,\n\t\t\tConstraints: []validation.Constraint{{Target: \"skip\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"skip\", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}},\n\t\t{TargetValue: take,\n\t\t\tConstraints: []validation.Constraint{{Target: \"take\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"take\", Name: validation.InclusiveMaximum, Rule: 500, Chain: nil},\n\t\t\t\t\t{Target: \"take\", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil},\n\t\t\t\t}}}}}); err != nil {\n\t\treturn result, validation.NewError(\"programmatic.AppsClient\", \"List\", err.Error())\n\t}\n\n\treq, err := client.ListPreparer(ctx, skip, take)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"List\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (ctx *ListFeedContext) OK(r FeedCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.feed.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FeedCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\th.RenderHTMLStatus(w, http.StatusBadRequest, \"400\", nil)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusBadRequest, apiErrorBadRequest)\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t}\n}", "func (ctx *ListOfferContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *StartFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewListPolicyBadRequest() *ListPolicyBadRequest {\n\n\treturn &ListPolicyBadRequest{}\n}", "func (ctx *CreateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewListAlertDefinitionBadRequest() *ListAlertDefinitionBadRequest {\n\treturn &ListAlertDefinitionBadRequest{}\n}", "func MakeListItemsEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\titems, err := service.ListItems(ctx)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn ListItemsResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tItems: items,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\treturn ListItemsResponse{\n\t\t\t\tErr: err,\n\t\t\t\tItems: items,\n\t\t\t}, err\n\t\t}\n\n\t\treturn ListItemsResponse{Items: items}, nil\n\t}\n}", "func (ctx *ListMessageContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func getCategoriesList(lister listing.Service) http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, r *http.Request) {\n\t\trw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tvar list *listing.CategoriesResponse\n\n\t\tlimit := r.FormValue(\"limit\")\n\t\ttop := r.FormValue(\"top\")\n\n\t\tl, err := strconv.ParseInt(limit, 10, 2)\n\t\tif err != nil {\n\t\t\tl = 100\n\t\t}\n\t\tif top == \"true\" {\n\t\t\tlist, err = lister.TopCategories(r.Context(), int(l))\n\t\t} else {\n\t\t\tlist, err = lister.Categories(r.Context())\n\t\t}\n\n\t\tif err != nil {\n\t\t\t// server problem while answering the request\n\t\t\tr := constructError(http.StatusInternalServerError,\n\t\t\t\t\"unable to process request\",\n\t\t\t\t\"A problem occurs while processing the request\")\n\n\t\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\t\tjson.NewEncoder(rw).Encode(r)\n\t\t\treturn\n\t\t}\n\n\t\trw.WriteHeader(http.StatusOK)\n\t\terr = json.NewEncoder(rw).Encode(list)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t}\n}", "func (o *ObjectsListBadRequest) WithPayload(payload *models.ErrorResponse) *ObjectsListBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *GetAccountsListBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "func NewListServerGroupBadRequest() *ListServerGroupBadRequest {\n\treturn &ListServerGroupBadRequest{}\n}", "func (_obj *DataService) GetMsgListWithContext(tarsCtx context.Context, index int32, date string, wx_id string, nextIndex *int32, msgList *[]Message, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(index, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(date, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(wx_id, 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*nextIndex), 4)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.WriteHead(codec.LIST, 5)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32(int32(len((*msgList))), 0)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tfor _, v := range *msgList {\n\n\t\terr = v.WriteBlock(_os, 0)\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"getMsgList\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*nextIndex), 4, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr, have, ty = _is.SkipToNoCheck(5, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif ty == codec.LIST {\n\t\terr = _is.Read_int32(&length, 0, true)\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\n\t\t(*msgList) = make([]Message, length)\n\t\tfor i23, e23 := int32(0), length; i23 < e23; i23++ {\n\n\t\t\terr = (*msgList)[i23].ReadBlock(_is, 0, false)\n\t\t\tif err != nil {\n\t\t\t\treturn ret, err\n\t\t\t}\n\n\t\t}\n\t} else if ty == codec.SIMPLE_LIST {\n\t\terr = fmt.Errorf(\"not support simple_list type\")\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\n\t} else {\n\t\terr = fmt.Errorf(\"require vector, but not\")\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func ListTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, app.TodoCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.TodoCollection\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(app.TodoCollection)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.TodoCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewCreateSecurityListBadRequest() *CreateSecurityListBadRequest {\n\treturn &CreateSecurityListBadRequest{}\n}", "func NewUserGroupListBadRequest() *UserGroupListBadRequest {\n\treturn &UserGroupListBadRequest{}\n}", "func (ctx *ListUserContext) BadRequest(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *DeleteFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func DeleteAllTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteAllCtx, _err := app.NewDeleteAllTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.DeleteAll(deleteAllCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewListTeamsBadRequest() *ListTeamsBadRequest {\n\treturn &ListTeamsBadRequest{}\n}", "func NewListGroupsBadRequest() *ListGroupsBadRequest {\n\treturn &ListGroupsBadRequest{}\n}", "func handleListErr(err error) error {\n\tif err == authorization.ErrUnauthorized || err == authorization.ErrNoClaims {\n\t\tlogger.WithError(err).Warn(\"couldn't access resource\")\n\t\treturn nil\n\t}\n\treturn err\n}", "func ServeBadRequest(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Bad Request\", http.StatusBadRequest)\n}", "func MakeListExceptionEndpoint(s service.InventoryService) endpoint.Endpoint {\n\tfmt.Println(\"endpoint 1 invoke\")\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(ListExceptionRequest)\n\t\trs, err := s.ListException(ctx, req.S)\n\t\treturn ListExceptionResponse{\n\t\t\tErr: err,\n\t\t\tRs: rs,\n\t\t}, nil\n\t}\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (o *GetAssetsListBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "func handle(fn func(context.Context, *models.ListOptions) (*models.ListResult, error)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tenc := json.NewEncoder(w)\n\t\tenc.SetIndent(\"\", \" \")\n\t\tenc.SetEscapeHTML(false) // idk why I hate it so much, but I do!\n\n\t\t// Parse request parameters\n\t\tcount := getURLCount(r.URL)\n\t\tappengine.Info(r.Context(), \"Requested %d posts\", count)\n\n\t\t// Fire the real request\n\t\topts := &models.ListOptions{\n\t\t\tCount: count,\n\t\t\tCursor: r.URL.Query().Get(\"cursor\"),\n\t\t\tTag: r.URL.Query().Get(\"tag\"),\n\t\t}\n\t\tres, err := fn(r.Context(), opts)\n\t\tif err != nil {\n\t\t\tappengine.Warning(r.Context(), \"Failed to process list handler: %v\", err)\n\t\t\tenc.Encode(response{\n\t\t\t\tStatus: \"error\",\n\t\t\t\tCode: http.StatusInternalServerError,\n\t\t\t\tErr: \"unable to fetch posts\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// fix up full response URLs based on incoming request\n\t\tr.URL.Host = r.Host\n\t\tif host := r.Header.Get(\"x-forwarded-host\"); host != \"\" {\n\t\t\tr.URL.Host = host // work around test environment shortcomings\n\t\t}\n\t\tr.URL.Scheme = \"http\"\n\t\tif scheme := r.Header.Get(\"x-forwarded-proto\"); scheme != \"\" {\n\t\t\tr.URL.Scheme = scheme\n\t\t}\n\n\t\t// Successful response!\n\t\tenc.Encode(response{\n\t\t\tStatus: \"success\",\n\t\t\tCode: http.StatusOK,\n\t\t\tData: res.Posts,\n\t\t\tNext: toLink(r.URL, res.Next),\n\t\t\tPrev: toLink(r.URL, res.Prev),\n\t\t\tSelf: toLink(r.URL, res.Self),\n\t\t})\n\t}\n}", "func NewGetfeedsDefault(code int) *GetfeedsDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetfeedsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func BadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(\"400 - Bad Request\"))\n}", "func (controller AppsController) List(c *gin.Context) {\n\tvar config entities.App\n\tif user, ok := c.Get(\"Session\"); ok {\n\t\tfmt.Printf(\"User %v\", user)\n\t}\n\tresult, err := mongodb.GetAll(controller.MongoDBClient, Collections[\"apps\"], bson.M{}, config)\n\tif err != nil {\n\t\tfmt.Printf(\"error %v\", err)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"message\": err})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\"apps\": result})\n}", "func ListHandler(r *request.Request) (request.Response, error) {\n\tif r.Context.Contest != nil {\n\t\treturn request.Redirect(paths.Route(paths.Home)), nil\n\t}\n\tprobs, err := problems.List(r.Request.Context(), problems.ListArgs{WithStatements: problems.StmtTitles}, problems.ListFilter{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnprobs := models.ProblemList{}\n\tfor _, p := range probs {\n\t\tif r.Context.CanSeeProblem(p) {\n\t\t\tnprobs = append(nprobs, p)\n\t\t}\n\t}\n\treturn request.Template(\"problems_list\", Params{nprobs}), nil\n}", "func NewGetRecentFoodsBadRequest() *GetRecentFoodsBadRequest {\n\treturn &GetRecentFoodsBadRequest{}\n}", "func (p *Resource) SGOListHandler(req *restful.Request, resp *restful.Response) {\n\t// logrus.Infof(\"AppsListHandler is called!\")\n\tx_auth_token := req.HeaderParameter(\"X-Auth-Token\")\n\tcode, err := services.TokenValidation(x_auth_token)\n\tif err != nil {\n\t\tresponse.WriteStatusError(code, err, resp)\n\t\treturn\n\t}\n\n\tvar skip int = queryIntParam(req, \"skip\", 0)\n\tvar limit int = queryIntParam(req, \"limit\", 0)\n\n\ttotal, sgos, code, err := services.GetSgoService().QueryAll(skip, limit, x_auth_token)\n\tif err != nil {\n\t\tresponse.WriteStatusError(code, err, resp)\n\t\treturn\n\t}\n\tres := response.QueryStruct{Success: true, Data: sgos}\n\tif c, _ := strconv.ParseBool(req.QueryParameter(\"count\")); c {\n\t\tres.Count = total\n\t\tresp.AddHeader(\"X-Object-Count\", strconv.Itoa(total))\n\t}\n\tresp.WriteEntity(res)\n\treturn\n}", "func (ctx *GetFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func MakeListTodosEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tr0, err := service.ListTodos(ctx)\n\n\t\tif err != nil {\n\t\t\tif endpointErr := endpointError(nil); errors.As(err, &endpointErr) && endpointErr.EndpointError() {\n\t\t\t\treturn ListTodosResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tR0: r0,\n\t\t\t\t}, err\n\t\t\t}\n\n\t\t\treturn ListTodosResponse{\n\t\t\t\tErr: err,\n\t\t\t\tR0: r0,\n\t\t\t}, nil\n\t\t}\n\n\t\treturn ListTodosResponse{R0: r0}, nil\n\t}\n}", "func (ctx *UpdateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func ErrBadRequest(w http.ResponseWriter, r *http.Request) {\n\tBadRequestWithErr(w, r, errors.New(\"Bad Request\"))\n}", "func NewListBootImageBadRequest() *ListBootImageBadRequest {\n\treturn &ListBootImageBadRequest{}\n}", "func RunBadRequest(response http.ResponseWriter, request *http.Request, container interface{}) {\n\terrorController := BadRequest{}\n\terrorController.Init(container, []string{}, request)\n\terrorController.Run(response, request)\n}", "func MakeListEndpoint(service integratedservices.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(ListRequest)\n\n\t\tservices, err := service.List(ctx, req.ClusterID)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn ListResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tServices: services,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\treturn ListResponse{\n\t\t\t\tErr: err,\n\t\t\t\tServices: services,\n\t\t\t}, err\n\t\t}\n\n\t\treturn ListResponse{Services: services}, nil\n\t}\n}", "func NewGetAssetsListBadRequest() *GetAssetsListBadRequest {\n\n\treturn &GetAssetsListBadRequest{}\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StopFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *GetFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func RespondBadRequest(err error) events.APIGatewayProxyResponse {\n\treturn Respond(http.StatusBadRequest, Error{Error: err.Error()})\n}", "func (_obj *DataService) GetMsgListOneWayWithContext(tarsCtx context.Context, index int32, date string, wx_id string, nextIndex *int32, msgList *[]Message, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(index, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(date, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(wx_id, 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*nextIndex), 4)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.WriteHead(codec.LIST, 5)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32(int32(len((*msgList))), 0)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tfor _, v := range *msgList {\n\n\t\terr = v.WriteBlock(_os, 0)\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"getMsgList\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func BadRequest(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 400, message...)\n}", "func NewListProvidersBadRequest() *ListProvidersBadRequest {\n\treturn &ListProvidersBadRequest{}\n}", "func NewListListenContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListListenContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := ListListenContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamAction := req.Params[\"action\"]\n\tif len(paramAction) > 0 {\n\t\trawAction := paramAction[0]\n\t\trctx.Action = &rawAction\n\t}\n\tparamCount := req.Params[\"count\"]\n\tif len(paramCount) > 0 {\n\t\trawCount := paramCount[0]\n\t\tif count, err2 := strconv.Atoi(rawCount); err2 == nil {\n\t\t\ttmp8 := count\n\t\t\ttmp7 := &tmp8\n\t\t\trctx.Count = tmp7\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"count\", rawCount, \"integer\"))\n\t\t}\n\t\tif rctx.Count != nil {\n\t\t\tif *rctx.Count < 5 {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`count`, *rctx.Count, 5, true))\n\t\t\t}\n\t\t}\n\t}\n\tparamEtype := req.Params[\"etype\"]\n\tif len(paramEtype) > 0 {\n\t\trawEtype := paramEtype[0]\n\t\trctx.Etype = &rawEtype\n\t}\n\tparamPrevid := req.Params[\"previd\"]\n\tif len(paramPrevid) > 0 {\n\t\trawPrevid := paramPrevid[0]\n\t\trctx.Previd = &rawPrevid\n\t}\n\treturn &rctx, err\n}", "func NoListFilesWithException(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif strings.HasSuffix(r.URL.Path, \"/\") && r.URL.Path != \"/\" {\n\t\t\tw.WriteHeader(http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t\thandler.ServeHTTP(w, r)\n\t})\n}", "func (ctx *CreateFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (c productController) list(ctx *routing.Context) error {\n\n\titems, err := c.Service.List(ctx.Request.Context())\n\tif err != nil {\n\t\tif err == apperror.ErrNotFound {\n\t\t\tc.Logger.With(ctx.Request.Context()).Info(err)\n\t\t\treturn errorshandler.NotFound(\"\")\n\t\t}\n\t\tc.Logger.With(ctx.Request.Context()).Error(err)\n\t\treturn errorshandler.InternalServerError(\"\")\n\t}\n\tctx.Response.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\treturn ctx.Write(items)\n}", "func NewListAddonsBadRequest() *ListAddonsBadRequest {\n\treturn &ListAddonsBadRequest{}\n}", "func NewListTasksBadRequest() *ListTasksBadRequest {\n\treturn &ListTasksBadRequest{}\n}", "func PostListEndpoint(reader reading.Service) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tparams := r.URL.Query()\n\t\titems, totalItems, err := reader.PostList(params)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error listing posts: %v: %s\", params, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tres := map[string]interface{}{\"items\": items, \"total_items\": totalItems}\n\n\t\tw.WriteHeader(http.StatusOK)\n\t\tjson.NewEncoder(w).Encode(res)\n\t}\n}" ]
[ "0.654809", "0.65028626", "0.6160737", "0.6062704", "0.6000288", "0.566398", "0.55979437", "0.5595483", "0.54895496", "0.5457125", "0.53915846", "0.5381886", "0.53800726", "0.5346801", "0.5337162", "0.52520263", "0.52141976", "0.51415104", "0.51281494", "0.51113385", "0.5046231", "0.50104916", "0.5002071", "0.49838087", "0.49305055", "0.4904135", "0.48535603", "0.48298657", "0.47842726", "0.47819397", "0.4781126", "0.4758423", "0.4754681", "0.47323582", "0.47126698", "0.4681328", "0.46752948", "0.46745813", "0.4671257", "0.46612376", "0.46535844", "0.4646559", "0.4621415", "0.4615201", "0.46105334", "0.46103582", "0.46100047", "0.45917225", "0.45814618", "0.45760795", "0.45742124", "0.45614803", "0.45516467", "0.45446914", "0.45305732", "0.4529695", "0.45178655", "0.44998652", "0.44640377", "0.44635552", "0.44543472", "0.44529906", "0.4449503", "0.44467962", "0.44447178", "0.44383273", "0.44175974", "0.4410067", "0.43975115", "0.43938762", "0.4382568", "0.4381401", "0.4378392", "0.4377851", "0.43761992", "0.43760765", "0.43536022", "0.4353245", "0.4351623", "0.43439493", "0.43391052", "0.43391007", "0.43265405", "0.4323091", "0.43182084", "0.43174493", "0.43146208", "0.43096653", "0.43093362", "0.43079874", "0.43064934", "0.42955956", "0.42846638", "0.42841858", "0.42715693", "0.4265329", "0.42626008", "0.42592403", "0.42590636", "0.42422608" ]
0.76372945
0
ListFeedNotFound runs the method List of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter { // Setup service var ( logBuf bytes.Buffer respSetter goatest.ResponseSetterFunc = func(r interface{}) {} ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} { sliceVal := []string{strconv.Itoa(limit)} query["limit"] = sliceVal } { sliceVal := []string{strconv.Itoa(page)} query["page"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds"), RawQuery: query.Encode(), } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} { sliceVal := []string{strconv.Itoa(limit)} prms["limit"] = sliceVal } { sliceVal := []string{strconv.Itoa(page)} prms["page"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) listCtx, _err := app.NewListFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil } // Perform action _err = ctrl.List(listCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 404 { t.Errorf("invalid response status code: got %+v, expected 404", rw.Code) } // Return results return rw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *ListFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ListFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ListMessageContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ListOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *UpdateFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ListItemContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ShowTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ListQuizzesNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.QuizzesController) (http.ResponseWriter, *app.StandardError) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/quizzes\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"QuizzesTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListQuizzesContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\tvar mt *app.StandardError\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.StandardError)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.StandardError\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetAllHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": true, \"msg\": \"`+msg+`\"}`, 404, service, \"application/json\")\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tjson.NewEncoder(w).Encode(&ServiceError{\n\t\tMessage: \"Endpoint not found\",\n\t\tSolution: \"See / for possible directives\",\n\t\tErrorCode: http.StatusNotFound,\n\t})\n}", "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (c *Context) NotFound() {\n\tc.JSON(404, ResponseWriter(404, \"page not found\", nil))\n}", "func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NotFound(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\tm := TemplateMapFromContext(r.Context())\n\t\tm.Title(http.StatusText(http.StatusNotFound))\n\t\th.RenderHTMLStatus(w, http.StatusNotFound, \"404\", m)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusNotFound, http.StatusText(http.StatusNotFound))\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t}\n}", "func ListTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ListUserContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (a *API) getNotFound(ctx context.Context, res *common.HttpResponseWriter) error {\n\tres.WriteHeader(http.StatusNotFound)\n\treturn nil\n}", "func (ctx *ShowCommentContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *DeleteFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (c ApiWrapper) NotFound(msg string, objs ...interface{}) revel.Result {\n\treturn c.renderErrorString(404, fmt.Sprintf(msg, objs))\n}", "func NotFound(w ResponseWriter, r *Request) { Error(w, \"404 page not found\", StatusNotFound) }", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowSecretsContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NewListServicesNotFound() *ListServicesNotFound {\n\treturn &ListServicesNotFound{}\n}", "func NewListServicesNotFound() *ListServicesNotFound {\n\treturn &ListServicesNotFound{}\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NotFound(w http.ResponseWriter) {\n\trenderError(w, http.StatusNotFound, nil)\n}", "func (ctx *GetOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (this *Context) NotFound(message string) {\n\tthis.ResponseWriter.WriteHeader(404)\n\tthis.ResponseWriter.Write([]byte(message))\n}", "func (r *Responder) NotFound() { r.write(http.StatusNotFound) }", "func notfound(out http.ResponseWriter, format string, args ...interface{}) {\n\tsend(http.StatusNotFound, out, format, args...)\n}", "func (ctx *GetDogsByHostIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *AcceptOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NoListFilesWithException(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif strings.HasSuffix(r.URL.Path, \"/\") && r.URL.Path != \"/\" {\n\t\t\tw.WriteHeader(http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t\thandler.ServeHTTP(w, r)\n\t})\n}", "func (ctx *GetUsersContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (f WalkFunc) Do(ctx context.Context, call *Call) { call.Reply(http.StatusNotFound, nil) }", "func (ctx *UpdateFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (nse ErrNoSuchEndpoint) NotFound() {}", "func (ctx *DeleteDogContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFoundHandler() ServiceHttpHandler { return ServiceHttpHandler{Handler: NotFound} }", "func (response BasicJSONResponse) NotFound(writer http.ResponseWriter) {\n\tNotFound(writer, response)\n}", "func (ctx *GetByIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowProfileContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NewListFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := ListFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamLimit := req.Params[\"limit\"]\n\tif len(paramLimit) == 0 {\n\t\trctx.Limit = 10\n\t} else {\n\t\trawLimit := paramLimit[0]\n\t\tif limit, err2 := strconv.Atoi(rawLimit); err2 == nil {\n\t\t\trctx.Limit = limit\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"limit\", rawLimit, \"integer\"))\n\t\t}\n\t\tif rctx.Limit < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`limit`, rctx.Limit, 1, true))\n\t\t}\n\t}\n\tparamPage := req.Params[\"page\"]\n\tif len(paramPage) == 0 {\n\t\trctx.Page = 1\n\t} else {\n\t\trawPage := paramPage[0]\n\t\tif page, err2 := strconv.Atoi(rawPage); err2 == nil {\n\t\t\trctx.Page = page\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"page\", rawPage, \"integer\"))\n\t\t}\n\t\tif rctx.Page < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`page`, rctx.Page, 1, true))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func NotFound(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 404, message...)\n}", "func RenderNotFound(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, NotFound(message...))\n}", "func LogsContainerNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string, follow bool, since *time.Time, stderr bool, stdout bool, tail string, timestamps bool, until *time.Time) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", follow)}\n\t\tquery[\"follow\"] = sliceVal\n\t}\n\tif since != nil {\n\t\tsliceVal := []string{(*since).Format(time.RFC3339)}\n\t\tquery[\"since\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stderr)}\n\t\tquery[\"stderr\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stdout)}\n\t\tquery[\"stdout\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{tail}\n\t\tquery[\"tail\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", timestamps)}\n\t\tquery[\"timestamps\"] = sliceVal\n\t}\n\tif until != nil {\n\t\tsliceVal := []string{(*until).Format(time.RFC3339)}\n\t\tquery[\"until\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/logs\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", follow)}\n\t\tprms[\"follow\"] = sliceVal\n\t}\n\tif since != nil {\n\t\tsliceVal := []string{(*since).Format(time.RFC3339)}\n\t\tprms[\"since\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stderr)}\n\t\tprms[\"stderr\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stdout)}\n\t\tprms[\"stdout\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{tail}\n\t\tprms[\"tail\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", timestamps)}\n\t\tprms[\"timestamps\"] = sliceVal\n\t}\n\tif until != nil {\n\t\tsliceVal := []string{(*until).Format(time.RFC3339)}\n\t\tprms[\"until\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tlogsCtx, _err := app.NewLogsContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Logs(logsCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ShowWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (h *HandleHelper) NotFound() {\n\terrResponse(http.StatusNotFound,\n\t\t\"the requested resource could not be found\",\n\t)(h.w, h.r)\n}", "func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request) {\n\twriteResponse(r, w, http.StatusNotFound, &SimpleResponse{\n\t\tTraceID: tracing.FromContext(r.Context()),\n\t\tMessage: \"not found\",\n\t})\n}", "func (ctx *DeleteOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func ListFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedTinyCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedTinyCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedTinyCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTinyCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NotFound(w http.ResponseWriter) {\n\thttp.Error(w, \"404 not found!!!\", http.StatusNotFound)\n}", "func NotFound(w http.ResponseWriter, err error) {\n\tError(w, http.StatusNotFound, err)\n}", "func NotFound(w http.ResponseWriter, _ error) {\n\t(Response{Error: \"resource not found\"}).json(w, http.StatusNotFound)\n}", "func NotFound(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeNotFound, \"not found\")\n}", "func writeInsightNotFound(w http.ResponseWriter, str string) {\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\tio.WriteString(w, str)\n}", "func (c *Context) NotFound() {\n\tc.Handle(http.StatusNotFound, \"\", nil)\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func ShowItemsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ItemsController, user *int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif user != nil {\n\t\tsliceVal := []string{strconv.Itoa(*user)}\n\t\tquery[\"user\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/item\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif user != nil {\n\t\tsliceVal := []string{strconv.Itoa(*user)}\n\t\tprms[\"user\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ItemsTest\"), rw, req, prms)\n\tshowCtx, err := app.NewShowItemsContext(goaCtx, req, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\n\t// Perform action\n\terr = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tresponse := response.CreateResponse()\n\tresponse.SendDataWithStatusCode(w, \"not found\", http.StatusOK)\n}", "func Index(w http.ResponseWriter, req *http.Request) {\n\thttp.NotFound(w, req)\n}", "func (ctx *GetLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) { Error(w, \"404 page not found\", http.StatusNotFound) }", "func RenderNotFound(w http.ResponseWriter) error {\n\tw.Header().Add(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\treturn template.ExecuteTemplate(w, \"404.amber\", nil)\n}", "func NotFound(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"404 Not Found\")\n\t}\n\treturn Response{Status: http.StatusNotFound, Data: data, Logging: logging}\n}", "func notFound(resource string) middleware.Responder {\n\tmessage := fmt.Sprintf(\"404 %s not found\", resource)\n\treturn operations.NewGetChartDefault(http.StatusNotFound).WithPayload(\n\t\t&models.Error{Code: helpers.Int64ToPtr(http.StatusNotFound), Message: &message},\n\t)\n}", "func NewThingsListNotFound() *ThingsListNotFound {\n\treturn &ThingsListNotFound{}\n}", "func (c *SeaterController) TraceNotFoundf(err error, format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tc.traceJSONAbort(err, 404, msg)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusNotFound]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultNotFound(w, r)\n\t}\n}", "func (ctx *UpdateOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func notFound(w http.ResponseWriter, req *http.Request) {\n\t// w.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\tapiError := apirouter.ErrorFromRequest(req, fmt.Sprintf(\"404 occurred: %s\", req.RequestURI), \"Whoops - this request is not recognized\", http.StatusNotFound, http.StatusNotFound, \"\")\n\tapirouter.ReturnResponse(w, req, apiError.Code, apiError)\n}", "func (uee *UnknownEndpointError) NotFound() {}", "func (ctx *AddLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (app *App) NotFound(handler handlerFunc) {\n\tapp.craterRequestHandler.notFoundHandler = func(w http.ResponseWriter, r *http.Request) {\n\t\treq := newRequest(r, make(map[string]string))\n\t\tres := newResponse(w)\n\t\thandler(req, res)\n\n\t\tapp.sendResponse(req, res)\n\t}\n}", "func NotFound(message ...interface{}) Err {\n\treturn Boomify(http.StatusNotFound, message...)\n}", "func (o *PostFriendsUpdatesListNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(404)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func NotFound(rw http.ResponseWriter) {\n\tHttpError(rw, \"not found\", 404)\n}", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tapi.WriteNotFound(w)\n\t})\n}", "func ListFeeds(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(GetFeeds()))\n}", "func (ctx *PlayLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func NotFound(format string, args ...interface{}) error {\n\targs = append(args, withDefaultMessage(NotFoundDefaultMsg))\n\treturn Errorf(http.StatusNotFound, format, args...)\n}", "func HandleNotFound(lgc *logic.Logic) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlgc.Logger().WithFields(log.Fields{\n\t\t\t\"path\": r.URL.Path, \"method\": r.Method,\n\t\t\t\"message\": \"404 Page Not Found\",\n\t\t}).Info(\"request start\")\n\t\tw.WriteHeader(404)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write([]byte(fmt.Sprintf(\n\t\t\t`{\"message\":\"Page Not Found %s %s\"}`, r.Method, r.URL.Path)))\n\t}\n}", "func NewGetfeedsDefault(code int) *GetfeedsDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetfeedsDefault{\n\t\t_statusCode: code,\n\t}\n}" ]
[ "0.6811877", "0.642495", "0.6205189", "0.6196571", "0.615615", "0.6025153", "0.5973448", "0.59218574", "0.5854398", "0.5841977", "0.5823302", "0.5756557", "0.5728903", "0.5481717", "0.5462229", "0.54587275", "0.5381352", "0.5380244", "0.53045183", "0.5270865", "0.5257241", "0.5239865", "0.5237785", "0.5234964", "0.52218884", "0.5171383", "0.51468676", "0.5125219", "0.511837", "0.51170164", "0.5091148", "0.50877315", "0.50877315", "0.50869435", "0.507174", "0.507174", "0.5063944", "0.5060367", "0.50400025", "0.5033859", "0.5027218", "0.5026349", "0.49941215", "0.49867943", "0.4980514", "0.4966479", "0.4935062", "0.49345002", "0.4928959", "0.49273986", "0.4924345", "0.49205786", "0.49084496", "0.49022472", "0.48976249", "0.4891745", "0.48772222", "0.4845821", "0.48424733", "0.48407143", "0.48374486", "0.48351434", "0.4828007", "0.48064575", "0.48062554", "0.4801281", "0.47953957", "0.47872853", "0.477134", "0.47521597", "0.4742358", "0.4742358", "0.47407416", "0.47390062", "0.473749", "0.4727485", "0.47248882", "0.47191375", "0.47140086", "0.470235", "0.46990645", "0.4693593", "0.46746778", "0.46534112", "0.46506074", "0.46490166", "0.46489188", "0.46484184", "0.4645625", "0.46432793", "0.46367043", "0.46305168", "0.46296832", "0.46296832", "0.46294653", "0.46165872", "0.46144888", "0.46126413", "0.4612503", "0.4592493" ]
0.74945706
0
ListFeedOK runs the method List of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} { sliceVal := []string{strconv.Itoa(limit)} query["limit"] = sliceVal } { sliceVal := []string{strconv.Itoa(page)} query["page"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds"), RawQuery: query.Encode(), } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} { sliceVal := []string{strconv.Itoa(limit)} prms["limit"] = sliceVal } { sliceVal := []string{strconv.Itoa(page)} prms["page"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) listCtx, _err := app.NewListFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.List(listCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 200 { t.Errorf("invalid response status code: got %+v, expected 200", rw.Code) } var mt app.FeedCollection if resp != nil { var _ok bool mt, _ok = resp.(app.FeedCollection) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ListTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, app.TodoCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.TodoCollection\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(app.TodoCollection)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.TodoCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ListFeedContext) OK(r FeedCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.feed.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FeedCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ListFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedTinyCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedTinyCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedTinyCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTinyCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *ListOutputContext) OK(r OutputCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.output.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = OutputCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ListFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (feed *Feed) FeedList(w http.ResponseWriter, r *http.Request) {\n\tfed :=service.NewFeed()\n\tw.Header().Set(\"Content-Type\", \"applcation/json; charset=UTF-8\")\n\tw.Write(fed.FeedList())\n\n}", "func ListFeeds(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(GetFeeds()))\n}", "func (ctx *ListFilterContext) OK(r FilterCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.filter.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FilterCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewListFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := ListFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamLimit := req.Params[\"limit\"]\n\tif len(paramLimit) == 0 {\n\t\trctx.Limit = 10\n\t} else {\n\t\trawLimit := paramLimit[0]\n\t\tif limit, err2 := strconv.Atoi(rawLimit); err2 == nil {\n\t\t\trctx.Limit = limit\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"limit\", rawLimit, \"integer\"))\n\t\t}\n\t\tif rctx.Limit < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`limit`, rctx.Limit, 1, true))\n\t\t}\n\t}\n\tparamPage := req.Params[\"page\"]\n\tif len(paramPage) == 0 {\n\t\trctx.Page = 1\n\t} else {\n\t\trawPage := paramPage[0]\n\t\tif page, err2 := strconv.Atoi(rawPage); err2 == nil {\n\t\t\trctx.Page = page\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"page\", rawPage, \"integer\"))\n\t\t}\n\t\tif rctx.Page < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`page`, rctx.Page, 1, true))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func (ctx *ListListenContext) OK(r *AntListenList) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.listen.list+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func GetFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewListServicesOK() *ListServicesOK {\n\treturn &ListServicesOK{}\n}", "func NewListServicesOK() *ListServicesOK {\n\treturn &ListServicesOK{}\n}", "func (ctx *ListCommentContext) OK(r CommentCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.comment+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = CommentCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func UpdateFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListContainerOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController) (http.ResponseWriter, app.GoaContainerListEachCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/list\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.GoaContainerListEachCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.GoaContainerListEachCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.GoaContainerListEachCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ShowTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ListOfferContext) OK(r OfferCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.offer+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = OfferCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (m *Mux) List(ds *discordgo.Session, dm *discordgo.Message, ctx *Context) {\n\tresp := \"```\\n\"\n\n\tfor p, v := range Config.Feeds {\n\t\tresp += strconv.Itoa(p) + \": \" + v.Feed.Title + \", \" + v.Feed.Link + \"\\n\"\n\t}\n\n\tresp += \"```\\n\"\n\n\tds.ChannelMessageSend(dm.ChannelID, resp)\n\n\treturn\n}", "func ListQuizzesOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.QuizzesController) (http.ResponseWriter, app.QuizCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/quizzes\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"QuizzesTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListQuizzesContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.QuizCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.QuizCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.QuizCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ListCategoryContext) OK(r CategoryCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.category+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = CategoryCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ListTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ListMessageContext) OK(r MessageCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.message+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = MessageCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func List(ctx context.Context, _ store.Store, r *http.Request) (*SuccessResponse, error) {\n\tr.ParseForm()\n\n\tclient = newsclient.New(listEndpoint)\n\tparams := new(list.Params)\n\terr := schema.NewDecoder().Decode(params, r.Form)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error decoding params: %v\", err)\n\t}\n\n\tif params.Page == 0 {\n\t\tparams.Page = 1\n\t}\n\n\t// Requests to external services should have timeouts.\n\treqCtx, cancel := context.WithTimeout(ctx, defaultDuration)\n\tdefer cancel()\n\n\tres, err := fetch(reqCtx, params)\n\tif err != nil {\n\t\treturn nil, &httperror.HTTPError{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tMessage: err.Error(),\n\t\t\tRequestURL: r.RequestURI,\n\t\t\tDocsURL: listEndpoint.DocsURL,\n\t\t}\n\t}\n\n\treturn &SuccessResponse{\n\t\tCode: http.StatusOK,\n\t\tRequestURL: r.RequestURI,\n\t\tCount: len(res.Articles),\n\t\tPage: params.Page,\n\t\tTotalCount: res.TotalResults,\n\t\tData: res.Articles,\n\t}, nil\n}", "func MakeListTodosEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tr0, err := service.ListTodos(ctx)\n\n\t\tif err != nil {\n\t\t\tif endpointErr := endpointError(nil); errors.As(err, &endpointErr) && endpointErr.EndpointError() {\n\t\t\t\treturn ListTodosResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tR0: r0,\n\t\t\t\t}, err\n\t\t\t}\n\n\t\t\treturn ListTodosResponse{\n\t\t\t\tErr: err,\n\t\t\t\tR0: r0,\n\t\t\t}, nil\n\t\t}\n\n\t\treturn ListTodosResponse{R0: r0}, nil\n\t}\n}", "func (ctx *ListMiddlecategoryContext) OK(r MiddlecategoryCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.middlecategory+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = MiddlecategoryCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func getCategoriesList(lister listing.Service) http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, r *http.Request) {\n\t\trw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tvar list *listing.CategoriesResponse\n\n\t\tlimit := r.FormValue(\"limit\")\n\t\ttop := r.FormValue(\"top\")\n\n\t\tl, err := strconv.ParseInt(limit, 10, 2)\n\t\tif err != nil {\n\t\t\tl = 100\n\t\t}\n\t\tif top == \"true\" {\n\t\t\tlist, err = lister.TopCategories(r.Context(), int(l))\n\t\t} else {\n\t\t\tlist, err = lister.Categories(r.Context())\n\t\t}\n\n\t\tif err != nil {\n\t\t\t// server problem while answering the request\n\t\t\tr := constructError(http.StatusInternalServerError,\n\t\t\t\t\"unable to process request\",\n\t\t\t\t\"A problem occurs while processing the request\")\n\n\t\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\t\tjson.NewEncoder(rw).Encode(r)\n\t\t\treturn\n\t\t}\n\n\t\trw.WriteHeader(http.StatusOK)\n\t\terr = json.NewEncoder(rw).Encode(list)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t}\n}", "func (ctx *ListAnalysisContext) OK(r *AntEventHistoryList) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.event.history.list+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *ListArticleContext) OK(r ArticleCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.article+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = ArticleCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func HandleListSuccessfully(t *testing.T, output string) {\n\tth.Mux.HandleFunc(\"/software_configs\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"GET\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", fake.TokenID)\n\t\tth.TestHeader(t, r, \"Accept\", \"application/json\")\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprintf(w, output)\n\t\t//r.ParseForm()\n\t})\n}", "func NewGetfeedsOK() *GetfeedsOK {\n\treturn &GetfeedsOK{}\n}", "func (c productController) list(ctx *routing.Context) error {\n\n\titems, err := c.Service.List(ctx.Request.Context())\n\tif err != nil {\n\t\tif err == apperror.ErrNotFound {\n\t\t\tc.Logger.With(ctx.Request.Context()).Info(err)\n\t\t\treturn errorshandler.NotFound(\"\")\n\t\t}\n\t\tc.Logger.With(ctx.Request.Context()).Error(err)\n\t\treturn errorshandler.InternalServerError(\"\")\n\t}\n\tctx.Response.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\treturn ctx.Write(items)\n}", "func MakeListEndpoint(service integratedservices.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(ListRequest)\n\n\t\tservices, err := service.List(ctx, req.ClusterID)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn ListResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tServices: services,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\treturn ListResponse{\n\t\t\t\tErr: err,\n\t\t\t\tServices: services,\n\t\t\t}, err\n\t\t}\n\n\t\treturn ListResponse{Services: services}, nil\n\t}\n}", "func listChartsHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.Context) error {\n\thandler := \"manager: list charts\"\n\tutil.LogHandlerEntry(handler, r)\n\ttypes, err := c.Manager.ListCharts()\n\tif err != nil {\n\t\thttputil.BadRequest(w, r, err)\n\t\treturn nil\n\t}\n\n\tutil.LogHandlerExitWithJSON(handler, w, types, http.StatusOK)\n\treturn nil\n}", "func (ctx *SpecsOutputContext) OK(r OutputSpecCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.output-spec.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = OutputSpecCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewListEventsOK() *ListEventsOK {\n\treturn &ListEventsOK{}\n}", "func NewListEventsOK() *ListEventsOK {\n\treturn &ListEventsOK{}\n}", "func (ctx *ListPlaceContext) OK(r PlaceCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.place+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = PlaceCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (a *Api) List(w http.ResponseWriter, r *http.Request) error {\n\treturn nil\n}", "func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func listHandler(c appengine.Context, w http.ResponseWriter, r *http.Request) *appError {\n\tq := datastore.NewQuery(\"Overlay\").\n\t\tFilter(\"Owner = \", user.Current(c).ID)\n\n\tvar overlays []*Overlay\n\tif _, err := q.GetAll(c, &overlays); err != nil {\n\t\treturn appErrorf(err, \"could not get overlays\")\n\t}\n\n\tif err := json.NewEncoder(w).Encode(overlays); err != nil {\n\t\treturn appErrorf(err, \"could not marshal overlay json\")\n\t}\n\treturn nil\n}", "func NewThingsListOK() *ThingsListOK {\n\treturn &ThingsListOK{}\n}", "func (client AppsClient) List(ctx context.Context, skip *int32, take *int32) (result ListApplicationInfoResponse, err error) {\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: skip,\n\t\t\tConstraints: []validation.Constraint{{Target: \"skip\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"skip\", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}},\n\t\t{TargetValue: take,\n\t\t\tConstraints: []validation.Constraint{{Target: \"take\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"take\", Name: validation.InclusiveMaximum, Rule: 500, Chain: nil},\n\t\t\t\t\t{Target: \"take\", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil},\n\t\t\t\t}}}}}); err != nil {\n\t\treturn result, validation.NewError(\"programmatic.AppsClient\", \"List\", err.Error())\n\t}\n\n\treq, err := client.ListPreparer(ctx, skip, take)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"List\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (controller AppsController) List(c *gin.Context) {\n\tvar config entities.App\n\tif user, ok := c.Get(\"Session\"); ok {\n\t\tfmt.Printf(\"User %v\", user)\n\t}\n\tresult, err := mongodb.GetAll(controller.MongoDBClient, Collections[\"apps\"], bson.M{}, config)\n\tif err != nil {\n\t\tfmt.Printf(\"error %v\", err)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"message\": err})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\"apps\": result})\n}", "func NewListOfDevicesOK() *ListOfDevicesOK {\n\treturn &ListOfDevicesOK{}\n}", "func (ctx *SpecsFilterContext) OK(r FilterSpecCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.filter-spec.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FilterSpecCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewListFirewallsOK() *ListFirewallsOK {\n\treturn &ListFirewallsOK{}\n}", "func (ctx *GetFilterContext) OK(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewListConfigurationsOK() *ListConfigurationsOK {\n\treturn &ListConfigurationsOK{}\n}", "func (ctx *ListUserContext) OK(r UserCollection) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.user+json; type=collection\")\n\tif r == nil {\n\t\tr = UserCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (p *Resource) SGOListHandler(req *restful.Request, resp *restful.Response) {\n\t// logrus.Infof(\"AppsListHandler is called!\")\n\tx_auth_token := req.HeaderParameter(\"X-Auth-Token\")\n\tcode, err := services.TokenValidation(x_auth_token)\n\tif err != nil {\n\t\tresponse.WriteStatusError(code, err, resp)\n\t\treturn\n\t}\n\n\tvar skip int = queryIntParam(req, \"skip\", 0)\n\tvar limit int = queryIntParam(req, \"limit\", 0)\n\n\ttotal, sgos, code, err := services.GetSgoService().QueryAll(skip, limit, x_auth_token)\n\tif err != nil {\n\t\tresponse.WriteStatusError(code, err, resp)\n\t\treturn\n\t}\n\tres := response.QueryStruct{Success: true, Data: sgos}\n\tif c, _ := strconv.ParseBool(req.QueryParameter(\"count\")); c {\n\t\tres.Count = total\n\t\tresp.AddHeader(\"X-Object-Count\", strconv.Itoa(total))\n\t}\n\tresp.WriteEntity(res)\n\treturn\n}", "func ListServiceFlavorResults(r *http.Request, cfg config.Config) (int, http.Header, []byte, error) {\n\t//STANDARD DECLARATIONS START\n\tcode := http.StatusOK\n\th := http.Header{}\n\toutput := []byte(\"\")\n\terr := error(nil)\n\tcontentType := \"application/xml\"\n\tcharset := \"utf-8\"\n\t//STANDARD DECLARATIONS END\n\n\tcontentType, err = respond.ParseAcceptHeader(r)\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\tif err != nil {\n\t\tcode = http.StatusNotAcceptable\n\t\toutput, _ = respond.MarshalContent(respond.NotAcceptableContentType, contentType, \"\", \" \")\n\t\treturn code, h, output, err\n\t}\n\n\t// Parse the request into the input\n\turlValues := r.URL.Query()\n\tvars := mux.Vars(r)\n\n\ttenantDbConfig, err := authentication.AuthenticateTenant(r.Header, cfg)\n\tif err != nil {\n\t\tif err.Error() == \"Unauthorized\" {\n\t\t\tcode = http.StatusUnauthorized\n\t\t\tout := respond.UnauthorizedMessage\n\t\t\toutput = out.MarshalTo(contentType)\n\t\t\treturn code, h, output, err\n\t\t}\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\tsession, err := mongo.OpenSession(tenantDbConfig)\n\tdefer mongo.CloseSession(session)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\treport := reports.MongoInterface{}\n\terr = mongo.FindOne(session, tenantDbConfig.Db, \"reports\", bson.M{\"info.name\": vars[\"report_name\"]}, &report)\n\n\tif err != nil {\n\t\tcode = http.StatusBadRequest\n\t\tmessage := \"The report with the name \" + vars[\"report_name\"] + \" does not exist\"\n\t\toutput, err := createErrorMessage(message, contentType) //Render the response into XML or JSON\n\t\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\t\treturn code, h, output, err\n\t}\n\n\tinput := serviceFlavorResultQuery{\n\t\tbasicQuery: basicQuery{\n\t\t\tName: vars[\"service_type\"],\n\t\t\tGranularity: urlValues.Get(\"granularity\"),\n\t\t\tFormat: contentType,\n\t\t\tStartTime: urlValues.Get(\"start_time\"),\n\t\t\tEndTime: urlValues.Get(\"end_time\"),\n\t\t\tReport: report,\n\t\t\tVars: vars,\n\t\t},\n\t\tEndpointGroup: vars[\"lgroup_name\"],\n\t}\n\n\ttenantDB := session.DB(tenantDbConfig.Db)\n\terrs := input.Validate(tenantDB)\n\tif len(errs) > 0 {\n\t\tout := respond.BadRequestSimple\n\t\tout.Errors = errs\n\t\toutput = out.MarshalTo(contentType)\n\t\tcode = 400\n\t\treturn code, h, output, err\n\t}\n\n\tif vars[\"lgroup_type\"] != report.GetEndpointGroupType() {\n\t\tcode = http.StatusBadRequest\n\t\tmessage := \"The report \" + vars[\"report_name\"] + \" does not define endpoint group type: \" + vars[\"lgroup_type\"] + \". Try using \" + report.GetEndpointGroupType() + \" instead.\"\n\t\toutput, err := createErrorMessage(message, contentType) //Render the response into XML or JSON\n\t\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\t\treturn code, h, output, err\n\t}\n\n\tresults := []ServiceFlavorInterface{}\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\t// Construct the query to mongodb based on the input\n\tfilter := bson.M{\n\t\t\"date\": bson.M{\"$gte\": input.StartTimeInt, \"$lte\": input.EndTimeInt},\n\t\t\"report\": report.ID,\n\t}\n\n\tif input.Name != \"\" {\n\t\tfilter[\"name\"] = input.Name\n\t}\n\n\tif input.EndpointGroup != \"\" {\n\t\tfilter[\"supergroup\"] = input.EndpointGroup\n\t}\n\n\t// Select the granularity of the search daily/monthly\n\tif input.Granularity == \"daily\" {\n\t\tcustomForm[0] = \"20060102\"\n\t\tcustomForm[1] = \"2006-01-02\"\n\t\tquery := DailyServiceFlavor(filter)\n\t\terr = mongo.Pipe(session, tenantDbConfig.Db, \"service_ar\", query, &results)\n\t} else if input.Granularity == \"monthly\" {\n\t\tcustomForm[0] = \"200601\"\n\t\tcustomForm[1] = \"2006-01\"\n\t\tquery := MonthlyServiceFlavor(filter)\n\t\terr = mongo.Pipe(session, tenantDbConfig.Db, \"service_ar\", query, &results)\n\t}\n\n\t// mongo.Find(session, tenantDbConfig.Db, \"endpoint_group_ar\", bson.M{}, \"_id\", &results)\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\toutput, err = createServiceFlavorResultView(results, report, input.Format)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\treturn code, h, output, err\n\n}", "func (m* Manager) ListHandler(w http.ResponseWriter, r *http.Request) {\n\tret, err := m.platformManager.ListFunction()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonRet, err := json.Marshal(ret)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.Header().Add(\"Content-Type\", \"application/json;charset=utf-8\")\n\tw.Write(jsonRet)\n\treturn\n}", "func (c *OutputController) List(ctx *app.ListOutputContext) error {\n\tres := app.OutputCollection{}\n\tspecs := c.om.GetSpec()\n\tfor _, spec := range specs {\n\t\to := app.Output{\n\t\t\tName: spec.Name,\n\t\t\tDesc: spec.Desc,\n\t\t\tProps: spec.Props,\n\t\t\tTags: spec.Tags,\n\t\t}\n\t\tres = append(res, &o)\n\t}\n\treturn ctx.OK(res)\n}", "func ListGuestbookOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.GuestbookController) (http.ResponseWriter, app.GuestbookGuestCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/guestbook/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"GuestbookTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListGuestbookContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.GuestbookGuestCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.GuestbookGuestCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.GuestbookGuestCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func MakeListEndpoint(s service.CatalogService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tproducts, err := s.List(ctx)\n\t\treturn ListResponse{\n\t\t\tErr: err,\n\t\t\tProducts: products,\n\t\t}, nil\n\t}\n}", "func ServiceListHandler(_ context.Context, list *corev1.ServiceList, options Options) (component.Component, error) {\n\tif list == nil {\n\t\treturn nil, errors.New(\"nil list\")\n\t}\n\n\tcols := component.NewTableCols(\"Name\", \"Labels\", \"Type\", \"Cluster IP\", \"External IP\", \"Target Ports\", \"Age\", \"Selector\")\n\ttbl := component.NewTable(\"Services\", \"We couldn't find any services!\", cols)\n\n\tfor _, s := range list.Items {\n\t\trow := component.TableRow{}\n\t\tnameLink, err := options.Link.ForObject(&s, s.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trow[\"Name\"] = nameLink\n\t\trow[\"Labels\"] = component.NewLabels(s.Labels)\n\t\trow[\"Type\"] = component.NewText(string(s.Spec.Type))\n\t\trow[\"Cluster IP\"] = component.NewText(s.Spec.ClusterIP)\n\t\trow[\"External IP\"] = component.NewText(describeExternalIPs(s))\n\t\trow[\"Target Ports\"] = printServicePorts(s.Spec.Ports)\n\n\t\tts := s.CreationTimestamp.Time\n\t\trow[\"Age\"] = component.NewTimestamp(ts)\n\n\t\trow[\"Selector\"] = printSelectorMap(s.Spec.Selector)\n\n\t\ttbl.Add(row)\n\t}\n\treturn tbl, nil\n}", "func StartFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (g *Goods) List(c Context) {\n\t// TODO\n\tc.String(http.StatusOK, \"get goods list\")\n}", "func (ctx *GetSwaggerContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func (ctx *GetDogsByHostIDHostContext) OK(r *Dogs) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"dogs\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *ListItemContext) OK(r ItemCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.item+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = ItemCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (s *ActionService) List(packageName string, options *ActionListOptions) ([]Action, *http.Response, error) {\n\tvar route string\n\tvar actions []Action\n\n\tif len(packageName) > 0 {\n\t\t// Encode resource name as a path (with no query params) before inserting it into the URI\n\t\t// This way any '?' chars in the name won't be treated as the beginning of the query params\n\t\tpackageName = (&url.URL{Path: packageName}).String()\n\t\troute = fmt.Sprintf(\"actions/%s/\", packageName)\n\t} else {\n\t\troute = fmt.Sprintf(\"actions\")\n\t}\n\n\trouteUrl, err := addRouteOptions(route, options)\n\tif err != nil {\n\t\tDebug(DbgError, \"addRouteOptions(%s, %#v) error: '%s'\\n\", route, options, err)\n\t\terrMsg := wski18n.T(\"Unable to add route options '{{.options}}'\",\n\t\t\tmap[string]interface{}{\"options\": options})\n\t\twhiskErr := MakeWskErrorFromWskError(errors.New(errMsg), err, EXIT_CODE_ERR_GENERAL, DISPLAY_MSG,\n\t\t\tNO_DISPLAY_USAGE)\n\t\treturn nil, nil, whiskErr\n\t}\n\tDebug(DbgError, \"Action list route with options: %s\\n\", route)\n\n\treq, err := s.client.NewRequestUrl(\"GET\", routeUrl, nil, IncludeNamespaceInUrl, AppendOpenWhiskPathPrefix, EncodeBodyAsJson, AuthRequired)\n\tif err != nil {\n\t\tDebug(DbgError, \"http.NewRequestUrl(GET, %s, nil, IncludeNamespaceInUrl, AppendOpenWhiskPathPrefix, EncodeBodyAsJson, AuthRequired) error: '%s'\\n\", routeUrl, err)\n\t\terrMsg := wski18n.T(\"Unable to create HTTP request for GET '{{.route}}': {{.err}}\",\n\t\t\tmap[string]interface{}{\"route\": routeUrl, \"err\": err})\n\t\twhiskErr := MakeWskErrorFromWskError(errors.New(errMsg), err, EXIT_CODE_ERR_NETWORK, DISPLAY_MSG,\n\t\t\tNO_DISPLAY_USAGE)\n\t\treturn nil, nil, whiskErr\n\t}\n\n\tresp, err := s.client.Do(req, &actions, ExitWithSuccessOnTimeout)\n\tif err != nil {\n\t\tDebug(DbgError, \"s.client.Do() error - HTTP req %s; error '%s'\\n\", req.URL.String(), err)\n\t\treturn nil, resp, err\n\t}\n\n\treturn actions, resp, err\n}", "func (c *SeriesController) List(ctx *app.ListSeriesContext) error {\n\t// SeriesController_List: start_implement\n\tm, err := c.fm()\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`unable to get model`, `error`, err.Error())\n\t\treturn ctx.ServiceUnavailable()\n\t}\n\tdefer func() { m.Close() }()\n\n\tlist, err := m.ListSeriesByIDs(nil, nil, nil, nil)\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`failed to get series list`, `error`, err.Error())\n\t\treturn ctx.InternalServerError()\n\t}\n\n\tbs := make(app.SeriesCollection, len(list))\n\tfor i, bk := range list {\n\t\tbs[i] = convert.ToSeriesMedia(bk)\n\t}\n\treturn ctx.OK(bs)\n\t// SeriesController_List: end_implement\n}", "func Ok(c *routing.Context, msg string, service string) error {\n\tResponse(c, msg, 200, service, \"application/json\")\n\treturn nil\n}", "func handle(fn func(context.Context, *models.ListOptions) (*models.ListResult, error)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tenc := json.NewEncoder(w)\n\t\tenc.SetIndent(\"\", \" \")\n\t\tenc.SetEscapeHTML(false) // idk why I hate it so much, but I do!\n\n\t\t// Parse request parameters\n\t\tcount := getURLCount(r.URL)\n\t\tappengine.Info(r.Context(), \"Requested %d posts\", count)\n\n\t\t// Fire the real request\n\t\topts := &models.ListOptions{\n\t\t\tCount: count,\n\t\t\tCursor: r.URL.Query().Get(\"cursor\"),\n\t\t\tTag: r.URL.Query().Get(\"tag\"),\n\t\t}\n\t\tres, err := fn(r.Context(), opts)\n\t\tif err != nil {\n\t\t\tappengine.Warning(r.Context(), \"Failed to process list handler: %v\", err)\n\t\t\tenc.Encode(response{\n\t\t\t\tStatus: \"error\",\n\t\t\t\tCode: http.StatusInternalServerError,\n\t\t\t\tErr: \"unable to fetch posts\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// fix up full response URLs based on incoming request\n\t\tr.URL.Host = r.Host\n\t\tif host := r.Header.Get(\"x-forwarded-host\"); host != \"\" {\n\t\t\tr.URL.Host = host // work around test environment shortcomings\n\t\t}\n\t\tr.URL.Scheme = \"http\"\n\t\tif scheme := r.Header.Get(\"x-forwarded-proto\"); scheme != \"\" {\n\t\t\tr.URL.Scheme = scheme\n\t\t}\n\n\t\t// Successful response!\n\t\tenc.Encode(response{\n\t\t\tStatus: \"success\",\n\t\t\tCode: http.StatusOK,\n\t\t\tData: res.Posts,\n\t\t\tNext: toLink(r.URL, res.Next),\n\t\t\tPrev: toLink(r.URL, res.Prev),\n\t\t\tSelf: toLink(r.URL, res.Self),\n\t\t})\n\t}\n}", "func MakeListItemsEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\titems, err := service.ListItems(ctx)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn ListItemsResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tItems: items,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\treturn ListItemsResponse{\n\t\t\t\tErr: err,\n\t\t\t\tItems: items,\n\t\t\t}, err\n\t\t}\n\n\t\treturn ListItemsResponse{Items: items}, nil\n\t}\n}", "func Feed(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase \"GET\":\n\t\t// get the user's feed\n\t\tuser := r.Context().Value(\"user\").(*authpb.UserId)\n\t\t// Get the user's obj\n\t\tuserObj, err := UserServiceClient.GetUser(r.Context(), &userpb.UserId{UserId: user.UserId})\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Get the user's following list\n\t\tfollowers, err := UserServiceClient.GetFollowing(r.Context(), &userpb.UserId{UserId: user.UserId})\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Construct an array of userIds to get posts and a map to map userids to user objects\n\t\tuserMap := make(map[uint64]*userpb.User)\n\t\tuserMap[user.UserId] = userObj\n\t\ttempArr := make([]uint64, 0, len(followers.GetUserList())+1)\n\t\ttempArr = append(tempArr, user.UserId)\n\t\tfor _, v := range followers.GetUserList() {\n\t\t\ttempArr = append(tempArr, v.AccountInformation.UserId)\n\t\t\tuserMap[v.AccountInformation.UserId] = v\n\t\t}\n\n\t\t// Get posts\n\t\tposts, err := PostServiceClient.GetPostsByAuthors(r.Context(), &postpb.UserIDs{UserIDs: tempArr})\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\t//create a reply struct\n\t\trespPostArray := make([]handlermodels.Post, len(posts.Posts))\n\t\tfor i, post := range posts.Posts {\n\t\t\t// construct a post struct\n\t\t\tauthor := userMap[post.UserId].AccountInformation\n\t\t\ttimestamp, _ := ptypes.Timestamp(post.Timestamp)\n\t\t\tauthorStruct := handlermodels.Author{UserID: author.UserId, Firstname: author.FirstName, Lastname: author.LastName, Email: author.Email}\n\t\t\tpostStruct := handlermodels.Post{Id: post.PostID, Timestamp: timestamp, Message: post.Message, Author: authorStruct}\n\t\t\trespPostArray[i] = postStruct\n\t\t}\n\t\trespMessage := handlermodels.FeedResponse{respPostArray}\n\t\tbody, err := json.Marshal(respMessage)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"content-type\", \"application/json\")\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"http://localhost:4200\")\n\t\tw.Write(body)\n\tdefault:\n\t\thttp.Error(w, \"Only GET allowed\", http.StatusMethodNotAllowed)\n\t}\n}", "func NewListUsersOK() *ListUsersOK {\n\n\treturn &ListUsersOK{}\n}", "func getFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tformat := chi.URLParam(r, \"format\")\n\t\tif format == \"\" {\n\t\t\tformat = \"rss\"\n\t\t}\n\t\ts, err := s.ServeFeed(format, plugin)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error serving the feed\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tswitch format {\n\t\tcase \"atom\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/atom+xml\")\n\t\tcase \"json\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tdefault:\n\t\t\tw.Header().Set(\"Content-Type\", \"application/rss+xml\")\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(s))\n\t}\n}", "func List(modelIns interface{}, paramCreators ...CriteriaCreator) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\n\t\ttotal, data := ListHandlerWithoutServe(modelIns, c, paramCreators...)\n\n\t\tc.JSON(200, gin.H{\n\t\t\t\"total\": total,\n\t\t\t\"data\": data,\n\t\t})\n\t}\n}", "func ListHandler(w http.ResponseWriter, r *http.Request) {\n\t_, _, ok := r.BasicAuth()\n\tif !ok {\n\t\tw.Header().Set(\"WWW-Authenticate\", fmt.Sprintf(`Basic realm=\"%s\"`, BasicAuthRealm))\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(http.StatusText(http.StatusUnauthorized) + \"\\n\"))\n\t\treturn\n\t}\n\tif !reqIsAdmin(r) {\n\t\thttp.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)\n\t\treturn\n\t}\n\toff := 0\n\tlim := 50\n\tvar of string\n\tvar li string\n\tvar err error\n\tif r.FormValue(\"offset\") != \"\" {\n\t\tof = r.FormValue(\"offset\")\n\t\toff, err = strconv.Atoi(of)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\tif r.FormValue(\"limit\") != \"\" {\n\t\tli = r.FormValue(\"limit\")\n\t\tlim, err = strconv.Atoi(li)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\tusrs, err := List(off, lim)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tjd, jerr := json.Marshal(&usrs)\n\tif jerr != nil {\n\t\thttp.Error(w, jerr.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tfmt.Fprintf(w, string(jd))\n}", "func (ctx *SearchHotelsContext) OK(r HotelCollection) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\tif r == nil {\n\t\tr = HotelCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func List(w http.ResponseWriter, r *http.Request) {\n\n\tmoviesRaw := MoviesDal.List()\n\n\tmovies := model.ListMoviesResponse{\n\t\tMovies: moviesRaw,\n\t}\n\n\tlog.Println(\"[RESPONSE] OK: The movies were fetched.\")\n\twriteResponse(w, http.StatusOK, movies)\n\n}", "func (uc UsersController) List(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprintf(w, \"UsersList\")\n}", "func UpdateFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func handleList(w http.ResponseWriter, r *http.Request) {\n\tappid := requestheader.GetAppID(r)\n\n\tlist, errCode, err := GetSwitches(appid)\n\tif errCode != ApiError.SUCCESS {\n\t\tutil.WriteJSON(w, util.GenRetObj(errCode, err))\n\t} else {\n\t\tutil.WriteJSON(w, util.GenRetObj(errCode, list))\n\t}\n}", "func NewActivityListJoinedOK() *ActivityListJoinedOK {\n\treturn &ActivityListJoinedOK{}\n}", "func MakeListEndpoint(s Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (response interface{}, err error) {\n\t\treq := request.(listRequest)\n\t\tsocks, err := s.List(req.Tags, req.Order, req.PageNum, req.PageSize)\n\t\treturn listResponse{Socks: socks, Err: err}, err\n\t}\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func DeleteAllTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteAllCtx, _err := app.NewDeleteAllTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.DeleteAll(deleteAllCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (res ItemsResource) List(w http.ResponseWriter, r *http.Request) {\n\trender.JSON(w, r, items)\n}", "func listHandler(w http.ResponseWriter, r *http.Request) *appError {\n\tvideos, err := bittube.DB.ListVideos()\n\tif err != nil {\n\t\treturn appErrorf(err, \"could not list videos: %v\", err)\n\t}\n\n\treturn listTmpl.Execute(w, r, videos)\n}", "func OffersHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.FormValue(\"token\") != Token_.Key {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tfmt.Fprintln(w, JsonResponse{\"status\": \"unauthorized\"})\n\t\treturn\n\t}\n\n\tif strings.HasSuffix(r.URL.Path, \"display\") {\n\t\tlog.Println(r.Method, r.URL, http.StatusMovedPermanently)\n\t\thttp.Redirect(w, r, \"http://\"+r.Host+DisplayEndpoint, 301)\n\t\treturn\n\t}\n\n\tlog.Println(r.Method, r.URL, http.StatusOK)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tb, err := json.Marshal(Offers)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tfmt.Fprintln(w, string(b))\n}", "func NewListOutputContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListOutputContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := ListOutputContext{Context: ctx, ResponseData: resp, RequestData: req}\n\treturn &rctx, err\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func getPluginListHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugins := s.ListFeeds()\n\t\tb, err := json.Marshal(plugins)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error listing the plugins\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write(b)\n\t}\n}", "func (ctx *ListFeedContext) OKTiny(r FeedTinyCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.feed.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FeedTinyCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *GetOpmlContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/xml\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func (ctx *GetAllHostContext) OK(r HostsresponseCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"hostsresponse; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = HostsresponseCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *ShowWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/xml\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func (v OrdersResource) List(c buffalo.Context) error {\n // Get the DB connection from the context\n tx, ok := c.Value(\"tx\").(*pop.Connection)\n if !ok {\n return fmt.Errorf(\"no transaction found\")\n }\n\n orders := &models.Orders{}\n\n // Paginate results. Params \"page\" and \"per_page\" control pagination.\n // Default values are \"page=1\" and \"per_page=20\".\n q := tx.PaginateFromParams(c.Params())\n\n // Retrieve all Orders from the DB\n if err := q.All(orders); err != nil {\n return err\n }\n\n return responder.Wants(\"html\", func (c buffalo.Context) error {\n // Add the paginator to the context so it can be used in the template.\n c.Set(\"pagination\", q.Paginator)\n\n c.Set(\"orders\", orders)\n return c.Render(http.StatusOK, r.HTML(\"/orders/index.plush.html\"))\n }).Wants(\"json\", func (c buffalo.Context) error {\n return c.Render(200, r.JSON(orders))\n }).Wants(\"xml\", func (c buffalo.Context) error {\n return c.Render(200, r.XML(orders))\n }).Respond(c)\n}", "func (ctx *ListLargecategoryContext) OK(r LargecategoryCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.largecategory+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = LargecategoryCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func CreateFeedCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewWeaviateThingsActionsListOK() *WeaviateThingsActionsListOK {\n\treturn &WeaviateThingsActionsListOK{}\n}", "func (a *Client) List(params *ListParams) (*ListOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"list\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/subjects\",\n\t\tProducesMediaTypes: []string{\"application/json; qs=0.5\", \"application/vnd.schemaregistry+json; qs=0.9\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.schemaregistry+json\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &ListReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for list: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}" ]
[ "0.6187998", "0.6159245", "0.61299014", "0.6003695", "0.59241635", "0.58804595", "0.5749759", "0.5690664", "0.5564265", "0.5497274", "0.5384616", "0.5346536", "0.53425634", "0.53273505", "0.53171396", "0.53171396", "0.5316322", "0.52949893", "0.5243879", "0.5221843", "0.52042615", "0.5162867", "0.51486135", "0.5144597", "0.51393634", "0.5138348", "0.51336324", "0.51167655", "0.50423235", "0.504006", "0.50353104", "0.50262415", "0.50218904", "0.5000593", "0.49611527", "0.49577537", "0.49396005", "0.49353036", "0.49217156", "0.4908677", "0.4908677", "0.4893681", "0.4881835", "0.4855832", "0.48530075", "0.48479295", "0.4846374", "0.48385453", "0.48378497", "0.48069748", "0.47899026", "0.47675717", "0.47647202", "0.47603244", "0.47525048", "0.4748136", "0.47356078", "0.47090915", "0.4707241", "0.47035632", "0.46931902", "0.46872428", "0.4683131", "0.4677293", "0.4665467", "0.46514994", "0.46393633", "0.46373755", "0.4610017", "0.46061462", "0.4603168", "0.46023786", "0.45904398", "0.45858654", "0.45538634", "0.45370132", "0.4534608", "0.45335", "0.45333666", "0.4531274", "0.45312685", "0.45206502", "0.45170757", "0.45094168", "0.45058593", "0.4496012", "0.44901", "0.4488174", "0.44834277", "0.4482024", "0.44775417", "0.44719064", "0.4470679", "0.44684008", "0.44638395", "0.4457122", "0.44570157", "0.44473058", "0.44470862", "0.4446163" ]
0.75721747
0
ListFeedOKTiny runs the method List of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func ListFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedTinyCollection) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} { sliceVal := []string{strconv.Itoa(limit)} query["limit"] = sliceVal } { sliceVal := []string{strconv.Itoa(page)} query["page"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds"), RawQuery: query.Encode(), } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} { sliceVal := []string{strconv.Itoa(limit)} prms["limit"] = sliceVal } { sliceVal := []string{strconv.Itoa(page)} prms["page"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) listCtx, _err := app.NewListFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.List(listCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 200 { t.Errorf("invalid response status code: got %+v, expected 200", rw.Code) } var mt app.FeedTinyCollection if resp != nil { var _ok bool mt, _ok = resp.(app.FeedTinyCollection) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTinyCollection", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, app.TodoCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.TodoCollection\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(app.TodoCollection)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.TodoCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func MakeListTodosEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tr0, err := service.ListTodos(ctx)\n\n\t\tif err != nil {\n\t\t\tif endpointErr := endpointError(nil); errors.As(err, &endpointErr) && endpointErr.EndpointError() {\n\t\t\t\treturn ListTodosResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tR0: r0,\n\t\t\t\t}, err\n\t\t\t}\n\n\t\t\treturn ListTodosResponse{\n\t\t\t\tErr: err,\n\t\t\t\tR0: r0,\n\t\t\t}, nil\n\t\t}\n\n\t\treturn ListTodosResponse{R0: r0}, nil\n\t}\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ListTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func getCategoriesList(lister listing.Service) http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, r *http.Request) {\n\t\trw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tvar list *listing.CategoriesResponse\n\n\t\tlimit := r.FormValue(\"limit\")\n\t\ttop := r.FormValue(\"top\")\n\n\t\tl, err := strconv.ParseInt(limit, 10, 2)\n\t\tif err != nil {\n\t\t\tl = 100\n\t\t}\n\t\tif top == \"true\" {\n\t\t\tlist, err = lister.TopCategories(r.Context(), int(l))\n\t\t} else {\n\t\t\tlist, err = lister.Categories(r.Context())\n\t\t}\n\n\t\tif err != nil {\n\t\t\t// server problem while answering the request\n\t\t\tr := constructError(http.StatusInternalServerError,\n\t\t\t\t\"unable to process request\",\n\t\t\t\t\"A problem occurs while processing the request\")\n\n\t\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\t\tjson.NewEncoder(rw).Encode(r)\n\t\t\treturn\n\t\t}\n\n\t\trw.WriteHeader(http.StatusOK)\n\t\terr = json.NewEncoder(rw).Encode(list)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t}\n}", "func (c productController) list(ctx *routing.Context) error {\n\n\titems, err := c.Service.List(ctx.Request.Context())\n\tif err != nil {\n\t\tif err == apperror.ErrNotFound {\n\t\t\tc.Logger.With(ctx.Request.Context()).Info(err)\n\t\t\treturn errorshandler.NotFound(\"\")\n\t\t}\n\t\tc.Logger.With(ctx.Request.Context()).Error(err)\n\t\treturn errorshandler.InternalServerError(\"\")\n\t}\n\tctx.Response.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\treturn ctx.Write(items)\n}", "func ListFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListFeeds(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(GetFeeds()))\n}", "func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (feed *Feed) FeedList(w http.ResponseWriter, r *http.Request) {\n\tfed :=service.NewFeed()\n\tw.Header().Set(\"Content-Type\", \"applcation/json; charset=UTF-8\")\n\tw.Write(fed.FeedList())\n\n}", "func MakeListEndpoint(service integratedservices.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(ListRequest)\n\n\t\tservices, err := service.List(ctx, req.ClusterID)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn ListResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tServices: services,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\treturn ListResponse{\n\t\t\t\tErr: err,\n\t\t\t\tServices: services,\n\t\t\t}, err\n\t\t}\n\n\t\treturn ListResponse{Services: services}, nil\n\t}\n}", "func (m *Mux) List(ds *discordgo.Session, dm *discordgo.Message, ctx *Context) {\n\tresp := \"```\\n\"\n\n\tfor p, v := range Config.Feeds {\n\t\tresp += strconv.Itoa(p) + \": \" + v.Feed.Title + \", \" + v.Feed.Link + \"\\n\"\n\t}\n\n\tresp += \"```\\n\"\n\n\tds.ChannelMessageSend(dm.ChannelID, resp)\n\n\treturn\n}", "func listChartsHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.Context) error {\n\thandler := \"manager: list charts\"\n\tutil.LogHandlerEntry(handler, r)\n\ttypes, err := c.Manager.ListCharts()\n\tif err != nil {\n\t\thttputil.BadRequest(w, r, err)\n\t\treturn nil\n\t}\n\n\tutil.LogHandlerExitWithJSON(handler, w, types, http.StatusOK)\n\treturn nil\n}", "func TodoList(w http.ResponseWriter, r *http.Request) []byte {\n\tvar todos []models.Todos\n\tdb := database.DB.Model(todos)\n\t// db.Scopes(AmountGreaterThan1000).\n\tfilters.Name(r, db)\n\tfilters.Done(r, db)\n\tdb.Order(\"name asc\").Find(&todos)\n\n\tresponse := utils.WrapJSONResponse(todos)\n\tjsonResponse, err := json.Marshal(response)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\n\treturn jsonResponse\n}", "func (s *Server) List(req *pb.ListTweetRequest, stream pb.TweetService_ListServer) error {\n\ttweets, err := s.tweetStore.List(stream.Context(), req.UserId, int(req.Limit))\n\tif err != nil {\n\t\treturn status.Errorf(codes.Internal, \"Could not list tweets: %v\", err)\n\t}\n\tres := &pb.ListTweetResponse{}\n\n\tfor _, tweet := range tweets {\n\t\tres.Tweet = tweet\n\t\terr := stream.Send(res)\n\t\tif err != nil {\n\t\t\treturn status.Errorf(codes.Internal, \"Could not send tweet: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func NewListFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := ListFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamLimit := req.Params[\"limit\"]\n\tif len(paramLimit) == 0 {\n\t\trctx.Limit = 10\n\t} else {\n\t\trawLimit := paramLimit[0]\n\t\tif limit, err2 := strconv.Atoi(rawLimit); err2 == nil {\n\t\t\trctx.Limit = limit\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"limit\", rawLimit, \"integer\"))\n\t\t}\n\t\tif rctx.Limit < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`limit`, rctx.Limit, 1, true))\n\t\t}\n\t}\n\tparamPage := req.Params[\"page\"]\n\tif len(paramPage) == 0 {\n\t\trctx.Page = 1\n\t} else {\n\t\trawPage := paramPage[0]\n\t\tif page, err2 := strconv.Atoi(rawPage); err2 == nil {\n\t\t\trctx.Page = page\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"page\", rawPage, \"integer\"))\n\t\t}\n\t\tif rctx.Page < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`page`, rctx.Page, 1, true))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func (m* Manager) ListHandler(w http.ResponseWriter, r *http.Request) {\n\tret, err := m.platformManager.ListFunction()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonRet, err := json.Marshal(ret)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.Header().Add(\"Content-Type\", \"application/json;charset=utf-8\")\n\tw.Write(jsonRet)\n\treturn\n}", "func List(ctx context.Context, _ store.Store, r *http.Request) (*SuccessResponse, error) {\n\tr.ParseForm()\n\n\tclient = newsclient.New(listEndpoint)\n\tparams := new(list.Params)\n\terr := schema.NewDecoder().Decode(params, r.Form)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error decoding params: %v\", err)\n\t}\n\n\tif params.Page == 0 {\n\t\tparams.Page = 1\n\t}\n\n\t// Requests to external services should have timeouts.\n\treqCtx, cancel := context.WithTimeout(ctx, defaultDuration)\n\tdefer cancel()\n\n\tres, err := fetch(reqCtx, params)\n\tif err != nil {\n\t\treturn nil, &httperror.HTTPError{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tMessage: err.Error(),\n\t\t\tRequestURL: r.RequestURI,\n\t\t\tDocsURL: listEndpoint.DocsURL,\n\t\t}\n\t}\n\n\treturn &SuccessResponse{\n\t\tCode: http.StatusOK,\n\t\tRequestURL: r.RequestURI,\n\t\tCount: len(res.Articles),\n\t\tPage: params.Page,\n\t\tTotalCount: res.TotalResults,\n\t\tData: res.Articles,\n\t}, nil\n}", "func listHandler(w http.ResponseWriter, r *http.Request) *appError {\n\tvideos, err := bittube.DB.ListVideos()\n\tif err != nil {\n\t\treturn appErrorf(err, \"could not list videos: %v\", err)\n\t}\n\n\treturn listTmpl.Execute(w, r, videos)\n}", "func List(r *http.Request, cfg config.Config) (int, http.Header, []byte, error) {\n\n\t//STANDARD DECLARATIONS START\n\tcode := http.StatusOK\n\th := http.Header{}\n\toutput := []byte(\"\")\n\terr := error(nil)\n\tcharset := \"utf-8\"\n\t//STANDARD DECLARATIONS END\n\n\t// Set Content-Type response Header value\n\tcontentType := r.Header.Get(\"Accept\")\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Try to open the mongo session\n\tsession, err := mongo.OpenSession(cfg.MongoDB)\n\tdefer session.Close()\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\t// Create structure for storing query results\n\tresults := []Tenant{}\n\t// Query tenant collection for all available documents.\n\t// nil query param == match everything\n\terr = mongo.Find(session, cfg.MongoDB.Db, \"tenants\", nil, \"name\", &results)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\t// After successfully retrieving the db results\n\t// call the createView function to render them into idented xml\n\toutput, err = createListView(results, \"Success\", code)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\treturn code, h, output, err\n}", "func (a *Api) List(w http.ResponseWriter, r *http.Request) error {\n\treturn nil\n}", "func listHandler(c appengine.Context, w http.ResponseWriter, r *http.Request) *appError {\n\tq := datastore.NewQuery(\"Overlay\").\n\t\tFilter(\"Owner = \", user.Current(c).ID)\n\n\tvar overlays []*Overlay\n\tif _, err := q.GetAll(c, &overlays); err != nil {\n\t\treturn appErrorf(err, \"could not get overlays\")\n\t}\n\n\tif err := json.NewEncoder(w).Encode(overlays); err != nil {\n\t\treturn appErrorf(err, \"could not marshal overlay json\")\n\t}\n\treturn nil\n}", "func ListHandler(w http.ResponseWriter, r *http.Request) {\n\t_, _, ok := r.BasicAuth()\n\tif !ok {\n\t\tw.Header().Set(\"WWW-Authenticate\", fmt.Sprintf(`Basic realm=\"%s\"`, BasicAuthRealm))\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(http.StatusText(http.StatusUnauthorized) + \"\\n\"))\n\t\treturn\n\t}\n\tif !reqIsAdmin(r) {\n\t\thttp.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)\n\t\treturn\n\t}\n\toff := 0\n\tlim := 50\n\tvar of string\n\tvar li string\n\tvar err error\n\tif r.FormValue(\"offset\") != \"\" {\n\t\tof = r.FormValue(\"offset\")\n\t\toff, err = strconv.Atoi(of)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\tif r.FormValue(\"limit\") != \"\" {\n\t\tli = r.FormValue(\"limit\")\n\t\tlim, err = strconv.Atoi(li)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\tusrs, err := List(off, lim)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tjd, jerr := json.Marshal(&usrs)\n\tif jerr != nil {\n\t\thttp.Error(w, jerr.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tfmt.Fprintf(w, string(jd))\n}", "func (s TemplateHandler) List(res http.ResponseWriter, req *http.Request) {\n\tres.Header().Add(\"Content-type\", \"application/json\")\n\tts, err := s.templateLoader.List()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tjson.NewEncoder(res).Encode(ts)\n}", "func ServiceListHandler(_ context.Context, list *corev1.ServiceList, options Options) (component.Component, error) {\n\tif list == nil {\n\t\treturn nil, errors.New(\"nil list\")\n\t}\n\n\tcols := component.NewTableCols(\"Name\", \"Labels\", \"Type\", \"Cluster IP\", \"External IP\", \"Target Ports\", \"Age\", \"Selector\")\n\ttbl := component.NewTable(\"Services\", \"We couldn't find any services!\", cols)\n\n\tfor _, s := range list.Items {\n\t\trow := component.TableRow{}\n\t\tnameLink, err := options.Link.ForObject(&s, s.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trow[\"Name\"] = nameLink\n\t\trow[\"Labels\"] = component.NewLabels(s.Labels)\n\t\trow[\"Type\"] = component.NewText(string(s.Spec.Type))\n\t\trow[\"Cluster IP\"] = component.NewText(s.Spec.ClusterIP)\n\t\trow[\"External IP\"] = component.NewText(describeExternalIPs(s))\n\t\trow[\"Target Ports\"] = printServicePorts(s.Spec.Ports)\n\n\t\tts := s.CreationTimestamp.Time\n\t\trow[\"Age\"] = component.NewTimestamp(ts)\n\n\t\trow[\"Selector\"] = printSelectorMap(s.Spec.Selector)\n\n\t\ttbl.Add(row)\n\t}\n\treturn tbl, nil\n}", "func List(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\t\tdbUser := \"postgres\"\n\tdbHost := \"localhost\"\n\tdbPassword := \"b4n4n4s\"\n\tdbName := \"postgres\"\n\n\tdbinfo := fmt.Sprintf(\"host=%s user=%s password=%s dbname=%s sslmode=disable\", dbHost, dbUser, dbPassword, dbName)\n\tdb, err := sql.Open(\"postgres\", dbinfo)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t}\n\n\ttodoList := []Todo{}\n\n\trows, err := db.Query(\"SELECT id, title, status FROM todo\")\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\ttodo := Todo{}\n\t\tif err := rows.Scan(&todo.ID, &todo.Title, &todo.Status); err != nil {\n\t\t\tw.WriteHeader(500)\n\t\t\tfmt.Fprintf(w, \"Failed to build todo list\")\n\t\t}\n\n\t\ttodoList = append(todoList, todo)\n\t}\n\n\tjsonResp, _ := json.Marshal(Todos{TodoList: todoList})\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\tfmt.Fprintf(w, string(jsonResp))\n}", "func MakeListItemsEndpoint(service todo.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\titems, err := service.ListItems(ctx)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn ListItemsResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tItems: items,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\treturn ListItemsResponse{\n\t\t\t\tErr: err,\n\t\t\t\tItems: items,\n\t\t\t}, err\n\t\t}\n\n\t\treturn ListItemsResponse{Items: items}, nil\n\t}\n}", "func (a *DefaultApiService) ListStories(ctx _context.Context, localVarOptionals *ListStoriesOpts) (Stories, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Stories\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/stories\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Id.IsSet() {\n\t\tt:=localVarOptionals.Id.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotId.IsSet() {\n\t\tt:=localVarOptionals.NotId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Title.IsSet() {\n\t\tlocalVarQueryParams.Add(\"title\", parameterToString(localVarOptionals.Title.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Body.IsSet() {\n\t\tlocalVarQueryParams.Add(\"body\", parameterToString(localVarOptionals.Body.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Text.IsSet() {\n\t\tlocalVarQueryParams.Add(\"text\", parameterToString(localVarOptionals.Text.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.TranslationsEnTitle.IsSet() {\n\t\tlocalVarQueryParams.Add(\"translations.en.title\", parameterToString(localVarOptionals.TranslationsEnTitle.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.TranslationsEnBody.IsSet() {\n\t\tlocalVarQueryParams.Add(\"translations.en.body\", parameterToString(localVarOptionals.TranslationsEnBody.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.TranslationsEnText.IsSet() {\n\t\tlocalVarQueryParams.Add(\"translations.en.text\", parameterToString(localVarOptionals.TranslationsEnText.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Language.IsSet() {\n\t\tt:=localVarOptionals.Language.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"language[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"language[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotLanguage.IsSet() {\n\t\tt:=localVarOptionals.NotLanguage.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!language[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!language[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.LinksPermalink.IsSet() {\n\t\tt:=localVarOptionals.LinksPermalink.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"links.permalink[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"links.permalink[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotLinksPermalink.IsSet() {\n\t\tt:=localVarOptionals.NotLinksPermalink.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!links.permalink[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!links.permalink[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PublishedAtStart.IsSet() {\n\t\tlocalVarQueryParams.Add(\"published_at.start\", parameterToString(localVarOptionals.PublishedAtStart.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PublishedAtEnd.IsSet() {\n\t\tlocalVarQueryParams.Add(\"published_at.end\", parameterToString(localVarOptionals.PublishedAtEnd.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CategoriesTaxonomy.IsSet() {\n\t\tlocalVarQueryParams.Add(\"categories.taxonomy\", parameterToString(localVarOptionals.CategoriesTaxonomy.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CategoriesConfident.IsSet() {\n\t\tlocalVarQueryParams.Add(\"categories.confident\", parameterToString(localVarOptionals.CategoriesConfident.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CategoriesId.IsSet() {\n\t\tt:=localVarOptionals.CategoriesId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"categories.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"categories.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotCategoriesId.IsSet() {\n\t\tt:=localVarOptionals.NotCategoriesId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!categories.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!categories.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CategoriesLabel.IsSet() {\n\t\tt:=localVarOptionals.CategoriesLabel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"categories.label[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"categories.label[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotCategoriesLabel.IsSet() {\n\t\tt:=localVarOptionals.NotCategoriesLabel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!categories.label[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!categories.label[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CategoriesLevel.IsSet() {\n\t\tt:=localVarOptionals.CategoriesLevel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"categories.level[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"categories.level[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotCategoriesLevel.IsSet() {\n\t\tt:=localVarOptionals.NotCategoriesLevel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!categories.level[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!categories.level[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesId.IsSet() {\n\t\tt:=localVarOptionals.EntitiesId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesId.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesLinksWikipedia.IsSet() {\n\t\tt:=localVarOptionals.EntitiesLinksWikipedia.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.links.wikipedia[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.links.wikipedia[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesLinksWikipedia.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesLinksWikipedia.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.links.wikipedia[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.links.wikipedia[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesLinksWikidata.IsSet() {\n\t\tt:=localVarOptionals.EntitiesLinksWikidata.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.links.wikidata[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.links.wikidata[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesLinksWikidata.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesLinksWikidata.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.links.wikidata[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.links.wikidata[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesTypes.IsSet() {\n\t\tt:=localVarOptionals.EntitiesTypes.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.types[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.types[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesTypes.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesTypes.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.types[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.types[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesStockTickers.IsSet() {\n\t\tt:=localVarOptionals.EntitiesStockTickers.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.stock_tickers[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.stock_tickers[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesBodyStockTickers.IsSet() {\n\t\tt:=localVarOptionals.EntitiesBodyStockTickers.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.body.stock_tickers[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.body.stock_tickers[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesSurfaceFormsText.IsSet() {\n\t\tt:=localVarOptionals.EntitiesSurfaceFormsText.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.surface_forms.text[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.surface_forms.text[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesSurfaceFormsText.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesSurfaceFormsText.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.surface_forms.text[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.surface_forms.text[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesTitleSurfaceFormsText.IsSet() {\n\t\tlocalVarQueryParams.Add(\"entities.title.surface_forms.text[]\", parameterToString(localVarOptionals.EntitiesTitleSurfaceFormsText.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesTitleSurfaceFormsText.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesTitleSurfaceFormsText.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.title.surface_forms.text[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.title.surface_forms.text[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesBodySurfaceFormsText.IsSet() {\n\t\tt:=localVarOptionals.EntitiesBodySurfaceFormsText.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.body.surface_forms.text[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.body.surface_forms.text[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesBodySurfaceFormsText.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesBodySurfaceFormsText.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.body.surface_forms.text[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.body.surface_forms.text[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SentimentTitlePolarity.IsSet() {\n\t\tlocalVarQueryParams.Add(\"sentiment.title.polarity\", parameterToString(localVarOptionals.SentimentTitlePolarity.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSentimentTitlePolarity.IsSet() {\n\t\tlocalVarQueryParams.Add(\"!sentiment.title.polarity\", parameterToString(localVarOptionals.NotSentimentTitlePolarity.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SentimentBodyPolarity.IsSet() {\n\t\tlocalVarQueryParams.Add(\"sentiment.body.polarity\", parameterToString(localVarOptionals.SentimentBodyPolarity.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSentimentBodyPolarity.IsSet() {\n\t\tlocalVarQueryParams.Add(\"!sentiment.body.polarity\", parameterToString(localVarOptionals.NotSentimentBodyPolarity.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesCountMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.count.min\", parameterToString(localVarOptionals.MediaImagesCountMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesCountMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.count.max\", parameterToString(localVarOptionals.MediaImagesCountMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesWidthMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.width.min\", parameterToString(localVarOptionals.MediaImagesWidthMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesWidthMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.width.max\", parameterToString(localVarOptionals.MediaImagesWidthMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesHeightMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.height.min\", parameterToString(localVarOptionals.MediaImagesHeightMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesHeightMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.height.max\", parameterToString(localVarOptionals.MediaImagesHeightMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesContentLengthMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.content_length.min\", parameterToString(localVarOptionals.MediaImagesContentLengthMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesContentLengthMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.content_length.max\", parameterToString(localVarOptionals.MediaImagesContentLengthMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesFormat.IsSet() {\n\t\tt:=localVarOptionals.MediaImagesFormat.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"media.images.format[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"media.images.format[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotMediaImagesFormat.IsSet() {\n\t\tt:=localVarOptionals.NotMediaImagesFormat.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!media.images.format[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!media.images.format[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaVideosCountMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.videos.count.min\", parameterToString(localVarOptionals.MediaVideosCountMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaVideosCountMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.videos.count.max\", parameterToString(localVarOptionals.MediaVideosCountMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AuthorId.IsSet() {\n\t\tt:=localVarOptionals.AuthorId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"author.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"author.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotAuthorId.IsSet() {\n\t\tt:=localVarOptionals.NotAuthorId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!author.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!author.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AuthorName.IsSet() {\n\t\tlocalVarQueryParams.Add(\"author.name\", parameterToString(localVarOptionals.AuthorName.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotAuthorName.IsSet() {\n\t\tlocalVarQueryParams.Add(\"!author.name\", parameterToString(localVarOptionals.NotAuthorName.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceId.IsSet() {\n\t\tt:=localVarOptionals.SourceId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceId.IsSet() {\n\t\tt:=localVarOptionals.NotSourceId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceName.IsSet() {\n\t\tt:=localVarOptionals.SourceName.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.name[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.name[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceName.IsSet() {\n\t\tt:=localVarOptionals.NotSourceName.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.name[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.name[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceDomain.IsSet() {\n\t\tt:=localVarOptionals.SourceDomain.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.domain[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.domain[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceDomain.IsSet() {\n\t\tt:=localVarOptionals.NotSourceDomain.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.domain[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.domain[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceLocationsCountry.IsSet() {\n\t\tt:=localVarOptionals.SourceLocationsCountry.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.locations.country[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.locations.country[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceLocationsCountry.IsSet() {\n\t\tt:=localVarOptionals.NotSourceLocationsCountry.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.locations.country[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.locations.country[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceLocationsState.IsSet() {\n\t\tt:=localVarOptionals.SourceLocationsState.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.locations.state[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.locations.state[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceLocationsState.IsSet() {\n\t\tt:=localVarOptionals.NotSourceLocationsState.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.locations.state[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.locations.state[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceLocationsCity.IsSet() {\n\t\tt:=localVarOptionals.SourceLocationsCity.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.locations.city[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.locations.city[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceLocationsCity.IsSet() {\n\t\tt:=localVarOptionals.NotSourceLocationsCity.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.locations.city[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.locations.city[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceScopesCountry.IsSet() {\n\t\tt:=localVarOptionals.SourceScopesCountry.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.scopes.country[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.scopes.country[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceScopesCountry.IsSet() {\n\t\tt:=localVarOptionals.NotSourceScopesCountry.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.scopes.country[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.scopes.country[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceScopesState.IsSet() {\n\t\tt:=localVarOptionals.SourceScopesState.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.scopes.state[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.scopes.state[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceScopesState.IsSet() {\n\t\tt:=localVarOptionals.NotSourceScopesState.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.scopes.state[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.scopes.state[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceScopesCity.IsSet() {\n\t\tt:=localVarOptionals.SourceScopesCity.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.scopes.city[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.scopes.city[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceScopesCity.IsSet() {\n\t\tt:=localVarOptionals.NotSourceScopesCity.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.scopes.city[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.scopes.city[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceScopesLevel.IsSet() {\n\t\tt:=localVarOptionals.SourceScopesLevel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.scopes.level[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.scopes.level[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceScopesLevel.IsSet() {\n\t\tt:=localVarOptionals.NotSourceScopesLevel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.scopes.level[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.scopes.level[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceLinksInCountMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source.links_in_count.min\", parameterToString(localVarOptionals.SourceLinksInCountMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceLinksInCountMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source.links_in_count.max\", parameterToString(localVarOptionals.SourceLinksInCountMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceRankingsAlexaRankMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source.rankings.alexa.rank.min\", parameterToString(localVarOptionals.SourceRankingsAlexaRankMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceRankingsAlexaRankMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source.rankings.alexa.rank.max\", parameterToString(localVarOptionals.SourceRankingsAlexaRankMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceRankingsAlexaCountry.IsSet() {\n\t\tt:=localVarOptionals.SourceRankingsAlexaCountry.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.rankings.alexa.country[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.rankings.alexa.country[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountFacebookMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.facebook.min\", parameterToString(localVarOptionals.SocialSharesCountFacebookMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountFacebookMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.facebook.max\", parameterToString(localVarOptionals.SocialSharesCountFacebookMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountGooglePlusMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.google_plus.min\", parameterToString(localVarOptionals.SocialSharesCountGooglePlusMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountGooglePlusMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.google_plus.max\", parameterToString(localVarOptionals.SocialSharesCountGooglePlusMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountLinkedinMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.linkedin.min\", parameterToString(localVarOptionals.SocialSharesCountLinkedinMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountLinkedinMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.linkedin.max\", parameterToString(localVarOptionals.SocialSharesCountLinkedinMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountRedditMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.reddit.min\", parameterToString(localVarOptionals.SocialSharesCountRedditMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountRedditMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.reddit.max\", parameterToString(localVarOptionals.SocialSharesCountRedditMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Clusters.IsSet() {\n\t\tt:=localVarOptionals.Clusters.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"clusters[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"clusters[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Return_.IsSet() {\n\t\tt:=localVarOptionals.Return_.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"return[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"return[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Aql.IsSet() {\n\t\tlocalVarQueryParams.Add(\"aql\", parameterToString(localVarOptionals.Aql.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AqlDefaultField.IsSet() {\n\t\tlocalVarQueryParams.Add(\"aql_default_field\", parameterToString(localVarOptionals.AqlDefaultField.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Query.IsSet() {\n\t\tlocalVarQueryParams.Add(\"query\", parameterToString(localVarOptionals.Query.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SortBy.IsSet() {\n\t\tlocalVarQueryParams.Add(\"sort_by\", parameterToString(localVarOptionals.SortBy.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SortDirection.IsSet() {\n\t\tlocalVarQueryParams.Add(\"sort_direction\", parameterToString(localVarOptionals.SortDirection.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Cursor.IsSet() {\n\t\tlocalVarQueryParams.Add(\"cursor\", parameterToString(localVarOptionals.Cursor.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PerPage.IsSet() {\n\t\tlocalVarQueryParams.Add(\"per_page\", parameterToString(localVarOptionals.PerPage.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/xml\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-AYLIEN-NewsAPI-Application-ID\"] = key\n\t\t}\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-AYLIEN-NewsAPI-Application-Key\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Errors\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Errors\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 422 {\n\t\t\tvar v Errors\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 429 {\n\t\t\tvar v Errors\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Errors\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func HTTPHandlerList(w http.ResponseWriter, r *http.Request) {\n\tvar returnStr string\n\n\t// tmpContainerList => json\n\ttmpJSON, _ := json.Marshal(ContainerList)\n\n\t// Add json to the returned string\n\treturnStr = string(tmpJSON)\n\n\tfmt.Fprint(w, returnStr)\n}", "func MakeListEndpoint(s Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (response interface{}, err error) {\n\t\treq := request.(listRequest)\n\t\tsocks, err := s.List(req.Tags, req.Order, req.PageNum, req.PageSize)\n\t\treturn listResponse{Socks: socks, Err: err}, err\n\t}\n}", "func getPluginListHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugins := s.ListFeeds()\n\t\tb, err := json.Marshal(plugins)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error listing the plugins\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write(b)\n\t}\n}", "func HandleListSuccessfully(t *testing.T, output string) {\n\tth.Mux.HandleFunc(\"/software_configs\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"GET\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", fake.TokenID)\n\t\tth.TestHeader(t, r, \"Accept\", \"application/json\")\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprintf(w, output)\n\t\t//r.ParseForm()\n\t})\n}", "func MakeListEndpoint(s service.CatalogService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tproducts, err := s.List(ctx)\n\t\treturn ListResponse{\n\t\t\tErr: err,\n\t\t\tProducts: products,\n\t\t}, nil\n\t}\n}", "func PricelistHandler(srv Service) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\n\t\tt := getCType(r)\n\t\theaders := getHeaders(t)\n\n\t\tlimit, err := toInt32(r.URL.Query().Get(\"limit\"))\n\t\tif err != nil {\n\t\t\tWriteError(w, headers, ErrBadRequest.With(err))\n\t\t\treturn\n\t\t}\n\n\t\tres, err := srv.GetPricelist(ctx, &GetPricelistRequest{Limit: limit})\n\t\tif err != nil {\n\t\t\tWriteError(w, headers, err)\n\t\t\treturn\n\t\t}\n\t\tprinterFn := getPricelistPrinter(t)\n\t\tb := []byte{}\n\t\tbuffer := bytes.NewBuffer(b)\n\t\tif err := printerFn(buffer, *res); err != nil {\n\t\t\tWriteError(w, headers, ErrInternalServerError.With(err))\n\t\t\treturn\n\t\t}\n\t\tWriteOK(w, headers, buffer.Bytes())\n\t})\n}", "func ShowTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func handleList(w http.ResponseWriter, r *http.Request) {\n\tappid := requestheader.GetAppID(r)\n\n\tlist, errCode, err := GetSwitches(appid)\n\tif errCode != ApiError.SUCCESS {\n\t\tutil.WriteJSON(w, util.GenRetObj(errCode, err))\n\t} else {\n\t\tutil.WriteJSON(w, util.GenRetObj(errCode, list))\n\t}\n}", "func TagsListMiddleware() func(http.Handler) http.Handler {\n\treturn middleware.New(func(w http.ResponseWriter, r *http.Request, next http.Handler) {\n\t\tctx := r.Context()\n\n\t\tart, p, _, err := preCheck(ctx)\n\t\tif err != nil {\n\t\t\tlibhttp.SendError(w, err)\n\t\t\treturn\n\t\t}\n\n\t\tif !canProxy(ctx, p) {\n\t\t\tnext.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\n\t\tn, _, err := util.ParseNAndLastParameters(r)\n\t\tif err != nil {\n\t\t\tlibhttp.SendError(w, err)\n\t\t\treturn\n\t\t}\n\n\t\tif n != nil && *n == 0 {\n\t\t\tutil.SendListTagsResponse(w, r, nil)\n\t\t\treturn\n\t\t}\n\n\t\tlogger := log.G(ctx).WithField(\"project\", art.ProjectName).WithField(\"repository\", art.Repository)\n\n\t\ttags, err := getLocalTags(ctx, art.Repository)\n\t\tif err != nil {\n\t\t\tlibhttp.SendError(w, err)\n\t\t\treturn\n\t\t}\n\n\t\tdefer func() {\n\t\t\tutil.SendListTagsResponse(w, r, tags)\n\t\t}()\n\n\t\tremote, err := proxy.NewRemoteHelper(ctx, p.RegistryID)\n\t\tif err != nil {\n\t\t\tlogger.Warningf(\"failed to get remote interface, error: %v, fallback to local tags\", err)\n\t\t\treturn\n\t\t}\n\n\t\tremoteRepository := strings.TrimPrefix(art.Repository, art.ProjectName+\"/\")\n\t\tremoteTags, err := remote.ListTags(remoteRepository)\n\t\tif err != nil {\n\t\t\tlogger.Warningf(\"failed to get remote tags, error: %v, fallback to local tags\", err)\n\t\t\treturn\n\t\t}\n\n\t\ttags = append(tags, remoteTags...)\n\t})\n}", "func List(c *gin.Context){\n\tlimitStr := c.Query(\"limit\")\n\tlimit, err := strconv.Atoi(limitStr)\n\tif err != nil {\n\t\tlimit = 0\n\t}\n\tres, err := list(limit)\n\tif err != nil {\n\t\tresponese.Error(c, err, nil)\n\t\treturn\n\t}\n\tresponese.Success(c, \"successed\", res)\n}", "func (s *Server) List(ctx context.Context, message *todopb.ListRequest) (*todopb.TodoCollection, error) {\n\tctx = context.WithValue(ctx, goa.MethodKey, \"list\")\n\tctx = context.WithValue(ctx, goa.ServiceKey, \"todo\")\n\tresp, err := s.ListH.Handle(ctx, message)\n\tif err != nil {\n\t\treturn nil, goagrpc.EncodeError(err)\n\t}\n\treturn resp.(*todopb.TodoCollection), nil\n}", "func listTags(ctx context.Context, kubeClient kubernetes.Interface, writer io.Writer) error {\n\ttagWebhooks, err := GetTagWebhooks(ctx, kubeClient)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve revision tags: %v\", err)\n\t}\n\tif len(tagWebhooks) == 0 {\n\t\tfmt.Fprintf(writer, \"No Istio revision tag MutatingWebhookConfigurations to list\\n\")\n\t\treturn nil\n\t}\n\ttags := make([]tagDescription, 0)\n\tfor _, wh := range tagWebhooks {\n\t\ttagName, err := GetWebhookTagName(wh)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error parsing tag name from webhook %q: %v\", wh.Name, err)\n\t\t}\n\t\ttagRevision, err := GetWebhookRevision(wh)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error parsing revision from webhook %q: %v\", wh.Name, err)\n\t\t}\n\t\ttagNamespaces, err := GetNamespacesWithTag(ctx, kubeClient, tagName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error retrieving namespaces for tag %q: %v\", tagName, err)\n\t\t}\n\t\ttagDesc := tagDescription{\n\t\t\tTag: tagName,\n\t\t\tRevision: tagRevision,\n\t\t\tNamespaces: tagNamespaces,\n\t\t}\n\t\ttags = append(tags, tagDesc)\n\t}\n\n\tswitch outputFormat {\n\tcase util.JSONFormat:\n\t\treturn PrintJSON(writer, tags)\n\tcase util.TableFormat:\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown format: %s\", outputFormat)\n\t}\n\tw := new(tabwriter.Writer).Init(writer, 0, 8, 1, ' ', 0)\n\tfmt.Fprintln(w, \"TAG\\tREVISION\\tNAMESPACES\")\n\tfor _, t := range tags {\n\t\tfmt.Fprintf(w, \"%s\\t%s\\t%s\\n\", t.Tag, t.Revision, strings.Join(t.Namespaces, \",\"))\n\t}\n\n\treturn w.Flush()\n}", "func handle(fn func(context.Context, *models.ListOptions) (*models.ListResult, error)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tenc := json.NewEncoder(w)\n\t\tenc.SetIndent(\"\", \" \")\n\t\tenc.SetEscapeHTML(false) // idk why I hate it so much, but I do!\n\n\t\t// Parse request parameters\n\t\tcount := getURLCount(r.URL)\n\t\tappengine.Info(r.Context(), \"Requested %d posts\", count)\n\n\t\t// Fire the real request\n\t\topts := &models.ListOptions{\n\t\t\tCount: count,\n\t\t\tCursor: r.URL.Query().Get(\"cursor\"),\n\t\t\tTag: r.URL.Query().Get(\"tag\"),\n\t\t}\n\t\tres, err := fn(r.Context(), opts)\n\t\tif err != nil {\n\t\t\tappengine.Warning(r.Context(), \"Failed to process list handler: %v\", err)\n\t\t\tenc.Encode(response{\n\t\t\t\tStatus: \"error\",\n\t\t\t\tCode: http.StatusInternalServerError,\n\t\t\t\tErr: \"unable to fetch posts\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// fix up full response URLs based on incoming request\n\t\tr.URL.Host = r.Host\n\t\tif host := r.Header.Get(\"x-forwarded-host\"); host != \"\" {\n\t\t\tr.URL.Host = host // work around test environment shortcomings\n\t\t}\n\t\tr.URL.Scheme = \"http\"\n\t\tif scheme := r.Header.Get(\"x-forwarded-proto\"); scheme != \"\" {\n\t\t\tr.URL.Scheme = scheme\n\t\t}\n\n\t\t// Successful response!\n\t\tenc.Encode(response{\n\t\t\tStatus: \"success\",\n\t\t\tCode: http.StatusOK,\n\t\t\tData: res.Posts,\n\t\t\tNext: toLink(r.URL, res.Next),\n\t\t\tPrev: toLink(r.URL, res.Prev),\n\t\t\tSelf: toLink(r.URL, res.Self),\n\t\t})\n\t}\n}", "func (s *Rest) listCtrl(w http.ResponseWriter, r *http.Request) {\n\n\tsiteID := r.URL.Query().Get(\"site\")\n\tlimit, skip := 0, 0\n\n\tif v, err := strconv.Atoi(r.URL.Query().Get(\"limit\")); err == nil {\n\t\tlimit = v\n\t}\n\tif v, err := strconv.Atoi(r.URL.Query().Get(\"skip\")); err == nil {\n\t\tskip = v\n\t}\n\n\tdata, err := s.Cache.Get(cache.Key(cache.URLKey(r), siteID), 8*time.Hour, func() ([]byte, error) {\n\t\tposts, e := s.DataService.List(siteID, limit, skip)\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\treturn encodeJSONWithHTML(posts)\n\t})\n\n\tif err != nil {\n\t\trest.SendErrorJSON(w, r, http.StatusBadRequest, err, \"can't get list of comments for \"+siteID)\n\t\treturn\n\t}\n\trenderJSONFromBytes(w, r, data)\n}", "func genericListHandler(options CrudOptions) uhttp.Handler {\n\tvar middlewares []uhttp.Middleware\n\tif options.ListPermission != nil {\n\t\tmiddlewares = []uhttp.Middleware{uauth.AuthJWT()}\n\t}\n\treturn uhttp.NewHandler(\n\t\tuhttp.WithPreProcess(options.ListPreprocess),\n\t\tuhttp.WithMiddlewares(middlewares...),\n\t\tuhttp.WithRequiredGet(options.ListRequiredGet),\n\t\tuhttp.WithOptionalGet(options.ListOptionalGet),\n\t\tuhttp.WithGet(func(r *http.Request, ret *int) interface{} {\n\t\t\t// Sanity check: ListOthersPermission can only be set if ListPermission is set\n\t\t\tif options.ListPermission == nil && options.ListOthersPermission != nil {\n\t\t\t\t*ret = http.StatusInternalServerError\n\t\t\t\treturn map[string]string{\"err\": \"Configuration problem: ListOthersPermission can only be set if ListPermission is set.\"}\n\t\t\t}\n\n\t\t\t// Check permissions\n\t\t\tvar limitToUser *uauth.User\n\t\t\tvar tmpUser *uauth.User\n\t\t\tvar err error\n\t\t\tif options.ListPermission != nil {\n\t\t\t\t// Return nothing, if listPermission is required but the user does not have it\n\t\t\t\ttmpUser, err = uauth.UserFromRequest(r)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Could not get user (%s)\", err)\n\t\t\t\t}\n\n\t\t\t\tif !tmpUser.CheckPermission(*options.ListPermission) {\n\t\t\t\t\treturn fmt.Errorf(\"User does not have the required permission: %s\", *options.ListPermission)\n\t\t\t\t}\n\n\t\t\t\t// Limit results if ListOthersPermission is required but the user does not have it\n\t\t\t\tif options.ListOthersPermission != nil {\n\t\t\t\t\tif !tmpUser.CheckPermission(*options.ListOthersPermission) {\n\t\t\t\t\t\tlimitToUser = tmpUser\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Load\n\t\t\tobjsFromDb, err := options.ModelService.List(limitToUser != nil, r.Context())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Render Response\n\t\t\treturn objsFromDb\n\t\t}),\n\t)\n}", "func (uc UsersController) List(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprintf(w, \"UsersList\")\n}", "func ListUsersHandle(service iface.Service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlimit := 100\n\t\trawLimit := r.URL.Query()[\"limit\"]\n\t\tif len(rawLimit) > 0 {\n\t\t\tvar err error\n\t\t\tlimit, err = strconv.Atoi(rawLimit[0])\n\t\t\tif err != nil || limit <= 0 {\n\t\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\t\tfmt.Fprintf(w, \"invalid limit \\\"%s\\\"\", rawLimit[0])\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tusers, err := service.FilterUsers(r.Context(), iface.FilterUsers{Limit: uint(limit)})\n\t\tif err != nil {\n\t\t\tlog.Log(err)\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tfmt.Fprintf(w, \"service failed\")\n\t\t\treturn\n\t\t}\n\n\t\tJSON(w, r, map[string]interface{}{\n\t\t\t\"users\": users,\n\t\t})\n\t}\n}", "func (v TopicsResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.WithStack(errors.New(\"no transaction found\"))\n\t}\n\n\ttopics := &models.Topics{}\n\n\t// Paginate results. Params \"page\" and \"per_page\" control pagination.\n\t// Default values are \"page=1\" and \"per_page=20\".\n\tq := tx.PaginateFromParams(c.Params())\n\n\t// Retrieve all Topics from the DB\n\tif err := q.All(topics); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// Add the paginator to the context so it can be used in the template.\n\tc.Set(\"pagination\", q.Paginator)\n\n\treturn c.Render(200, r.Auto(c, topics))\n}", "func ListServiceFlavorResults(r *http.Request, cfg config.Config) (int, http.Header, []byte, error) {\n\t//STANDARD DECLARATIONS START\n\tcode := http.StatusOK\n\th := http.Header{}\n\toutput := []byte(\"\")\n\terr := error(nil)\n\tcontentType := \"application/xml\"\n\tcharset := \"utf-8\"\n\t//STANDARD DECLARATIONS END\n\n\tcontentType, err = respond.ParseAcceptHeader(r)\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\tif err != nil {\n\t\tcode = http.StatusNotAcceptable\n\t\toutput, _ = respond.MarshalContent(respond.NotAcceptableContentType, contentType, \"\", \" \")\n\t\treturn code, h, output, err\n\t}\n\n\t// Parse the request into the input\n\turlValues := r.URL.Query()\n\tvars := mux.Vars(r)\n\n\ttenantDbConfig, err := authentication.AuthenticateTenant(r.Header, cfg)\n\tif err != nil {\n\t\tif err.Error() == \"Unauthorized\" {\n\t\t\tcode = http.StatusUnauthorized\n\t\t\tout := respond.UnauthorizedMessage\n\t\t\toutput = out.MarshalTo(contentType)\n\t\t\treturn code, h, output, err\n\t\t}\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\tsession, err := mongo.OpenSession(tenantDbConfig)\n\tdefer mongo.CloseSession(session)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\treport := reports.MongoInterface{}\n\terr = mongo.FindOne(session, tenantDbConfig.Db, \"reports\", bson.M{\"info.name\": vars[\"report_name\"]}, &report)\n\n\tif err != nil {\n\t\tcode = http.StatusBadRequest\n\t\tmessage := \"The report with the name \" + vars[\"report_name\"] + \" does not exist\"\n\t\toutput, err := createErrorMessage(message, contentType) //Render the response into XML or JSON\n\t\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\t\treturn code, h, output, err\n\t}\n\n\tinput := serviceFlavorResultQuery{\n\t\tbasicQuery: basicQuery{\n\t\t\tName: vars[\"service_type\"],\n\t\t\tGranularity: urlValues.Get(\"granularity\"),\n\t\t\tFormat: contentType,\n\t\t\tStartTime: urlValues.Get(\"start_time\"),\n\t\t\tEndTime: urlValues.Get(\"end_time\"),\n\t\t\tReport: report,\n\t\t\tVars: vars,\n\t\t},\n\t\tEndpointGroup: vars[\"lgroup_name\"],\n\t}\n\n\ttenantDB := session.DB(tenantDbConfig.Db)\n\terrs := input.Validate(tenantDB)\n\tif len(errs) > 0 {\n\t\tout := respond.BadRequestSimple\n\t\tout.Errors = errs\n\t\toutput = out.MarshalTo(contentType)\n\t\tcode = 400\n\t\treturn code, h, output, err\n\t}\n\n\tif vars[\"lgroup_type\"] != report.GetEndpointGroupType() {\n\t\tcode = http.StatusBadRequest\n\t\tmessage := \"The report \" + vars[\"report_name\"] + \" does not define endpoint group type: \" + vars[\"lgroup_type\"] + \". Try using \" + report.GetEndpointGroupType() + \" instead.\"\n\t\toutput, err := createErrorMessage(message, contentType) //Render the response into XML or JSON\n\t\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\t\treturn code, h, output, err\n\t}\n\n\tresults := []ServiceFlavorInterface{}\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\t// Construct the query to mongodb based on the input\n\tfilter := bson.M{\n\t\t\"date\": bson.M{\"$gte\": input.StartTimeInt, \"$lte\": input.EndTimeInt},\n\t\t\"report\": report.ID,\n\t}\n\n\tif input.Name != \"\" {\n\t\tfilter[\"name\"] = input.Name\n\t}\n\n\tif input.EndpointGroup != \"\" {\n\t\tfilter[\"supergroup\"] = input.EndpointGroup\n\t}\n\n\t// Select the granularity of the search daily/monthly\n\tif input.Granularity == \"daily\" {\n\t\tcustomForm[0] = \"20060102\"\n\t\tcustomForm[1] = \"2006-01-02\"\n\t\tquery := DailyServiceFlavor(filter)\n\t\terr = mongo.Pipe(session, tenantDbConfig.Db, \"service_ar\", query, &results)\n\t} else if input.Granularity == \"monthly\" {\n\t\tcustomForm[0] = \"200601\"\n\t\tcustomForm[1] = \"2006-01\"\n\t\tquery := MonthlyServiceFlavor(filter)\n\t\terr = mongo.Pipe(session, tenantDbConfig.Db, \"service_ar\", query, &results)\n\t}\n\n\t// mongo.Find(session, tenantDbConfig.Db, \"endpoint_group_ar\", bson.M{}, \"_id\", &results)\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\toutput, err = createServiceFlavorResultView(results, report, input.Format)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\treturn code, h, output, err\n\n}", "func (ctx *ListFeedContext) OKTiny(r FeedTinyCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.feed.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FeedTinyCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func getList(w io.Writer, r *http.Request) error {\n\tc := appengine.NewContext(r)\n\n\t// Get the list id from the URL.\n\tid := mux.Vars(r)[\"list\"]\n\n\t// Decode the obtained id into a datastore key.\n\tkey, err := datastore.DecodeKey(id)\n\tif err != nil {\n\t\treturn appErrorf(http.StatusBadRequest, \"invalid list id\")\n\t}\n\n\t// Fetch the list from the datastore.\n\tlist := &List{}\n\terr = datastore.Get(c, key, list)\n\tif err == datastore.ErrNoSuchEntity {\n\t\treturn appErrorf(http.StatusNotFound, \"list not found\")\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fetch list: %v\", err)\n\t}\n\n\t// Set the ID field with the id from the request url and encode the list.\n\tlist.ID = id\n\treturn json.NewEncoder(w).Encode(&list)\n}", "func (h *accountHandler) List(ctx context.Context, req *api.Request, rsp *api.Response) error {\n\tlog.Info(\"Received Example.Call request\")\n\n\t// parse values from the get request\n\tlimitStr, ok := req.Get[\"limit\"]\n\n\tif !ok || len(limitStr.Values) == 0 {\n\t\treturn errors.BadRequest(\"go.micro.api.account\", \"no content\")\n\t}\n\n\tlimit, _ := strconv.Atoi(limitStr.Values[0])\n\t// make request\n\tresponse, err := h.userSrvClient.List(ctx, &userPB.UserListQuery{\n\t\tLimit: &wrappers.UInt32Value{Value: uint32(limit)},\n\t\tPage: &wrappers.UInt32Value{Value: 1},\n\t})\n\tif err != nil {\n\t\treturn errors.InternalServerError(\"go.micro.api.account.call\", err.Error())\n\t}\n\tlog.Info(response)\n\n\t// set response status\n\trsp.StatusCode = 200\n\n\t// respond with some json\n\tb, _ := json.Marshal(response)\n\n\t// set json body\n\trsp.Body = string(b)\n\n\treturn nil\n}", "func tasklist(ctx context.Context, w http.ResponseWriter, req *http.Request) {\n\ttasks := ctx.Value(\"tasks\").(*list.List)\n\n\tresp := mkEmptylist()\n\tif resp == nil {\n\t\tpanic(\"can't generate base UBER document\")\n\t}\n\n\tfor t, i := tasks.Front(), 0; t != nil; t = t.Next() {\n\t\tresp.appendItem(fmt.Sprintf(\"task%d\", i+1), t.Value.(string))\n\t\ti++\n\t}\n\n\tbs, err := json.Marshal(resp)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write(mkError(\"ServerError\", \"reason\", \"Cannot read HTTP request body\"))\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/vnd.uber+json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(bs)\n}", "func List(ctx context.Context, ws WatWorkspace, ttl time.Duration) (CommandList, error) {\n\tif ttl > 0 {\n\t\texists, err := ws.Exists(fnameList)\n\t\tif err != nil {\n\t\t\treturn CommandList{}, err\n\t\t}\n\n\t\tif exists {\n\t\t\tcmdList, err := listFromFile(ws)\n\t\t\tif err != nil {\n\t\t\t\treturn cmdList, err\n\t\t\t}\n\n\t\t\tif time.Since(cmdList.Timestamp) < ttl {\n\t\t\t\t// List is current, yay!\n\t\t\t\treturn cmdList, nil\n\t\t\t}\n\t\t}\n\t}\n\n\t// List is stale or does not exist, (re)populate\n\tcmds, err := populateAt(ctx, ws)\n\tif err != nil {\n\t\treturn CommandList{}, fmt.Errorf(\"populateAt: %v\", err)\n\t}\n\n\tcmdList := CommandList{\n\t\tTimestamp: time.Now(),\n\t\tCommands: cmds,\n\t}\n\terr = cmdList.toFile(ws)\n\tif err != nil {\n\t\treturn CommandList{}, fmt.Errorf(\"toFile: %v\", err)\n\t}\n\n\treturn cmdList, nil\n}", "func (ssc *ServicesController) List() (*[]*service.Service, error) {\n\tvar services []*service.Service\n\n\tresponse, e := ssc.c.ClientREST.HTTPMethod(\"GET\", endpointFService)\n\n\tif e != nil {\n\t\tservices = append(services, &service.Service{})\n\t\treturn &services, e\n\t}\n\n\tdocuments := response.BodyMap()[\"DOCUMENT_POOL\"].(map[string]interface{})\n\n\tfor _, v := range documents {\n\t\tservice := NewService(v.(map[string]interface{}))\n\t\tservices = append(services, service)\n\t}\n\n\treturn &services, e\n}", "func (rm *RequestManager) ListHandler(w http.ResponseWriter, r *http.Request) {\n\tperson := &rm.Person;\n\tif r.Method != \"GET\" {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\n\tlogger.log(\"GET /list \" + r.URL.Path)\n\n\tdata, err := person.GetList(w)\n\tif(err == nil) {\n\t\tjson.NewEncoder(w).Encode(&data)\n\t}\n}", "func listTenants(c *cli.Context, w io.Writer) error {\n\terr := checkArgCount(c, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient.Photonclient, err = client.GetClient(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttenants, err := client.Photonclient.Tenants.GetAll()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif c.GlobalIsSet(\"non-interactive\") {\n\t\tfor _, tenant := range tenants.Items {\n\t\t\tfmt.Printf(\"%s\\t%s\\n\", tenant.ID, tenant.Name)\n\t\t}\n\t} else if utils.NeedsFormatting(c) {\n\t\tutils.FormatObjects(tenants.Items, w, c)\n\t} else {\n\t\tw := new(tabwriter.Writer)\n\t\tw.Init(os.Stdout, 4, 4, 2, ' ', 0)\n\t\tfmt.Fprintf(w, \"ID\\tName\\n\")\n\t\tfor _, tenant := range tenants.Items {\n\t\t\tfmt.Fprintf(w, \"%s\\t%s\\n\", tenant.ID, tenant.Name)\n\t\t}\n\t\terr = w.Flush()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(\"\\nTotal: %d\\n\", len(tenants.Items))\n\t}\n\n\treturn nil\n}", "func List(modelIns interface{}, paramCreators ...CriteriaCreator) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\n\t\ttotal, data := ListHandlerWithoutServe(modelIns, c, paramCreators...)\n\n\t\tc.JSON(200, gin.H{\n\t\t\t\"total\": total,\n\t\t\t\"data\": data,\n\t\t})\n\t}\n}", "func (t *TripHandlerImpl) List (c *gin.Context) {\n\tlimitBasic, err := strconv.Atoi(c.DefaultQuery(\"limit\", \"100\"))\n\tif err != nil {\n\t\tc.IndentedJSON(http.StatusBadRequest, api.TripList{})\n\t\treturn\n\t}\n\tstartBasic, err := strconv.Atoi(c.DefaultQuery(\"start\", \"0\"))\n\tif err != nil {\n\t\tc.IndentedJSON(http.StatusBadRequest, api.TripList{})\n\t\treturn\n\t}\n\tlimit := int32(limitBasic)\n\tstart := int32(startBasic)\n\tlist, total := t.tripManager.List(start, limit)\n\ttripList := api.TripList{\n\t\tTripList: list,\n\t\tTotal: total,\n\t\tLimit: limit,\n\t}\n\tc.IndentedJSON(http.StatusOK, tripList)\n}", "func (c *OutputController) List(ctx *app.ListOutputContext) error {\n\tres := app.OutputCollection{}\n\tspecs := c.om.GetSpec()\n\tfor _, spec := range specs {\n\t\to := app.Output{\n\t\t\tName: spec.Name,\n\t\t\tDesc: spec.Desc,\n\t\t\tProps: spec.Props,\n\t\t\tTags: spec.Tags,\n\t\t}\n\t\tres = append(res, &o)\n\t}\n\treturn ctx.OK(res)\n}", "func ListHandler(ctx context.Context, r *http.Request) (interface{}, error) {\n\tctx = setupHandlerContext(ctx, r)\n\n\tresponse, err := storageHandler.ListEntities(ctx, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "func ListContainerOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController) (http.ResponseWriter, app.GoaContainerListEachCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/list\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.GoaContainerListEachCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.GoaContainerListEachCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.GoaContainerListEachCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (s *Service) ListTodos(c *gin.Context) {\n\trows, err := sq.\n\t\tSelect(\"*\").\n\t\tFrom(tableName).\n\t\tRunWith(s.Db).\n\t\tLimit(10).\n\t\tQuery()\n\n\tif err != nil {\n\t\ts.AbortDbConnError(c, err)\n\t}\n\n\tdefer errorHandler.CleanUpAndHandleError(rows.Close, s.Logger)\n\n\ttodos := make([]Todo, 0)\n\tfor rows.Next() {\n\t\tvar todo Todo\n\t\terr := rows.Scan(&todo.CreationTimestamp, &todo.UpdateTimestamp, &todo.ID, &todo.Text, &todo.IsDone)\n\t\tif err != nil {\n\t\t\ts.Logger.Error(err)\n\t\t\treturn\n\t\t}\n\t\ttodos = append(todos, todo)\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\ts.AbortSerializationError(c, err)\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"data\": todos,\n\t})\n}", "func repoList(w http.ResponseWriter, r *http.Request) {}", "func GetUserTodos(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tskipLiteral := r.URL.Query().Get(\"skip\")\n\tlimitLiteral := r.URL.Query().Get(\"limit\")\n\tif skipLiteral == \"\" {\n\t\tskipLiteral = \"0\"\n\t}\n\tif limitLiteral == \"\" {\n\t\tlimitLiteral = \"10\"\n\t}\n\tskip, err := strconv.Atoi(skipLiteral)\n\tif err != nil {\n\t\tshared.SendError(w, models.Response{Status: http.StatusBadRequest, Message: err.Error()})\n\t\treturn\n\t}\n\tlimit, err := strconv.Atoi(skipLiteral)\n\tif err != nil {\n\t\tshared.SendError(w, models.Response{Status: http.StatusBadRequest, Message: err.Error()})\n\t\treturn\n\t}\n\tclaims := r.Context().Value(shared.KeyClaims).(jwt.MapClaims)\n\tID := claims[\"id\"].(string)\n\n\ttodos, err := controllers.GetUserTodos(ID, params.ByName(\"id\"), skip, limit)\n\tif err != nil {\n\t\tshared.SendError(w, models.Response{Status: http.StatusInternalServerError, Message: err.Error()})\n\t\treturn\n\t}\n\tshared.SendJSON(w, http.StatusOK, todos)\n}", "func (c *SeriesController) List(ctx *app.ListSeriesContext) error {\n\t// SeriesController_List: start_implement\n\tm, err := c.fm()\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`unable to get model`, `error`, err.Error())\n\t\treturn ctx.ServiceUnavailable()\n\t}\n\tdefer func() { m.Close() }()\n\n\tlist, err := m.ListSeriesByIDs(nil, nil, nil, nil)\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`failed to get series list`, `error`, err.Error())\n\t\treturn ctx.InternalServerError()\n\t}\n\n\tbs := make(app.SeriesCollection, len(list))\n\tfor i, bk := range list {\n\t\tbs[i] = convert.ToSeriesMedia(bk)\n\t}\n\treturn ctx.OK(bs)\n\t// SeriesController_List: end_implement\n}", "func (v ToursResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.New(\"no transaction found\")\n\t}\n\n\ttours := &models.Tours{}\n\n\t// Paginate results. Params \"page\" and \"per_page\" control pagination.\n\t// Default values are \"page=1\" and \"per_page=20\".\n\tq := tx.PaginateFromParams(c.Params())\n\n\t// Retrieve all Tours from the DB\n\tif err := q.All(tours); err != nil {\n\t\treturn err\n\t}\n\n\t// Add the paginator to the context so it can be used in the template.\n\tc.Set(\"pagination\", q.Paginator)\n\n\treturn c.Render(200, r.Auto(c, tours))\n}", "func (ctx *ListListenContext) OK(r *AntListenList) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.listen.list+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (v OrdersResource) List(c buffalo.Context) error {\n // Get the DB connection from the context\n tx, ok := c.Value(\"tx\").(*pop.Connection)\n if !ok {\n return fmt.Errorf(\"no transaction found\")\n }\n\n orders := &models.Orders{}\n\n // Paginate results. Params \"page\" and \"per_page\" control pagination.\n // Default values are \"page=1\" and \"per_page=20\".\n q := tx.PaginateFromParams(c.Params())\n\n // Retrieve all Orders from the DB\n if err := q.All(orders); err != nil {\n return err\n }\n\n return responder.Wants(\"html\", func (c buffalo.Context) error {\n // Add the paginator to the context so it can be used in the template.\n c.Set(\"pagination\", q.Paginator)\n\n c.Set(\"orders\", orders)\n return c.Render(http.StatusOK, r.HTML(\"/orders/index.plush.html\"))\n }).Wants(\"json\", func (c buffalo.Context) error {\n return c.Render(200, r.JSON(orders))\n }).Wants(\"xml\", func (c buffalo.Context) error {\n return c.Render(200, r.XML(orders))\n }).Respond(c)\n}", "func (a *DefaultApiService) ListTrends(ctx _context.Context, field string, localVarOptionals *ListTrendsOpts) (Trends, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Trends\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/trends\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Id.IsSet() {\n\t\tt:=localVarOptionals.Id.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotId.IsSet() {\n\t\tt:=localVarOptionals.NotId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Title.IsSet() {\n\t\tlocalVarQueryParams.Add(\"title\", parameterToString(localVarOptionals.Title.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Body.IsSet() {\n\t\tlocalVarQueryParams.Add(\"body\", parameterToString(localVarOptionals.Body.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Text.IsSet() {\n\t\tlocalVarQueryParams.Add(\"text\", parameterToString(localVarOptionals.Text.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.TranslationsEnTitle.IsSet() {\n\t\tlocalVarQueryParams.Add(\"translations.en.title\", parameterToString(localVarOptionals.TranslationsEnTitle.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.TranslationsEnBody.IsSet() {\n\t\tlocalVarQueryParams.Add(\"translations.en.body\", parameterToString(localVarOptionals.TranslationsEnBody.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.TranslationsEnText.IsSet() {\n\t\tlocalVarQueryParams.Add(\"translations.en.text\", parameterToString(localVarOptionals.TranslationsEnText.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.LinksPermalink.IsSet() {\n\t\tt:=localVarOptionals.LinksPermalink.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"links.permalink[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"links.permalink[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotLinksPermalink.IsSet() {\n\t\tt:=localVarOptionals.NotLinksPermalink.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!links.permalink[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!links.permalink[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Language.IsSet() {\n\t\tt:=localVarOptionals.Language.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"language[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"language[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotLanguage.IsSet() {\n\t\tt:=localVarOptionals.NotLanguage.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!language[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!language[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PublishedAtStart.IsSet() {\n\t\tlocalVarQueryParams.Add(\"published_at.start\", parameterToString(localVarOptionals.PublishedAtStart.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PublishedAtEnd.IsSet() {\n\t\tlocalVarQueryParams.Add(\"published_at.end\", parameterToString(localVarOptionals.PublishedAtEnd.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CategoriesTaxonomy.IsSet() {\n\t\tlocalVarQueryParams.Add(\"categories.taxonomy\", parameterToString(localVarOptionals.CategoriesTaxonomy.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CategoriesConfident.IsSet() {\n\t\tlocalVarQueryParams.Add(\"categories.confident\", parameterToString(localVarOptionals.CategoriesConfident.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CategoriesId.IsSet() {\n\t\tt:=localVarOptionals.CategoriesId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"categories.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"categories.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotCategoriesId.IsSet() {\n\t\tt:=localVarOptionals.NotCategoriesId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!categories.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!categories.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CategoriesLabel.IsSet() {\n\t\tt:=localVarOptionals.CategoriesLabel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"categories.label[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"categories.label[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotCategoriesLabel.IsSet() {\n\t\tt:=localVarOptionals.NotCategoriesLabel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!categories.label[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!categories.label[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CategoriesLevel.IsSet() {\n\t\tt:=localVarOptionals.CategoriesLevel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"categories.level[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"categories.level[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotCategoriesLevel.IsSet() {\n\t\tt:=localVarOptionals.NotCategoriesLevel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!categories.level[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!categories.level[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesId.IsSet() {\n\t\tt:=localVarOptionals.EntitiesId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesId.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesLinksWikipedia.IsSet() {\n\t\tt:=localVarOptionals.EntitiesLinksWikipedia.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.links.wikipedia[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.links.wikipedia[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesLinksWikipedia.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesLinksWikipedia.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.links.wikipedia[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.links.wikipedia[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesLinksWikidata.IsSet() {\n\t\tt:=localVarOptionals.EntitiesLinksWikidata.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.links.wikidata[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.links.wikidata[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesLinksWikidata.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesLinksWikidata.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.links.wikidata[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.links.wikidata[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesTypes.IsSet() {\n\t\tt:=localVarOptionals.EntitiesTypes.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.types[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.types[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesTypes.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesTypes.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.types[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.types[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesStockTickers.IsSet() {\n\t\tt:=localVarOptionals.EntitiesStockTickers.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.stock_tickers[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.stock_tickers[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesBodyStockTickers.IsSet() {\n\t\tt:=localVarOptionals.EntitiesBodyStockTickers.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.body.stock_tickers[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.body.stock_tickers[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesSurfaceFormsText.IsSet() {\n\t\tt:=localVarOptionals.EntitiesSurfaceFormsText.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.surface_forms.text[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.surface_forms.text[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesSurfaceFormsText.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesSurfaceFormsText.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.surface_forms.text[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.surface_forms.text[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesTitleSurfaceFormsText.IsSet() {\n\t\tlocalVarQueryParams.Add(\"entities.title.surface_forms.text[]\", parameterToString(localVarOptionals.EntitiesTitleSurfaceFormsText.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesTitleSurfaceFormsText.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesTitleSurfaceFormsText.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.title.surface_forms.text[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.title.surface_forms.text[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EntitiesBodySurfaceFormsText.IsSet() {\n\t\tt:=localVarOptionals.EntitiesBodySurfaceFormsText.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"entities.body.surface_forms.text[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"entities.body.surface_forms.text[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotEntitiesBodySurfaceFormsText.IsSet() {\n\t\tt:=localVarOptionals.NotEntitiesBodySurfaceFormsText.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!entities.body.surface_forms.text[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!entities.body.surface_forms.text[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SentimentTitlePolarity.IsSet() {\n\t\tlocalVarQueryParams.Add(\"sentiment.title.polarity\", parameterToString(localVarOptionals.SentimentTitlePolarity.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSentimentTitlePolarity.IsSet() {\n\t\tlocalVarQueryParams.Add(\"!sentiment.title.polarity\", parameterToString(localVarOptionals.NotSentimentTitlePolarity.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SentimentBodyPolarity.IsSet() {\n\t\tlocalVarQueryParams.Add(\"sentiment.body.polarity\", parameterToString(localVarOptionals.SentimentBodyPolarity.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSentimentBodyPolarity.IsSet() {\n\t\tlocalVarQueryParams.Add(\"!sentiment.body.polarity\", parameterToString(localVarOptionals.NotSentimentBodyPolarity.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesCountMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.count.min\", parameterToString(localVarOptionals.MediaImagesCountMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesCountMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.count.max\", parameterToString(localVarOptionals.MediaImagesCountMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesWidthMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.width.min\", parameterToString(localVarOptionals.MediaImagesWidthMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesWidthMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.width.max\", parameterToString(localVarOptionals.MediaImagesWidthMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesHeightMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.height.min\", parameterToString(localVarOptionals.MediaImagesHeightMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesHeightMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.height.max\", parameterToString(localVarOptionals.MediaImagesHeightMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesContentLengthMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.content_length.min\", parameterToString(localVarOptionals.MediaImagesContentLengthMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesContentLengthMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.images.content_length.max\", parameterToString(localVarOptionals.MediaImagesContentLengthMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaImagesFormat.IsSet() {\n\t\tt:=localVarOptionals.MediaImagesFormat.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"media.images.format[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"media.images.format[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotMediaImagesFormat.IsSet() {\n\t\tt:=localVarOptionals.NotMediaImagesFormat.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!media.images.format[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!media.images.format[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaVideosCountMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.videos.count.min\", parameterToString(localVarOptionals.MediaVideosCountMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MediaVideosCountMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"media.videos.count.max\", parameterToString(localVarOptionals.MediaVideosCountMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AuthorId.IsSet() {\n\t\tt:=localVarOptionals.AuthorId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"author.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"author.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotAuthorId.IsSet() {\n\t\tt:=localVarOptionals.NotAuthorId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!author.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!author.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AuthorName.IsSet() {\n\t\tlocalVarQueryParams.Add(\"author.name\", parameterToString(localVarOptionals.AuthorName.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotAuthorName.IsSet() {\n\t\tlocalVarQueryParams.Add(\"!author.name\", parameterToString(localVarOptionals.NotAuthorName.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceId.IsSet() {\n\t\tt:=localVarOptionals.SourceId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceId.IsSet() {\n\t\tt:=localVarOptionals.NotSourceId.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.id[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.id[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceName.IsSet() {\n\t\tt:=localVarOptionals.SourceName.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.name[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.name[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceName.IsSet() {\n\t\tt:=localVarOptionals.NotSourceName.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.name[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.name[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceDomain.IsSet() {\n\t\tt:=localVarOptionals.SourceDomain.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.domain[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.domain[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceDomain.IsSet() {\n\t\tt:=localVarOptionals.NotSourceDomain.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.domain[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.domain[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceLocationsCountry.IsSet() {\n\t\tt:=localVarOptionals.SourceLocationsCountry.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.locations.country[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.locations.country[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceLocationsCountry.IsSet() {\n\t\tt:=localVarOptionals.NotSourceLocationsCountry.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.locations.country[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.locations.country[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceLocationsState.IsSet() {\n\t\tt:=localVarOptionals.SourceLocationsState.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.locations.state[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.locations.state[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceLocationsState.IsSet() {\n\t\tt:=localVarOptionals.NotSourceLocationsState.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.locations.state[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.locations.state[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceLocationsCity.IsSet() {\n\t\tt:=localVarOptionals.SourceLocationsCity.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.locations.city[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.locations.city[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceLocationsCity.IsSet() {\n\t\tt:=localVarOptionals.NotSourceLocationsCity.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.locations.city[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.locations.city[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceScopesCountry.IsSet() {\n\t\tt:=localVarOptionals.SourceScopesCountry.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.scopes.country[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.scopes.country[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceScopesCountry.IsSet() {\n\t\tt:=localVarOptionals.NotSourceScopesCountry.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.scopes.country[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.scopes.country[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceScopesState.IsSet() {\n\t\tt:=localVarOptionals.SourceScopesState.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.scopes.state[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.scopes.state[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceScopesState.IsSet() {\n\t\tt:=localVarOptionals.NotSourceScopesState.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.scopes.state[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.scopes.state[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceScopesCity.IsSet() {\n\t\tt:=localVarOptionals.SourceScopesCity.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.scopes.city[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.scopes.city[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceScopesCity.IsSet() {\n\t\tt:=localVarOptionals.NotSourceScopesCity.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.scopes.city[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.scopes.city[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceScopesLevel.IsSet() {\n\t\tt:=localVarOptionals.SourceScopesLevel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.scopes.level[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.scopes.level[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.NotSourceScopesLevel.IsSet() {\n\t\tt:=localVarOptionals.NotSourceScopesLevel.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"!source.scopes.level[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"!source.scopes.level[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceLinksInCountMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source.links_in_count.min\", parameterToString(localVarOptionals.SourceLinksInCountMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceLinksInCountMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source.links_in_count.max\", parameterToString(localVarOptionals.SourceLinksInCountMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceRankingsAlexaRankMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source.rankings.alexa.rank.min\", parameterToString(localVarOptionals.SourceRankingsAlexaRankMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceRankingsAlexaRankMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source.rankings.alexa.rank.max\", parameterToString(localVarOptionals.SourceRankingsAlexaRankMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceRankingsAlexaCountry.IsSet() {\n\t\tt:=localVarOptionals.SourceRankingsAlexaCountry.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"source.rankings.alexa.country[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"source.rankings.alexa.country[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountFacebookMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.facebook.min\", parameterToString(localVarOptionals.SocialSharesCountFacebookMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountFacebookMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.facebook.max\", parameterToString(localVarOptionals.SocialSharesCountFacebookMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountGooglePlusMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.google_plus.min\", parameterToString(localVarOptionals.SocialSharesCountGooglePlusMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountGooglePlusMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.google_plus.max\", parameterToString(localVarOptionals.SocialSharesCountGooglePlusMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountLinkedinMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.linkedin.min\", parameterToString(localVarOptionals.SocialSharesCountLinkedinMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountLinkedinMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.linkedin.max\", parameterToString(localVarOptionals.SocialSharesCountLinkedinMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountRedditMin.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.reddit.min\", parameterToString(localVarOptionals.SocialSharesCountRedditMin.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SocialSharesCountRedditMax.IsSet() {\n\t\tlocalVarQueryParams.Add(\"social_shares_count.reddit.max\", parameterToString(localVarOptionals.SocialSharesCountRedditMax.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Clusters.IsSet() {\n\t\tt:=localVarOptionals.Clusters.Value()\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"clusters[]\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"clusters[]\", parameterToString(t, \"multi\"))\n\t\t}\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Aql.IsSet() {\n\t\tlocalVarQueryParams.Add(\"aql\", parameterToString(localVarOptionals.Aql.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AqlDefaultField.IsSet() {\n\t\tlocalVarQueryParams.Add(\"aql_default_field\", parameterToString(localVarOptionals.AqlDefaultField.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Query.IsSet() {\n\t\tlocalVarQueryParams.Add(\"query\", parameterToString(localVarOptionals.Query.Value(), \"\"))\n\t}\n\tlocalVarQueryParams.Add(\"field\", parameterToString(field, \"\"))\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/xml\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-AYLIEN-NewsAPI-Application-ID\"] = key\n\t\t}\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-AYLIEN-NewsAPI-Application-Key\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Errors\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Errors\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 422 {\n\t\t\tvar v Errors\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 429 {\n\t\t\tvar v Errors\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Errors\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func serviceListOperation(request *http.Request, response *http.Response, operationContext *restrictedOperationContext) error {\n\tvar err error\n\t// ServiceList response is a JSON array\n\t// https://docs.docker.com/engine/api/v1.28/#operation/ServiceList\n\tresponseArray, err := getResponseAsJSONArray(response)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif operationContext.isAdmin {\n\t\tresponseArray, err = decorateServiceList(responseArray, operationContext.resourceControls)\n\t} else {\n\t\tresponseArray, err = filterServiceList(responseArray, operationContext.resourceControls, operationContext.userID, operationContext.userTeamIDs)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn rewriteResponse(response, responseArray, http.StatusOK)\n}", "func CreateFeedCreatedTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (res ItemsResource) List(w http.ResponseWriter, r *http.Request) {\n\trender.JSON(w, r, items)\n}", "func (p *Proxy) List(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tlogger := mPkg.GetLogger(ctx)\n\n\topt, err := fromHTTPRequestToListOptions(r, p.maxListLimit)\n\tif err != nil {\n\t\tlogger.Error(\"could not parse filter\", zap.Error(err))\n\t\trender.Render(w, r, cHttp.ErrResponse(http.StatusBadRequest, err.Error()))\n\n\t\treturn\n\t}\n\n\tlogger.Debug(\"Retrieving info for load tests\")\n\n\tloadTests, err := p.kubeClient.ListLoadTest(ctx, *opt)\n\tif err != nil {\n\t\tlogger.Error(\"could not list load tests\", zap.Error(err))\n\t\trender.Render(w, r, cHttp.ErrResponse(http.StatusInternalServerError, err.Error()))\n\n\t\treturn\n\t}\n\n\titems := make([]LoadTestStatus, len(loadTests.Items))\n\tfor i, lt := range loadTests.Items {\n\t\titems[i] = LoadTestStatus{\n\t\t\tType: lt.Spec.Type.String(),\n\t\t\tDistributedPods: *lt.Spec.DistributedPods,\n\t\t\tNamespace: lt.Status.Namespace,\n\t\t\tPhase: lt.Status.Phase.String(),\n\t\t\tTags: lt.Spec.Tags,\n\t\t\tHasEnvVars: len(lt.Spec.EnvVars) != 0,\n\t\t\tHasTestData: len(lt.Spec.TestData) != 0,\n\t\t}\n\t}\n\n\trender.JSON(w, r, &LoadTestStatusPage{\n\t\tLimit: opt.Limit,\n\t\tContinue: loadTests.Continue,\n\t\tRemain: loadTests.RemainingItemCount,\n\t\tItems: items,\n\t})\n}", "func NewListOutputContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListOutputContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := ListOutputContext{Context: ctx, ResponseData: resp, RequestData: req}\n\treturn &rctx, err\n}", "func PostListEndpoint(reader reading.Service) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tparams := r.URL.Query()\n\t\titems, totalItems, err := reader.PostList(params)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error listing posts: %v: %s\", params, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tres := map[string]interface{}{\"items\": items, \"total_items\": totalItems}\n\n\t\tw.WriteHeader(http.StatusOK)\n\t\tjson.NewEncoder(w).Encode(res)\n\t}\n}", "func (h WorkloadHandler) List(ctx *gin.Context) {\n}", "func MakeListEndpoint(service clusterfeature.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(ListClusterFeaturesRequest)\n\t\tresult, err := service.List(ctx, req.ClusterID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn transformList(result), nil\n\t}\n}", "func List(r *http.Request, cfg config.Config) (int, http.Header, []byte, error) {\n\n\t//STANDARD DECLARATIONS START\n\n\tcode := http.StatusOK\n\th := http.Header{}\n\toutput := []byte(\"\")\n\terr := error(nil)\n\tcharset := \"utf-8\"\n\n\t//STANDARD DECLARATIONS END\n\n\t// Set Content-Type response Header value\n\tcontentType := r.Header.Get(\"Accept\")\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\turlValues := r.URL.Query()\n\tdateStr := urlValues.Get(\"date\")\n\tname := urlValues.Get(\"name\")\n\n\t// Grab Tenant DB configuration from context\n\ttenantDbConfig := context.Get(r, \"tenant_conf\").(config.MongoConfig)\n\n\t// Open session to tenant database\n\tsession, err := mongo.OpenSession(tenantDbConfig)\n\tdefer mongo.CloseSession(session)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\tdt, dateStr, err := utils.ParseZuluDate(dateStr)\n\tif err != nil {\n\t\tcode = http.StatusBadRequest\n\t\toutput, _ = respond.MarshalContent(respond.ErrBadRequestDetails(err.Error()), contentType, \"\", \" \")\n\t\treturn code, h, output, err\n\t}\n\twQuery := prepMultiQuery(dt, name)\n\n\twCol := session.DB(tenantDbConfig.Db).C(weightCol)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\tresults := []Weights{}\n\terr = wCol.Pipe(wQuery).All(&results)\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\t// Create view of the results\n\toutput, err = createListView(results, \"Success\", code) //Render the results into JSON\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\treturn code, h, output, err\n}", "func (client AppsClient) List(ctx context.Context, skip *int32, take *int32) (result ListApplicationInfoResponse, err error) {\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: skip,\n\t\t\tConstraints: []validation.Constraint{{Target: \"skip\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"skip\", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}},\n\t\t{TargetValue: take,\n\t\t\tConstraints: []validation.Constraint{{Target: \"take\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"take\", Name: validation.InclusiveMaximum, Rule: 500, Chain: nil},\n\t\t\t\t\t{Target: \"take\", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil},\n\t\t\t\t}}}}}); err != nil {\n\t\treturn result, validation.NewError(\"programmatic.AppsClient\", \"List\", err.Error())\n\t}\n\n\treq, err := client.ListPreparer(ctx, skip, take)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"List\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func userList(w http.ResponseWriter, r *http.Request) {}", "func (_obj *DataService) GetMsgListWithContext(tarsCtx context.Context, index int32, date string, wx_id string, nextIndex *int32, msgList *[]Message, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(index, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(date, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(wx_id, 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*nextIndex), 4)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.WriteHead(codec.LIST, 5)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32(int32(len((*msgList))), 0)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tfor _, v := range *msgList {\n\n\t\terr = v.WriteBlock(_os, 0)\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"getMsgList\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*nextIndex), 4, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr, have, ty = _is.SkipToNoCheck(5, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif ty == codec.LIST {\n\t\terr = _is.Read_int32(&length, 0, true)\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\n\t\t(*msgList) = make([]Message, length)\n\t\tfor i23, e23 := int32(0), length; i23 < e23; i23++ {\n\n\t\t\terr = (*msgList)[i23].ReadBlock(_is, 0, false)\n\t\t\tif err != nil {\n\t\t\t\treturn ret, err\n\t\t\t}\n\n\t\t}\n\t} else if ty == codec.SIMPLE_LIST {\n\t\terr = fmt.Errorf(\"not support simple_list type\")\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\n\t} else {\n\t\terr = fmt.Errorf(\"require vector, but not\")\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func UpdateFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func TweetSeguidos(w http.ResponseWriter, r *http.Request) {\n\n\tif len(r.URL.Query().Get(\"limit\")) < 1 {\n\t\thttp.Error(w, \"Debe enviar el parámetro \\\"limit\\\"\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tlimit, err := strconv.Atoi(r.URL.Query().Get(\"limit\"))\n\tif err != nil {\n\t\thttp.Error(w, \"Debe enviar el parámetro \\\"limit\\\" como entero mayor a 0\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif len(r.URL.Query().Get(\"page\")) < 1 {\n\t\thttp.Error(w, \"Debe enviar el parámetro \\\"page\\\"\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tpage, err := strconv.Atoi(r.URL.Query().Get(\"page\"))\n\tif err != nil {\n\t\thttp.Error(w, \"Debe enviar el parámetro \\\"page\\\" como entero mayor a 0\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trespuesta, correcto := bd.TweetSeguidos(IDUsuario, limit, page)\n\tif correcto == false {\n\t\thttp.Error(w, \"Error al leer los tweets\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(respuesta)\n}", "func (ctx *ListFeedContext) OK(r FeedCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.feed.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FeedCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func List(helper Helper, writer io.Writer) error {\n\taccts, err := helper.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.NewEncoder(writer).Encode(accts)\n}", "func (s *ActionService) List(packageName string, options *ActionListOptions) ([]Action, *http.Response, error) {\n\tvar route string\n\tvar actions []Action\n\n\tif len(packageName) > 0 {\n\t\t// Encode resource name as a path (with no query params) before inserting it into the URI\n\t\t// This way any '?' chars in the name won't be treated as the beginning of the query params\n\t\tpackageName = (&url.URL{Path: packageName}).String()\n\t\troute = fmt.Sprintf(\"actions/%s/\", packageName)\n\t} else {\n\t\troute = fmt.Sprintf(\"actions\")\n\t}\n\n\trouteUrl, err := addRouteOptions(route, options)\n\tif err != nil {\n\t\tDebug(DbgError, \"addRouteOptions(%s, %#v) error: '%s'\\n\", route, options, err)\n\t\terrMsg := wski18n.T(\"Unable to add route options '{{.options}}'\",\n\t\t\tmap[string]interface{}{\"options\": options})\n\t\twhiskErr := MakeWskErrorFromWskError(errors.New(errMsg), err, EXIT_CODE_ERR_GENERAL, DISPLAY_MSG,\n\t\t\tNO_DISPLAY_USAGE)\n\t\treturn nil, nil, whiskErr\n\t}\n\tDebug(DbgError, \"Action list route with options: %s\\n\", route)\n\n\treq, err := s.client.NewRequestUrl(\"GET\", routeUrl, nil, IncludeNamespaceInUrl, AppendOpenWhiskPathPrefix, EncodeBodyAsJson, AuthRequired)\n\tif err != nil {\n\t\tDebug(DbgError, \"http.NewRequestUrl(GET, %s, nil, IncludeNamespaceInUrl, AppendOpenWhiskPathPrefix, EncodeBodyAsJson, AuthRequired) error: '%s'\\n\", routeUrl, err)\n\t\terrMsg := wski18n.T(\"Unable to create HTTP request for GET '{{.route}}': {{.err}}\",\n\t\t\tmap[string]interface{}{\"route\": routeUrl, \"err\": err})\n\t\twhiskErr := MakeWskErrorFromWskError(errors.New(errMsg), err, EXIT_CODE_ERR_NETWORK, DISPLAY_MSG,\n\t\t\tNO_DISPLAY_USAGE)\n\t\treturn nil, nil, whiskErr\n\t}\n\n\tresp, err := s.client.Do(req, &actions, ExitWithSuccessOnTimeout)\n\tif err != nil {\n\t\tDebug(DbgError, \"s.client.Do() error - HTTP req %s; error '%s'\\n\", req.URL.String(), err)\n\t\treturn nil, resp, err\n\t}\n\n\treturn actions, resp, err\n}", "func (h *Handlers) ListHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == \"POST\" {\n\t\tfirstnameInput := strings.Trim(r.FormValue(\"firstname\"), \" \")\n\t\tlastnameInput := strings.Trim(r.FormValue(\"lastname\"), \" \")\n\n\t\tif h.ValidInput.MatchString(firstnameInput) && h.ValidInput.MatchString(lastnameInput) {\n\t\t\tperson := entity.Person{\n\t\t\t\tFirstname: firstnameInput,\n\t\t\t\tLastname: lastnameInput,\n\t\t\t}\n\t\t\th.DBClient.InsertPerson(person)\n\t\t}\n\n\t\thttp.Redirect(w, r, \"/\", http.StatusMovedPermanently)\n\t}\n\n\tpersons, err := h.DBClient.GetPersons()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Println(err)\n\t}\n\n\terr = h.ListTemplate.ExecuteTemplate(w, \"layout\", struct{ Persons []entity.Person }{persons})\n\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Println(err)\n\t}\n}", "func (controller AppsController) List(c *gin.Context) {\n\tvar config entities.App\n\tif user, ok := c.Get(\"Session\"); ok {\n\t\tfmt.Printf(\"User %v\", user)\n\t}\n\tresult, err := mongodb.GetAll(controller.MongoDBClient, Collections[\"apps\"], bson.M{}, config)\n\tif err != nil {\n\t\tfmt.Printf(\"error %v\", err)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"message\": err})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\"apps\": result})\n}", "func (s *PhotoStreamServer) ListHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"received list request\")\n\n\timageDir := s.RootDir + \"/assets/images\"\n\tfiles, err := ioutil.ReadDir(imageDir)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\timageListResponse := &ImageListResponse{Images: make([]*ImageFileInfo, len(files))}\n\tfor i, f := range files {\n\t\tinfo := &ImageFileInfo{\n\t\t\tFilename: f.Name(),\n\t\t\tCreatedAt: fmt.Sprintf(\"%v\", f.ModTime()),\n\t\t}\n\t\timageListResponse.Images[i] = info\n\t}\n\n\tres, err := json.Marshal(imageListResponse)\n\tif err != nil {\n\t\tfmt.Println(\"problem marshalling json list response:\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.Write(res)\n}", "func (client ServicesClient) ListResponder(resp *http.Response) (result ServiceResourceList, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (p *Resource) SGOListHandler(req *restful.Request, resp *restful.Response) {\n\t// logrus.Infof(\"AppsListHandler is called!\")\n\tx_auth_token := req.HeaderParameter(\"X-Auth-Token\")\n\tcode, err := services.TokenValidation(x_auth_token)\n\tif err != nil {\n\t\tresponse.WriteStatusError(code, err, resp)\n\t\treturn\n\t}\n\n\tvar skip int = queryIntParam(req, \"skip\", 0)\n\tvar limit int = queryIntParam(req, \"limit\", 0)\n\n\ttotal, sgos, code, err := services.GetSgoService().QueryAll(skip, limit, x_auth_token)\n\tif err != nil {\n\t\tresponse.WriteStatusError(code, err, resp)\n\t\treturn\n\t}\n\tres := response.QueryStruct{Success: true, Data: sgos}\n\tif c, _ := strconv.ParseBool(req.QueryParameter(\"count\")); c {\n\t\tres.Count = total\n\t\tresp.AddHeader(\"X-Object-Count\", strconv.Itoa(total))\n\t}\n\tresp.WriteEntity(res)\n\treturn\n}", "func ServerListHandler(w http.ResponseWriter, r *http.Request) {\n\tenv := envFromRequest(r)\n\n\tservers, err := json.Marshal(polling.ListServers(env.ServerStates))\n\tif err != nil {\n\t\tenv.Logger.Error(\"component\", \"handler\", \"err\", err)\n\t\tos.Exit(1)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(servers)\n}", "func (s *Accounts) ListFunc(rw http.ResponseWriter, r *http.Request) {\n\tlimit, err := strconv.Atoi(r.FormValue(\"limit\"))\n\tif err != nil {\n\t\tlimit = 0\n\t}\n\n\toffset, err := strconv.Atoi(r.FormValue(\"offset\"))\n\tif err != nil {\n\t\toffset = 0\n\t}\n\n\tres, err := s.service.List(limit, offset)\n\n\tif err != nil {\n\t\thandleError(rw, s.log, err)\n\t\treturn\n\t}\n\n\thandleJsonResponse(rw, http.StatusOK, res)\n}", "func ListService(ctx *gin.Context) {\n\tlog := logger.RuntimeLog\n\tzoneName := ctx.Param(\"zone\")\n\tnamespace := ctx.Param(\"ns\")\n\n\t// fetch k8s-client handler by zoneName\n\tkclient, err := GetClientByAzCode(zoneName)\n\tif err != nil {\n\t\tlog.WithError(err)\n\t\tSendResponse(ctx, errno.ErrTokenInvalid, nil)\n\t\treturn\n\t}\n\n\tstartAt := time.Now()\n\tsvcs, err := kclient.CoreV1().Services(namespace).List(metav1.ListOptions{})\n\tif err != nil {\n\t\tSendResponse(ctx, err, \"failed to get Service info.\")\n\t\treturn\n\t}\n\tlogger.MetricsEmit(\n\t\tSVC_CONST.K8S_LOG_Method_ListService,\n\t\tutil.GetReqID(ctx),\n\t\tfloat32(time.Since(startAt)/time.Millisecond),\n\t\terr == err,\n\t)\n\n\tSendResponse(ctx, errno.OK, svcs.Items)\n}", "func (s seaOtterNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.SeaOtter, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.SeaOtter))\n\t})\n\treturn ret, err\n}", "func (c *TrackerController) List(ctx *app.ListTrackerContext) error {\n\texp, err := query.Parse(ctx.Filter)\n\tif err != nil {\n\t\treturn goa.ErrBadRequest(fmt.Sprintf(\"could not parse filter: %s\", err.Error()))\n\t}\n\tstart, limit, err := parseLimit(ctx.Page)\n\tif err != nil {\n\t\treturn goa.ErrBadRequest(fmt.Sprintf(\"could not parse paging: %s\", err.Error()))\n\t}\n\treturn application.Transactional(c.db, func(appl application.Application) error {\n\t\tresult, err := appl.Trackers().List(ctx.Context, exp, start, &limit)\n\t\tif err != nil {\n\t\t\treturn goa.ErrInternal(fmt.Sprintf(\"Error listing trackers: %s\", err.Error()))\n\t\t}\n\t\treturn ctx.OK(result)\n\t})\n\n}", "func (h UserHTTP) List(w http.ResponseWriter, r *http.Request) {\n\tlistRequest := listRequestDecoder(r)\n\tusers, err := h.svc.ListUsers(r.Context(), listRequest)\n\tif err != nil {\n\t\th.logger.With(r.Context()).Errorf(\"list users error : %s\", err)\n\t\trender.Render(w, r, e.BadRequest(err, \"bad request\"))\n\t\treturn\n\t}\n\trender.Respond(w, r, users)\n}", "func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := rootURL(c)\n\tif opts != nil {\n\t\tquery, err := opts.ToAmphoraListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\treturn pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn AmphoraPage{pagination.LinkedPageBase{PageResult: r}}\n\t})\n}", "func (g *Goods) List(c Context) {\n\t// TODO\n\tc.String(http.StatusOK, \"get goods list\")\n}" ]
[ "0.6771778", "0.623025", "0.55744016", "0.55318755", "0.5502598", "0.54656845", "0.5440476", "0.5433453", "0.5415765", "0.53617513", "0.53446615", "0.5318034", "0.53087264", "0.529815", "0.5259181", "0.5251516", "0.52512604", "0.5251112", "0.5221298", "0.5204197", "0.52032375", "0.51745534", "0.5161816", "0.51536494", "0.51529205", "0.5129623", "0.5092444", "0.506714", "0.50527096", "0.5048453", "0.50480443", "0.50412285", "0.50270027", "0.50218976", "0.5006121", "0.49872127", "0.49817133", "0.49770838", "0.49768263", "0.4976712", "0.49736476", "0.49512443", "0.49485317", "0.4944742", "0.4938129", "0.49365604", "0.49301362", "0.49283463", "0.49250308", "0.48875648", "0.48730597", "0.4867946", "0.48670188", "0.48669168", "0.4858472", "0.48510125", "0.48503295", "0.48470524", "0.4839057", "0.4827729", "0.4823798", "0.48203567", "0.48125046", "0.4801703", "0.47957063", "0.47934297", "0.4783932", "0.4780656", "0.47797906", "0.47796", "0.47751415", "0.4770465", "0.47649333", "0.47578195", "0.4751727", "0.47461498", "0.47396898", "0.47344622", "0.4732273", "0.47292733", "0.472425", "0.47221088", "0.4716352", "0.47137153", "0.4708789", "0.4707958", "0.47073728", "0.46994615", "0.46921366", "0.46864757", "0.4686255", "0.4683646", "0.46784067", "0.46774796", "0.467177", "0.46700352", "0.46697965", "0.46696267", "0.46655452", "0.46610647" ]
0.7114381
0
StartFeedAccepted runs the method Start of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func StartFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter { // Setup service var ( logBuf bytes.Buffer respSetter goatest.ResponseSetterFunc = func(r interface{}) {} ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v/start", id), } req, err := http.NewRequest("POST", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) startCtx, _err := app.NewStartFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil } // Perform action _err = ctrl.Start(startCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 202 { t.Errorf("invalid response status code: got %+v, expected 202", rw.Code) } // Return results return rw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *StartFeedContext) Accepted() error {\n\tctx.ResponseData.WriteHeader(202)\n\treturn nil\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StopFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *StopFeedContext) Accepted() error {\n\tctx.ResponseData.WriteHeader(202)\n\treturn nil\n}", "func (fes *FrontEndService) Start(ctx context.Context) <-chan error {\n\tlogrus.Infof(\"FrontEndService: Start\")\n\terrCh := make(chan error, 1)\n\tgo fes.start(ctx, errCh)\n\treturn errCh\n}", "func (s *JSONHTTPServer) StartService(\n\tctx context.Context,\n\tservices ...ServiceAPI,\n) <-chan struct{} {\n\tstarted := make(chan struct{})\n\n\t// This will block, so run it in a goroutine\n\tgo s.startInternal(\n\t\tctx,\n\t\tstarted,\n\t\tservices...)\n\n\treturn started\n}", "func (cmd *Start) Apply(ctxt context.Context, _ io.Writer, _ retro.Session, repo retro.Repo) (retro.CommandResult, error) {\n\treturn retro.CommandResult{cmd.session: []retro.Event{events.StartSession{}}}, nil\n}", "func (r *ManagedServicePollRequest) StartContext(ctx context.Context) (response *ManagedServicePollResponse, err error) {\n\tresult, err := helpers.PollContext(ctx, r.interval, r.statuses, r.predicates, r.task)\n\tif result != nil {\n\t\tresponse = &ManagedServicePollResponse{\n\t\t\tresponse: result.(*ManagedServiceGetResponse),\n\t\t}\n\t}\n\treturn\n}", "func Start(w http.ResponseWriter, r *http.Request) error {\n\tif !strings.Contains(r.Header.Get(\"Accept\"), \"text/event-stream\") {\n\t\treturn ErrNotAcceptable\n\t}\n\n\tfor h, v := range headers {\n\t\tw.Header().Set(h, v)\n\t}\n\n\tw.WriteHeader(200)\n\n\tw.(http.Flusher).Flush()\n\n\treturn nil\n}", "func (client ServicesClient) StartSender(req *http.Request) (future ServicesStartFuture, err error) {\n\tvar resp *http.Response\n\tfuture.FutureAPI = &azure.Future{}\n\tresp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))\n\tif err != nil {\n\t\treturn\n\t}\n\tvar azf azure.Future\n\tazf, err = azure.NewFutureFromResponse(resp)\n\tfuture.FutureAPI = &azf\n\tfuture.Result = future.result\n\treturn\n}", "func Start(ctx context.Context, configFile string) (done chan struct{}) {\n\tdone = make(chan struct{})\n\n\tgo func() {\n\t\tdefer close(done)\n\n\t\tl := zerolog.New(os.Stdout)\n\n\t\terr := runApp(ctx, l, configFile)\n\t\tif err != nil {\n\t\t\tl.Fatal().Err(err).Msg(\"running app\")\n\t\t}\n\t}()\n\n\treturn done\n}", "func (s *service) Start(context.Context) error {\n\treturn s.StartOnce(\"BHS Feeder Service\", func() error {\n\t\ts.logger.Infow(\"Starting BHS feeder\")\n\t\tticker := time.NewTicker(utils.WithJitter(s.pollPeriod))\n\t\ts.parentCtx, s.cancel = context.WithCancel(context.Background())\n\t\tgo func() {\n\t\t\tdefer close(s.done)\n\t\t\tdefer ticker.Stop()\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ticker.C:\n\t\t\t\t\ts.runFeeder()\n\t\t\t\tcase <-s.stop:\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\treturn nil\n\t})\n}", "func (svc *Service) Start(ctx context.Context, svcErrors chan error) {\n\n\t// Start kafka logging\n\tsvc.dataBakerProducer.Channels().LogErrors(ctx, \"error received from kafka data baker producer, topic: \"+svc.cfg.DatabakerImportTopic)\n\tsvc.inputFileAvailableProducer.Channels().LogErrors(ctx, \"error received from kafka input file available producer, topic: \"+svc.cfg.InputFileAvailableTopic)\n\n\t// Start healthcheck\n\tsvc.healthCheck.Start(ctx)\n\n\t// Run the http server in a new go-routine\n\tgo func() {\n\t\tlog.Event(ctx, \"Starting api...\", log.INFO)\n\t\tif err := svc.server.ListenAndServe(); err != nil {\n\t\t\tsvcErrors <- errors.Wrap(err, \"failure in http listen and serve\")\n\t\t}\n\t}()\n}", "func (ctx *GetFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func HandleStart(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tname := p.ByName(\"name\")\n\n\t// Nothing to respond with here\n\tfmt.Println(\"START: \" + name)\n\n\treq := GameRequest{}\n\tb, _ := io.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\n\terr := json.Unmarshal(b, &req)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: start parse: \" + err.Error() + \", \" + string(b))\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tfn := snakes[name].Start\n\tif fn == nil {\n\t\treturn\n\t}\n\n\terr = fn(r.Context(), req)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: start handle: \" + err.Error())\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func start(w http.ResponseWriter, r *http.Request) {\n c := appengine.NewContext(r)\n u := user.Current(c)\n playerId := u.String()\n\n // Get or create the Game.\n game, err := getGame(c, \"nertz\")\n if err != nil {\n http.Error(w, err.Error(), 500)\n return\n }\n\n // Create a new Client, getting the channel token.\n token, err := game.makePlayer(c, playerId)\n if err != nil {\n http.Error(w, err.Error(), 500)\n return\n }\n\n url, err := user.LogoutURL(c, r.URL.String())\n if err != nil {\n http.Error(w, err.Error(), http.StatusInternalServerError)\n return\n }\n\n // Render the HTML template\n data := tmplData{ url, game.Id, token, }\n err = tmpl.Execute(w, data)\n if err != nil {\n http.Error(w, err.Error(), 500)\n return\n }\n}", "func NewStartFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*StartFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := StartFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\treturn &rctx, err\n}", "func StartControllerService() {\n\tserviceName := common.ControllerServiceName\n\tcfg := common.SetupServerConfig(configure.NewCommonConfigure())\n\tif e := os.Setenv(\"port\", fmt.Sprintf(\"%d\", cfg.GetServiceConfig(serviceName).GetPort())); e != nil {\n\t\tlog.Panic(e)\n\t}\n\n\tmeta, err := metadata.NewCassandraMetadataService(cfg.GetMetadataConfig())\n\tif err != nil {\n\t\t// no metadata service - just fail early\n\t\tlog.WithField(common.TagErr, err).Fatal(`unable to instantiate metadata service (did you run ./scripts/setup_cassandra_schema.sh?)`)\n\t}\n\thwInfoReader := common.NewHostHardwareInfoReader(meta)\n\treporter := common.NewMetricReporterWithHostname(cfg.GetServiceConfig(serviceName))\n\tdClient := dconfigclient.NewDconfigClient(cfg.GetServiceConfig(serviceName), serviceName)\n\tsVice := common.NewService(serviceName, uuid.New(), cfg.GetServiceConfig(serviceName), common.NewUUIDResolver(meta), hwInfoReader, reporter, dClient, common.NewBypassAuthManager())\n\tmcp, tc := controllerhost.NewController(cfg, sVice, meta, common.NewDummyZoneFailoverManager())\n\tmcp.Start(tc)\n\tcommon.ServiceLoop(cfg.GetServiceConfig(serviceName).GetPort()+diagnosticPortOffset, cfg, mcp.Service)\n}", "func Start() {\n\te := echo.New()\n\tlogger = e.Logger\n\n\t// custom context\n\te.Use(func(h echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\tcc := &MatchContext{c}\n\t\t\treturn h(cc)\n\t\t}\n\t})\n\n\te.Use(middleware.Recover())\n\te.Logger.SetLevel(func() log.Lvl {\n\t\tif Verbose {\n\t\t\treturn log.DEBUG\n\t\t}\n\t\treturn log.INFO\n\t}())\n\tif l, ok := e.Logger.(*log.Logger); ok {\n\t\tl.SetHeader(\"${time_rfc3339} ${level}\")\n\t}\n\n\tsetupRoutes(e)\n\te.GET(\"/swagger/*\", echoSwagger.WrapHandler)\n\n\te.Logger.Fatal(e.Start(\":8000\"))\n}", "func (s *FluentdService) Start(ctx context.Context, r *pb.FluentdStartRequest) (*pb.FluentdStartResponse, error) {\n\treturn &pb.FluentdStartResponse{Status: pb.FluentdStartResponse_START_SUCCESS}, nil\n}", "func (s JSONHTTPServer) StartService(status chan bool) {\n\tgo s.startInternal(status)\n}", "func (s JSONHTTPServer) StartService(status chan bool) {\n\tgo s.startInternal(status)\n}", "func (r *ClusterPollRequest) StartContext(ctx context.Context) (response *ClusterPollResponse, err error) {\n\tresult, err := helpers.PollContext(ctx, r.interval, r.statuses, r.predicates, r.task)\n\tif result != nil {\n\t\tresponse = &ClusterPollResponse{\n\t\t\tresponse: result.(*ClusterGetResponse),\n\t\t}\n\t}\n\treturn\n}", "func (client DeploymentsClient) StartSender(req *http.Request) (future DeploymentsStartFuture, err error) {\n\tvar resp *http.Response\n\tfuture.FutureAPI = &azure.Future{}\n\tresp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))\n\tif err != nil {\n\t\treturn\n\t}\n\tvar azf azure.Future\n\tazf, err = azure.NewFutureFromResponse(resp)\n\tfuture.FutureAPI = &azf\n\tfuture.Result = future.result\n\treturn\n}", "func (a *ApplyTask) Start(taskChannel chan taskrunner.TaskResult) {\n\tgo func() {\n\t\ta.ApplyOptions.SetObjects(a.Objects)\n\t\terr := a.ApplyOptions.Run()\n\t\ttaskChannel <- taskrunner.TaskResult{\n\t\t\tErr: err,\n\t\t}\n\t}()\n}", "func Accepted(w http.ResponseWriter) error {\n\tconst msg = \"request accepted\"\n\tw.Header().Add(\"Content-Type\", \"text/plain\")\n\tw.Header().Add(\"Content-Length\", fmt.Sprintf(\"%d\", len(msg)))\n\tw.WriteHeader(http.StatusAccepted)\n\t_, err := w.Write([]byte(msg))\n\treturn err\n}", "func (s *StreamingController) StartStreaming(c *gin.Context) {\n\tvar err error\n\n\t// Request body validation\n\tvar requestBody request.StartStreaming\n\terr = c.ShouldBindJSON(&requestBody)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": errInvalidRequest.Error(),\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\t// Get all existed rules\n\tgetRulesResp, err := twitterController.GetRules()\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": errFailedGetRules.Error(),\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tfmt.Println(\"Get all existed rules\")\n\n\t// Delete all existed rules if any\n\tif len(getRulesResp.Data) > 0 {\n\t\tvar ruleIds []string\n\t\tfor _, data := range getRulesResp.Data {\n\t\t\truleIds = append(ruleIds, data.Id)\n\t\t}\n\n\t\t_, err := twitterController.DeleteRules(ruleIds)\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"message\": errFailedDeleteRule.Error(),\n\t\t\t\t\"error\": err.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t}\n\tfmt.Println(\"Delete all existed rules if any\")\n\n\t// Post the received rule\n\tpostRulesResp, err := twitterController.PostRules([]string{requestBody.Rule})\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": errFailedPostRule.Error(),\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tfmt.Println(\"Post the received rule\")\n\n\t// Store rule and streaming data into DB\n\tdb := dbConn.OpenConnection()\n\tdefer db.Close()\n\n\trule := model.Rule{\n\t\tID: postRulesResp.Data[0].Id,\n\t\tValue: requestBody.Rule,\n\t}\n\truleQuery := \"INSERT INTO rules (id, value) VALUES ($1, $2)\"\n\t_, err = db.Exec(ruleQuery, rule.ID, rule.Value)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": errFailedInsertRuleDB.Error(),\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tstreamingID := 0\n\tstreaming := model.Streaming{\n\t\tName: requestBody.Name,\n\t\tStartTime: time.Now(),\n\t\tRuleID: rule.ID,\n\t}\n\tstreamingQuery := \"INSERT INTO streamings (name, start_time, rule_id) VALUES ($1, $2, $3) RETURNING id\"\n\terr = db.QueryRow(streamingQuery, streaming.Name, streaming.StartTime, streaming.RuleID).Scan(&streamingID)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": errFailedInsertRuleDB.Error(),\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tfmt.Println(\"Store rule and streaming data into DB\")\n\n\t// Start the streaming goroutine\n\twg.Add(1)\n\tquit = make(chan struct{})\n\tgo twitterController.GetStream()\n\tfmt.Println(\"Start streaming (goroutine)\")\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"success\": true,\n\t\t\"data\": response.StartStreaming{\n\t\t\tID: int64(streamingID),\n\t\t\tName: streaming.Name,\n\t\t\tStartTime: streaming.StartTime,\n\t\t\tRuleID: rule.ID,\n\t\t\tRule: rule.Value,\n\t\t},\n\t})\n}", "func (s *XPackWatcherStartService) Do(ctx context.Context) (*XPackWatcherStartResponse, error) {\n\t// Check pre-conditions\n\tif err := s.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get URL for request\n\tpath, params, err := s.buildURL()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get HTTP response\n\tres, err := s.client.PerformRequest(ctx, PerformRequestOptions{\n\t\tMethod: \"POST\",\n\t\tPath: path,\n\t\tParams: params,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return operation response\n\tret := new(XPackWatcherStartResponse)\n\tif err := json.Unmarshal(res.Body, ret); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ret, nil\n}", "func chainStarted(service moleculer.Service, mixin *moleculer.Mixin) moleculer.Service {\n\tif mixin.Started != nil {\n\t\tsvcHook := service.Started\n\t\tservice.Started = func(ctx moleculer.BrokerContext, svc moleculer.Service) {\n\t\t\tif svcHook != nil {\n\t\t\t\tsvcHook(ctx, svc)\n\t\t\t}\n\t\t\tmixin.Started(ctx, svc)\n\t\t}\n\t}\n\treturn service\n}", "func (s *Service) Do(ctx context.Context) error {\n\tlog.Printf(\"[INFO] starting youtube service\")\n\n\tif s.SkipShorts > 0 {\n\t\tlog.Printf(\"[DEBUG] skip youtube episodes shorter than %v\", s.SkipShorts)\n\t}\n\tfor _, f := range s.Feeds {\n\t\tlog.Printf(\"[INFO] youtube feed %+v\", f)\n\t}\n\n\ttick := time.NewTicker(s.CheckDuration)\n\tdefer tick.Stop()\n\n\tif err := s.procChannels(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to process channels\")\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-tick.C:\n\t\t\tif err := s.procChannels(ctx); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to process channels\")\n\t\t\t}\n\t\t}\n\t}\n}", "func (eng *Engine) Pre(c filter.Context) (int, error) {\n\teng.lastActive = time.Now()\n\n\tif len(eng.applied) == 0 {\n\t\treturn eng.BaseFilter.Pre(c)\n\t}\n\n\trc := acquireContext()\n\trc.delegate = c\n\tfor _, rt := range eng.applied {\n\t\tstatusCode, err := rt.Pre(rc)\n\t\tif nil != err {\n\t\t\treleaseContext(rc)\n\t\t\treturn statusCode, err\n\t\t}\n\n\t\tif statusCode == filter.BreakFilterChainCode {\n\t\t\treleaseContext(rc)\n\t\t\treturn statusCode, err\n\t\t}\n\t}\n\n\treleaseContext(rc)\n\treturn http.StatusOK, nil\n}", "func ExampleStreamingEndpointsClient_BeginStart() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclient, err := armmediaservices.NewStreamingEndpointsClient(\"0a6ec948-5a62-437d-b9df-934dc7c1b722\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := client.BeginStart(ctx,\n\t\t\"mediaresources\",\n\t\t\"slitestmedia10\",\n\t\t\"myStreamingEndpoint1\",\n\t\tnil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t_, err = poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n}", "func (hr *HttpReceiver) TcStart(ctx context.Context) error {\n\treturn hr.tcServer.start(ctx)\n}", "func StartConverger(opts ...ConvergerOpt) Converger {\n\tconverger := &converger{\n\t\tlastVersion: 0,\n\t\tinbox: make(chan convergeRequest, 5),\n\t\tstop: make(chan struct{}, 1),\n\t\tcompiler: NewPhaseOrderedCompiler(),\n\t}\n\tfor _, opt := range opts {\n\t\topt(converger)\n\t}\n\tgo converger.run()\n\treturn converger\n}", "func (ss *StreamerServer) handleStartStreams(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"POST\" {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tb, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tglog.Infof(\"Got request: '%s'\", string(b))\n\tssr := &model.StartStreamsReq{}\n\terr = json.Unmarshal(b, ssr)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\tglog.Infof(\"Start streams request %+v\", *ssr)\n\tif ssr.Host == \"\" {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"Should specify 'host' field\"))\n\t\treturn\n\t}\n\tif ssr.Repeat <= 0 {\n\t\tssr.Repeat = 1\n\t}\n\tif ssr.Simultaneous <= 0 {\n\t\tssr.Simultaneous = 1\n\t}\n\tif ssr.FileName == \"\" {\n\t\tssr.FileName = \"BigBuckBunny.mp4\"\n\n\t}\n\tif ssr.RTMP == 0 {\n\t\tssr.RTMP = 1935\n\t}\n\tif ssr.Media == 0 {\n\t\tssr.Media = 8935\n\t}\n\tif ssr.ProfilesNum != 0 {\n\t\tmodel.ProfilesNum = ssr.ProfilesNum\n\t}\n\tif _, err := os.Stat(ssr.FileName); os.IsNotExist(err) {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(`File ` + ssr.FileName + ` does not exists`))\n\t\treturn\n\t}\n\tglog.Infof(\"Get request: %+v\", ssr)\n\tif !ssr.DoNotClearStats {\n\t\tss.streamer = testers.NewStreamer(ss.wowzaMode)\n\t}\n\tvar streamDuration time.Duration\n\tif ssr.Time != \"\" {\n\t\tif streamDuration, err = ParseStreamDurationArgument(ssr.Time); err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\t}\n\n\tbaseManifestID, err := ss.streamer.StartStreams(ssr.FileName, ssr.Host, strconv.Itoa(ssr.RTMP), strconv.Itoa(ssr.Media), ssr.Simultaneous,\n\t\tssr.Repeat, streamDuration, true, ssr.MeasureLatency, true, 3, 5*time.Second, 0)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tres, err := json.Marshal(\n\t\t&model.StartStreamsRes{\n\t\t\tSuccess: true,\n\t\t\tBaseManifestID: baseManifestID,\n\t\t},\n\t)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\tw.Write(res)\n}", "func CreateFeedCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StartService(ctx context.Context, opener entroq.BackendOpener) (*grpc.Server, Dialer, error) {\n\tlis := bufconn.Listen(bufSize)\n\tsvc, err := qsvc.New(ctx, opener)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"start service: %w\", err)\n\t}\n\ts := grpc.NewServer()\n\thpb.RegisterHealthServer(s, health.NewServer())\n\tpb.RegisterEntroQServer(s, svc)\n\tgo s.Serve(lis)\n\n\treturn s, lis.Dial, nil\n}", "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (por *Processor) TracesAccepted(ctx context.Context, numSpans int) {\n\tif por.level != configtelemetry.LevelNone {\n\t\tpor.recordData(ctx, component.DataTypeTraces, int64(numSpans), int64(0), int64(0))\n\t}\n}", "func TestServiceStart(t *testing.T) {\n\trunTest(t, func(s *res.Service) {\n\t\ts.Handle(\"model\", res.GetResource(func(r res.GetRequest) { r.NotFound() }))\n\t}, nil)\n}", "func NewCreateExtensionsV1beta1NamespacedIngressAccepted() *CreateExtensionsV1beta1NamespacedIngressAccepted {\n\n\treturn &CreateExtensionsV1beta1NamespacedIngressAccepted{}\n}", "func (r *Reporter) Start(_ context.Context) error {\n\treturn nil\n}", "func (h *hasuraAdapter) Start(ctx context.Context) error {\n\th.logger.Info(\"Starting Hasura adapter\")\n\n\tif h.token != \"\" && !h.isAdmin {\n\t\tsrc := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: h.token})\n\t\th.client = oauth2.NewClient(ctx, src)\n\t} else {\n\t\th.client = http.DefaultClient\n\t}\n\n\treturn h.ceClient.StartReceiver(ctx, h.dispatch)\n}", "func (ri *RestInvoker) ContextDo(ctx context.Context, req *rest.Request, options ...InvocationOption) (*rest.Response, error) {\n\topts := getOpts(string(req.GetRequest().Host()), options...)\n\topts.Protocol = common.ProtocolRest\n\tif len(opts.Filters) == 0 {\n\t\topts.Filters = ri.opts.Filters\n\t}\n\tif string(req.GetRequest().URI().Scheme()) != \"cse\" {\n\t\treturn nil, fmt.Errorf(\"Scheme invalid: %s, only support cse://\", req.GetRequest().URI().Scheme())\n\t}\n\tif req.GetHeader(\"Content-Type\") == \"\" {\n\t\treq.SetHeader(\"Content-Type\", \"application/json\")\n\t}\n\tnewReq := req.Copy()\n\tdefer newReq.Close()\n\tresp := rest.NewResponse()\n\tnewReq.SetHeader(common.HeaderSourceName, config.SelfServiceName)\n\tinv := invocation.CreateInvocation()\n\twrapInvocationWithOpts(inv, opts)\n\tinv.AppID = config.GlobalDefinition.AppID\n\tinv.MicroServiceName = string(req.GetRequest().Host())\n\tinv.Args = newReq\n\tinv.Reply = resp\n\tinv.Ctx = ctx\n\tinv.URLPathFormat = req.Req.URI().String()\n\tinv.MethodType = req.GetMethod()\n\tc, err := handler.GetChain(common.Consumer, ri.opts.ChainName)\n\tif err != nil {\n\t\tlager.Logger.Errorf(err, \"Handler chain init err.\")\n\t\treturn nil, err\n\t}\n\tc.Next(inv, func(ir *invocation.InvocationResponse) error {\n\t\terr = ir.Err\n\t\treturn err\n\t})\n\treturn resp, err\n}", "func (c *Sender) Do(r *http.Request) (*http.Response, error) {\n\tc.attempts++\n\n\tif !c.reuseResponse || c.resp == nil {\n\t\tresp := NewResponse()\n\t\tresp.Request = r\n\t\tresp.Body = NewBody(c.content)\n\t\tresp.Status = c.status\n\t\tresp.StatusCode = c.statusCode\n\t\tc.resp = resp\n\t} else {\n\t\tc.resp.Body.(*Body).reset()\n\t}\n\n\tif c.pollAttempts > 0 {\n\t\tc.pollAttempts--\n\t\tc.resp.Status = \"Accepted\"\n\t\tc.resp.StatusCode = http.StatusAccepted\n\t\tSetAcceptedHeaders(c.resp)\n\t}\n\n\tif c.emitErrors > 0 || c.emitErrors < 0 {\n\t\tc.emitErrors--\n\t\tif c.err == nil {\n\t\t\treturn c.resp, fmt.Errorf(\"Faux Error\")\n\t\t}\n\t\treturn c.resp, c.err\n\t}\n\treturn c.resp, nil\n}", "func (ctx *GetFilterContext) OK(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewDeleteCoreV1NamespacedServiceAccepted() *DeleteCoreV1NamespacedServiceAccepted {\n\treturn &DeleteCoreV1NamespacedServiceAccepted{}\n}", "func (service *Service) Start(context moleculer.BrokerContext) {\n\tif service.started != nil {\n\t\tgo service.started(context, (*service.schema))\n\t}\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) WithPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (mw *Stats) Begin(w http.ResponseWriter) (time.Time, ResponseWriter) {\n\tstart := time.Now()\n\n\twriter := NewRecorderResponseWriter(w, 200)\n\n\treturn start, writer\n}", "func (c *StreamerController) Start(tctx *tcontext.Context, location binlog.Location) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tc.meetError = false\n\tc.closed = false\n\tc.currentBinlogType = c.initBinlogType\n\n\tvar err error\n\tif c.serverIDUpdated {\n\t\terr = c.resetReplicationSyncer(tctx, location)\n\t} else {\n\t\terr = c.updateServerIDAndResetReplication(tctx, location)\n\t}\n\tif err != nil {\n\t\tc.close(tctx)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (d *DataPointCollector) Start(output chan<- []pipeline.DataPoint) error {\n\n\tlistener, err := server.OpenListener(d.addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tconn, err := listener.Accept()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\td.clientServer = publisherClientServer{\n\t\t\t\toutput: output,\n\t\t\t\tlistener: listener,\n\t\t\t}\n\n\t\t\tserver := rpc.NewServer()\n\t\t\tserver.RegisterName(\"PublisherClient\", &d.clientServer)\n\n\t\t\tcodec := jsonrpc.NewServerCodec(conn)\n\n\t\t\tgo server.ServeCodec(codec)\n\t\t}\n\t}()\n\n\treturn nil\n}", "func (a *datadogAdapter) Start(ctx context.Context) error {\n\ta.logger.Info(\"Starting Datadog adapter\")\n\treturn a.ceClient.StartReceiver(ctx, a.dispatch)\n}", "func startDashboardController(ns string, cfg *rest.Config, signalHandler <-chan struct{}, autodetectChannel chan schema.GroupVersionKind) {\n\t// Create a new Cmd to provide shared dependencies and start components\n\tdashboardMgr, err := manager.New(cfg, manager.Options{\n\t\tMetricsBindAddress: \"0\",\n\t\tNamespace: ns,\n\t})\n\tif err != nil {\n\t\tlog.Error(err, \"\")\n\t\tos.Exit(1)\n\t}\n\n\t// Setup Scheme for the dashboard resource\n\tif err := apis.AddToScheme(dashboardMgr.GetScheme()); err != nil {\n\t\tlog.Error(err, \"\")\n\t\tos.Exit(1)\n\t}\n\n\t// Use a separate manager for the dashboard controller\n\tgrafanadashboard.Add(dashboardMgr, ns)\n\n\tgo func() {\n\t\tif err := dashboardMgr.Start(signalHandler); err != nil {\n\t\t\tlog.Error(err, \"dashboard manager exited non-zero\")\n\t\t\tos.Exit(1)\n\t\t}\n\t}()\n}", "func (cmd *Start) Apply(ctxt context.Context, _ types.Aggregate, aggStore types.Depot) ([]types.Event, error) {\n\treturn []types.Event{events.StartSession{}}, nil\n}", "func startTracing(serviceName string, reporterURI string, probability float64) (*trace.TracerProvider, error) {\n\n\t// WARNING: The current settings are using defaults which may not be\n\t// compatible with your project. Please review the documentation for\n\t// opentelemetry.\n\n\texporter, err := otlptrace.New(\n\t\tcontext.Background(),\n\t\totlptracegrpc.NewClient(\n\t\t\totlptracegrpc.WithInsecure(), // This should be configurable\n\t\t\totlptracegrpc.WithEndpoint(reporterURI),\n\t\t),\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating new exporter: %w\", err)\n\t}\n\n\ttraceProvider := trace.NewTracerProvider(\n\t\ttrace.WithSampler(trace.TraceIDRatioBased(probability)),\n\t\ttrace.WithBatcher(exporter,\n\t\t\ttrace.WithMaxExportBatchSize(trace.DefaultMaxExportBatchSize),\n\t\t\ttrace.WithBatchTimeout(trace.DefaultScheduleDelay*time.Millisecond),\n\t\t\ttrace.WithMaxExportBatchSize(trace.DefaultMaxExportBatchSize),\n\t\t),\n\t\ttrace.WithResource(\n\t\t\tresource.NewWithAttributes(\n\t\t\t\tsemconv.SchemaURL,\n\t\t\t\tsemconv.ServiceNameKey.String(serviceName),\n\t\t\t),\n\t\t),\n\t)\n\n\t// We must set this provider as the global provider for things to work,\n\t// but we pass this provider around the program where needed to collect\n\t// our traces.\n\totel.SetTracerProvider(traceProvider)\n\n\t// Chooses the HTTP header formats we extract incoming trace contexts from,\n\t// and the headers we set in outgoing requests.\n\totel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(\n\t\tpropagation.TraceContext{},\n\t\tpropagation.Baggage{},\n\t))\n\n\treturn traceProvider, nil\n}", "func (sm *SinkManager) Start(newAppServiceChan, deletedAppServiceChan <-chan store.AppService) {\n\tgo sm.listenForNewAppServices(newAppServiceChan)\n\tgo sm.listenForDeletedAppServices(deletedAppServiceChan)\n\n\tsm.listenForErrorMessages()\n}", "func (c *Consumer) Start(ctx context.Context) error {\n\treturn c.start(ctx)\n}", "func NewCreateNetworkingV1beta1NamespacedIngressAccepted() *CreateNetworkingV1beta1NamespacedIngressAccepted {\n\n\treturn &CreateNetworkingV1beta1NamespacedIngressAccepted{}\n}", "func (es Streamer) Start(logs chan<- types.EventData, errs chan<- error) {\n\tapps := LoadApplications(es.RegistryPath)\n\n\tes.logs = logs\n\tes.errs = errs\n\n\tclient, err := ethclient.Dial(es.WebsocketURL)\n\tif err != nil {\n\t\tes.errs <- err\n\t}\n\n\tchainID, err := client.NetworkID(context.Background())\n\tif err != nil {\n\t\tes.errs <- err\n\t}\n\tlog.Info(fmt.Sprintf(\"Connected to Ethereum chain ID %s\\n\", chainID))\n\n\t// Start application subscriptions\n\tappEvents := make(chan ctypes.Log)\n\tfor _, app := range apps {\n\t\tquery := es.buildSubscriptionFilter(app)\n\n\t\t// Start the contract subscription\n\t\t_, err := client.SubscribeFilterLogs(context.Background(), query, appEvents)\n\t\tif err != nil {\n\t\t\tlog.Info(fmt.Sprintf(\"Failed to subscribe to app %s\\n\", app.ID))\n\t\t} else {\n\t\t\tlog.Info(fmt.Sprintf(\"Subscribed to app %s\\n\", app.ID))\n\t\t}\n\t}\n\n\tfor {\n\t\tselect {\n\t\t// case err := <-sub.Err(): // TODO: capture subscription errors\n\t\t// \tes.errs <- err\n\t\tcase vLog := <-appEvents:\n\t\t\tlog.Info(fmt.Sprintf(\"Witnessed tx %s on app %s\\n\", vLog.TxHash.Hex(), vLog.Address.Hex()))\n\t\t\teventData := types.NewEventData(vLog.Address, vLog)\n\t\t\tes.logs <- eventData\n\t\t}\n\t}\n}", "func NewCreateDiscoveryV1beta1NamespacedEndpointSliceAccepted() *CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted {\n\n\treturn &CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted{}\n}", "func (c Control) ServeStartTask(w http.ResponseWriter, r *http.Request) {\n\tc.ServeTaskAction(w, r, true)\n}", "func (client ServicesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenAccepted() *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenAccepted{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenAccepted() *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenAccepted{}\n}", "func (k *Kafka) Start(tweetChannel chan *twitter.Tweet) {\n\tfor {\n\t\tselect {\n\t\tcase tweet := <-tweetChannel:\n\t\t\ttbytes, err := json.Marshal(tweet)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"ERR: error decoding json from tweet\")\n\t\t\t}\n\t\t\tgo k.sendTweetToKafka(tbytes)\n\t\tdefault:\n\t\t}\n\t}\n}", "func Start(gracefulStop chan os.Signal) error {\n\tctx := context.Background()\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tport, address := ipkg.ParseServerEnvVars()\n\tgwPort, gwAddress := ipkg.ParseGateWayEnvVars()\n\n\tgrpcEndpoint := ipkg.FmtAddress(address, port)\n\n\tlogLevel := ipkg.ParseLogLevel()\n\tlogger = cl.GetModuleLogger(\"internal.app.restgateway\", logLevel)\n\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/swagger/\", serveSwagger)\n\n\tmuxGateway := runtime.NewServeMux()\n\n\topts := []grpc.DialOption{grpc.WithInsecure()}\n\terr := api.RegisterClusterCreatorHandlerFromEndpoint(ctx, muxGateway, grpcEndpoint, opts)\n\tif err != nil {\n\t\tlogger.Errorf(\"could not register from endpoints: %s\", err)\n\t\treturn err\n\t}\n\n\tmux.Handle(\"/\", muxGateway)\n\n\t// Chance here to gracefully handle being stopped.\n\tgo func() {\n\t\tsig := <-gracefulStop\n\t\tlogger.Infof(\"caught sig: %+v\", sig)\n\t\tlogger.Infof(\"Wait for 2 second to finish processing\")\n\t\ttime.Sleep(2 * time.Second)\n\t\tcancel()\n\t\tlogger.Infof(\"service terminated\")\n\t\tos.Exit(0)\n\t}()\n\n\treturn http.ListenAndServe(ipkg.FmtAddress(gwAddress, gwPort), mux)\n}", "func (_DelegationController *DelegationControllerFilterer) FilterDelegationAccepted(opts *bind.FilterOpts) (*DelegationControllerDelegationAcceptedIterator, error) {\n\n\tlogs, sub, err := _DelegationController.contract.FilterLogs(opts, \"DelegationAccepted\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DelegationControllerDelegationAcceptedIterator{contract: _DelegationController.contract, event: \"DelegationAccepted\", logs: logs, sub: sub}, nil\n}", "func (a *Acceptor) Start() {\n\tgo func() {\n\t\tfor {\n\t\t\t//TODO(student): Task 3 - distributed implementation\n\t\t\tselect {\n\t\t\tcase prp := <-a.prepareChan:\n\t\t\t\tpromise, ok := a.handlePrepare(prp)\n\t\t\t\tif ok == true {\n\t\t\t\t\ta.PromiseOut <- promise\n\t\t\t\t}\n\t\t\t\t//fmt.Printf(\"Acceptor %v: promise ok? %v\", a.Id, ok)\n\t\t\tcase acc := <-a.acceptChan:\n\t\t\t\tif learn, ok := a.handleAccept(acc); ok == true {\n\t\t\t\t\ta.LearnOut <- learn\n\t\t\t\t}\n\t\t\tcase <-a.stop:\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}()\n}", "func (r *RateEnforcer) Start(ctx context.Context, t astiencoder.CreateTaskFunc) {\n\tr.BaseNode.Start(ctx, t, func(t *astikit.Task) {\n\t\t// Make sure to wait for all dispatcher subprocesses to be done so that they are properly closed\n\t\tdefer r.d.wait()\n\n\t\t// Make sure to stop the chan properly\n\t\tdefer r.c.Stop()\n\n\t\t// Start tick\n\t\tstartTickCtx := r.startTick(r.Context())\n\n\t\t// Start chan\n\t\tr.c.Start(r.Context())\n\n\t\t// Wait for start tick to be really over since it's not the blocking pattern\n\t\t// and is executed in a goroutine\n\t\t<-startTickCtx.Done()\n\t})\n}", "func (l *SlotService) StartService(ctx context.Context, logger log.Logger, rootView viewer, cfgMgr *viper.Viper, updateFns []func(context.Context, *viper.Viper), ch eh.CommandHandler, eb eh.EventBus) *view.View {\n\n\tslotUri := rootView.GetURI() + \"/Slots\"\n\tslotLogger := logger.New(\"module\", \"slot\")\n\n\tslotView := view.New(\n\t\tview.WithURI(slotUri),\n\t\t//ah.WithAction(ctx, slotLogger, \"clear.logs\", \"/Actions/..fixme...\", MakeClearLog(eb), ch, eb),\n\t)\n\n\tAddAggregate(ctx, slotLogger, slotView, rootView.GetUUID(), l.ch, l.eb)\n\n\t// Start up goroutine that listens for log-specific events and creates log aggregates\n\tl.manageSlots(ctx, slotLogger, slotUri, cfgMgr, updateFns, ch, eb)\n\n\treturn slotView\n}", "func (a *API) StartService(serviceID string) error {\n\treturn newServiceStarter(a).Start(serviceID)\n}", "func (c *Client) Start(ctx context.Context, productMap exchange.ProductMap, exchangeDoneCh chan<- struct{}) error {\n\tc.productMap = productMap[c.exchangeName]\n\terr := c.GetPairs()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = c.API.Connect(c.GetURL())\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = c.API.SendSubscribeRequest(c.FormatSubscribeRequest())\n\tif err != nil {\n\t\treturn err\n\t}\n\tgo c.StartTickerListener(ctx, exchangeDoneCh)\n\treturn nil\n}", "func (ctx *ControllerContext) Start(stopCh chan struct{}) {\n\tgo ctx.IngressInformer.Run(stopCh)\n\tgo ctx.ServiceInformer.Run(stopCh)\n\tgo ctx.PodInformer.Run(stopCh)\n\tgo ctx.NodeInformer.Run(stopCh)\n\tif ctx.EndpointInformer != nil {\n\t\tgo ctx.EndpointInformer.Run(stopCh)\n\t}\n}", "func (fc *appendFlowControl) start(res *resolution, recv func() (*pb.AppendRequest, error)) func() (*pb.AppendRequest, error) {\n\tfc.reset(res, timeNow().UnixNano()/1e6)\n\tfc.ticker = time.NewTicker(flowControlQuantum)\n\n\t// Pump calls to |recv| in a goroutine, as they may block indefinitely.\n\t// We expect that |recv| is tied to a Context which will be cancelled\n\t// upon the returned closure returning an error, so these don't actually\n\t// hang around indefinitely.\n\tgo func(ch chan<- appendChunk) {\n\t\tfor {\n\t\t\tvar req, err = recv()\n\t\t\tch <- appendChunk{req: req, err: err}\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(fc.chunkCh)\n\n\treturn fc.recv\n}", "func Start(ctx context.Context, config *Config) error {\n\tlog.Debug(\"start application\")\n\n\tserviceRepo := service.NewRepository()\n\n\tserviceConfig := service.Config{\n\t\tNoTrackMode: config.NoTrackMode,\n\t\tConnDefaults: config.Defaults,\n\t\tConnsSettings: config.ServicesConnsSettings,\n\t\tDatabasesRE: config.DatabasesRE,\n\t\tDisabledCollectors: config.DisableCollectors,\n\t\tCollectorsSettings: config.CollectorsSettings,\n\t}\n\n\tvar wg sync.WaitGroup\n\tctx, cancel := context.WithCancel(ctx)\n\n\tif config.ServicesConnsSettings == nil || len(config.ServicesConnsSettings) == 0 {\n\t\t// run background discovery, the service repo will be fulfilled at first iteration\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tserviceRepo.StartBackgroundDiscovery(ctx, serviceConfig)\n\t\t\twg.Done()\n\t\t}()\n\t} else {\n\t\t// fulfill service repo using passed services\n\t\tserviceRepo.AddServicesFromConfig(serviceConfig)\n\n\t\t// setup exporters for all services\n\t\terr := serviceRepo.SetupServices(serviceConfig)\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Start auto-update loop if it is enabled.\n\tif config.AutoUpdate != \"off\" {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tac := &autoupdate.Config{\n\t\t\t\tBinaryPath: config.BinaryPath,\n\t\t\t\tBinaryVersion: config.BinaryVersion,\n\t\t\t\tUpdatePolicy: config.AutoUpdate,\n\t\t\t}\n\t\t\tautoupdate.StartAutoupdateLoop(ctx, ac)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\terrCh := make(chan error)\n\tdefer close(errCh)\n\n\t// Start HTTP metrics listener.\n\twg.Add(1)\n\tgo func() {\n\t\tif err := runMetricsListener(ctx, config); err != nil {\n\t\t\terrCh <- err\n\t\t}\n\t\twg.Done()\n\t}()\n\n\t// Start metrics sender if necessary.\n\tif config.SendMetricsURL != \"\" {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tif err := runSendMetricsLoop(ctx, config, serviceRepo); err != nil {\n\t\t\t\terrCh <- err\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\t// Waiting for errors or context cancelling.\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlog.Info(\"exit signaled, stop application\")\n\t\t\tcancel()\n\t\t\twg.Wait()\n\t\t\treturn nil\n\t\tcase err := <-errCh:\n\t\t\tcancel()\n\t\t\twg.Wait()\n\t\t\treturn err\n\t\t}\n\t}\n}", "func (s *TransferServiceOp) Start(ctx context.Context, r *TransferStartRequest) (*TransferStartResponse, *Response, error) {\n\tpath := fmt.Sprintf(\"%s/start_transfer/\", transferBasePath)\n\n\treq, err := s.client.NewRequest(ctx, \"POST\", path, r)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tpayload := &TransferStartResponse{}\n\tresp, err := s.client.Do(ctx, req, payload)\n\n\treturn payload, resp, err\n}", "func (s *Service) Start(ctx context.Context) error {\n\n\t// Ensure topic exists and is configured correctly\n\tif err := s.validateManagementTopic(ctx); err != nil {\n\t\treturn fmt.Errorf(\"could not validate end-to-end topic: %w\", err)\n\t}\n\n\t// Get up-to-date metadata and inform our custom partitioner about the partition count\n\ttopicMetadata, err := s.getTopicMetadata(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get topic metadata after validation: %w\", err)\n\t}\n\tpartitions := len(topicMetadata.Topics[0].Partitions)\n\ts.partitionCount = partitions\n\n\t// finally start everything else (producing, consuming, continous validation, consumer group tracking)\n\tgo s.startReconciliation(ctx)\n\tgo s.startConsumeMessages(ctx)\n\tgo s.startProducer(ctx)\n\n\t// keep track of groups, delete old unused groups\n\tif s.config.Consumer.DeleteStaleConsumerGroups {\n\t\tgo s.groupTracker.start(ctx)\n\t}\n\n\treturn nil\n}", "func StartWriter(c LineChan, exitChan chan int) error {\n\tconn, err := net.Dial(\"tcp\", *host)\n\tif err != nil {\n\t\tlog.Fatal(\"can't connect to server\")\n\t\treturn err\n\t}\n\n\tif *doTls {\n\t\ttlsconfig := tls.Config{\n\t\t\tInsecureSkipVerify: true,\n\t\t}\n\t\tconn = tls.Client(conn, &tlsconfig)\n\t}\n\n\teventChan := make(chan relp.ClientEvent, 20)\n\tgo func() {\n\t\tfor event := range eventChan {\n\t\t\tlog.Print(\"RECEIVED EVENT: \", event)\n\t\t}\n\t}()\n\n\tclient, err := relp.NewClientFrom(conn, *windowSize, nil)\n\tif err != nil {\n\t\tlog.Fatal(\"can't create or connect to server \", err.Error())\n\t\treturn err\n\t}\n\treturn Writer(c, exitChan, client)\n}", "func (ctx *CreateFilterContext) Created(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func (r *Reporter) Start(ctx context.Context) error {\n\tif r.Errors != nil {\n\t\tr.D.Debug(\"starting errors reporter\")\n\t\tif err := r.Errors.Start(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.D.Debug(\"errors reporter started\")\n\t}\n\n\tif r.Logging != nil {\n\t\tr.D.Debug(\"starting logging reporter\")\n\t\tif err := r.Logging.Start(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.D.Debug(\"logging reporter started\")\n\t}\n\n\tif r.Metrics != nil {\n\t\tr.D.Debug(\"starting metrics reporter\")\n\t\tif err := r.Metrics.Start(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.D.Debug(\"metrics reporter started\")\n\t}\n\n\treturn nil\n}", "func getFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tformat := chi.URLParam(r, \"format\")\n\t\tif format == \"\" {\n\t\t\tformat = \"rss\"\n\t\t}\n\t\ts, err := s.ServeFeed(format, plugin)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error serving the feed\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tswitch format {\n\t\tcase \"atom\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/atom+xml\")\n\t\tcase \"json\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tdefault:\n\t\t\tw.Header().Set(\"Content-Type\", \"application/rss+xml\")\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(s))\n\t}\n}", "func (p *OAuthProxy) OAuthStart(rw http.ResponseWriter, req *http.Request, tags []string) {\n\t// The proxy redirects to the authenticator, and provides it with redirectURI (which points\n\t// back to the sso proxy).\n\tlogger := log.NewLogEntry()\n\tremoteAddr := getRemoteAddr(req)\n\n\tif p.isXHR(req) {\n\t\tlogger.WithRemoteAddress(remoteAddr).Error(\"aborting start of oauth flow on XHR\")\n\t\tp.XHRError(rw, req, http.StatusUnauthorized, errors.New(\"cannot continue oauth flow on xhr\"))\n\t\treturn\n\t}\n\n\trequestURI := req.URL.String()\n\tcallbackURL := p.GetRedirectURL(req.Host)\n\n\t// We redirect the browser to the authenticator with a 302 status code. The target URL is\n\t// constructed using the GetSignInURL() method, which encodes the following data:\n\t//\n\t// * client_id: Defined by the OAuth2 RFC https://tools.ietf.org/html/rfc6749.\n\t// Identifies the application requesting authentication information,\n\t// from our perspective this will always be static since the client\n\t// will always be sso proxy\n\t//\n\t// * redirect_uri: Defined by the OAuth2 RFC https://tools.ietf.org/html/rfc6749.\n\t// Informs the authenticator _where_ to redirect the user back to once\n\t// they have authenticated with the auth provider and given us permission\n\t// to access their auth information\n\t//\n\t// * response_type: Defined by the OAuth2 RFC https://tools.ietf.org/html/rfc6749.\n\t// Required by the spec and must be set to \"code\"\n\t//\n\t// * scope: Defined by the OAuth2 RFC https://tools.ietf.org/html/rfc6749.\n\t// Used to offer different auth scopes, but will be unnecessary in the context of SSO.\n\t//\n\t// * state: Defined by the OAuth2 RFC https://tools.ietf.org/html/rfc6749.\n\t// Used to prevent cross site forgery and maintain state across the client and server.\n\n\tkey := aead.GenerateKey()\n\n\tstate := &StateParameter{\n\t\tSessionID: fmt.Sprintf(\"%x\", key),\n\t\tRedirectURI: requestURI,\n\t}\n\n\t// we encrypt this value to be opaque the browser cookie\n\t// this value will be unique since we always use a randomized nonce as part of marshaling\n\tencryptedCSRF, err := p.cookieCipher.Marshal(state)\n\tif err != nil {\n\t\ttags = append(tags, \"csrf_token_error\")\n\t\tp.StatsdClient.Incr(\"application_error\", tags, 1.0)\n\t\tlogger.Error(err, \"failed to marshal state parameter for CSRF token\")\n\t\tp.ErrorPage(rw, req, http.StatusInternalServerError, \"Internal Error\", err.Error())\n\t\treturn\n\t}\n\tp.csrfStore.SetCSRF(rw, req, encryptedCSRF)\n\n\t// we encrypt this value to be opaque the uri query value\n\t// this value will be unique since we always use a randomized nonce as part of marshaling\n\tencryptedState, err := p.cookieCipher.Marshal(state)\n\tif err != nil {\n\t\ttags = append(tags, \"error:marshaling_state_parameter\")\n\t\tp.StatsdClient.Incr(\"application_error\", tags, 1.0)\n\t\tlogger.Error(err, \"failed to marshal state parameter for state query parameter\")\n\t\tp.ErrorPage(rw, req, http.StatusInternalServerError, \"Internal Error\", err.Error())\n\t\treturn\n\t}\n\n\tsigninURL := p.provider.GetSignInURL(callbackURL, encryptedState)\n\tlogger.WithSignInURL(signinURL).Info(\"starting OAuth flow\")\n\thttp.Redirect(rw, req, signinURL.String(), http.StatusFound)\n}", "func StartService() *Service {\n\treturn &Service{\n\t\tstreamch: hwinfo.StreamSharedMem(),\n\t}\n}", "func (this *ReceiverHolder) Start() error {\n\n\tfmt.Println(\"Starting server ...\")\n\t//register shutdown hook\n\tthis.registerShutdownHook()\n\n\ts := http.Server{}\n\ts.Handler = this.engine\n\n\t//show a informative message\n\tthis.receiver.ShowMessage()\n\n\t//start serving.\n\t// go func() {\n\t// \ts.Serve(this.listener)\n\t// }()\n\t// this.registerShutdownHook()\n\treturn s.Serve(this.listener)\n}", "func (client ServicesClient) StartPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"serviceName\": autorest.Encode(\"path\", serviceName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2022-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func Start(ctx context.Context, config *Config) error {\n\tlog.Debug(\"start application\")\n\n\tserviceRepo := service.NewRepository()\n\n\tserviceConfig := service.Config{\n\t\tNoTrackMode: config.NoTrackMode,\n\t\tConnDefaults: config.Defaults,\n\t\tConnsSettings: config.ServicesConnsSettings,\n\t\tDatabasesRE: config.DatabasesRE,\n\t\tDisabledCollectors: config.DisableCollectors,\n\t\tCollectorsSettings: config.CollectorsSettings,\n\t}\n\n\tvar wg sync.WaitGroup\n\tctx, cancel := context.WithCancel(ctx)\n\n\tif config.ServicesConnsSettings == nil {\n\t\t// run background discovery, the service repo will be fulfilled at first iteration\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tserviceRepo.StartBackgroundDiscovery(ctx, serviceConfig)\n\t\t\twg.Done()\n\t\t}()\n\t} else {\n\t\t// fulfill service repo using passed services\n\t\tserviceRepo.AddServicesFromConfig(serviceConfig)\n\n\t\t// setup exporters for all services\n\t\terr := serviceRepo.SetupServices(serviceConfig)\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Start auto-update loop if it is enabled.\n\tif config.AutoUpdate != \"off\" {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tac := &autoupdate.Config{\n\t\t\t\tBinaryPath: config.BinaryPath,\n\t\t\t\tBinaryVersion: config.BinaryVersion,\n\t\t\t\tUpdatePolicy: config.AutoUpdate,\n\t\t\t}\n\t\t\tautoupdate.StartAutoupdateLoop(ctx, ac)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\terrCh := make(chan error)\n\tdefer close(errCh)\n\n\t// Start HTTP metrics listener.\n\twg.Add(1)\n\tgo func() {\n\t\tif err := runMetricsListener(ctx, config); err != nil {\n\t\t\terrCh <- err\n\t\t}\n\t\twg.Done()\n\t}()\n\n\t// Start metrics sender if necessary.\n\tif config.SendMetricsURL != \"\" {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tif err := runSendMetricsLoop(ctx, config, serviceRepo); err != nil {\n\t\t\t\terrCh <- err\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\t// Waiting for errors or context cancelling.\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlog.Info(\"exit signaled, stop application\")\n\t\t\tcancel()\n\t\t\twg.Wait()\n\t\t\treturn nil\n\t\tcase err := <-errCh:\n\t\t\tcancel()\n\t\t\twg.Wait()\n\t\t\treturn err\n\t\t}\n\t}\n}", "func (p *Plugin) Start(ctx context.Context, in *plugin.StartRequest) (*plugin.StartResponse, error) {\n\terr := p.Service.Start(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &plugin.StartResponse{}, nil\n}", "func (sb *StatusBeater) Start(stopChan chan struct{}, publish func(event beat.Event)) {\n\tgo func() {\n\t\tsb.Beat(ServiceStarted, \"Service started\", publish)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-sb.IntervalFunc():\n\t\t\t\tsb.Beat(ServiceRunning, \"Service is Running\", publish)\n\t\t\tcase <-stopChan:\n\t\t\t\tsb.Beat(ServiceStopped, \"Service is Stopped\", publish)\n\t\t\t\tsb.doneChan <- struct{}{}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "func (svc Service) Start() {\n\tif initialized == false {\n\t\tsvc.Initialize()\n\t}\n\n\tcfg := svc.config\n\n\trouter := httprouter.New()\n\n\trname := fmt.Sprintf(\"%s/coord/:zip\", cfg.PrimaryRoute)\n\trouter.GET(rname, svc.coordHandler)\n\tlog.Info(\"added route %s\\n\", rname)\n\n\trname = fmt.Sprintf(\"%s/ziplist/:coord\", cfg.PrimaryRoute)\n\trouter.GET(rname, svc.ziplistHandler)\n\tlog.Info(\"added route %s\\n\", rname)\n\n\trname = fmt.Sprintf(\"%s/status\", cfg.PrimaryRoute)\n\trouter.GET(rname, svc.statusHandler)\n\tlog.Info(\"added route %s\\n\", rname)\n\n\tport := svc.config.Port\n\thost := fmt.Sprintf(\":%d\", port)\n\tlog.Info(\"listening on port %d\\n\", port)\n\n\terr := http.ListenAndServe(host, router)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (c *SeaterController) Accepted(data interface{}) {\n\tc.Code(202)\n\tc.jsonResp(data)\n}", "func (f *Feed) Start(URL string) (chan *storage.RssEntry, error) {\n\tlog.Println(\"Start: \", URL)\n\tf.URL = URL\n\tf.itemPipe = make(chan *storage.RssEntry, 20)\n\n\tinitPipe := make(chan error)\n\tgo f.doFeed(initPipe)\n\terr := <-initPipe\n\tif err != nil {\n\t\tf.disabled = true\n\t\treturn nil, err\n\t}\n\treturn f.itemPipe, nil\n}", "func (m serviceMetrics) ServiceStarting() {\n\tlabels := m.labels()\n\tlabels[\"activity\"] = ActivityStarting\n\tm.activities.With(labels).Inc()\n}", "func (ctx *CreateFeedContext) Created(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 201, r)\n}", "func NewCreateApiregistrationV1beta1APIServiceAccepted() *CreateApiregistrationV1beta1APIServiceAccepted {\n\treturn &CreateApiregistrationV1beta1APIServiceAccepted{}\n}", "func StartHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"startHandler, jobid = %d\", services.JobId)\n\tservices.ChannelMap[services.JobId] = make(chan struct{})\n\tgo services.TaskMock(services.JobId, 0)\n\tservices.JobId++\n}", "func (s *AngularService) Start() (err error) {\n\tif s.options.Cd != \"\" {\n\t\tvar currDir string\n\t\tif currDir, err = os.Getwd(); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif err = os.Chdir(s.options.Cd); err != nil {\n\t\t\treturn\n\t\t}\n\t\tdefer os.Chdir(currDir)\n\t}\n\n\tvar ctx context.Context\n\n\tctx, s.ctxCancel = context.WithCancel(context.Background())\n\ts.done = ctx.Done()\n\n\tcmdArgs := []string{\"serve\"}\n\tif s.options.Port > 0 {\n\t\tcmdArgs = append(cmdArgs, \"--port\", strconv.Itoa(s.options.Port))\n\t}\n\n\tif s.options.Args != nil {\n\t\tcmdArgs = append(cmdArgs, s.options.Args...)\n\t}\n\n\tcmd := exec.CommandContext(ctx, \"ng\", cmdArgs...)\n\n\tif s.options.Stdout != nil {\n\t\tcmd.Stdout = s.options.Stdout\n\t}\n\tif s.options.Stderr != nil {\n\t\tcmd.Stderr = s.options.Stderr\n\t}\n\n\treturn cmd.Start()\n}", "func NewCreateCoreV1NamespacedPodBindingAccepted() *CreateCoreV1NamespacedPodBindingAccepted {\n\n\treturn &CreateCoreV1NamespacedPodBindingAccepted{}\n}" ]
[ "0.56677824", "0.5330943", "0.5168027", "0.50691026", "0.4982396", "0.49238583", "0.4904968", "0.4899284", "0.48081008", "0.46950048", "0.4551081", "0.45348108", "0.4524064", "0.44922796", "0.44420192", "0.4434831", "0.44135892", "0.4350451", "0.43384218", "0.433623", "0.43318483", "0.43248755", "0.43113914", "0.43113914", "0.43013656", "0.4277582", "0.42548534", "0.42327744", "0.42310083", "0.422801", "0.421886", "0.4214863", "0.42126316", "0.42045176", "0.42019558", "0.42008835", "0.41989198", "0.41989198", "0.41934738", "0.4184289", "0.41617832", "0.41595972", "0.41584542", "0.41475883", "0.41410124", "0.41397914", "0.41358393", "0.41332996", "0.4131705", "0.41214746", "0.40959126", "0.40850574", "0.408344", "0.40751198", "0.4067648", "0.40582007", "0.40580964", "0.40578854", "0.40563852", "0.40547568", "0.4049727", "0.40495527", "0.40437353", "0.40341973", "0.4034067", "0.40334693", "0.40270862", "0.40257204", "0.40057543", "0.40049592", "0.4000953", "0.39841214", "0.397863", "0.3977202", "0.3975187", "0.3957154", "0.39569074", "0.39565918", "0.39554763", "0.395237", "0.39509314", "0.39508593", "0.39480877", "0.39455715", "0.3945549", "0.39446867", "0.3941601", "0.3938523", "0.39357948", "0.3932051", "0.3931355", "0.39202973", "0.3919952", "0.39145643", "0.39114845", "0.39109358", "0.39102972", "0.39089188", "0.39062476", "0.39058" ]
0.74448365
0
StartFeedBadRequest runs the method Start of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v/start", id), } req, err := http.NewRequest("POST", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) startCtx, _err := app.NewStartFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } return nil, e } // Perform action _err = ctrl.Start(startCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 400 { t.Errorf("invalid response status code: got %+v, expected 400", rw.Code) } var mt error if resp != nil { var _ok bool mt, _ok = resp.(error) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of error", resp, resp) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StartFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ListFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func RunBadRequest(response http.ResponseWriter, request *http.Request, container interface{}) {\n\terrorController := BadRequest{}\n\terrorController.Init(container, []string{}, request)\n\terrorController.Run(response, request)\n}", "func (ctx *StartFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *StopFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func RenderBadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\treturn\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *CreateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func RenderBadRequest(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, BadRequest(message...))\n}", "func (ctx *GetFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, err *Error) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusBadRequest]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tr = ctxSetErr(r, err)\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultBadRequest(w, r, err)\n\t}\n}", "func DeleteFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func SendBadRequest(w http.ResponseWriter, opts ...ErrorOpts) {\n\tres := errorResponse{\n\t\tCode: CodeBadRequest,\n\t\tMessage: \"Bad request\",\n\t}\n\tres.apply(opts)\n\tSendJSON(w, 400, &res)\n}", "func (ctx *CreateDogContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func NewStartFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*StartFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := StartFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\treturn &rctx, err\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *CreateOutputContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ListFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func ServeBadRequest(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Bad Request\", http.StatusBadRequest)\n}", "func (ctx *CreateFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func BadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(\"400 - Bad Request\"))\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StartContainerNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *GetFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *GetOutputContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func BadRequest(w http.ResponseWriter, err error) {\n\tError(w, http.StatusBadRequest, err)\n}", "func StartContainerNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *UpdateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func RespondBadRequest(err error) events.APIGatewayProxyResponse {\n\treturn Respond(http.StatusBadRequest, Error{Error: err.Error()})\n}", "func (c *SeaterController) TraceBadRequestf(err error, format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tc.traceJSONAbort(nil, 400, msg)\n}", "func BadRequest(message string, w http.ResponseWriter) {\n\tbody := createBodyWithMessage(message)\n\twriteResponse(400, body, w)\n}", "func ErrBadRequest(w http.ResponseWriter, r *http.Request) {\n\tBadRequestWithErr(w, r, errors.New(\"Bad Request\"))\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\th.RenderHTMLStatus(w, http.StatusBadRequest, \"400\", nil)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusBadRequest, apiErrorBadRequest)\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t}\n}", "func (r *Responder) BadRequest() { r.write(http.StatusBadRequest) }", "func BadRequest(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeBadRequest, \"bad request\")\n}", "func (ctx *CreateMessageContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func StopFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func BadRequest(r *http.ResponseWriter) error {\n\tresponse := *r\n\tresponse.WriteHeader(400)\n\treturn nil\n}", "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateContainerBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, command []string, entrypoint []string, env []string, image string, name string, sslRedirect bool, volumes []string, workingDir *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := command\n\t\tquery[\"command\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := entrypoint\n\t\tquery[\"entrypoint\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := env\n\t\tquery[\"env\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{image}\n\t\tquery[\"image\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{name}\n\t\tquery[\"name\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", sslRedirect)}\n\t\tquery[\"sslRedirect\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := volumes\n\t\tquery[\"volumes\"] = sliceVal\n\t}\n\tif workingDir != nil {\n\t\tsliceVal := []string{*workingDir}\n\t\tquery[\"workingDir\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/create\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := command\n\t\tprms[\"command\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := entrypoint\n\t\tprms[\"entrypoint\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := env\n\t\tprms[\"env\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{image}\n\t\tprms[\"image\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{name}\n\t\tprms[\"name\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", sslRedirect)}\n\t\tprms[\"sslRedirect\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := volumes\n\t\tprms[\"volumes\"] = sliceVal\n\t}\n\tif workingDir != nil {\n\t\tsliceVal := []string{*workingDir}\n\t\tprms[\"workingDir\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ShowTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateBadRequestResponse(w http.ResponseWriter, err error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tbytes, _ := json.Marshal(err.Error())\n\tw.Write(bytes)\n}", "func BadRequest(w http.ResponseWriter, text string, err error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(text))\n\tfmt.Println(text, \", Bad request with error:\", err)\n}", "func (fes *FrontEndService) start(ctx context.Context, errCh chan<- error) {\n\tlogrus.Infof(\"FrontEndService: start (monitor BIRD logs=%v)\", fes.logBird)\n\tdefer close(errCh)\n\tdefer logrus.Warnf(\"FrontEndService: Run fnished\")\n\n\tif !fes.logBird {\n\t\tif stdoutStderr, err := exec.CommandContext(ctx, \"bird\", \"-d\", \"-c\", fes.birdConfFile).CombinedOutput(); err != nil {\n\t\t\tlogrus.Errorf(\"FrontEndService: err: \\\"%v\\\", out: %s\", err, stdoutStderr)\n\t\t\terrCh <- err\n\t\t}\n\t} else {\n\t\tcmd := exec.CommandContext(ctx, \"bird\", \"-d\", \"-c\", fes.birdConfFile)\n\t\t// get stderr pipe reader that will be connected with the process' stderr by Start()\n\t\tpipe, err := cmd.StderrPipe()\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"FrontEndService: stderr pipe err: \\\"%v\\\"\", err)\n\t\t\terrCh <- err\n\t\t\treturn\n\t\t}\n\n\t\t// Note: Probably not needed at all, as due to the use of CommandContext()\n\t\t// Start() would kill the process as soon context become done. Which should\n\t\t// lead to an EOF on stderr anyways.\n\t\tgo func() {\n\t\t\t// make sure bufio Scan() can be breaked out from when context is done\n\t\t\tw, ok := cmd.Stderr.(*os.File)\n\t\t\tif !ok {\n\t\t\t\t// not considered a deal-breaker at the moment; see above note\n\t\t\t\tlogrus.Debugf(\"FrontEndService: cmd.Stderr not *os.File\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// when context is done, close File thus signalling EOF to bufio Scan()\n\t\t\tdefer w.Close()\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tlogrus.Infof(\"FrontEndService: context closed, terminate log monitoring...\")\n\t\t\t}\n\t\t}()\n\n\t\t// start the process (BIRD)\n\t\tif err := cmd.Start(); err != nil {\n\t\t\tlogrus.Errorf(\"FrontEndService: start err: \\\"%v\\\"\", err)\n\t\t\terrCh <- err\n\t\t\treturn\n\t\t}\n\n\t\t// scan stderr of previously started process\n\t\t// Note: there could be other log-worthy printouts...\n\t\tscanner := bufio.NewScanner(pipe)\n\t\tfor scanner.Scan() {\n\t\t\tif ok, _ := regexp.MatchString(`Error|<ERROR>|<BUG>|<FATAL>|<WARNING>`, scanner.Text()); ok {\n\t\t\t\tlogrus.Warnf(\"[bird] %v\", scanner.Text())\n\t\t\t} else if ok, _ := regexp.MatchString(`<INFO>|BGP session|Connected|Received:|Started|Neighbor|Startup delayed`, scanner.Text()); ok {\n\t\t\t\tlogrus.Infof(\"[bird] %v\", scanner.Text())\n\t\t\t} else {\n\t\t\t\t//logrus.Debugf(\"[bird] %v\", scanner.Text())\n\t\t\t}\n\t\t}\n\t\tif err := scanner.Err(); err != nil {\n\t\t\tlogrus.Errorf(\"FrontEndService: scanner err: \\\"%v\\\"\", err)\n\t\t\terrCh <- err\n\t\t}\n\n\t\t// wait until process concludes\n\t\t// (should only get here after stderr got closed or scanner returned error)\n\t\tif err := cmd.Wait(); err != nil {\n\t\t\tlogrus.Errorf(\"FrontEndService: err: \\\"%v\\\"\", err)\n\t\t\terrCh <- err\n\t\t}\n\t}\n}", "func badRequestHandler(w http.ResponseWriter, r *http.Request, e error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tio.WriteString(w, e.Error())\n}", "func HS400(w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\tw.Header().Set(\"Cache-Control\", \"no-cache,no-store\")\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(\"400 Bad Request\"))\n}", "func BadRequest(w http.ResponseWriter, errorType, message string) {\n\terrMsg := ErrorMessage{ErrorType: errorType, Message: message}\n\trenderError(w, http.StatusBadRequest, &errMsg)\n}", "func (ctx *PubPshbContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func BadRequest(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"400 Bad Request\")\n\t}\n\treturn Response{\n\t\tStatus: http.StatusBadRequest,\n\t\tData: data,\n\t\tLogging: logging,\n\t}\n}", "func (ctx *CreateItemContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *CreateProfileContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (fes *FrontEndService) Start(ctx context.Context) <-chan error {\n\tlogrus.Infof(\"FrontEndService: Start\")\n\terrCh := make(chan error, 1)\n\tgo fes.start(ctx, errCh)\n\treturn errCh\n}", "func BadRequest(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 400, message...)\n}", "func (ctx *ShowProfileContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *VmContext) reportBadRequest(cause string) {\n\tctx.client <- &types.QemuResponse{\n\t\tVmId: ctx.Id,\n\t\tCode: types.E_BAD_REQUEST,\n\t\tCause: cause,\n\t}\n}", "func (svc *Service) Start(ctx context.Context, svcErrors chan error) {\n\n\t// Start kafka logging\n\tsvc.dataBakerProducer.Channels().LogErrors(ctx, \"error received from kafka data baker producer, topic: \"+svc.cfg.DatabakerImportTopic)\n\tsvc.inputFileAvailableProducer.Channels().LogErrors(ctx, \"error received from kafka input file available producer, topic: \"+svc.cfg.InputFileAvailableTopic)\n\n\t// Start healthcheck\n\tsvc.healthCheck.Start(ctx)\n\n\t// Run the http server in a new go-routine\n\tgo func() {\n\t\tlog.Event(ctx, \"Starting api...\", log.INFO)\n\t\tif err := svc.server.ListenAndServe(); err != nil {\n\t\t\tsvcErrors <- errors.Wrap(err, \"failure in http listen and serve\")\n\t\t}\n\t}()\n}", "func ResponseBadRequest(w http.ResponseWriter) {\n\tvar response Response\n\n\t// Set Response Data\n\tresponse.Status = false\n\tresponse.Code = http.StatusBadRequest\n\tresponse.Message = \"Bad Request\"\n\n\t// Set Response Data to HTTP\n\tResponseWrite(w, response.Code, response)\n}", "func (o *ServiceAddBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *StopAppBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n}", "func (ctx *GetOpmlContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func BadRequestHandler() Handler {\n\treturn HandlerFunc(BadRequest)\n}", "func NewStopFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*StopFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := StopFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\treturn &rctx, err\n}", "func (ctx *DeleteDogContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func (c *context) Failed(msg string) {\n\tc.writer.WriteHeader(http.StatusBadRequest)\n\tfmt.Fprint(c.writer, msg)\n}", "func (ctx *CreateCommentContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *AddListenContext) BadRequest(r *AntError) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.error+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *UploadOpmlContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *CreateHostContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func HS400t(w http.ResponseWriter, errmsg string) {\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\tw.Header().Set(\"Cache-Control\", \"no-cache,no-store\")\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(\"400 Bad Request: \" + errmsg))\n}", "func ListTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateFeedCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 201 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 201\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (o *PutProjectProjectNameStageStageNameServiceServiceNameResourceBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *GetDocumentBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func BadRequest(w http.ResponseWriter, err error) {\n\t(Response{Error: err.Error()}).json(w, http.StatusBadRequest)\n}", "func (ctx *RegisterAuthenticationContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewCreateServiceBadRequest() *CreateServiceBadRequest {\n\treturn &CreateServiceBadRequest{}\n}", "func (ctx *CreateOfferContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *GetDogsByHostIDHostContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func (ctx *SubPshbContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *CreateSecretsContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func CreateTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, body string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewCreateFeedBadRequest() *CreateFeedBadRequest {\n\treturn &CreateFeedBadRequest{}\n}", "func (o *ServiceInstanceLastOperationGetBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func BadReqErr(w http.ResponseWriter, desc string) {\n\tsetError(w, desc, http.StatusBadRequest)\n}", "func (o *GetIndexSearchBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (r *ManagedServicePollRequest) StartContext(ctx context.Context) (response *ManagedServicePollResponse, err error) {\n\tresult, err := helpers.PollContext(ctx, r.interval, r.statuses, r.predicates, r.task)\n\tif result != nil {\n\t\tresponse = &ManagedServicePollResponse{\n\t\t\tresponse: result.(*ManagedServiceGetResponse),\n\t\t}\n\t}\n\treturn\n}", "func (o *GetTaskTaskIDBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (o *V1CreateHelloBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (ctx *PostEventContext) BadRequest(r *AntError) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.error+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}" ]
[ "0.6157987", "0.5834709", "0.5809212", "0.5577873", "0.53529215", "0.530886", "0.5166492", "0.51471514", "0.51280826", "0.50080276", "0.48995003", "0.48464987", "0.4814051", "0.47568718", "0.47410375", "0.4711494", "0.46939573", "0.46373233", "0.4623745", "0.45515543", "0.45384857", "0.45237026", "0.45042798", "0.4502551", "0.44976467", "0.44897377", "0.44792753", "0.44379476", "0.44301322", "0.44016352", "0.43969116", "0.43850005", "0.43839654", "0.43772355", "0.43605176", "0.43572658", "0.43520904", "0.43353534", "0.43195677", "0.43087143", "0.4296593", "0.4292642", "0.4283703", "0.42717665", "0.4271212", "0.42525378", "0.42438197", "0.42276457", "0.42079714", "0.41915816", "0.41870937", "0.4178767", "0.41761646", "0.41743743", "0.41678137", "0.41608712", "0.4158735", "0.4142715", "0.41277054", "0.4126391", "0.4116702", "0.41164175", "0.41085485", "0.40989882", "0.40975288", "0.40945953", "0.40925217", "0.4087991", "0.40868992", "0.40845275", "0.40830058", "0.40758175", "0.407185", "0.40629894", "0.40602875", "0.4056847", "0.4055156", "0.40405372", "0.40380353", "0.4026175", "0.4021875", "0.4016983", "0.40076134", "0.4006956", "0.40034482", "0.39991322", "0.39954153", "0.39899197", "0.39881852", "0.3987242", "0.39864734", "0.39832607", "0.3981927", "0.39785966", "0.3976157", "0.39672625", "0.39656827", "0.39534765", "0.39487207", "0.39456463" ]
0.7233614
0
StartFeedNotFound runs the method Start of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter { // Setup service var ( logBuf bytes.Buffer respSetter goatest.ResponseSetterFunc = func(r interface{}) {} ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v/start", id), } req, err := http.NewRequest("POST", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) startCtx, _err := app.NewStartFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil } // Perform action _err = ctrl.Start(startCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 404 { t.Errorf("invalid response status code: got %+v, expected 404", rw.Code) } // Return results return rw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *GetFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StartContainerNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StartFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ListFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *UpdateFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (c *Context) NotFound() {\n\tc.JSON(404, ResponseWriter(404, \"page not found\", nil))\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NotFound(w ResponseWriter, r *Request) { Error(w, \"404 page not found\", StatusNotFound) }", "func (ctx *GetFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFoundHandler() ServiceHttpHandler { return ServiceHttpHandler{Handler: NotFound} }", "func NotFound(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": true, \"msg\": \"`+msg+`\"}`, 404, service, \"application/json\")\n\treturn nil\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (f WalkFunc) Do(ctx context.Context, call *Call) { call.Reply(http.StatusNotFound, nil) }", "func writeInsightNotFound(w http.ResponseWriter, str string) {\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\tio.WriteString(w, str)\n}", "func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteDogContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetByIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func LogsContainerNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string, follow bool, since *time.Time, stderr bool, stdout bool, tail string, timestamps bool, until *time.Time) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", follow)}\n\t\tquery[\"follow\"] = sliceVal\n\t}\n\tif since != nil {\n\t\tsliceVal := []string{(*since).Format(time.RFC3339)}\n\t\tquery[\"since\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stderr)}\n\t\tquery[\"stderr\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stdout)}\n\t\tquery[\"stdout\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{tail}\n\t\tquery[\"tail\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", timestamps)}\n\t\tquery[\"timestamps\"] = sliceVal\n\t}\n\tif until != nil {\n\t\tsliceVal := []string{(*until).Format(time.RFC3339)}\n\t\tquery[\"until\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/logs\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", follow)}\n\t\tprms[\"follow\"] = sliceVal\n\t}\n\tif since != nil {\n\t\tsliceVal := []string{(*since).Format(time.RFC3339)}\n\t\tprms[\"since\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stderr)}\n\t\tprms[\"stderr\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stdout)}\n\t\tprms[\"stdout\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{tail}\n\t\tprms[\"tail\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", timestamps)}\n\t\tprms[\"timestamps\"] = sliceVal\n\t}\n\tif until != nil {\n\t\tsliceVal := []string{(*until).Format(time.RFC3339)}\n\t\tprms[\"until\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tlogsCtx, _err := app.NewLogsContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Logs(logsCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (r *Responder) NotFound() { r.write(http.StatusNotFound) }", "func StartContainerNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (this *Context) NotFound(message string) {\n\tthis.ResponseWriter.WriteHeader(404)\n\tthis.ResponseWriter.Write([]byte(message))\n}", "func (c *Context) NotFound() {\n\tc.Handle(http.StatusNotFound, \"\", nil)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tjson.NewEncoder(w).Encode(&ServiceError{\n\t\tMessage: \"Endpoint not found\",\n\t\tSolution: \"See / for possible directives\",\n\t\tErrorCode: http.StatusNotFound,\n\t})\n}", "func (ctx *ShowCommentContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (a *API) getNotFound(ctx context.Context, res *common.HttpResponseWriter) error {\n\tres.WriteHeader(http.StatusNotFound)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\tm := TemplateMapFromContext(r.Context())\n\t\tm.Title(http.StatusText(http.StatusNotFound))\n\t\th.RenderHTMLStatus(w, http.StatusNotFound, \"404\", m)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusNotFound, http.StatusText(http.StatusNotFound))\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t}\n}", "func TestServiceStart(t *testing.T) {\n\trunTest(t, func(s *res.Service) {\n\t\ts.Handle(\"model\", res.GetResource(func(r res.GetRequest) { r.NotFound() }))\n\t}, nil)\n}", "func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request) {\n\twriteResponse(r, w, http.StatusNotFound, &SimpleResponse{\n\t\tTraceID: tracing.FromContext(r.Context()),\n\t\tMessage: \"not found\",\n\t})\n}", "func (app *App) NotFound(handler handlerFunc) {\n\tapp.craterRequestHandler.notFoundHandler = func(w http.ResponseWriter, r *http.Request) {\n\t\treq := newRequest(r, make(map[string]string))\n\t\tres := newResponse(w)\n\t\thandler(req, res)\n\n\t\tapp.sendResponse(req, res)\n\t}\n}", "func ShowTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewStartFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*StartFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := StartFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\treturn &rctx, err\n}", "func (ctx *GetDogsByHostIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowProfileContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (h *HandleHelper) NotFound() {\n\terrResponse(http.StatusNotFound,\n\t\t\"the requested resource could not be found\",\n\t)(h.w, h.r)\n}", "func (ctx *ShowSecretsContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (web *WebServer) NotFound(handler http.HandlerFunc) {\n\tweb.router.NotFound(handler)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusNotFound]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultNotFound(w, r)\n\t}\n}", "func (ctx *GetAllHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (client HTTPSuccessClient) Head404Sender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *DeleteFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter) {\n\trenderError(w, http.StatusNotFound, nil)\n}", "func SimpleNotFoundHandler(c *Context) error {\n\thttp.NotFound(c.W, c.R)\n\treturn nil\n}", "func Test_Ctx_SendFile_404(t *testing.T) {\n\tt.Parallel()\n\tapp := New()\n\tapp.Get(\"/\", func(ctx *Ctx) {\n\t\terr := ctx.SendFile(\"./john_dow.go/\")\n\t\tutils.AssertEqual(t, false, err == nil)\n\t})\n\n\tresp, err := app.Test(httptest.NewRequest(\"GET\", \"/\", nil))\n\tutils.AssertEqual(t, nil, err)\n\tutils.AssertEqual(t, StatusNotFound, resp.StatusCode)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) { Error(w, \"404 page not found\", http.StatusNotFound) }", "func NotFound(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeNotFound, \"not found\")\n}", "func DefaultHandler(w http.ResponseWriter, _ *http.Request) {\r\n\tlog.Print(\"In DefaultHandler\")\r\n\r\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\r\n\tw.WriteHeader(http.StatusNotFound)\r\n\tw.Write( []byte (\"This is the tech_test service\"))\r\n}", "func (ctx *PlayLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (ctx *AddLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter) {\n\thttp.Error(w, \"404 not found!!!\", http.StatusNotFound)\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func (ctx *GetLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (wa *webapi) defaultHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n}", "func (ctx *ListItemContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tresponse := response.CreateResponse()\n\tresponse.SendDataWithStatusCode(w, \"not found\", http.StatusOK)\n}", "func RenderNotFound(w http.ResponseWriter) error {\n\tw.Header().Add(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\treturn template.ExecuteTemplate(w, \"404.amber\", nil)\n}", "func NotFound(w http.ResponseWriter, err error) {\n\tError(w, http.StatusNotFound, err)\n}", "func (ctx *GetUsersContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func SendNotFound(c *gin.Context) {\n\tSendHTML(http.StatusNotFound, c, \"notfound\", nil)\n}", "func NewGetV1ServicesServiceIDTypeWebsocketNotFound() *GetV1ServicesServiceIDTypeWebsocketNotFound {\n\treturn &GetV1ServicesServiceIDTypeWebsocketNotFound{}\n}", "func notfound(out http.ResponseWriter, format string, args ...interface{}) {\n\tsend(http.StatusNotFound, out, format, args...)\n}", "func (ctx *MoveLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *AcceptOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (he *HTTPErrors) NotFound(ctx *Context) {\n\the.Emit(http.StatusNotFound, ctx)\n}", "func (ctx *ListMessageContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func handleDefault(w http.ResponseWriter, req *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tfmt.Fprintf(w, \"No such page: %s\\n\", req.URL)\n}", "func (nse ErrNoSuchEndpoint) NotFound() {}", "func (ctx *UpdateFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *DeleteOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func HandleNotFound(lgc *logic.Logic) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlgc.Logger().WithFields(log.Fields{\n\t\t\t\"path\": r.URL.Path, \"method\": r.Method,\n\t\t\t\"message\": \"404 Page Not Found\",\n\t\t}).Info(\"request start\")\n\t\tw.WriteHeader(404)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write([]byte(fmt.Sprintf(\n\t\t\t`{\"message\":\"Page Not Found %s %s\"}`, r.Method, r.URL.Path)))\n\t}\n}", "func MaybeStart(serviceName string, f func(wg *sync.WaitGroup), wg *sync.WaitGroup) {\n\tif !viper.GetBool(serviceName + \".enabled\") {\n\t\treturn\n\t}\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tf(wg)\n\t}()\n}", "func (ctx *ListOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func RenderNotFound(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, NotFound(message...))\n}", "func NotFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"Not Found: %s\", r.URL.String())\n\tservice.WriteProblem(w, \"No route found\", \"ERROR_NOT_FOUND\", http.StatusNotFound, errors.New(\"Route not found\"))\n}", "func (ctx *CreateUserContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func StartControllerService() {\n\tserviceName := common.ControllerServiceName\n\tcfg := common.SetupServerConfig(configure.NewCommonConfigure())\n\tif e := os.Setenv(\"port\", fmt.Sprintf(\"%d\", cfg.GetServiceConfig(serviceName).GetPort())); e != nil {\n\t\tlog.Panic(e)\n\t}\n\n\tmeta, err := metadata.NewCassandraMetadataService(cfg.GetMetadataConfig())\n\tif err != nil {\n\t\t// no metadata service - just fail early\n\t\tlog.WithField(common.TagErr, err).Fatal(`unable to instantiate metadata service (did you run ./scripts/setup_cassandra_schema.sh?)`)\n\t}\n\thwInfoReader := common.NewHostHardwareInfoReader(meta)\n\treporter := common.NewMetricReporterWithHostname(cfg.GetServiceConfig(serviceName))\n\tdClient := dconfigclient.NewDconfigClient(cfg.GetServiceConfig(serviceName), serviceName)\n\tsVice := common.NewService(serviceName, uuid.New(), cfg.GetServiceConfig(serviceName), common.NewUUIDResolver(meta), hwInfoReader, reporter, dClient, common.NewBypassAuthManager())\n\tmcp, tc := controllerhost.NewController(cfg, sVice, meta, common.NewDummyZoneFailoverManager())\n\tmcp.Start(tc)\n\tcommon.ServiceLoop(cfg.GetServiceConfig(serviceName).GetPort()+diagnosticPortOffset, cfg, mcp.Service)\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NotFoundHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tapi.WriteNotFound(w)\n\t})\n}", "func NotFound(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"404 Not Found\")\n\t}\n\treturn Response{Status: http.StatusNotFound, Data: data, Logging: logging}\n}", "func (c *Context) NotFound() error {\n\treturn c.M.opt.HandleNotFound(c)\n}", "func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func SendNotFound(w http.ResponseWriter, opts ...ErrorOpts) {\n\tres := errorResponse{\n\t\tCode: CodeNotFound,\n\t\tMessage: \"Not found\",\n\t}\n\tres.apply(opts)\n\tSendJSON(w, 404, &res)\n}", "func (ctx *ShowUserContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func notFoundHandler(res http.ResponseWriter, req *http.Request) {\n\tdefer server.LogRequest(req, http.StatusNotFound)\n\n\tres.WriteHeader(http.StatusNotFound)\n\trenderBaseTemplate(res, \"404.html\", nil)\n}", "func NotFound(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 404, message...)\n}", "func (w *ServiceWriter) Start() {\n\tgo func() {\n\t\tdefer watchdog.LogOnPanic()\n\t\tw.Run()\n\t}()\n}" ]
[ "0.63470036", "0.60626704", "0.60222155", "0.58633584", "0.5558933", "0.5548775", "0.5536885", "0.54864746", "0.5415606", "0.5288339", "0.52303463", "0.5075732", "0.50053626", "0.49644378", "0.49644378", "0.4963207", "0.49327728", "0.49130467", "0.49030197", "0.48316094", "0.48251182", "0.48051655", "0.4793085", "0.47871864", "0.47830027", "0.47525978", "0.47521204", "0.47517762", "0.47379997", "0.47345877", "0.47314852", "0.47080776", "0.4706084", "0.4703327", "0.4688606", "0.4665027", "0.46587443", "0.46583062", "0.4655974", "0.46549758", "0.46465212", "0.46304533", "0.4626072", "0.4620683", "0.46165282", "0.4616009", "0.46141803", "0.46134517", "0.45862973", "0.4569688", "0.45681667", "0.4553215", "0.45423982", "0.45253012", "0.4509019", "0.45015967", "0.44948488", "0.4488696", "0.44672823", "0.444067", "0.44338098", "0.44212326", "0.44212326", "0.440817", "0.44037345", "0.43956628", "0.43938163", "0.43934298", "0.4390767", "0.4390658", "0.43872076", "0.43785456", "0.4377173", "0.43597513", "0.43572545", "0.43537942", "0.43456164", "0.4342676", "0.4329005", "0.4323974", "0.43125698", "0.43115675", "0.43115675", "0.43097696", "0.4302296", "0.42992836", "0.42975712", "0.4288838", "0.42880765", "0.4286205", "0.4281862", "0.42781374", "0.42778897", "0.42651564", "0.42631373", "0.42326567", "0.42257708", "0.42237735", "0.42213795", "0.4215461" ]
0.7374306
0
StopFeedAccepted runs the method Stop of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func StopFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter { // Setup service var ( logBuf bytes.Buffer respSetter goatest.ResponseSetterFunc = func(r interface{}) {} ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v/stop", id), } req, err := http.NewRequest("POST", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) stopCtx, _err := app.NewStopFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil } // Perform action _err = ctrl.Stop(stopCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 202 { t.Errorf("invalid response status code: got %+v, expected 202", rw.Code) } // Return results return rw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *StopFeedContext) Accepted() error {\n\tctx.ResponseData.WriteHeader(202)\n\treturn nil\n}", "func StartFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewStopFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*StopFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := StopFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\treturn &rctx, err\n}", "func (ctx *StartFeedContext) Accepted() error {\n\tctx.ResponseData.WriteHeader(202)\n\treturn nil\n}", "func NewStopAppAccepted() *StopAppAccepted {\n\treturn &StopAppAccepted{}\n}", "func (f *HTTPFeeder) Stop(stopChan chan bool) {\n\tif f.IsRunning {\n\t\tf.Server.Shutdown(context.TODO())\n\t}\n\tclose(stopChan)\n}", "func (_m *FakeScheduleService) stopApplied(_a0 models.AlertRuleKey) {\n\t_m.Called(_a0)\n}", "func (client ServicesClient) StopSender(req *http.Request) (future ServicesStopFuture, err error) {\n\tvar resp *http.Response\n\tfuture.FutureAPI = &azure.Future{}\n\tresp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))\n\tif err != nil {\n\t\treturn\n\t}\n\tvar azf azure.Future\n\tazf, err = azure.NewFutureFromResponse(resp)\n\tfuture.FutureAPI = &azf\n\tfuture.Result = future.result\n\treturn\n}", "func (h *Handler) cancel(c echo.Context) (e error) {\n\tctx := c.(*cuxs.Context)\n\tvar r cancelRequest\n\tvar id int64\n\tvar sr *model.SalesReturn\n\n\tif id, e = common.Decrypt(ctx.Param(\"id\")); e == nil {\n\t\tif sr, e = ShowSalesReturn(\"id\", id); e == nil {\n\t\t\tr.SR = sr\n\t\t\tif e = ctx.Bind(&r); e == nil {\n\t\t\t\tif e = CancelSalesReturn(sr); e == nil {\n\t\t\t\t\tif e = UpdateExpense(sr); e == nil {\n\t\t\t\t\t\tctx.Data(sr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\te = echo.ErrNotFound\n\t\t}\n\t}\n\n\treturn ctx.Serve(e)\n}", "func (ss *StreamerServer) handleStop(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tglog.Info(\"Got stop request.\")\n\tss.streamer.Stop()\n\tw.WriteHeader(http.StatusOK)\n}", "func (a *Animator) Stop() {\n\tif a.cancelRun != nil {\n\t\ta.Log.Info(\"Stopping VolumeSeriesRequest Animator\")\n\t\ta.stoppedChan = make(chan struct{})\n\t\ta.cancelRun()\n\t\tselect {\n\t\tcase <-a.stoppedChan: // response received\n\t\tcase <-time.After(a.StopPeriod):\n\t\t\ta.Log.Warning(\"Timed out waiting for termination\")\n\t\t}\n\t}\n\ta.Log.Info(\"Stopped VolumeSeriesRequest Animator\")\n}", "func liveStopHandler(cache *CacheManager, serverChan chan error) RouteHandler {\n\treturn func (w http.ResponseWriter, r *http.Request, params map[string]string) {\n\t\terr := cache.Stop(params[\"filename\"])\n\t\tif err != nil {\n\t\t\tserverChan <- err\n\t\t\thttp.Error(w, \"Invalid request !\", http.StatusNotFound)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"\")\n\t\t}\n\t}\n}", "func (c *Context) Stop() {\n\tc.stopChannel <- struct{}{}\n}", "func (c *Controller) Stop() error {\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\n\tif !c.started {\n\t\treturn fmt.Errorf(\"webhook server has not been started\")\n\t}\n\tif err := admissionregistration.Instance().DeleteMutatingWebhookConfiguration(storkAdmissionController); err != nil {\n\t\tlog.Errorf(\"unable to delete webhook configuration, %v\", err)\n\t\treturn err\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tif err := c.server.Shutdown(ctx); err != nil {\n\t\treturn err\n\t}\n\tc.started = false\n\treturn nil\n}", "func Stop(channel string, uid int, rid string, sid string) error {\n\trequestBody := fmt.Sprintf(`\n\t\t{\n\t\t\t\"cname\": \"%s\",\n\t\t\t\"uid\": \"%d\",\n\t\t\t\"clientRequest\": {\n\t\t\t}\n\t\t}\n\t`, channel, uid)\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.agora.io/v1/apps/\"+viper.GetString(\"APP_ID\")+\"/cloud_recording/resourceid/\"+rid+\"/sid/\"+sid+\"/mode/mix/stop\",\n\t\tbytes.NewBuffer([]byte(requestBody)))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.SetBasicAuth(viper.GetString(\"CUSTOMER_ID\"), viper.GetString(\"CUSTOMER_CERTIFICATE\"))\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tvar result map[string]string\n\tjson.NewDecoder(resp.Body).Decode(&result)\n\n\treturn nil\n}", "func (c *ContextCollector) Stop(stoppedChan chan bool) {\n\tif c.Running {\n\t\tclose(c.StopCounterChan)\n\t\t<-c.StoppedCounterChan\n\t\tc.StoppedChan = stoppedChan\n\t\tclose(c.StopChan)\n\t\tc.Running = false\n\t}\n}", "func (c *Context) watchStop(walker *ContextGraphWalker) (chan struct{}, <-chan struct{}) {\n\tstop := make(chan struct{})\n\twait := make(chan struct{})\n\n\t// get the runContext cancellation channel now, because releaseRun will\n\t// write to the runContext field.\n\tdone := c.runContext.Done()\n\n\tgo func() {\n\t\tdefer close(wait)\n\t\t// Wait for a stop or completion\n\t\tselect {\n\t\tcase <-done:\n\t\t\t// done means the context was canceled, so we need to try and stop\n\t\t\t// providers.\n\t\tcase <-stop:\n\t\t\t// our own stop channel was closed.\n\t\t\treturn\n\t\t}\n\n\t\t// If we're here, we're stopped, trigger the call.\n\n\t\t{\n\t\t\t// Copy the providers so that a misbehaved blocking Stop doesn't\n\t\t\t// completely hang Terraform.\n\t\t\twalker.providerLock.Lock()\n\t\t\tps := make([]ResourceProvider, 0, len(walker.providerCache))\n\t\t\tfor _, p := range walker.providerCache {\n\t\t\t\tps = append(ps, p)\n\t\t\t}\n\t\t\tdefer walker.providerLock.Unlock()\n\n\t\t\tfor _, p := range ps {\n\t\t\t\t// We ignore the error for now since there isn't any reasonable\n\t\t\t\t// action to take if there is an error here, since the stop is still\n\t\t\t\t// advisory: Terraform will exit once the graph node completes.\n\t\t\t\tp.Stop()\n\t\t\t}\n\t\t}\n\n\t\t{\n\t\t\t// Call stop on all the provisioners\n\t\t\twalker.provisionerLock.Lock()\n\t\t\tps := make([]ResourceProvisioner, 0, len(walker.provisionerCache))\n\t\t\tfor _, p := range walker.provisionerCache {\n\t\t\t\tps = append(ps, p)\n\t\t\t}\n\t\t\tdefer walker.provisionerLock.Unlock()\n\n\t\t\tfor _, p := range ps {\n\t\t\t\t// We ignore the error for now since there isn't any reasonable\n\t\t\t\t// action to take if there is an error here, since the stop is still\n\t\t\t\t// advisory: Terraform will exit once the graph node completes.\n\t\t\t\tp.Stop()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn stop, wait\n}", "func (client ServicesClient) StopPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"serviceName\": autorest.Encode(\"path\", serviceName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2022-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func (core *coreService) Stop(_ context.Context) error {\n\tif core.messageBatcher != nil {\n\t\tif err := core.messageBatcher.Stop(); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to stop message batcher\")\n\t\t}\n\t}\n\treturn core.chainListener.Stop()\n}", "func ReceiveTwitterOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TwitterController, oauthToken string, oauthVerifier string, state string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{oauthToken}\n\t\tquery[\"oauth_token\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{oauthVerifier}\n\t\tquery[\"oauth_verifier\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{state}\n\t\tquery[\"state\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/twitter/receive\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{oauthToken}\n\t\tprms[\"oauth_token\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{oauthVerifier}\n\t\tprms[\"oauth_verifier\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{state}\n\t\tprms[\"state\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TwitterTest\"), rw, req, prms)\n\treceiveCtx, _err := app.NewReceiveTwitterContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Receive(receiveCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (s *apateletService) StopApatelet(context.Context, *empty.Empty) (*empty.Empty, error) {\n\tlog.Printf(\"received request to stop\")\n\n\tgo func() {\n\t\ttime.Sleep(time.Second) // Wait a bit to properly answer the control plane\n\n\t\ts.stopChannel <- struct{}{}\n\t}()\n\n\treturn new(empty.Empty), nil\n}", "func (pf *PortForwarder) Stop(ctx context.Context, req *waterfall_grpc_pb.PortForwardRequest) (*empty_pb.Empty, error) {\n\tpf.sessionsMutex.Lock()\n\tdefer pf.sessionsMutex.Unlock()\n\n\tlog.Printf(\"Stopping forwarding %s ...\\n\", req.Session.Src)\n\n\ts, ok := pf.sessions[req.Session.Src]\n\tif !ok {\n\t\treturn &empty_pb.Empty{}, nil\n\t}\n\ts.cancel()\n\n\tdelete(pf.sessions, req.Session.Src)\n\treturn &empty_pb.Empty{}, s.lis.Close()\n}", "func (pf *PortForwarder) Stop(ctx context.Context, req *waterfall_grpc.PortForwardRequest) (*empty_pb.Empty, error) {\n\tpf.sessionsMutex.Lock()\n\tdefer pf.sessionsMutex.Unlock()\n\n\tlog.Printf(\"Stopping forwarding %s ...\\n\", req.Session.Src)\n\n\ts, ok := pf.sessions[req.Session.Src]\n\tif !ok {\n\t\treturn &empty_pb.Empty{}, nil\n\t}\n\ts.cancel()\n\n\tdelete(pf.sessions, req.Session.Src)\n\treturn &empty_pb.Empty{}, s.lis.Close()\n}", "func (d *ServerlessDemultiplexer) Stop(flush bool) {\n\tif flush {\n\t\td.ForceFlushToSerializer(time.Now(), true)\n\t}\n\n\td.statsdWorker.stop()\n\n\tif d.forwarder != nil {\n\t\td.forwarder.Stop()\n\t}\n}", "func (s *server) stoppableContext(ctx context.Context) context.Context {\n\ts.stopMu.Lock()\n\tdefer s.stopMu.Unlock()\n\n\tstoppable, cancel := context.WithCancel(ctx)\n\tgo mergeStop(stoppable, cancel, s.stopCh)\n\treturn stoppable\n}", "func StopHandler(w http.ResponseWriter, r *http.Request) {\n\t// services.JobProgress and quit\n\tcurrentJobid, _ := strconv.Atoi(r.URL.Path[6:])\n\tch := services.ChannelMap[currentJobid]\n\tclose(ch)\n\tdelete(services.ChannelMap, currentJobid)\n\tfmt.Fprintf(w, \"stopHandler\")\n}", "func (m *Middleware) Stop(_ management.CommandWriter) error {\n\treturn nil\n}", "func (w *ServiceWriter) Stop() {\n\tclose(w.exit)\n\tw.exitWG.Wait()\n}", "func (client DeploymentsClient) StopSender(req *http.Request) (future DeploymentsStopFuture, err error) {\n\tvar resp *http.Response\n\tfuture.FutureAPI = &azure.Future{}\n\tresp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))\n\tif err != nil {\n\t\treturn\n\t}\n\tvar azf azure.Future\n\tazf, err = azure.NewFutureFromResponse(resp)\n\tfuture.FutureAPI = &azf\n\tfuture.Result = future.result\n\treturn\n}", "func (_SweetToken *SweetTokenCaller) Stopped(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _SweetToken.contract.Call(opts, out, \"stopped\")\n\treturn *ret0, err\n}", "func (a *Client) StopPacketGenerator(params *StopPacketGeneratorParams, opts ...ClientOption) (*StopPacketGeneratorNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewStopPacketGeneratorParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"StopPacketGenerator\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/packet/generators/{id}/stop\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &StopPacketGeneratorReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*StopPacketGeneratorNoContent)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for StopPacketGenerator: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (rtspService *RTSPService) Stop(msg *wssapi.Msg) (err error) {\n\treturn\n}", "func ExampleStreamingEndpointsClient_BeginStop() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclient, err := armmediaservices.NewStreamingEndpointsClient(\"0a6ec948-5a62-437d-b9df-934dc7c1b722\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := client.BeginStop(ctx,\n\t\t\"mediaresources\",\n\t\t\"slitestmedia10\",\n\t\t\"myStreamingEndpoint1\",\n\t\tnil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t_, err = poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n}", "func (c *ConsumerManager) Stop(ctx context.Context) (err error) {\n\terrC := make(chan error)\n\n\tgo func() {\n\t\terrC <- c.stop()\n\t}()\n\n\tselect {\n\tcase err = <-errC:\n\tcase <-ctx.Done():\n\t\terr = ErrStopDeadlineExceeded\n\t}\n\n\treturn\n}", "func chainStopped(service moleculer.Service, mixin *moleculer.Mixin) moleculer.Service {\n\tif mixin.Stopped != nil {\n\t\tsvcHook := service.Stopped\n\t\tservice.Stopped = func(ctx moleculer.BrokerContext, svc moleculer.Service) {\n\t\t\tif svcHook != nil {\n\t\t\t\tsvcHook(ctx, svc)\n\t\t\t}\n\t\t\tmixin.Stopped(ctx, svc)\n\t\t}\n\t}\n\treturn service\n}", "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (client JobClient) StopSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "func (c *consumerImpl) Stop() {\n\tc.logger.Info(\"Stopping consumer\")\n\tc.cancelFunc()\n\tc.consumerHandler.stop()\n}", "func cancel(echoReq *alexa.EchoRequest) *alexa.EchoResponse {\n\tmsg := \"Goodbye\"\n\techoResp := alexa.NewEchoResponse().OutputSpeech(msg).EndSession(true)\n\treturn echoResp\n}", "func (s *StreamingController) StopStreaming(c *gin.Context) {\n\tvar err error\n\n\t// Request body validation\n\tvar requestBody request.StopStreaming\n\terr = c.ShouldBindJSON(&requestBody)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": errInvalidRequest.Error(),\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\t// Update the streaming end time in DB\n\tdb := dbConn.OpenConnection()\n\tdefer db.Close()\n\n\tstreamingQuery := \"UPDATE streamings SET end_time = $1 WHERE id = $2\"\n\t_, err = db.Exec(streamingQuery, time.Now(), requestBody.ID)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": errFailedUpdateStreamingDB.Error(),\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\t// Stop the streaming goroutine\n\tclose(quit)\n\twg.Wait()\n\tc.JSON(http.StatusOK, gin.H{\"success\": true})\n}", "func (c *SeaterController) Accepted(data interface{}) {\n\tc.Code(202)\n\tc.jsonResp(data)\n}", "func (hr *HttpReceiver) TcStop() error {\n\treturn hr.tcServer.stop()\n}", "func twitterStream(res http.ResponseWriter, req *http.Request) {\n log.Info(\"WS Twitter Request: \",req.URL.Query())\n filter := req.URL.Query()[\"filter\"]\n if filter != nil {\n \n // Upgrades the http server connection to the websocket protocol \n conn, _ := upgrader.Upgrade(res, req, nil)\n \n filters = append(filters,filter[0]);\n conns[filter[0]] = conn;\n printConnsFiltes()\n \n // Stop the twitter stream in order to stream again with new filter\n stopGlobTwitterStream()\n \t\n \t// Read only tweet from twitter stream\n \tdemux := twitter.NewSwitchDemux()\n \tdemux.Tweet = func(tweet *twitter.Tweet) {\n \t text := tweet.Text\n\t \n \t for _, v := range filters {\n \t if strings.Contains(text,v) && conns[v] != nil {\n \t wsWriter(conns[v],text)\n \t } \n \t }\n \t}\n \t\n \tfmt.Println(\"Starting Stream...\")\n \t\n \t// Filter\n \tfilterParams := &twitter.StreamFilterParams{\n \t\tTrack: filters,\n \t\tStallWarnings: twitter.Bool(true),\n \t}\n \t\n \tstream, err := client.Streams.Filter(filterParams)\n \t\n \tglobalTwitterStream = stream\n \t\n \tfmt.Println(reflect.TypeOf(stream))\n \tif err != nil {\n \t\tlog.Error(err)\n \t}\n \t\n go wsReader(conn,filter[0],stream) // Read messages from the websocket or stop websoket and twitter stream\n \tgo demux.HandleChan(stream.Messages) // Receive twitter messages until stream quits\n \n } else {\n fmt.Fprintf(res, \"Warning: Filter param is required to stream the data from Twitter\")\n }\n}", "func (s *Service) Do(ctx context.Context) error {\n\tlog.Printf(\"[INFO] starting youtube service\")\n\n\tif s.SkipShorts > 0 {\n\t\tlog.Printf(\"[DEBUG] skip youtube episodes shorter than %v\", s.SkipShorts)\n\t}\n\tfor _, f := range s.Feeds {\n\t\tlog.Printf(\"[INFO] youtube feed %+v\", f)\n\t}\n\n\ttick := time.NewTicker(s.CheckDuration)\n\tdefer tick.Stop()\n\n\tif err := s.procChannels(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to process channels\")\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-tick.C:\n\t\t\tif err := s.procChannels(ctx); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to process channels\")\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *streamStrategy) Stop() {\n\tclose(s.inputChan)\n\t<-s.done\n}", "func (c *Controller) Stop(ctx hive.HookContext) error {\n\tdoneChan := make(chan struct{})\n\tgo func() {\n\t\tc.workerpool.Close()\n\t\tclose(doneChan)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-doneChan:\n\t}\n\n\treturn nil\n}", "func (c *Controller) Stop(ctx hive.HookContext) error {\n\tdoneChan := make(chan struct{})\n\tgo func() {\n\t\tc.workerpool.Close()\n\t\tclose(doneChan)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-doneChan:\n\t}\n\n\treturn nil\n}", "func (eng *Engine) Post(c filter.Context) (int, error) {\n\teng.lastActive = time.Now()\n\n\tif len(eng.applied) == 0 {\n\t\treturn eng.BaseFilter.Post(c)\n\t}\n\n\trc := acquireContext()\n\trc.delegate = c\n\n\tl := len(eng.applied)\n\tfor i := l - 1; i >= 0; i-- {\n\t\trt := eng.applied[i]\n\n\t\tstatusCode, err := rt.Post(rc)\n\t\tif nil != err {\n\t\t\treleaseContext(rc)\n\t\t\treturn statusCode, err\n\t\t}\n\n\t\tif statusCode == filter.BreakFilterChainCode {\n\t\t\treleaseContext(rc)\n\t\t\treturn statusCode, err\n\t\t}\n\t}\n\n\treleaseContext(rc)\n\treturn http.StatusOK, nil\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (client ServicesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "func Stop(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {\n\tvar res gophercloud.ErrResult\n\n\treqBody := map[string]interface{}{\"os-stop\": nil}\n\n\t_, res.Err = perigee.Request(\"POST\", actionURL(client, id), perigee.Options{\n\t\tMoreHeaders: client.AuthenticatedHeaders(),\n\t\tReqBody: reqBody,\n\t\tOkCodes: []int{202},\n\t})\n\n\treturn res\n}", "func NewScraperControllerReceiver(\n\tcfg *ScraperControllerSettings,\n\tlogger *zap.Logger,\n\tnextConsumer consumer.MetricsConsumer,\n\toptions ...ScraperControllerOption,\n) (component.Receiver, error) {\n\tif nextConsumer == nil {\n\t\treturn nil, componenterror.ErrNilNextConsumer\n\t}\n\n\tif cfg.CollectionInterval <= 0 {\n\t\treturn nil, errors.New(\"collection_interval must be a positive duration\")\n\t}\n\n\tsc := &controller{\n\t\tname: cfg.Name(),\n\t\tlogger: logger,\n\t\tcollectionInterval: cfg.CollectionInterval,\n\t\tnextConsumer: nextConsumer,\n\t\tmetricsScrapers: &multiMetricScraper{},\n\t\tdone: make(chan struct{}),\n\t\tterminated: make(chan struct{}),\n\t}\n\n\tfor _, op := range options {\n\t\top(sc)\n\t}\n\n\tif len(sc.metricsScrapers.scrapers) > 0 {\n\t\tsc.resourceMetricScrapers = append(sc.resourceMetricScrapers, sc.metricsScrapers)\n\t}\n\n\treturn sc, nil\n}", "func (s *AngularService) Stop() error {\n\tif s.ctxCancel == nil {\n\t\treturn errors.New(\"service was not started before\")\n\t}\n\n\ts.ctxCancel()\n\n\treturn nil\n}", "func (a *DefaultApiService) Stop(ctx _context.Context) ([]InlineResponse200, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []InlineResponse200\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/drive/stop\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v []InlineResponse200\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (hs *HTTPSpanner) Decorate(appName string, next http.Handler) http.Handler {\n\tif hs == nil {\n\t\t// allow DI of nil values to shut off money trace\n\t\treturn next\n\t}\n\n\treturn http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) {\n\t\tif span, err := hs.SD(request); err == nil {\n\t\t\tspan.AppName, span.Name = appName, \"ServeHTTP\"\n\t\t\ttracker := hs.Start(request.Context(), span)\n\n\t\t\tctx := context.WithValue(request.Context(), contextKeyTracker, tracker)\n\n\t\t\ts := simpleResponseWriter{\n\t\t\t\tcode: http.StatusOK,\n\t\t\t\tResponseWriter: response,\n\t\t\t}\n\n\t\t\tnext.ServeHTTP(s, request.WithContext(ctx))\n\n\t\t\t//TODO: application and not library code should finish the above tracker\n\t\t\t//such that information on it could be forwarded\n\t\t\t//once confirmed, delete the below\n\n\t\t\t// tracker.Finish(Result{\n\t\t\t// \tName: \"ServeHTTP\",\n\t\t\t// \tAppName: appName,\n\t\t\t// \tCode: s.code,\n\t\t\t// \tSuccess: s.code < 400,\n\t\t\t// })\n\n\t\t} else {\n\t\t\tnext.ServeHTTP(response, request)\n\t\t}\n\t})\n}", "func (s *FluentdService) Stop(ctx context.Context, r *pb.FluentdStopRequest) (*pb.FluentdStopResponse, error) {\n\treturn &pb.FluentdStopResponse{Status: pb.FluentdStopResponse_STOP_SUCCESS}, nil\n}", "func (r *tee) Response(filters.FilterContext) {}", "func (ri *RestInvoker) ContextDo(ctx context.Context, req *rest.Request, options ...InvocationOption) (*rest.Response, error) {\n\topts := getOpts(string(req.GetRequest().Host()), options...)\n\topts.Protocol = common.ProtocolRest\n\tif len(opts.Filters) == 0 {\n\t\topts.Filters = ri.opts.Filters\n\t}\n\tif string(req.GetRequest().URI().Scheme()) != \"cse\" {\n\t\treturn nil, fmt.Errorf(\"Scheme invalid: %s, only support cse://\", req.GetRequest().URI().Scheme())\n\t}\n\tif req.GetHeader(\"Content-Type\") == \"\" {\n\t\treq.SetHeader(\"Content-Type\", \"application/json\")\n\t}\n\tnewReq := req.Copy()\n\tdefer newReq.Close()\n\tresp := rest.NewResponse()\n\tnewReq.SetHeader(common.HeaderSourceName, config.SelfServiceName)\n\tinv := invocation.CreateInvocation()\n\twrapInvocationWithOpts(inv, opts)\n\tinv.AppID = config.GlobalDefinition.AppID\n\tinv.MicroServiceName = string(req.GetRequest().Host())\n\tinv.Args = newReq\n\tinv.Reply = resp\n\tinv.Ctx = ctx\n\tinv.URLPathFormat = req.Req.URI().String()\n\tinv.MethodType = req.GetMethod()\n\tc, err := handler.GetChain(common.Consumer, ri.opts.ChainName)\n\tif err != nil {\n\t\tlager.Logger.Errorf(err, \"Handler chain init err.\")\n\t\treturn nil, err\n\t}\n\tc.Next(inv, func(ir *invocation.InvocationResponse) error {\n\t\terr = ir.Err\n\t\treturn err\n\t})\n\treturn resp, err\n}", "func (o *StopAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\n}", "func stopwatch(handler func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tstart := time.Now()\n\n\t\tdefer func() {\n\t\t\tlogger.Tracef(\"[%s, %s, %s]\", r.Method, r.RequestURI, time.Since(start))\n\t\t}()\n\n\t\thandler(w, r)\n\t}\n}", "func (ps *rateLimiter) Stop() { close(ps.exit) }", "func (std *ReaderService) Stop() error {\n\tstd.rw.Lock()\n\tdefer std.rw.Unlock()\n\n\tif std.closed {\n\t\treturn nil\n\t}\n\n\tclose(std.stopped)\n\n\tstd.wg.Wait()\n\n\t// Stop subscription delivery.\n\tstd.pub.Stop()\n\tstd.pubErrs.Stop()\n\n\tstd.closed = true\n\tclose(std.done)\n\n\treturn nil\n}", "func handleStopNotifySpent(wsc *wsClient, icmd interface{}) (interface{}, error) {\n\tcmd, ok := icmd.(*btcjson.StopNotifySpentCmd)\n\tif !ok {\n\t\treturn nil, btcjson.ErrRPCInternal\n\t}\n\n\toutpoints, err := deserializeOutpoints(cmd.OutPoints)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, outpoint := range outpoints {\n\t\twsc.server.ntfnMgr.UnregisterSpentRequest(wsc, outpoint)\n\t}\n\n\treturn nil, nil\n}", "func (fss *StreamingService) Close() error { return nil }", "func (w *Watcher) Stop() { w.streamer.Stop() }", "func (c *Controller) Stop() {\n\tglog.Info(\"Stopping the SparkApplication controller\")\n\tc.queue.ShutDown()\n}", "func StopContainerNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (s *Server) handleStop(w http.ResponseWriter, req *http.Request) {\n\tif req.Method != http.MethodDelete {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tw.Write([]byte(`bye...`))\n\ts.server.Close()\n}", "func (f *FakeOutput) Stop() error { return nil }", "func (ingc *IngressController) Stop() {\n\tingc.stopCh <- struct{}{}\n\tingc.log.Info(\"Shutting down workers\")\n\tclose(ingc.stopCh)\n\t<-ingc.nsQs.DoneChan\n\tingc.log.Info(\"Controller exiting\")\n}", "func (t *TaskController[T, U, C, CT, TF]) Stop() {\n\tclose(t.productExitCh)\n\t// Clear all the task in the task queue and mark all task complete.\n\t// so that ```t.Wait``` is able to close resultCh\n\tfor range t.inputCh {\n\t\tt.wg.Done()\n\t}\n\tt.pool.StopTask(t.TaskID())\n\t// Clear the resultCh to avoid blocking the consumer put result into the channel and cannot exit.\n\tchannel.Clear(t.resultCh)\n}", "func (api *distributedservicecardAPI) StopWatch(handler DistributedServiceCardHandler) error {\n\tapi.ct.Lock()\n\tworker := api.ct.workPools[\"DistributedServiceCard\"]\n\tapi.ct.Unlock()\n\t// Don't call stop with ctkit lock. Lock might be taken when an event comes in for the worker\n\tif worker != nil {\n\t\tworker.Stop()\n\t}\n\treturn api.ct.StopWatchDistributedServiceCard(handler)\n}", "func (k *Kinsumer) Stop() {\n\tk.stoprequest <- true\n\tk.mainWG.Wait()\n}", "func (i *ServiceInitializer) StopService(s turbo.Servable) {\n}", "func StopContainerNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func Cancel(w http.ResponseWriter, r *http.Request) {\n\terr := command.New(getFlags(r.URL.Query())).\n\t\tStopRunningCommand().\n\t\tError\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func Accepted(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"202 Accepted\")\n\t}\n\treturn Response{Status: http.StatusAccepted, Data: data, Logging: logging}\n}", "func (r *Reporter) Stop(_ context.Context) error {\n\treturn nil\n}", "func Accepted(w http.ResponseWriter) error {\n\tconst msg = \"request accepted\"\n\tw.Header().Add(\"Content-Type\", \"text/plain\")\n\tw.Header().Add(\"Content-Length\", fmt.Sprintf(\"%d\", len(msg)))\n\tw.WriteHeader(http.StatusAccepted)\n\t_, err := w.Write([]byte(msg))\n\treturn err\n}", "func (l *RouteFiltersClientDeletePollerResponse) Resume(ctx context.Context, client *RouteFiltersClient, token string) error {\n\tpt, err := armruntime.NewPollerFromResumeToken(\"RouteFiltersClient.Delete\", token, client.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpoller := &RouteFiltersClientDeletePoller{\n\t\tpt: pt,\n\t}\n\tresp, err := poller.Poll(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.Poller = poller\n\tl.RawResponse = resp\n\treturn nil\n}", "func (bfx *bloomfilterIndexer) Stop(ctx context.Context) error {\n\treturn bfx.flusher.KVStoreWithBuffer().Stop(ctx)\n}", "func (f *feeService) stop() {\n\tif err := f.srv.Shutdown(context.Background()); err != nil {\n\t\tfmt.Printf(\"error: cannot stop fee api: %v\", err)\n\t}\n\n\tf.wg.Wait()\n}", "func (s *Server) HandleStreamedOut(command *entity.ActionCommand, stream entity.ActionProtocol_HandleStreamedOutServer) error {\n\te, err := s.entityFor(ServiceName(command.ServiceName))\n\tif err != nil {\n\t\treturn err\n\t}\n\tr := runner{context: &Context{\n\t\tEntity: e,\n\t\tInstance: e.EntityFunc(),\n\t\tctx: stream.Context(),\n\t\tcommand: command,\n\t\tmetadata: command.Metadata,\n\t\tsideEffects: make([]*protocol.SideEffect, 0),\n\t}}\n\tr.context.respondFunc(func(c *Context) error {\n\t\tr.response, err = r.actionResponse()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = stream.Send(r.response); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.response = nil\n\t\tr.context.response = nil\n\t\tr.context.forward = nil\n\t\tr.context.failure = nil\n\t\tr.context.sideEffects = make([]*protocol.SideEffect, 0)\n\t\treturn nil\n\t})\n\tfor {\n\t\t// No matter what error runCommand returns here, we take it as an error\n\t\t// to stop the stream as errors are sent through action.Context.Respond.\n\t\tif err = r.runCommand(command); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif r.context.cancelled {\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func (service *Service) Stop(context moleculer.BrokerContext) {\n\tif service.stopped != nil {\n\t\tgo service.stopped(context, (*service.schema))\n\t}\n}", "func (s *Server) Stop() error {\n\tif err := s.ctx.Gateway.Close(); err != nil {\n\t\treturn fmt.Errorf(\"close gateway backend error: %s\", err)\n\t}\n\tif err := s.ctx.Application.Close(); err != nil {\n\t\treturn fmt.Errorf(\"close application backend error: %s\", err)\n\t}\n\tif err := s.ctx.Controller.Close(); err != nil {\n\t\treturn fmt.Errorf(\"close network-controller backend error: %s\", err)\n\t}\n\n\tlog.Info(\"waiting for pending actions to complete\")\n\ts.wg.Wait()\n\treturn nil\n}", "func (c *Controller) stop(name types.NamespacedName) {\n\tproc, ok := c.procs[name]\n\tif !ok {\n\t\treturn\n\t}\n\n\tif proc.cancelFunc == nil {\n\t\treturn\n\t}\n\tproc.cancelFunc()\n\t<-proc.doneCh\n\tproc.probeWorker = nil\n\tproc.cancelFunc = nil\n\tproc.doneCh = nil\n}", "func (b *blocksProviderImpl) Stop() {\n\tatomic.StoreInt32(&b.done, 1)\n\tb.client.CloseSend()\n}", "func (bt *Netsamplebeat) Stop() {\n\terr := bt.client.Close()\n\tif err != nil {\n\t\tlogp.Warn(\"beat client close exited with error: %s\", err.Error())\n\t}\n\tclose(bt.done)\n}", "func (k *KubeStore) StopChiselService(envId, blockNameTeleported string) *utilsGoServer.Error {\n\t_, err := k.kubeClient.AppsV1().Deployments(envId).UpdateScale(context.TODO(), chiselAppName, &autoscalingv1.Scale{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: chiselAppName,\n\t\t\tNamespace: envId,\n\t\t},\n\t\tSpec: autoscalingv1.ScaleSpec{\n\t\t\tReplicas: 0,\n\t\t},\n\t}, metav1.UpdateOptions{})\n\n\tif err != nil {\n\t\treturn utilsGoServer.NewInternalErrorWithErr(\"could not stop chisel service\", err)\n\t}\n\n\tlog.Debug().Msgf(\"successfully stopped chisel service in env %s\", envId)\n\n\tif blockNameTeleported != \"\" {\n\t\terr = revertServiceToOriginal(context.TODO(), k.kubeClient, envId, blockNameTeleported)\n\n\t\tif err != nil {\n\t\t\tklog.ErrorfWithErr(err, \"Error while cancelling teleport for %s.%s\", blockNameTeleported, envId)\n\t\t\treturn utilsGoServer.NewInternalErrorWithErr(\"Error while cancelling teleport\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *MockController) Stop() error {\n\tc.StopFuncCalled++\n\n\treturn c.StopFunc()\n}", "func (c *Consumer) Stop() error {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\tif !c.isStarted {\n\t\treturn fmt.Errorf(\"Consumer.Stop() consumer has not started\")\n\t}\n\n\tif c.cancelFunc == nil {\n\t\treturn fmt.Errorf(\"Consumer.Stop() cancel func is nil\")\n\t}\n\n\tif c.logLevel >= log.LogLevelDebug {\n\t\tc.logger.Log(log.LogLevelDebug, \"Consumer.Stop() execute cancel func\")\n\t}\n\n\tc.cancelFunc()\n\n\tif c.logLevel >= log.LogLevelDebug {\n\t\tc.logger.Log(log.LogLevelDebug, \"Consumer.Stop() wait for stopping of all goroutines\")\n\t}\n\n\tc.wg.Wait()\n\tc.isStarted = false\n\n\tif c.logLevel >= log.LogLevelDebug {\n\t\tc.logger.Log(log.LogLevelDebug, \"Consumer.Stop() start cleaning of public delivery channel\")\n\t}\n\n\tc.cleanPublicDeliveryChannel()\n\n\tif c.logLevel >= log.LogLevelDebug {\n\t\tc.logger.Log(log.LogLevelDebug, \"Consumer.Stop() trigger invalidation signal\")\n\t}\n\n\tc.triggerInvalidation()\n\n\tif c.logLevel >= log.LogLevelDebug {\n\t\tc.logger.Log(log.LogLevelDebug, \"Consumer.Stop() close channel and connection to RabbitMQ\")\n\t}\n\n\terr := c.channel.Close()\n\tif err != nil && c.logLevel >= log.LogLevelError {\n\t\tmsg := fmt.Sprintf(\"Consumer.Stop() close channel error: %v\", err)\n\t\tc.logger.Log(log.LogLevelError, msg)\n\t}\n\n\terr = c.connection.Close()\n\tif err != nil && c.logLevel >= log.LogLevelError {\n\t\tmsg := fmt.Sprintf(\"Consumer.Stop() close connection to RabbitMQ error: %v\", err)\n\t\tc.logger.Log(log.LogLevelError, msg)\n\t}\n\n\tif c.logLevel >= log.LogLevelInfo {\n\t\tc.logger.Log(log.LogLevelInfo, \"Consumer.Stop() consumer has successfully stopped\")\n\t}\n\n\treturn nil\n}", "func (o *CloudTidesAPI) Serve(builder middleware.Builder) http.Handler {\n\to.Init()\n\n\tif o.Middleware != nil {\n\t\treturn o.Middleware(builder)\n\t}\n\treturn o.context.APIHandler(builder)\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (csrl *CoalescingSerializingRateLimiter) Stop() {\n\tcsrl.lock.Lock()\n\tcsrl.stopped = true\n\tcsrl.lock.Unlock()\n\n\tfor csrl.isHandlerRunning() {\n\t\ttime.Sleep(50 * time.Millisecond)\n\t}\n}", "func (nr *namedReceiver) Stop(ctx context.Context, d Dest) error {\n\tmetricRecvTotal.WithLabelValues(d.Type.String(), \"STOP\")\n\treturn nr.Receiver.Stop(ctx, d)\n}", "func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (_SweetToken *SweetTokenCallerSession) Stopped() (bool, error) {\n\treturn _SweetToken.Contract.Stopped(&_SweetToken.CallOpts)\n}", "func (c *Controller) Serve() error {\n\tselect {\n\tcase <-c.doneCh:\n\t\treturn fmt.Errorf(\"tried to reuse a stopped server\")\n\tdefault:\n\t}\n\n\tif c.gserver != nil {\n\t\tgo func() {\n\t\t\tlog.Infow(\"graphql listening\", \"addr\", c.gl.Addr().String())\n\t\t\tc.gserver.Serve(c.gl)\n\t\t}()\n\t}\n\tlog.Infow(\"controller listening\", \"addr\", c.Addr())\n\treturn c.server.Serve(c.l)\n}" ]
[ "0.5967225", "0.53513354", "0.5269473", "0.51873416", "0.49433386", "0.49381483", "0.46150312", "0.45644704", "0.45452827", "0.45101902", "0.45058453", "0.43470925", "0.4317051", "0.42461056", "0.4231967", "0.42163494", "0.42157894", "0.42143443", "0.42096573", "0.41961262", "0.41843915", "0.41826075", "0.41689843", "0.4154097", "0.4123741", "0.4117833", "0.4115538", "0.41103554", "0.4102372", "0.4097876", "0.40862885", "0.40838572", "0.40793842", "0.40781432", "0.4076705", "0.40689665", "0.40670604", "0.40646335", "0.40599817", "0.40315735", "0.40304703", "0.4022178", "0.40185305", "0.4000597", "0.39848903", "0.3983108", "0.39722568", "0.39718485", "0.39718485", "0.39568612", "0.3946882", "0.3943529", "0.3940594", "0.39371118", "0.39262527", "0.39245805", "0.39083025", "0.38977346", "0.38852784", "0.3882727", "0.38819826", "0.38770998", "0.38733274", "0.3872179", "0.38560092", "0.38477305", "0.38436", "0.38310334", "0.38239893", "0.38225406", "0.38181692", "0.38131255", "0.38099062", "0.38080394", "0.38064665", "0.38057396", "0.3802353", "0.37966955", "0.37767968", "0.37718737", "0.37682056", "0.3767304", "0.37652948", "0.37646428", "0.37614202", "0.3755844", "0.3749992", "0.37416172", "0.3736209", "0.37327284", "0.3731016", "0.37286147", "0.372506", "0.37241766", "0.3719244", "0.37168726", "0.3716495", "0.37090254", "0.3703914", "0.37025326" ]
0.7422107
0
StopFeedBadRequest runs the method Stop of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v/stop", id), } req, err := http.NewRequest("POST", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) stopCtx, _err := app.NewStopFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } return nil, e } // Perform action _err = ctrl.Stop(stopCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 400 { t.Errorf("invalid response status code: got %+v, expected 400", rw.Code) } var mt error if resp != nil { var _ok bool mt, _ok = resp.(error) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of error", resp, resp) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StopFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewStopFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*StopFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := StopFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\treturn &rctx, err\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func RunBadRequest(response http.ResponseWriter, request *http.Request, container interface{}) {\n\terrorController := BadRequest{}\n\terrorController.Init(container, []string{}, request)\n\terrorController.Run(response, request)\n}", "func (ctx *StopFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func ListFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NewStopAppBadRequest() *StopAppBadRequest {\n\treturn &StopAppBadRequest{}\n}", "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func DeleteFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (c *SeaterController) TraceBadRequestf(err error, format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tc.traceJSONAbort(nil, 400, msg)\n}", "func StopContainerNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func RenderBadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\treturn\n}", "func StopContainerNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ReceiveTwitterBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TwitterController, oauthToken string, oauthVerifier string, state string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{oauthToken}\n\t\tquery[\"oauth_token\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{oauthVerifier}\n\t\tquery[\"oauth_verifier\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{state}\n\t\tquery[\"state\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/twitter/receive\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{oauthToken}\n\t\tprms[\"oauth_token\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{oauthVerifier}\n\t\tprms[\"oauth_verifier\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{state}\n\t\tprms[\"state\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TwitterTest\"), rw, req, prms)\n\treceiveCtx, _err := app.NewReceiveTwitterContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Receive(receiveCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func RenderBadRequest(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, BadRequest(message...))\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ServeBadRequest(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Bad Request\", http.StatusBadRequest)\n}", "func (s *Server) handleStop(w http.ResponseWriter, req *http.Request) {\n\tif req.Method != http.MethodDelete {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tw.Write([]byte(`bye...`))\n\ts.server.Close()\n}", "func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (client ServicesClient) StopPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"serviceName\": autorest.Encode(\"path\", serviceName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2022-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func (core *coreService) Stop(_ context.Context) error {\n\tif core.messageBatcher != nil {\n\t\tif err := core.messageBatcher.Stop(); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to stop message batcher\")\n\t\t}\n\t}\n\treturn core.chainListener.Stop()\n}", "func (a *DefaultApiService) Stop(ctx _context.Context) ([]InlineResponse200, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []InlineResponse200\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/drive/stop\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v []InlineResponse200\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (ss *StreamerServer) handleStop(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tglog.Info(\"Got stop request.\")\n\tss.streamer.Stop()\n\tw.WriteHeader(http.StatusOK)\n}", "func (m *Middleware) Stop(_ management.CommandWriter) error {\n\treturn nil\n}", "func SendBadRequest(w http.ResponseWriter, opts ...ErrorOpts) {\n\tres := errorResponse{\n\t\tCode: CodeBadRequest,\n\t\tMessage: \"Bad request\",\n\t}\n\tres.apply(opts)\n\tSendJSON(w, 400, &res)\n}", "func StopFlexGetHandler(w http.ResponseWriter, req *http.Request) {\n\tglog.Info(\"Stop FlexGet\")\n\tif result, err := execFlexGetAction(stopFlexGetCmd); err != nil {\n\t\tglog.Error(\"Error stopping FlexGet: \", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t} else {\n\t\tfmt.Fprint(w, string(result))\n\t}\n}", "func (h *Handler) cancel(c echo.Context) (e error) {\n\tctx := c.(*cuxs.Context)\n\tvar r cancelRequest\n\tvar id int64\n\tvar sr *model.SalesReturn\n\n\tif id, e = common.Decrypt(ctx.Param(\"id\")); e == nil {\n\t\tif sr, e = ShowSalesReturn(\"id\", id); e == nil {\n\t\t\tr.SR = sr\n\t\t\tif e = ctx.Bind(&r); e == nil {\n\t\t\t\tif e = CancelSalesReturn(sr); e == nil {\n\t\t\t\t\tif e = UpdateExpense(sr); e == nil {\n\t\t\t\t\t\tctx.Data(sr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\te = echo.ErrNotFound\n\t\t}\n\t}\n\n\treturn ctx.Serve(e)\n}", "func StopHandler(w http.ResponseWriter, r *http.Request) {\n\t// services.JobProgress and quit\n\tcurrentJobid, _ := strconv.Atoi(r.URL.Path[6:])\n\tch := services.ChannelMap[currentJobid]\n\tclose(ch)\n\tdelete(services.ChannelMap, currentJobid)\n\tfmt.Fprintf(w, \"stopHandler\")\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func errorAndStop(c *gin.Context, m string) {\n\terr := fmt.Errorf(fmt.Sprintf(\"*** %s\", m))\n\tc.AbortWithError(http.StatusBadRequest, err)\n}", "func (r *Reporter) Stop(_ context.Context) error {\n\treturn nil\n}", "func (f *HTTPFeeder) Stop(stopChan chan bool) {\n\tif f.IsRunning {\n\t\tf.Server.Shutdown(context.TODO())\n\t}\n\tclose(stopChan)\n}", "func (c *Controller) Stop() {\n\tglog.Info(\"Stopping the SparkApplication controller\")\n\tc.queue.ShutDown()\n}", "func (o *StopAppBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n}", "func StopScenario(w http.ResponseWriter, r *http.Request) {\n\tvar s scn.StopRequest\n\tvar err error\n\terr = json.NewDecoder(r.Body).Decode(&s)\n\tif err != nil {\n\t\terrorImpl.WriteHTTPError(w, http.StatusOK, errorImpl.ScenarioError(\"Decode error\", err))\n\t\treturn\n\t}\n\terr = s.Stop()\n\tif err != nil {\n\t\terrorImpl.WriteHTTPError(w, http.StatusOK, errorImpl.ScenarioError(\"Stop error\", err))\n\t\treturn\n\t}\n}", "func ErrBadRequest(w http.ResponseWriter, r *http.Request) {\n\tBadRequestWithErr(w, r, errors.New(\"Bad Request\"))\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, err *Error) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusBadRequest]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tr = ctxSetErr(r, err)\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultBadRequest(w, r, err)\n\t}\n}", "func (c *Controller) Stop() error {\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\n\tif !c.started {\n\t\treturn fmt.Errorf(\"webhook server has not been started\")\n\t}\n\tif err := admissionregistration.Instance().DeleteMutatingWebhookConfiguration(storkAdmissionController); err != nil {\n\t\tlog.Errorf(\"unable to delete webhook configuration, %v\", err)\n\t\treturn err\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tif err := c.server.Shutdown(ctx); err != nil {\n\t\treturn err\n\t}\n\tc.started = false\n\treturn nil\n}", "func (r *RestResponse) RespBad(errCode int, errMsg string, data interface{}) Output {\n\tout := Output{\n\t\tCode: http.StatusBadRequest,\n\t\tMessage: \"Bad Requests\",\n\t\tErrorCode: errCode,\n\t\tErrorMsg: errMsg,\n\t\tResult: data,\n\t}\n\n\treturn out\n}", "func (c *ConsumerManager) Stop(ctx context.Context) (err error) {\n\terrC := make(chan error)\n\n\tgo func() {\n\t\terrC <- c.stop()\n\t}()\n\n\tselect {\n\tcase err = <-errC:\n\tcase <-ctx.Done():\n\t\terr = ErrStopDeadlineExceeded\n\t}\n\n\treturn\n}", "func (a *Animator) Stop() {\n\tif a.cancelRun != nil {\n\t\ta.Log.Info(\"Stopping VolumeSeriesRequest Animator\")\n\t\ta.stoppedChan = make(chan struct{})\n\t\ta.cancelRun()\n\t\tselect {\n\t\tcase <-a.stoppedChan: // response received\n\t\tcase <-time.After(a.StopPeriod):\n\t\t\ta.Log.Warning(\"Timed out waiting for termination\")\n\t\t}\n\t}\n\ta.Log.Info(\"Stopped VolumeSeriesRequest Animator\")\n}", "func RespondBadRequest(err error) events.APIGatewayProxyResponse {\n\treturn Respond(http.StatusBadRequest, Error{Error: err.Error()})\n}", "func (c *Controller) Stop() {\n\tglog.Info(\"shutdown http service\")\n}", "func (r *Response) Fail(w http.ResponseWriter, errorCode int, message string, status int) {\n\tw.WriteHeader(status)\n\tf := failResponse{\n\t\tStatus: \"ERROR\",\n\t\tErrorCode: errorCode,\n\t\tMessage: message,\n\t}\n\tout, err := json.Marshal(f)\n\tif err != nil {\n\t\tr.logger.Error(\"Failed to unmarshal data \", err)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\tw.Write(out)\n}", "func (s *AngularService) Stop() error {\n\tif s.ctxCancel == nil {\n\t\treturn errors.New(\"service was not started before\")\n\t}\n\n\ts.ctxCancel()\n\n\treturn nil\n}", "func (ctx *StartFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func liveStopHandler(cache *CacheManager, serverChan chan error) RouteHandler {\n\treturn func (w http.ResponseWriter, r *http.Request, params map[string]string) {\n\t\terr := cache.Stop(params[\"filename\"])\n\t\tif err != nil {\n\t\t\tserverChan <- err\n\t\t\thttp.Error(w, \"Invalid request !\", http.StatusNotFound)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"\")\n\t\t}\n\t}\n}", "func (s *StreamingController) StopStreaming(c *gin.Context) {\n\tvar err error\n\n\t// Request body validation\n\tvar requestBody request.StopStreaming\n\terr = c.ShouldBindJSON(&requestBody)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": errInvalidRequest.Error(),\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\t// Update the streaming end time in DB\n\tdb := dbConn.OpenConnection()\n\tdefer db.Close()\n\n\tstreamingQuery := \"UPDATE streamings SET end_time = $1 WHERE id = $2\"\n\t_, err = db.Exec(streamingQuery, time.Now(), requestBody.ID)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": errFailedUpdateStreamingDB.Error(),\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\t// Stop the streaming goroutine\n\tclose(quit)\n\twg.Wait()\n\tc.JSON(http.StatusOK, gin.H{\"success\": true})\n}", "func (app *App) Stop() {}", "func (c *Context) Stop() {\n\tc.stopChannel <- struct{}{}\n}", "func (rtspService *RTSPService) Stop(msg *wssapi.Msg) (err error) {\n\treturn\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (a *Client) StopPacketGenerator(params *StopPacketGeneratorParams, opts ...ClientOption) (*StopPacketGeneratorNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewStopPacketGeneratorParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"StopPacketGenerator\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/packet/generators/{id}/stop\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &StopPacketGeneratorReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*StopPacketGeneratorNoContent)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for StopPacketGenerator: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func End(ctx context.Context, w http.ResponseWriter, req *http.Request) (context.Context, error) {\n\tspan := trace.FromContext(ctx)\n\tif span == nil {\n\t\treturn ctx, nil\n\t}\n\n\tspan.End()\n\treturn ctx, nil\n}", "func (c *Controller) Stop(ctx hive.HookContext) error {\n\tdoneChan := make(chan struct{})\n\tgo func() {\n\t\tc.workerpool.Close()\n\t\tclose(doneChan)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-doneChan:\n\t}\n\n\treturn nil\n}", "func (c *Controller) Stop(ctx hive.HookContext) error {\n\tdoneChan := make(chan struct{})\n\tgo func() {\n\t\tc.workerpool.Close()\n\t\tclose(doneChan)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-doneChan:\n\t}\n\n\treturn nil\n}", "func ResponseBadRequest(w http.ResponseWriter) {\n\tvar response Response\n\n\t// Set Response Data\n\tresponse.Status = false\n\tresponse.Code = http.StatusBadRequest\n\tresponse.Message = \"Bad Request\"\n\n\t// Set Response Data to HTTP\n\tResponseWrite(w, response.Code, response)\n}", "func (ctx *StopFeedContext) Accepted() error {\n\tctx.ResponseData.WriteHeader(202)\n\treturn nil\n}", "func Fail(w http.ResponseWriter, code, message string, err error) {\n\tres := &errors.Error{\n\t\tCode: code,\n\t\tMessage: message,\n\t\tDetail: err.Error(),\n\t}\n\tErr, ok := err.(*errors.Error)\n\tif ok {\n\t\tres = Err\n\t}\n\tsc, ok := statusMap()[res.Code]\n\tif !ok {\n\t\tsc = http.StatusInternalServerError\n\t}\n\tw.WriteHeader(sc)\n\tif err = render.Write(w, res); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprint(w, \"Error rendering response\")\n\t}\n}", "func AbortHandler(w http.ResponseWriter) func(context.Context, problems.Problem) {\n\treturn func(ctx context.Context, problem problems.Problem) {\n\t\tselect {\n\t\tcase <-ctx.Done(): // Context was cancelled or reached deadline\n\t\t\tlog := logger.FromContext(ctx)\n\t\t\tlog.Info(\"tried to write error response, but context was cancelled/reached deadline\")\n\t\tdefault:\n\t\t\tresponse := problems.NewErrorResponse(ctx, problem)\n\t\t\twriteErrorResponse(ctx, w, response)\n\t\t}\n\t}\n}", "func (w *ServiceWriter) Stop() {\n\tclose(w.exit)\n\tw.exitWG.Wait()\n}", "func (c *context) Failed(msg string) {\n\tc.writer.WriteHeader(http.StatusBadRequest)\n\tfmt.Fprint(c.writer, msg)\n}", "func ListTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/\"),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func Stop(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {\n\tvar res gophercloud.ErrResult\n\n\treqBody := map[string]interface{}{\"os-stop\": nil}\n\n\t_, res.Err = perigee.Request(\"POST\", actionURL(client, id), perigee.Options{\n\t\tMoreHeaders: client.AuthenticatedHeaders(),\n\t\tReqBody: reqBody,\n\t\tOkCodes: []int{202},\n\t})\n\n\treturn res\n}", "func (c *Client) Stop(ctx context.Context, id string) error {\n\targ := &ngrok.Item{ID: id}\n\n\tvar path bytes.Buffer\n\tif err := template.Must(template.New(\"stop_path\").Parse(\"/tunnel_sessions/{{ .ID }}/stop\")).Execute(&path, arg); err != nil {\n\t\tpanic(err)\n\t}\n\targ.ID = \"\"\n\tvar (\n\t\tapiURL = &url.URL{Path: path.String()}\n\t\tbodyArg interface{}\n\t)\n\tapiURL.Path = path.String()\n\tbodyArg = arg\n\n\tif err := c.apiClient.Do(ctx, \"POST\", apiURL, bodyArg, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *requestContext) fail(code int, msg string, args ...any) {\n\tbody := fmt.Sprintf(msg, args...)\n\tlogging.Errorf(c.Context, \"HTTP %d: %s\", code, body)\n\thttp.Error(c.Writer, body, code)\n}", "func BadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(\"400 - Bad Request\"))\n}", "func (f *FakeOutput) Stop() error { return nil }", "func (t *Transporter) stopHandler(server *Server) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\terr := server.Stop()\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(w, \"error to stop server %s\", server.config.Host)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"success to stop server %s\", server.config.Host)\n\t\t}\n\t}\n}", "func (a *App) Stop(err error) error {\n\ta.cancel()\n\tif err != nil {\n\t\ta.Logger.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func BadRequest(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeBadRequest, \"bad request\")\n}", "func Stop(appName string, ctx *Context) {\n\tpresent, process := FindDaemonProcess(ctx)\n\tif present {\n\t\tconst prefix = \"server.stop\"\n\t\tvar err error\n\t\tswitch {\n\t\tcase cmdr.GetBoolRP(prefix, \"hup\"):\n\t\t\tlog.Printf(\"sending SIGHUP to pid %v\", process.Pid)\n\t\t\terr = sigSendHUP(process)\n\t\tcase cmdr.GetBoolRP(prefix, \"quit\"):\n\t\t\tlog.Printf(\"sending SIGQUIT to pid %v\", process.Pid)\n\t\t\terr = sigSendQUIT(process)\n\t\tcase cmdr.GetBoolRP(prefix, \"kill\"):\n\t\t\tlog.Printf(\"sending SIGKILL to pid %v\", process.Pid)\n\t\t\terr = sigSendKILL(process)\n\t\tcase cmdr.GetBoolRP(prefix, \"usr2\"):\n\t\t\tlog.Printf(\"sending SIGUSR2 to pid %v\", process.Pid)\n\t\t\terr = sigSendUSR2(process)\n\t\tcase cmdr.GetBoolRP(prefix, \"term\"):\n\t\t\tfallthrough\n\t\tdefault:\n\t\t\tlog.Printf(\"sending SIGTERM to pid %v\", process.Pid)\n\t\t\terr = sigSendTERM(process)\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tfmt.Printf(\"%v is stopped.\\n\", appName)\n\t}\n}", "func (pf *PortForwarder) Stop(ctx context.Context, req *waterfall_grpc_pb.PortForwardRequest) (*empty_pb.Empty, error) {\n\tpf.sessionsMutex.Lock()\n\tdefer pf.sessionsMutex.Unlock()\n\n\tlog.Printf(\"Stopping forwarding %s ...\\n\", req.Session.Src)\n\n\ts, ok := pf.sessions[req.Session.Src]\n\tif !ok {\n\t\treturn &empty_pb.Empty{}, nil\n\t}\n\ts.cancel()\n\n\tdelete(pf.sessions, req.Session.Src)\n\treturn &empty_pb.Empty{}, s.lis.Close()\n}", "func (s *FluentdService) Stop(ctx context.Context, r *pb.FluentdStopRequest) (*pb.FluentdStopResponse, error) {\n\treturn &pb.FluentdStopResponse{Status: pb.FluentdStopResponse_STOP_SUCCESS}, nil\n}", "func (c *consumerImpl) Stop() {\n\tc.logger.Info(\"Stopping consumer\")\n\tc.cancelFunc()\n\tc.consumerHandler.stop()\n}", "func (a *appsec) stop() {\n\ta.unregisterWAF()\n\ta.limiter.Stop()\n}", "func (o *ServiceInstanceLastOperationGetBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (c *HAProxyController) Stop() {\n\tlogger.Infof(\"Stopping Ingress Controller\")\n\tlogger.Error(c.haproxyService(\"stop\"))\n}", "func (ctx *GetFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (this *AVTransport) Stop(instanceId uint32) error {\n\ttype Response struct {\n\t\tXMLName xml.Name\n\t\tErrorResponse\n\t}\n\targs := []Arg{\n\t\t{\"InstanceID\", instanceId},\n\t}\n\tresponse := this.Svc.Call(\"Stop\", args)\n\tdoc := Response{}\n\txml.Unmarshal([]byte(response), &doc)\n\treturn doc.Error()\n}", "func (ctx *DeleteFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (serv *Server) handleBadRequest(conn int) {\n\tvar (\n\t\tlogp = `handleBadRequest`\n\t\tframeClose []byte = NewFrameClose(false, StatusBadRequest, nil)\n\n\t\terr error\n\t)\n\n\terr = Send(conn, frameClose, serv.Options.ReadWriteTimeout)\n\tif err != nil {\n\t\tlog.Printf(`%s: %s`, logp, err)\n\t\tgoto out\n\t}\n\n\t_, err = Recv(conn, serv.Options.ReadWriteTimeout)\n\tif err != nil {\n\t\tlog.Printf(`%s: %s`, logp, err)\n\t}\nout:\n\tserv.ClientRemove(conn)\n}", "func Cancel(w http.ResponseWriter, r *http.Request) {\n\terr := command.New(getFlags(r.URL.Query())).\n\t\tStopRunningCommand().\n\t\tError\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (c *Context) Stop() {\n\tlog.Printf(\"[WARN] terraform: Stop called, initiating interrupt sequence\")\n\n\tc.l.Lock()\n\tdefer c.l.Unlock()\n\n\t// If we're running, then stop\n\tif c.runContextCancel != nil {\n\t\tlog.Printf(\"[WARN] terraform: run context exists, stopping\")\n\n\t\t// Tell the hook we want to stop\n\t\tc.sh.Stop()\n\n\t\t// Stop the context\n\t\tc.runContextCancel()\n\t\tc.runContextCancel = nil\n\t}\n\n\t// Grab the condition var before we exit\n\tif cond := c.runCond; cond != nil {\n\t\tcond.Wait()\n\t}\n\n\tlog.Printf(\"[WARN] terraform: stop complete\")\n}", "func (srv *Server) minerStopHandler(w http.ResponseWriter, req *http.Request) {\n\tsrv.miner.StopMining()\n\twriteSuccess(w)\n}", "func (this *Context) Abort(status int, body string) {\n\tthis.ResponseWriter.WriteHeader(status)\n\tthis.ResponseWriter.Write([]byte(body))\n}", "func StopExperiment(settings *playfab.Settings, postData *StopExperimentRequestModel, entityToken string) (*EmptyResponseModel, error) {\r\n if entityToken == \"\" {\n return nil, playfab.NewCustomError(\"entityToken should not be an empty string\", playfab.ErrorGeneric)\n }\r\n b, errMarshal := json.Marshal(postData)\r\n if errMarshal != nil {\r\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\r\n }\r\n\r\n sourceMap, err := playfab.Request(settings, b, \"/Experimentation/StopExperiment\", \"X-EntityToken\", entityToken)\r\n if err != nil {\r\n return nil, err\r\n }\r\n \r\n result := &EmptyResponseModel{}\r\n\r\n config := mapstructure.DecoderConfig{\r\n DecodeHook: playfab.StringToDateTimeHook,\r\n Result: result,\r\n }\r\n \r\n decoder, errDecoding := mapstructure.NewDecoder(&config)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n \r\n errDecoding = decoder.Decode(sourceMap)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n\r\n return result, nil\r\n}", "func TestBadRequest(t *testing.T) {\n\texpectedCode := http.StatusBadRequest\n\tbody := testEndpoint(t, \"GET\", \"/weather?location=kampala\", expectedCode)\n\n\texpectedBody := `{\"message\":\"No location/date specified\"}`\n\n\tif body != expectedBody {\n\t\tt.Errorf(\"Handler returned wrong body: got %v instead of %v\", body, expectedBody)\n\t}\n}", "func (c *MockController) Stop() error {\n\tc.StopFuncCalled++\n\n\treturn c.StopFunc()\n}", "func BadRequest(w http.ResponseWriter, errorType, message string) {\n\terrMsg := ErrorMessage{ErrorType: errorType, Message: message}\n\trenderError(w, http.StatusBadRequest, &errMsg)\n}", "func (b *Batch) Stop() {\n\tb.cancelFunc()\n}", "func (pf *PortForwarder) Stop(ctx context.Context, req *waterfall_grpc.PortForwardRequest) (*empty_pb.Empty, error) {\n\tpf.sessionsMutex.Lock()\n\tdefer pf.sessionsMutex.Unlock()\n\n\tlog.Printf(\"Stopping forwarding %s ...\\n\", req.Session.Src)\n\n\ts, ok := pf.sessions[req.Session.Src]\n\tif !ok {\n\t\treturn &empty_pb.Empty{}, nil\n\t}\n\ts.cancel()\n\n\tdelete(pf.sessions, req.Session.Src)\n\treturn &empty_pb.Empty{}, s.lis.Close()\n}", "func (r *Reporter) Stop(ctx context.Context) error {\n\tif r.Errors != nil {\n\t\tr.D.Debug(\"stopping errors reporter\")\n\t\tif err := r.Errors.Stop(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.D.Debug(\"errors reporter stopped\")\n\t}\n\n\tif r.Logging != nil {\n\t\tr.D.Debug(\"stopping logging reporter\")\n\t\tif err := r.Logging.Stop(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.D.Debug(\"logging reporter stopped\")\n\t}\n\n\tif r.Metrics != nil {\n\t\tr.D.Debug(\"stopping metrics reporter\")\n\t\tif err := r.Metrics.Stop(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tr.D.Debug(\"metrics reporter stopped\")\n\t}\n\n\treturn nil\n}", "func BadRequest(w http.ResponseWriter, err error) {\n\tError(w, http.StatusBadRequest, err)\n}" ]
[ "0.6282968", "0.6024318", "0.5639982", "0.5638879", "0.53281105", "0.51829237", "0.50986665", "0.5066442", "0.5043542", "0.49509162", "0.49501032", "0.49500132", "0.49267724", "0.48767814", "0.480943", "0.47375074", "0.47180447", "0.470334", "0.46751076", "0.46563792", "0.46397448", "0.46382937", "0.46124378", "0.45948383", "0.45128545", "0.45100647", "0.45058653", "0.44837254", "0.44613674", "0.44467288", "0.44463778", "0.44355622", "0.4401395", "0.43880773", "0.43759054", "0.43650478", "0.4320843", "0.430837", "0.4267624", "0.4259395", "0.42559236", "0.42421383", "0.42390788", "0.42348713", "0.42082408", "0.4207955", "0.4196125", "0.41941655", "0.41909507", "0.41725072", "0.4163193", "0.41618192", "0.4160219", "0.41600108", "0.41376132", "0.41353962", "0.41319564", "0.41293854", "0.4128222", "0.4128222", "0.4123379", "0.41176495", "0.4106556", "0.40913513", "0.40836388", "0.4077004", "0.40730193", "0.40638968", "0.40548366", "0.40497205", "0.40472183", "0.403963", "0.40326756", "0.40313545", "0.40200752", "0.40193784", "0.4015762", "0.40153292", "0.40124443", "0.40112233", "0.40079132", "0.40074283", "0.40069884", "0.40015852", "0.39999807", "0.39973423", "0.39886644", "0.39813462", "0.39801052", "0.39795396", "0.39778772", "0.3977021", "0.39713734", "0.39709088", "0.39696583", "0.39661288", "0.3965635", "0.39628446", "0.39552727", "0.39458555" ]
0.7370387
0
StopFeedNotFound runs the method Stop of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter { // Setup service var ( logBuf bytes.Buffer respSetter goatest.ResponseSetterFunc = func(r interface{}) {} ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v/stop", id), } req, err := http.NewRequest("POST", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) stopCtx, _err := app.NewStopFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil } // Perform action _err = ctrl.Stop(stopCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 404 { t.Errorf("invalid response status code: got %+v, expected 404", rw.Code) } // Return results return rw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StopFeedAccepted(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 202 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 202\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StopContainerNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewStopFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*StopFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := StopFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\treturn &rctx, err\n}", "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *ListFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *UpdateFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": true, \"msg\": \"`+msg+`\"}`, 404, service, \"application/json\")\n\treturn nil\n}", "func (this *Context) NotFound(message string) {\n\tthis.ResponseWriter.WriteHeader(404)\n\tthis.ResponseWriter.Write([]byte(message))\n}", "func NotFoundHandler() ServiceHttpHandler { return ServiceHttpHandler{Handler: NotFound} }", "func (ctx *GetFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w ResponseWriter, r *Request) { Error(w, \"404 page not found\", StatusNotFound) }", "func (ctx *DeleteFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (web *WebServer) NotFound(handler http.HandlerFunc) {\n\tweb.router.NotFound(handler)\n}", "func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (f *HTTPFeeder) Stop(stopChan chan bool) {\n\tif f.IsRunning {\n\t\tf.Server.Shutdown(context.TODO())\n\t}\n\tclose(stopChan)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tjson.NewEncoder(w).Encode(&ServiceError{\n\t\tMessage: \"Endpoint not found\",\n\t\tSolution: \"See / for possible directives\",\n\t\tErrorCode: http.StatusNotFound,\n\t})\n}", "func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request) {\n\twriteResponse(r, w, http.StatusNotFound, &SimpleResponse{\n\t\tTraceID: tracing.FromContext(r.Context()),\n\t\tMessage: \"not found\",\n\t})\n}", "func (c *Context) NotFound() {\n\tc.JSON(404, ResponseWriter(404, \"page not found\", nil))\n}", "func (c *SeaterController) TraceNotFoundf(err error, format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tc.traceJSONAbort(err, 404, msg)\n}", "func (ctx *DeleteDogContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (c *Context) NotFound() {\n\tc.Handle(http.StatusNotFound, \"\", nil)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusNotFound]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultNotFound(w, r)\n\t}\n}", "func NotFound(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeNotFound, \"not found\")\n}", "func (app *App) NotFound(handler handlerFunc) {\n\tapp.craterRequestHandler.notFoundHandler = func(w http.ResponseWriter, r *http.Request) {\n\t\treq := newRequest(r, make(map[string]string))\n\t\tres := newResponse(w)\n\t\thandler(req, res)\n\n\t\tapp.sendResponse(req, res)\n\t}\n}", "func (f WalkFunc) Do(ctx context.Context, call *Call) { call.Reply(http.StatusNotFound, nil) }", "func StopContainerNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (r *Responder) NotFound() { r.write(http.StatusNotFound) }", "func (h *HandleHelper) NotFound() {\n\terrResponse(http.StatusNotFound,\n\t\t\"the requested resource could not be found\",\n\t)(h.w, h.r)\n}", "func NotFound(w http.ResponseWriter) {\n\trenderError(w, http.StatusNotFound, nil)\n}", "func NotFound(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 404, message...)\n}", "func (ctx *DeleteOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func RenderNotFound(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, NotFound(message...))\n}", "func (s *server) Stop(ctx context.Context, in *pb.StopRequest) (*pb.StopResponse, error) {\n\tmapLock.RLock()\n\t// given a URL checks to see if its currently not being crawled\n\tindx, exists := s.spiderPtr.siteURLIndex[in.Link]\n\tmapLock.RUnlock()\n\tif !exists {\n\t\tmsg := fmt.Sprintf(\"Site %s is not being crawled\", in.Link)\n\t\treturn &pb.StopResponse{Message: msg}, nil\n\t}\n\tshutdownSpecificSiteCrawler <- linkIndex{url: in.Link, index: indx.index}\n\n\treturn &pb.StopResponse{Message: \"Crawler Stopping\"}, nil\n}", "func (ctx *ShowWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (m *Middleware) Stop(_ management.CommandWriter) error {\n\treturn nil\n}", "func (ctx *UpdateFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (a *API) getNotFound(ctx context.Context, res *common.HttpResponseWriter) error {\n\tres.WriteHeader(http.StatusNotFound)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, err error) {\n\tError(w, http.StatusNotFound, err)\n}", "func (ctx *ShowSecretsContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowCommentContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func StopHandler(w http.ResponseWriter, r *http.Request) {\n\t// services.JobProgress and quit\n\tcurrentJobid, _ := strconv.Atoi(r.URL.Path[6:])\n\tch := services.ChannelMap[currentJobid]\n\tclose(ch)\n\tdelete(services.ChannelMap, currentJobid)\n\tfmt.Fprintf(w, \"stopHandler\")\n}", "func NotFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"Not Found: %s\", r.URL.String())\n\tservice.WriteProblem(w, \"No route found\", \"ERROR_NOT_FOUND\", http.StatusNotFound, errors.New(\"Route not found\"))\n}", "func NotFound(w http.ResponseWriter) {\n\thttp.Error(w, \"404 not found!!!\", http.StatusNotFound)\n}", "func (c *Controller) Stop(ctx hive.HookContext) error {\n\tdoneChan := make(chan struct{})\n\tgo func() {\n\t\tc.workerpool.Close()\n\t\tclose(doneChan)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-doneChan:\n\t}\n\n\treturn nil\n}", "func (c *Controller) Stop(ctx hive.HookContext) error {\n\tdoneChan := make(chan struct{})\n\tgo func() {\n\t\tc.workerpool.Close()\n\t\tclose(doneChan)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-doneChan:\n\t}\n\n\treturn nil\n}", "func writeInsightNotFound(w http.ResponseWriter, str string) {\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\tio.WriteString(w, str)\n}", "func (ctx *PlayLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (ctx *ListMessageContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, r *http.Request) { Error(w, \"404 page not found\", http.StatusNotFound) }", "func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func LogsContainerNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, id string, follow bool, since *time.Time, stderr bool, stdout bool, tail string, timestamps bool, until *time.Time) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", follow)}\n\t\tquery[\"follow\"] = sliceVal\n\t}\n\tif since != nil {\n\t\tsliceVal := []string{(*since).Format(time.RFC3339)}\n\t\tquery[\"since\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stderr)}\n\t\tquery[\"stderr\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stdout)}\n\t\tquery[\"stdout\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{tail}\n\t\tquery[\"tail\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", timestamps)}\n\t\tquery[\"timestamps\"] = sliceVal\n\t}\n\tif until != nil {\n\t\tsliceVal := []string{(*until).Format(time.RFC3339)}\n\t\tquery[\"until\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/%v/logs\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", follow)}\n\t\tprms[\"follow\"] = sliceVal\n\t}\n\tif since != nil {\n\t\tsliceVal := []string{(*since).Format(time.RFC3339)}\n\t\tprms[\"since\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stderr)}\n\t\tprms[\"stderr\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", stdout)}\n\t\tprms[\"stdout\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{tail}\n\t\tprms[\"tail\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", timestamps)}\n\t\tprms[\"timestamps\"] = sliceVal\n\t}\n\tif until != nil {\n\t\tsliceVal := []string{(*until).Format(time.RFC3339)}\n\t\tprms[\"until\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tlogsCtx, _err := app.NewLogsContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Logs(logsCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func notFound(resource string) middleware.Responder {\n\tmessage := fmt.Sprintf(\"404 %s not found\", resource)\n\treturn operations.NewGetChartDefault(http.StatusNotFound).WithPayload(\n\t\t&models.Error{Code: helpers.Int64ToPtr(http.StatusNotFound), Message: &message},\n\t)\n}", "func (ctx *GetLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func ServeNotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Not Found\", http.StatusNotFound)\n}", "func WithNotFoundHandler(handler http.Handler) RunOption {\n\trt := router.NewRouter()\n\trt.SetNotFoundHandler(handler)\n\treturn WithRouter(rt)\n}", "func (client ServicesClient) StopPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"serviceName\": autorest.Encode(\"path\", serviceName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tconst APIVersion = \"2022-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func (ctx *ListOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tresponse := response.CreateResponse()\n\tresponse.SendDataWithStatusCode(w, \"not found\", http.StatusOK)\n}", "func NotFound(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\tm := TemplateMapFromContext(r.Context())\n\t\tm.Title(http.StatusText(http.StatusNotFound))\n\t\th.RenderHTMLStatus(w, http.StatusNotFound, \"404\", m)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusNotFound, http.StatusText(http.StatusNotFound))\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t}\n}", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func SimpleNotFoundHandler(c *Context) error {\n\thttp.NotFound(c.W, c.R)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, _ error) {\n\t(Response{Error: \"resource not found\"}).json(w, http.StatusNotFound)\n}", "func NewStopAppNotFound() *StopAppNotFound {\n\treturn &StopAppNotFound{}\n}", "func NotFoundHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tapi.WriteNotFound(w)\n\t})\n}", "func (ctx *DeleteLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func ShowTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *AcceptOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowProfileContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func RenderNotFound(w http.ResponseWriter) error {\n\tw.Header().Add(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\treturn template.ExecuteTemplate(w, \"404.amber\", nil)\n}", "func liveStopHandler(cache *CacheManager, serverChan chan error) RouteHandler {\n\treturn func (w http.ResponseWriter, r *http.Request, params map[string]string) {\n\t\terr := cache.Stop(params[\"filename\"])\n\t\tif err != nil {\n\t\t\tserverChan <- err\n\t\t\thttp.Error(w, \"Invalid request !\", http.StatusNotFound)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"\")\n\t\t}\n\t}\n}", "func (c *Controller) Stop() {\n\tglog.Info(\"shutdown http service\")\n}", "func NotFound(data Serializer, logging ...interface{}) Response {\n\tif data == nil {\n\t\tdata = String(\"404 Not Found\")\n\t}\n\treturn Response{Status: http.StatusNotFound, Data: data, Logging: logging}\n}", "func (ctx *ListItemContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (r *Reporter) Stop(_ context.Context) error {\n\treturn nil\n}", "func (c ApiWrapper) NotFound(msg string, objs ...interface{}) revel.Result {\n\treturn c.renderErrorString(404, fmt.Sprintf(msg, objs))\n}", "func (ctx *UpdateOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (h *Handler) cancel(c echo.Context) (e error) {\n\tctx := c.(*cuxs.Context)\n\tvar r cancelRequest\n\tvar id int64\n\tvar sr *model.SalesReturn\n\n\tif id, e = common.Decrypt(ctx.Param(\"id\")); e == nil {\n\t\tif sr, e = ShowSalesReturn(\"id\", id); e == nil {\n\t\t\tr.SR = sr\n\t\t\tif e = ctx.Bind(&r); e == nil {\n\t\t\t\tif e = CancelSalesReturn(sr); e == nil {\n\t\t\t\t\tif e = UpdateExpense(sr); e == nil {\n\t\t\t\t\t\tctx.Data(sr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\te = echo.ErrNotFound\n\t\t}\n\t}\n\n\treturn ctx.Serve(e)\n}", "func HandleNotFound(lgc *logic.Logic) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlgc.Logger().WithFields(log.Fields{\n\t\t\t\"path\": r.URL.Path, \"method\": r.Method,\n\t\t\t\"message\": \"404 Page Not Found\",\n\t\t}).Info(\"request start\")\n\t\tw.WriteHeader(404)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write([]byte(fmt.Sprintf(\n\t\t\t`{\"message\":\"Page Not Found %s %s\"}`, r.Method, r.URL.Path)))\n\t}\n}", "func (ctx *MoveLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func DeleteTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (client ServicesClient) StopSender(req *http.Request) (future ServicesStopFuture, err error) {\n\tvar resp *http.Response\n\tfuture.FutureAPI = &azure.Future{}\n\tresp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))\n\tif err != nil {\n\t\treturn\n\t}\n\tvar azf azure.Future\n\tazf, err = azure.NewFutureFromResponse(resp)\n\tfuture.FutureAPI = &azf\n\tfuture.Result = future.result\n\treturn\n}", "func (w *ServiceWriter) Stop() {\n\tclose(w.exit)\n\tw.exitWG.Wait()\n}", "func (s *Service) Stop(svc service.Service) error {\n\treturn nil\n}", "func (r Response) NotFound(code string, payload Payload, header ...ResponseHeader) {\n\tr.Response(code, http.NotFound, payload, header...)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\treturn\n}", "func NotFound(rw http.ResponseWriter) {\n\tHttpError(rw, \"not found\", 404)\n}" ]
[ "0.6611819", "0.60847664", "0.58584744", "0.57953215", "0.5725757", "0.569989", "0.56717837", "0.55977374", "0.54439646", "0.53810745", "0.5275468", "0.5233608", "0.51267004", "0.50475746", "0.50398195", "0.49987158", "0.4983825", "0.49757338", "0.4944888", "0.4944888", "0.4921303", "0.4881348", "0.48732805", "0.48394302", "0.48240122", "0.48071873", "0.48037976", "0.4797547", "0.4797248", "0.4781039", "0.47629783", "0.47620097", "0.47438803", "0.47164395", "0.47038832", "0.46798003", "0.46687606", "0.4659192", "0.46460304", "0.46289223", "0.46152616", "0.46131194", "0.46030635", "0.4596768", "0.45926347", "0.4585289", "0.4584435", "0.4579994", "0.45778686", "0.45749456", "0.45540425", "0.45519632", "0.45519632", "0.4541427", "0.45289642", "0.4519781", "0.4514147", "0.4514147", "0.45112953", "0.44770154", "0.44769964", "0.44534034", "0.44503704", "0.44338536", "0.44283906", "0.4427806", "0.44240695", "0.44208676", "0.44152027", "0.44147035", "0.44074506", "0.4397272", "0.43957472", "0.43957472", "0.43928075", "0.4392135", "0.4382437", "0.4377479", "0.43760526", "0.43746686", "0.4372247", "0.43663684", "0.4365483", "0.43651462", "0.43644738", "0.434813", "0.43436244", "0.43432242", "0.43277702", "0.43267205", "0.43262255", "0.43105263", "0.4309878", "0.43098375", "0.43068528", "0.43041483", "0.42954138", "0.42887482", "0.42798096", "0.42782253" ]
0.7397668
0
UpdateFeedBadRequest runs the method Update of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} if tags != nil { sliceVal := []string{*tags} query["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} query["title"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), RawQuery: query.Encode(), } req, err := http.NewRequest("PUT", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if tags != nil { sliceVal := []string{*tags} prms["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} prms["title"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) updateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } return nil, e } // Perform action _err = ctrl.Update(updateCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 400 { t.Errorf("invalid response status code: got %+v, expected 400", rw.Code) } var mt error if resp != nil { var _ok bool mt, _ok = resp.(error) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of error", resp, resp) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tquery[\"url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{url_}\n\t\tprms[\"url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StartFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func StopFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func UpdateTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func DeleteFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func TestUpdate_BadRequest(t *testing.T) {\n\tcontroller := gomock.NewController(t)\n\tdefer controller.Finish()\n\n\tmockUser := &core.User{\n\t\tID: 1,\n\t\tLogin: \"octocat\",\n\t}\n\n\tin := new(bytes.Buffer)\n\tw := httptest.NewRecorder()\n\tr := httptest.NewRequest(\"PATCH\", \"/api/user\", in)\n\tr = r.WithContext(\n\t\trequest.WithUser(r.Context(), mockUser),\n\t)\n\n\tHandleUpdate(nil)(w, r)\n\tif got, want := w.Code, 400; want != got {\n\t\tt.Errorf(\"Want response code %d, got %d\", want, got)\n\t}\n\n\tgot, want := new(errors.Error), &errors.Error{Message: \"EOF\"}\n\tjson.NewDecoder(w.Body).Decode(got)\n\tif diff := cmp.Diff(got, want); len(diff) != 0 {\n\t\tt.Errorf(diff)\n\t}\n}", "func ListFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func RunBadRequest(response http.ResponseWriter, request *http.Request, container interface{}) {\n\terrorController := BadRequest{}\n\terrorController.Init(container, []string{}, request)\n\terrorController.Run(response, request)\n}", "func (ctx *StopFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *UpdateFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, err *Error) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusBadRequest]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tr = ctxSetErr(r, err)\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultBadRequest(w, r, err)\n\t}\n}", "func RenderBadRequest(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, BadRequest(message...))\n}", "func (ctx *UpdateOutputContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func RenderBadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\treturn\n}", "func (ctx *GetFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *CreateFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *UpdateFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *UpdateFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *StartFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func UpdateFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func BadRequest(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(\"400 - Bad Request\"))\n}", "func NewUpdateFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*UpdateFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := UpdateFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\tparamTags := req.Params[\"tags\"]\n\tif len(paramTags) > 0 {\n\t\trawTags := paramTags[0]\n\t\trctx.Tags = &rawTags\n\t}\n\tparamTitle := req.Params[\"title\"]\n\tif len(paramTitle) > 0 {\n\t\trawTitle := paramTitle[0]\n\t\trctx.Title = &rawTitle\n\t}\n\treturn &rctx, err\n}", "func ServeBadRequest(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Bad Request\", http.StatusBadRequest)\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func BadRequest(w http.ResponseWriter, err error) {\n\tError(w, http.StatusBadRequest, err)\n}", "func NewUpdateBadRequestResponseBody(res *goa.ServiceError) *UpdateBadRequestResponseBody {\n\tbody := &UpdateBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func BadRequest(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeBadRequest, \"bad request\")\n}", "func (r *Responder) BadRequest() { r.write(http.StatusBadRequest) }", "func SendBadRequest(w http.ResponseWriter, opts ...ErrorOpts) {\n\tres := errorResponse{\n\t\tCode: CodeBadRequest,\n\t\tMessage: \"Bad request\",\n\t}\n\tres.apply(opts)\n\tSendJSON(w, 400, &res)\n}", "func (ctx *DeleteFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *ListFeedContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewUpdateBadRequest(body *UpdateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewUpdateBadRequest(body *UpdateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func RespondBadRequest(err error) events.APIGatewayProxyResponse {\n\treturn Respond(http.StatusBadRequest, Error{Error: err.Error()})\n}", "func UpdateFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetOutputContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (r *Response) BadRequest(v interface{}) {\n\tr.writeResponse(http.StatusBadRequest, v)\n}", "func BadRequest(r *http.ResponseWriter) error {\n\tresponse := *r\n\tresponse.WriteHeader(400)\n\treturn nil\n}", "func NewUpdateAppBadRequest() *UpdateAppBadRequest {\n\treturn &UpdateAppBadRequest{}\n}", "func (c *SeaterController) TraceBadRequestf(err error, format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tc.traceJSONAbort(nil, 400, msg)\n}", "func BadRequest(w http.ResponseWriter, text string, err error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Write([]byte(text))\n\tfmt.Println(text, \", Bad request with error:\", err)\n}", "func BadRequest(w http.ResponseWriter, err error) {\n\t(Response{Error: err.Error()}).json(w, http.StatusBadRequest)\n}", "func BadRequest(message string, w http.ResponseWriter) {\n\tbody := createBodyWithMessage(message)\n\twriteResponse(400, body, w)\n}", "func (o *UpdateActionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (ctx *UpdateListenContext) BadRequest(r *AntError) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.error+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ErrBadRequest(w http.ResponseWriter, r *http.Request) {\n\tBadRequestWithErr(w, r, errors.New(\"Bad Request\"))\n}", "func BadRequest(w http.ResponseWriter, errorType, message string) {\n\terrMsg := ErrorMessage{ErrorType: errorType, Message: message}\n\trenderError(w, http.StatusBadRequest, &errMsg)\n}", "func (resp *Response) BadRequest(w http.ResponseWriter, message string) {\n\tresp.Error = message\n\twrite(resp, w)\n}", "func AppUpdateHandler(context utils.Context, w http.ResponseWriter, r *http.Request) {\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.LogInfo.Printf(\"Error reading body: %v\", err)\n\t\thttp.Error(w, \"unable to read request body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tlog.LogInfo.Printf(\"Attempting to update : %s\\n\", string(body))\n\n\t//use decode here instead of unmarshal\n\tapplication, err := utils.ParseJson(body)\n\n\tif err != nil {\n\t\tlog.LogError.Println(err)\n\t\thttp.Error(w, \"unable to parse JSON\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tdbConn := context.DBConn\n\tdbBucket := context.DBBucketApp\n\n\tkey := []byte(application.Environment + \"_\" + application.Name)\n\tvalue := []byte(body)\n\n\tif err := database.InsertDBValue(dbConn, dbBucket, key, value); err != nil {\n\t\tlog.LogInfo.Printf(\"Failed to update DB: %v\", err)\n\t}\n\n\tlog.LogInfo.Printf(\"application environment: %s\\n\", application.Environment)\n\n}", "func badRequestHandler(w http.ResponseWriter, r *http.Request, e error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tio.WriteString(w, e.Error())\n}", "func (ctx *UpdateUserContext) BadRequest(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, format interface{}, args ...interface{}) {\n\tvar message string\n\tswitch v := format.(type) {\n\tcase string:\n\t\tmessage = v\n\tcase error:\n\t\tmessage = v.Error()\n\tcase fmt.Stringer:\n\t\tmessage = v.String()\n\tdefault:\n\t\tdvid.Criticalf(\"BadRequest called with unknown format type: %v\\n\", format)\n\t\treturn\n\t}\n\tif len(args) > 0 {\n\t\tmessage = fmt.Sprintf(message, args...)\n\t}\n\terrorMsg := fmt.Sprintf(\"%s (%s).\", message, r.URL.Path)\n\tdvid.Errorf(errorMsg + \"\\n\")\n\thttp.Error(w, errorMsg, http.StatusBadRequest)\n}", "func (response BasicJSONResponse) BadRequest(writer http.ResponseWriter) {\n\tBadRequest(writer, response)\n}", "func BadRequest(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 400, message...)\n}", "func (c *SeaterController) BadRequestf(format string, args ...interface{}) {\n\tc.TraceBadRequestf(nil, format, args...)\n}", "func NewUpdateEntityFilterBadRequest() *UpdateEntityFilterBadRequest {\n\treturn &UpdateEntityFilterBadRequest{}\n}", "func BadRequest(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\th.RenderHTMLStatus(w, http.StatusBadRequest, \"400\", nil)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusBadRequest, apiErrorBadRequest)\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t}\n}", "func ModifyItemsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ItemsController, id int, payload *app.ModifyItemPayload) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Validate payload\n\terr := payload.Validate()\n\tif err != nil {\n\t\te, ok := err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(err) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected payload validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/item/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ItemsTest\"), rw, req, prms)\n\tmodifyCtx, err := app.NewModifyItemsContext(goaCtx, req, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\tmodifyCtx.Payload = payload\n\n\t// Perform action\n\terr = ctrl.Modify(modifyCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *PutEventContext) BadRequest(r *AntError) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.error+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *CreateOutputContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *GetFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func NewUpdateCalculatedMetricsServiceBadRequest() *UpdateCalculatedMetricsServiceBadRequest {\n\treturn &UpdateCalculatedMetricsServiceBadRequest{}\n}", "func refreshFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tif err := s.RefreshFeed(plugin); err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error listing the plugins\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n}", "func NewUpdateMTOServiceItemStatusBadRequest() *UpdateMTOServiceItemStatusBadRequest {\n\treturn &UpdateMTOServiceItemStatusBadRequest{}\n}", "func NewUpdateAPIBadRequest() *UpdateAPIBadRequest {\n\treturn &UpdateAPIBadRequest{}\n}", "func RespondBadRequest(w http.ResponseWriter, message string) {\n\tlog.WithFields(log.Fields{\n\t\t\"time\": time.Now(),\n\t\t\"message\": message,\n\t}).Error(\"Received a bad request\")\n\terrorResponse := ErrorResponse{Error: message}\n\thttp.Error(w, \"\", http.StatusBadRequest)\n\t_ = json.NewEncoder(w).Encode(errorResponse)\n}", "func (ctx *CreateFilterContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *CreateDogContext) BadRequest() error {\n\tctx.ResponseData.WriteHeader(400)\n\treturn nil\n}", "func (o *UserEditBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func NewUpdateMessageBadRequestResponseBody(res *goa.ServiceError) *UpdateMessageBadRequestResponseBody {\n\tbody := &UpdateMessageBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func ErrBadRequestf(format string, arguments ...interface{}) *Status {\n\treturn &Status{Code: http.StatusBadRequest, Text: fmt.Sprintf(format, arguments...)}\n}", "func ShowTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (s *APIServer) UpdateApps(c *gin.Context) {\n}", "func (j *ServiceTestJig) UpdateServiceOrFail(namespace, name string, update func(*api.Service)) *api.Service {\n\tsvc, err := j.UpdateService(namespace, name, update)\n\tif err != nil {\n\t\tframework.Failf(err.Error())\n\t}\n\treturn svc\n}", "func (ctx *GetFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (c ApiWrapper) BadRequest(msg string, objs ...interface{}) revel.Result {\n\treturn c.renderErrorString(400, fmt.Sprintf(msg, objs))\n}", "func UpdateTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *PubPshbContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func (ctx *PostEventContext) BadRequest(r *AntError) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.error+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ResponseBadRequest(w http.ResponseWriter) {\n\tvar response Response\n\n\t// Set Response Data\n\tresponse.Status = false\n\tresponse.Code = http.StatusBadRequest\n\tresponse.Message = \"Bad Request\"\n\n\t// Set Response Data to HTTP\n\tResponseWrite(w, response.Code, response)\n}", "func (ctx *UpdateOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func BadRequestResponse(w http.ResponseWriter) error {\n\tw.WriteHeader(http.StatusBadRequest)\n\n\tdata, err := badRequestBody.MarshalJSON()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"marshal json\")\n\t}\n\n\tif _, err := w.Write(data); err != nil {\n\t\treturn errors.Wrap(err, \"write response\")\n\t}\n\n\treturn nil\n}", "func handleActivityUpdate(w http.ResponseWriter, r *http.Request) {\r\n\t//[TODO: query param approach is not the effecient way to handle, as the parameters values in the url are visible to anyone,a nd it could pose security issues. so, need to explore the way in which we can pass the values as part of the HTTP header/body instead of URL]\r\n\ti := strings.Index(r.RequestURI, \"?\") // since url.ParseQuery is not able to retrieve the first key (of the query string) correctly, find the position of ? in the url and\r\n\tqs := r.RequestURI[i+1 : len(r.RequestURI)] // substring it and then\r\n\r\n\tm, _ := url.ParseQuery(qs) // parse it\r\n\tc := appengine.NewContext(r)\r\n\r\n\terr := helpers.UpdateActivity(c, m[\"ActivityName\"][0], m[\"StartTime\"][0], m[\"Status\"][0], m[\"NewStatus\"][0])\r\n\r\n\tif err != nil {\r\n\t\thttp.Error(w, \"Error while changing the status: \"+err.Error(), http.StatusInternalServerError)\r\n\t\treturn\r\n\t}\r\n\r\n\thttp.Redirect(w, r, \"/\", http.StatusFound)\r\n}", "func ValidateUpdateBadRequestResponseBody(body *UpdateBadRequestResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "func ValidateUpdateBadRequestResponseBody(body *UpdateBadRequestResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "func BadRequestIfErr(w http.ResponseWriter, r *http.Request, err error) bool {\n\tif err != nil {\n\t\tres := prepContext(r)\n\t\tBadRequestWithErr(w, res, err)\n\t\treturn true\n\t}\n\n\treturn false\n}", "func BadRequest(err error) Response {\n\treturn &errorResponse{\n\t\tcode: http.StatusBadRequest,\n\t\tmsg: err.Error(),\n\t}\n}", "func BadRequestHandler() Handler {\n\treturn HandlerFunc(BadRequest)\n}", "func (ctx *UpdateFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func TestBadRequest(t *testing.T) {\n\texpectedCode := http.StatusBadRequest\n\tbody := testEndpoint(t, \"GET\", \"/weather?location=kampala\", expectedCode)\n\n\texpectedBody := `{\"message\":\"No location/date specified\"}`\n\n\tif body != expectedBody {\n\t\tt.Errorf(\"Handler returned wrong body: got %v instead of %v\", body, expectedBody)\n\t}\n}", "func (ctx *CreateMessageContext) BadRequest(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}" ]
[ "0.61627066", "0.6157309", "0.5838464", "0.5707554", "0.55888885", "0.548779", "0.54845536", "0.54576546", "0.53694224", "0.53589827", "0.5350626", "0.51506656", "0.5144219", "0.51399356", "0.5131488", "0.5128663", "0.51093495", "0.5106876", "0.51001036", "0.50690234", "0.5035062", "0.50287527", "0.5003803", "0.49893326", "0.49664557", "0.4953262", "0.4929799", "0.48861903", "0.48761845", "0.48726055", "0.48683548", "0.48620492", "0.48559946", "0.48465863", "0.48411828", "0.48380035", "0.48343885", "0.48343885", "0.48164368", "0.4781232", "0.4765367", "0.47621801", "0.47415873", "0.47368112", "0.4726501", "0.4715636", "0.46997723", "0.46946", "0.46788493", "0.4676203", "0.46266395", "0.46242678", "0.4623227", "0.46081617", "0.4597691", "0.4593589", "0.45924124", "0.45865226", "0.45854926", "0.45742443", "0.4559679", "0.4554927", "0.4547509", "0.45291758", "0.45222792", "0.452152", "0.45095536", "0.4499688", "0.4485967", "0.4484537", "0.44828248", "0.44752765", "0.4474958", "0.4472382", "0.4472176", "0.44521844", "0.4451097", "0.44446996", "0.44357824", "0.44141892", "0.4405034", "0.4403594", "0.43949622", "0.43751284", "0.43698025", "0.43652654", "0.43596298", "0.43591717", "0.43451285", "0.43435544", "0.434341", "0.4342734", "0.43422675", "0.43422675", "0.4334797", "0.4328088", "0.43255424", "0.43233976", "0.43218237", "0.43206328" ]
0.726267
0
UpdateFeedNotFound runs the method Update of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter { // Setup service var ( logBuf bytes.Buffer respSetter goatest.ResponseSetterFunc = func(r interface{}) {} ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} if tags != nil { sliceVal := []string{*tags} query["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} query["title"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), RawQuery: query.Encode(), } req, err := http.NewRequest("PUT", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if tags != nil { sliceVal := []string{*tags} prms["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} prms["title"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) updateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil } // Perform action _err = ctrl.Update(updateCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 404 { t.Errorf("invalid response status code: got %+v, expected 404", rw.Code) } // Return results return rw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *UpdateFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func GetFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *UpdateOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *GetFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *StartFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func UpdateFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *StopFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func StartFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/start\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstartCtx, _err := app.NewStartFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Start(startCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *DeleteFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ListFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func UpdateTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func DeleteFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func StopFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v/stop\", id),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tstopCtx, _err := app.NewStopFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Stop(stopCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func ListFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (r *Responder) NotFound() { r.write(http.StatusNotFound) }", "func (ctx *GetOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (app *App) NotFound(handler handlerFunc) {\n\tapp.craterRequestHandler.notFoundHandler = func(w http.ResponseWriter, r *http.Request) {\n\t\treq := newRequest(r, make(map[string]string))\n\t\tres := newResponse(w)\n\t\thandler(req, res)\n\n\t\tapp.sendResponse(req, res)\n\t}\n}", "func NotFound(w ResponseWriter, r *Request) { Error(w, \"404 page not found\", StatusNotFound) }", "func (ctx *UpdateUserContext) NotFound(r error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func GetFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func NotFound(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": true, \"msg\": \"`+msg+`\"}`, 404, service, \"application/json\")\n\treturn nil\n}", "func (a *API) getNotFound(ctx context.Context, res *common.HttpResponseWriter) error {\n\tres.WriteHeader(http.StatusNotFound)\n\treturn nil\n}", "func (f WalkFunc) Do(ctx context.Context, call *Call) { call.Reply(http.StatusNotFound, nil) }", "func NotFound(w ResponseWriter, r *Request) {\n\tw.SetHeader(CodeNotFound, \"not found\")\n}", "func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request) {\n\twriteResponse(r, w, http.StatusNotFound, &SimpleResponse{\n\t\tTraceID: tracing.FromContext(r.Context()),\n\t\tMessage: \"not found\",\n\t})\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowBottleContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thandlerMu.RLock()\n\tf, ok := handlerMap[http.StatusNotFound]\n\thandlerMu.RUnlock()\n\tif ok {\n\t\tf.ServeHTTP(w, r)\n\t} else {\n\t\tdefaultNotFound(w, r)\n\t}\n}", "func NotFoundHandler() ServiceHttpHandler { return ServiceHttpHandler{Handler: NotFound} }", "func (this *Context) NotFound(message string) {\n\tthis.ResponseWriter.WriteHeader(404)\n\tthis.ResponseWriter.Write([]byte(message))\n}", "func (h *HandleHelper) NotFound() {\n\terrResponse(http.StatusNotFound,\n\t\t\"the requested resource could not be found\",\n\t)(h.w, h.r)\n}", "func writeInsightNotFound(w http.ResponseWriter, str string) {\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\tio.WriteString(w, str)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tjson.NewEncoder(w).Encode(&ServiceError{\n\t\tMessage: \"Endpoint not found\",\n\t\tSolution: \"See / for possible directives\",\n\t\tErrorCode: http.StatusNotFound,\n\t})\n}", "func NotFound(w http.ResponseWriter) {\n\trenderError(w, http.StatusNotFound, nil)\n}", "func (ctx *UpdateFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ModifyItemsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ItemsController, id int, payload *app.ModifyItemPayload) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Validate payload\n\terr := payload.Validate()\n\tif err != nil {\n\t\te, ok := err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(err) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected payload validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/item/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ItemsTest\"), rw, req, prms)\n\tmodifyCtx, err := app.NewModifyItemsContext(goaCtx, req, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\tmodifyCtx.Payload = payload\n\n\t// Perform action\n\terr = ctrl.Modify(modifyCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *GetFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NewUpdateNotFound(body *UpdateNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func NewUpdateNotFound(body *UpdateNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "func (ctx *GetUsersContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func (c *Context) NotFound() {\n\tc.JSON(404, ResponseWriter(404, \"page not found\", nil))\n}", "func (ctx *ShowCommentContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (o *ThreadUpdateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(404)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func NewApplyUpdateNotFound() *ApplyUpdateNotFound {\n\treturn &ApplyUpdateNotFound{}\n}", "func (ctx *PlayLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func NotFound(w http.ResponseWriter, err error) {\n\tError(w, http.StatusNotFound, err)\n}", "func RenderNotFound(w http.ResponseWriter, message ...interface{}) {\n\tRender(w, NotFound(message...))\n}", "func NotFound(w http.ResponseWriter, r *http.Request, h *render.Renderer) {\n\taccept := strings.Split(r.Header.Get(\"Accept\"), \",\")\n\taccept = append(accept, strings.Split(r.Header.Get(\"Content-Type\"), \",\")...)\n\n\tswitch {\n\tcase prefixInList(accept, ContentTypeHTML):\n\t\tm := TemplateMapFromContext(r.Context())\n\t\tm.Title(http.StatusText(http.StatusNotFound))\n\t\th.RenderHTMLStatus(w, http.StatusNotFound, \"404\", m)\n\tcase prefixInList(accept, ContentTypeJSON):\n\t\th.RenderJSON(w, http.StatusNotFound, http.StatusText(http.StatusNotFound))\n\tdefault:\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t}\n}", "func SendNotFound(w http.ResponseWriter, opts ...ErrorOpts) {\n\tres := errorResponse{\n\t\tCode: CodeNotFound,\n\t\tMessage: \"Not found\",\n\t}\n\tres.apply(opts)\n\tSendJSON(w, 404, &res)\n}", "func (suite *TenantTestSuite) TestUpdateNotFound() {\n\t// Prepare the request object\n\trequest, _ := http.NewRequest(\"PUT\", \"/api/v2/admin/tenants/BADID\", strings.NewReader(\"{}\"))\n\t// add the content-type header to application/json\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\t// add the authentication token which is seeded in testdb\n\trequest.Header.Set(\"x-api-key\", suite.clientkey)\n\n\tresponse := httptest.NewRecorder()\n\n\tsuite.router.ServeHTTP(response, request)\n\n\tcode := response.Code\n\toutput := response.Body.String()\n\n\tsuite.Equal(404, code, \"Internal Server Error\")\n\tsuite.Equal(suite.respTenantNotFound, output, \"Response body mismatch\")\n}", "func (j *ServiceTestJig) UpdateServiceOrFail(namespace, name string, update func(*api.Service)) *api.Service {\n\tsvc, err := j.UpdateService(namespace, name, update)\n\tif err != nil {\n\t\tframework.Failf(err.Error())\n\t}\n\treturn svc\n}", "func (ctx *ShowWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFoundHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tapi.WriteNotFound(w)\n\t})\n}", "func UpdateFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func notfound(out http.ResponseWriter, format string, args ...interface{}) {\n\tsend(http.StatusNotFound, out, format, args...)\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tresponse := response.CreateResponse()\n\tresponse.SendDataWithStatusCode(w, \"not found\", http.StatusOK)\n}", "func (ctx *GetLocationsContext) NotFound(r *Error) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"error\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func NotFound(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\thttp.NotFound(w, r)\n\treturn nil\n}", "func NewUpdateFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*UpdateFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := UpdateFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\tparamTags := req.Params[\"tags\"]\n\tif len(paramTags) > 0 {\n\t\trawTags := paramTags[0]\n\t\trctx.Tags = &rawTags\n\t}\n\tparamTitle := req.Params[\"title\"]\n\tif len(paramTitle) > 0 {\n\t\trawTitle := paramTitle[0]\n\t\trctx.Title = &rawTitle\n\t}\n\treturn &rctx, err\n}", "func ServeNotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"Not Found\", http.StatusNotFound)\n}", "func (r *Response) NotFound(v interface{}) {\n\tr.writeResponse(http.StatusNotFound, v)\n}", "func WrapWithNotFound(cause error, parameters ...wparams.ParamStorer) Error {\n\treturn newGenericError(cause, DefaultNotFound, wparams.NewParamStorer(parameters...))\n}", "func NotFound(w http.ResponseWriter, r *http.Request) { Error(w, \"404 page not found\", http.StatusNotFound) }", "func (wa *webapi) defaultHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n}", "func (ctx *AddLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *MoveLinkWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *DeleteFilterContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *DeleteDogContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFound(w http.ResponseWriter) {\n\thttp.Error(w, \"404 not found!!!\", http.StatusNotFound)\n}", "func (response BasicJSONResponse) NotFound(writer http.ResponseWriter) {\n\tNotFound(writer, response)\n}", "func (resp *Response) NotFound(w http.ResponseWriter, queryParam string) {\n\tresp.Error = \"The user with id \" + queryParam + \" was not found\"\n\twrite(resp, w)\n}", "func RenderNotFound(w http.ResponseWriter) error {\n\tw.Header().Add(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\treturn template.ExecuteTemplate(w, \"404.amber\", nil)\n}", "func (o *PostFriendsUpdatesListNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(404)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func NotFound(mw relay.MessageWriter, r *relay.Request, a *Action) {\n\tmw.WriteCommand(irc.INFO)\n\tmw.Params().Set(r.Receivers()...)\n\tfmt.Fprintf(mw, \"Oops... action %s not found.\", a.Method)\n}", "func (web *WebServer) NotFound(handler http.HandlerFunc) {\n\tweb.router.NotFound(handler)\n}", "func (c ApiWrapper) NotFound(msg string, objs ...interface{}) revel.Result {\n\treturn c.renderErrorString(404, fmt.Sprintf(msg, objs))\n}", "func NotFound(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\treturn\n}", "func ShowTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tshowCtx, _err := app.NewShowTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Show(showCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *ShowProfileContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func refreshFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tif err := s.RefreshFeed(plugin); err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error listing the plugins\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n}", "func (ctx *DeleteOutputContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func SendNotFound(c *gin.Context) {\n\tSendHTML(http.StatusNotFound, c, \"notfound\", nil)\n}", "func NotFound(w http.ResponseWriter, _ error) {\n\t(Response{Error: \"resource not found\"}).json(w, http.StatusNotFound)\n}", "func NotFound(w http.ResponseWriter, message ...interface{}) {\n\tboom(w, 404, message...)\n}", "func (c *Context) NotFound() {\n\tc.Handle(http.StatusNotFound, \"\", nil)\n}", "func GetFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetByIDHostContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ListItemContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *ShowSecretsContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func (ctx *AcceptOfferContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NotFoundHandler() Handler { return HandlerFunc(NotFound) }", "func NewUpdateAppNotFound() *UpdateAppNotFound {\n\treturn &UpdateAppNotFound{}\n}", "func NewUpdateAppNotFound() *UpdateAppNotFound {\n\treturn &UpdateAppNotFound{}\n}", "func TestPutNotificationNotFound(t *testing.T) {\n\treq, err := http.NewRequest(\"PUT\", fmt.Sprintf(\"%s/api/v1/notification/not-found\", server.URL), nil)\n\n\tif err != nil {\n\t\tt.Fatal(\"Request failed [PUT] /api/v1/notification\")\n\t}\n\n\tresp, _ := http.DefaultClient.Do(req)\n\n\tassert.Equal(t, 404, resp.StatusCode)\n}" ]
[ "0.6689948", "0.62865585", "0.59022856", "0.5883028", "0.5879438", "0.5813659", "0.57847697", "0.578247", "0.5745945", "0.56624615", "0.56593025", "0.55157435", "0.54933727", "0.5484851", "0.545109", "0.5379509", "0.5169704", "0.5147451", "0.51276183", "0.5089034", "0.50740635", "0.5063807", "0.50313824", "0.50269294", "0.5013358", "0.5008331", "0.49923974", "0.49905112", "0.49869823", "0.4983913", "0.4983913", "0.49497005", "0.4918928", "0.49182516", "0.49064678", "0.4906092", "0.4902252", "0.48653996", "0.4862883", "0.48399326", "0.48304644", "0.4830227", "0.4830227", "0.48290512", "0.48284334", "0.47767657", "0.47762266", "0.47752368", "0.47704443", "0.47676173", "0.4765766", "0.47518665", "0.47475216", "0.47330177", "0.472077", "0.4717953", "0.47136465", "0.4713177", "0.47085604", "0.4703412", "0.46918756", "0.4688408", "0.4688408", "0.46766746", "0.46609434", "0.46597114", "0.46480697", "0.46433327", "0.46426558", "0.46343726", "0.462181", "0.46201575", "0.46177873", "0.46159923", "0.46069697", "0.46069598", "0.46047604", "0.46031734", "0.46015722", "0.45971516", "0.45968902", "0.45894322", "0.45865777", "0.45864528", "0.4575682", "0.45752612", "0.45741385", "0.4572871", "0.45619023", "0.4544555", "0.45438915", "0.45406324", "0.45386076", "0.453641", "0.45363933", "0.45281643", "0.45281643", "0.45239356", "0.45239356", "0.4518455" ]
0.7308207
0
UpdateFeedOK runs the method Update of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func UpdateFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.Feed) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} if tags != nil { sliceVal := []string{*tags} query["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} query["title"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), RawQuery: query.Encode(), } req, err := http.NewRequest("PUT", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if tags != nil { sliceVal := []string{*tags} prms["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} prms["title"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) updateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.Update(updateCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 200 { t.Errorf("invalid response status code: got %+v, expected 200", rw.Code) } var mt *app.Feed if resp != nil { var _ok bool mt, _ok = resp.(*app.Feed) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.Feed", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *UpdateFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func UpdateFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateOutputContext) OK(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *GetFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func UpdateTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateFilterContext) OK(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func GetFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *ListFeedContext) OK(r FeedCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.feed.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FeedCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewFormatScoreServiceUpdateOK() *FormatScoreServiceUpdateOK {\n\treturn &FormatScoreServiceUpdateOK{}\n}", "func (ctx *UpdateUsersContext) OK(r *User) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"user\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewUpdateFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*UpdateFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := UpdateFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\tparamTags := req.Params[\"tags\"]\n\tif len(paramTags) > 0 {\n\t\trawTags := paramTags[0]\n\t\trctx.Tags = &rawTags\n\t}\n\tparamTitle := req.Params[\"title\"]\n\tif len(paramTitle) > 0 {\n\t\trawTitle := paramTitle[0]\n\t\trctx.Title = &rawTitle\n\t}\n\treturn &rctx, err\n}", "func (ctx *GetOutputContext) OK(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewApplyUpdateOK() *ApplyUpdateOK {\n\treturn &ApplyUpdateOK{}\n}", "func (ctx *UpdateUserContext) OK(r *User) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.user+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (w *ServiceWriter) Flush() {\n\tif !w.updated {\n\t\treturn\n\t}\n\tw.updated = false\n\n\tserviceBuffer := w.serviceBuffer\n\n\tlog.Debugf(\"going to flush updated service metadata, %d services\", len(serviceBuffer))\n\tatomic.StoreInt64(&w.stats.Services, int64(len(serviceBuffer)))\n\n\tdata, err := model.EncodeServicesPayload(serviceBuffer)\n\tif err != nil {\n\t\tlog.Errorf(\"encoding issue: %v\", err)\n\t\treturn\n\t}\n\n\theaders := map[string]string{\n\t\tlanguageHeaderKey: strings.Join(info.Languages(), \"|\"),\n\t\t\"Content-Type\": \"application/json\",\n\t}\n\n\tatomic.AddInt64(&w.stats.Bytes, int64(len(data)))\n\n\tstartFlush := time.Now()\n\n\t// Send the payload to the endpoint\n\terr = w.endpoint.Write(data, headers)\n\n\tflushTime := time.Since(startFlush)\n\n\t// TODO: if error, depending on why, replay later.\n\tif err != nil {\n\t\tatomic.AddInt64(&w.stats.Errors, 1)\n\t\tlog.Errorf(\"failed to flush service payload, time:%s, size:%d bytes, error: %s\", flushTime, len(data), err)\n\t\treturn\n\t}\n\n\tlog.Infof(\"flushed service payload to the API, time:%s, size:%d bytes\", flushTime, len(data))\n\tstatsd.Client.Gauge(\"datadog.trace_agent.service_writer.flush_duration\", flushTime.Seconds(), nil, 1)\n\tatomic.AddInt64(&w.stats.Payloads, 1)\n}", "func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (is *InfluxStats) WriteOkUpdate(ps int64, wt time.Duration) {\n\tis.mutex.Lock()\n\tdefer is.mutex.Unlock()\n\tif is.PSentMax < ps {\n\t\tis.PSentMax = ps\n\t}\n\tif is.WriteTimeMax < wt {\n\t\tis.WriteTimeMax = wt\n\t}\n\tis.WriteSent++\n\tis.PSent += ps\n\tis.WriteTime += wt\n}", "func (ctx *UpdateFeedContext) OKTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func OK(w http.ResponseWriter, data interface{}, message string) {\n\tsuccessResponse := BuildSuccess(data, message, MetaInfo{HTTPStatus: http.StatusOK})\n\tWrite(w, successResponse, http.StatusOK)\n}", "func (ctx *UpdateFeedContext) OKLink(r *FeedLink) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func OK(w http.ResponseWriter, r *http.Request, body interface{}) {\n\tbuilder := response.New(w, r)\n\tbuilder.WithHeader(\"Content-Type\", \"text/xml; charset=utf-8\")\n\tbuilder.WithBody(body)\n\tbuilder.Write()\n}", "func Update(ctx *gin.Context, data interface{}) {\n\tctx.JSON(http.StatusAccepted, gin.H{\"code\": merrors.ErrSuccess, \"data\": data})\n\treturn\n}", "func NewUpdateEntityFilterOK() *UpdateEntityFilterOK {\n\treturn &UpdateEntityFilterOK{}\n}", "func refreshFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tif err := s.RefreshFeed(plugin); err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error listing the plugins\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n}", "func update(w http.ResponseWriter, req *http.Request) {\n\tresponse := \"\"\n\tswitch req.RequestURI {\n\tcase \"/get/accounts\":\n\t\tmapD := map[string]int{\"apple\": 5, \"lettuce\": 7}\n\t\tmapB, _ := json.Marshal(mapD)\n\t\tresponse = string(mapB)\n\t\tbreak\n\tdefault:\n\t\tr, _ := json.Marshal(\"Request not found\")\n\t\tresponse = string(r)\n\t\tbreak\n\t}\n\n\tcontext := Context{Title: response}\n\trender(w, \"api\", context)\n}", "func OK(r *http.ResponseWriter) error {\n\tresponse := *r\n\tresponse.WriteHeader(200)\n\treturn nil\n}", "func (p *Projector) doUpdateFeed(request *protobuf.UpdateMutationStreamRequest) ap.MessageMarshaller {\n\tvar err error\n\n\tc.Debugf(\"%v doUpdateFeed()\\n\", p.logPrefix)\n\tresponse := protobuf.NewMutationStreamResponse(request)\n\n\ttopic := request.GetTopic()\n\tbucketns := request.GetBuckets()\n\n\tfeed, err := p.GetFeed(topic) // only existing feed\n\tif err != nil {\n\t\tc.Errorf(\"%v %v\\n\", p.logPrefix, err)\n\t\tresponse.UpdateErr(err)\n\t\treturn response\n\t}\n\n\tif err = feed.UpdateFeed(request); err == nil {\n\t\t// gather latest set of timestamps for each bucket, provided request\n\t\t// is not for deleting the bucket.\n\t\tif !request.IsDelBuckets() {\n\t\t\t// we expect failoverTimestamps and kvTimestamps to be re-populated.\n\t\t\tfailTss := make([]*protobuf.TsVbuuid, 0, len(bucketns))\n\t\t\tkvTss := make([]*protobuf.TsVbuuid, 0, len(bucketns))\n\t\t\tfor _, bucketn := range bucketns {\n\t\t\t\tfailTss = append(failTss, feed.failoverTimestamps[bucketn])\n\t\t\t\tkvTss = append(kvTss, feed.kvTimestamps[bucketn])\n\t\t\t}\n\t\t\tresponse.UpdateTimestamps(failTss, kvTss)\n\t\t}\n\t} else {\n\t\tresponse.UpdateErr(err)\n\t}\n\treturn response\n}", "func (ctx *ShowStatusContext) OK(r *Status) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.status+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewUpdateConsumerOK() *UpdateConsumerOK {\n\treturn &UpdateConsumerOK{}\n}", "func (ctx *ShowWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/xml\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func NewUpdateHookOK() *UpdateHookOK {\n\treturn &UpdateHookOK{}\n}", "func NewUpdateAppOK() *UpdateAppOK {\n\treturn &UpdateAppOK{}\n}", "func NewUpdateAppOK() *UpdateAppOK {\n\treturn &UpdateAppOK{}\n}", "func NewUpdateAppOK() *UpdateAppOK {\n\treturn &UpdateAppOK{}\n}", "func (ctx *ListOutputContext) OK(r OutputCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.output.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = OutputCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *SpecsOutputContext) OK(r OutputSpecCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.output-spec.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = OutputSpecCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func Ok(c *routing.Context, msg string, service string) error {\n\tResponse(c, msg, 200, service, \"application/json\")\n\treturn nil\n}", "func (srv *Service) WriteOk(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusOK)\n}", "func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler.ProgressEvent, error) {\n\t// Add your code here:\n\t// * Make API calls (use req.Session)\n\t// * Mutate the model\n\t// * Check/set any callback context (req.CallbackContext / response.CallbackContext)\n\n\t// Construct a new handler.ProgressEvent and return it\n\tresponse := handler.ProgressEvent{\n\t\tOperationStatus: handler.Success,\n\t\tMessage: \"Update complete\",\n\t\tResourceModel: currentModel,\n\t}\n\n\treturn response, nil\n\n\t// Not implemented, return an empty handler.ProgressEvent\n\t// and an error\n\treturn handler.ProgressEvent{}, errors.New(\"Not implemented: Update\")\n}", "func NewEndpointUpdateOK() *EndpointUpdateOK {\n\treturn &EndpointUpdateOK{}\n}", "func Ok(ctx context.Context, w http.ResponseWriter, response interface{}) {\n\treader, err := FormatOk(response)\n\tif err != nil {\n\t\tlog.Error(ctx, \"unable marshal response\", \"err\", err, \"type\", \"reply\")\n\t\tErr(ctx, w, http.StatusInternalServerError, \"internal error\")\n\t\treturn\n\t}\n\n\tFromContext(ctx).Reply(ctx, w, http.StatusOK, reader)\n}", "func (ctx *UpdateListenContext) OK(r *AntRegResult) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.reg.result+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (h *Handler) put(c echo.Context) (e error) {\n\tctx := c.(*cuxs.Context)\n\tvar r updateRequest\n\tvar sd *auth.SessionData\n\tvar id int64\n\tvar sr *model.SalesReturn\n\n\tif sd, e = auth.UserSession(ctx); e == nil {\n\t\tr.SessionData = sd\n\n\t\tif id, e = common.Decrypt(ctx.Param(\"id\")); e == nil {\n\t\t\tif sr, e = ShowSalesReturn(\"id\", id); e == nil {\n\t\t\t\tr.SR = sr\n\t\t\t\tr.SO = sr.SalesOrder\n\t\t\t\tif e = ctx.Bind(&r); e == nil {\n\t\t\t\t\tu := r.Transform(sr)\n\n\t\t\t\t\tif e = u.Save(\"recognition_date\", \"note\", \"updated_by\", \"updated_at\", \"total_amount\", \"document_status\"); e == nil {\n\t\t\t\t\t\tif e = UpdateSalesReturnItem(sr.SalesReturnItems, u.SalesReturnItems); e == nil {\n\t\t\t\t\t\t\tctx.Data(u)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\te = echo.ErrNotFound\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ctx.Serve(e)\n}", "func (r *resourceFrameworkShare) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {\n}", "func (r *Responder) OK() { r.write(http.StatusOK) }", "func UpdateWidget(res http.ResponseWriter, req *http.Request) {\n\tresp := response.New()\n\n\tresp.Render(res, req)\n}", "func (ctx *PutEventContext) OK(r *AntResult) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.result+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *GetOpmlContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/xml\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func UpdateTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (w *ServiceWriter) Run() {\n\tw.exitWG.Add(1)\n\tdefer w.exitWG.Done()\n\n\t// for now, simply flush every x seconds\n\tflushTicker := time.NewTicker(5 * time.Second)\n\tdefer flushTicker.Stop()\n\n\tupdateInfoTicker := time.NewTicker(1 * time.Minute)\n\tdefer updateInfoTicker.Stop()\n\n\tlog.Debug(\"starting service writer\")\n\n\tfor {\n\t\tselect {\n\t\tcase sm := <-w.InServices:\n\t\t\tupdated := w.serviceBuffer.Update(sm)\n\t\t\tif updated {\n\t\t\t\tw.updated = updated\n\t\t\t\tstatsd.Client.Count(\"datadog.trace_agent.writer.services.updated\", 1, nil, 1)\n\t\t\t}\n\t\tcase <-flushTicker.C:\n\t\t\tw.Flush()\n\t\tcase <-updateInfoTicker.C:\n\t\t\tgo w.updateInfo()\n\t\tcase <-w.exit:\n\t\t\tlog.Info(\"exiting service writer, flushing all modified services\")\n\t\t\tw.Flush()\n\t\t\treturn\n\t\t}\n\t}\n}", "func (ctx *ShowBottleContext) OK(r *GoaExampleBottle) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.example.bottle+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (r *ManagedServiceUpdateRequest) SendContext(ctx context.Context) (result *ManagedServiceUpdateResponse, err error) {\n\tquery := helpers.CopyQuery(r.query)\n\theader := helpers.CopyHeader(r.header)\n\tbuffer := &bytes.Buffer{}\n\terr = writeManagedServiceUpdateRequest(r, buffer)\n\tif err != nil {\n\t\treturn\n\t}\n\turi := &url.URL{\n\t\tPath: r.path,\n\t\tRawQuery: query.Encode(),\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"PATCH\",\n\t\tURL: uri,\n\t\tHeader: header,\n\t\tBody: io.NopCloser(buffer),\n\t}\n\tif ctx != nil {\n\t\trequest = request.WithContext(ctx)\n\t}\n\tresponse, err := r.transport.RoundTrip(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tresult = &ManagedServiceUpdateResponse{}\n\tresult.status = response.StatusCode\n\tresult.header = response.Header\n\treader := bufio.NewReader(response.Body)\n\t_, err = reader.Peek(1)\n\tif err == io.EOF {\n\t\terr = nil\n\t\treturn\n\t}\n\tif result.status >= 400 {\n\t\tresult.err, err = errors.UnmarshalErrorStatus(reader, result.status)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = result.err\n\t\treturn\n\t}\n\terr = readManagedServiceUpdateResponse(result, reader)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (r *GowebHTTPResponder) WithOK(ctx context.Context) error {\n\treturn r.WithStatus(ctx, http.StatusOK)\n}", "func NewUpdateRuleSetOK() *UpdateRuleSetOK {\n\treturn &UpdateRuleSetOK{}\n}", "func (ctx *GetSwaggerContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func (ctx *ShowBottleContext) OK(r *GoaExampleBottle) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.example.bottle+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (s *Server) update(w http.ResponseWriter, r *http.Request) {\n\tv := mux.Vars(r)\n\tlogID, err := url.PathUnescape(v[\"logid\"])\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"cannot parse URL: %v\", err.Error()), http.StatusBadRequest)\n\t}\n\tbody, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"cannot read request body: %v\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\tvar req api.UpdateRequest\n\tif err := json.Unmarshal(body, &req); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"cannot parse request body as proper JSON struct: %v\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\t// Get the output from the witness.\n\tsth, err := s.w.Update(r.Context(), logID, req.STH, req.Proof)\n\tif err != nil {\n\t\t// If there was a failed precondition it's possible the caller was\n\t\t// just out of date. Give the returned STH to help them\n\t\t// form a new request.\n\t\tif c := status.Code(err); c == codes.FailedPrecondition {\n\t\t\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\t\t\tw.WriteHeader(httpForCode(c))\n\t\t\t// The returned STH gets written a few lines below.\n\t\t} else {\n\t\t\thttp.Error(w, fmt.Sprintf(\"failed to update to new STH: %v\", err), httpForCode(http.StatusInternalServerError))\n\t\t\treturn\n\t\t}\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tif _, err := w.Write(sth); err != nil {\n\t\tklog.Errorf(\"Write(): %v\", err)\n\t}\n}", "func APIOK(c *fiber.Ctx, msg string, data interface{}) error {\n\terr := c.Status(200).JSON(APIResponse{\n\t\tStatus: \"OK\",\n\t\tMsg: msg,\n\t\tData: data,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// fix old browsers (like Safari) problems with encoding\n\t// because of this line, we don't follow the RFC standard\n\tc.Set(\"Content-Type\", fiber.MIMEApplicationJSONCharsetUTF8)\n\treturn nil\n}", "func handleActivityUpdate(w http.ResponseWriter, r *http.Request) {\r\n\t//[TODO: query param approach is not the effecient way to handle, as the parameters values in the url are visible to anyone,a nd it could pose security issues. so, need to explore the way in which we can pass the values as part of the HTTP header/body instead of URL]\r\n\ti := strings.Index(r.RequestURI, \"?\") // since url.ParseQuery is not able to retrieve the first key (of the query string) correctly, find the position of ? in the url and\r\n\tqs := r.RequestURI[i+1 : len(r.RequestURI)] // substring it and then\r\n\r\n\tm, _ := url.ParseQuery(qs) // parse it\r\n\tc := appengine.NewContext(r)\r\n\r\n\terr := helpers.UpdateActivity(c, m[\"ActivityName\"][0], m[\"StartTime\"][0], m[\"Status\"][0], m[\"NewStatus\"][0])\r\n\r\n\tif err != nil {\r\n\t\thttp.Error(w, \"Error while changing the status: \"+err.Error(), http.StatusInternalServerError)\r\n\t\treturn\r\n\t}\r\n\r\n\thttp.Redirect(w, r, \"/\", http.StatusFound)\r\n}", "func (c *ServiceCreate) update() error {\n\tcmd := exec.Command(\"go\", \"get\", \"-u\", \"github.com/RobyFerro/go-web-framework\")\n\tcmd.Dir = c.Args\n\n\treturn cmd.Run()\n}", "func NewUpdateAPIOK() *UpdateAPIOK {\n\treturn &UpdateAPIOK{}\n}", "func MakeUpdateEndpoint(service integratedservices.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(UpdateRequest)\n\n\t\terr := service.Update(ctx, req.ClusterID, req.ServiceName, req.Spec)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn UpdateResponse{Err: err}, nil\n\t\t\t}\n\n\t\t\treturn UpdateResponse{Err: err}, err\n\t\t}\n\n\t\treturn UpdateResponse{}, nil\n\t}\n}", "func NewDeploymentUpdateOK() *DeploymentUpdateOK {\n\treturn &DeploymentUpdateOK{}\n}", "func (a *Client) Update(params *UpdateParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Update\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/api/v1/AgreementReports/{agreementId}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/*+json\", \"application/json\", \"application/json-patch+json\", \"text/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*UpdateOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for Update: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func getFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tformat := chi.URLParam(r, \"format\")\n\t\tif format == \"\" {\n\t\t\tformat = \"rss\"\n\t\t}\n\t\ts, err := s.ServeFeed(format, plugin)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error serving the feed\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tswitch format {\n\t\tcase \"atom\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/atom+xml\")\n\t\tcase \"json\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tdefault:\n\t\t\tw.Header().Set(\"Content-Type\", \"application/rss+xml\")\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(s))\n\t}\n}", "func (h *UpdateHandler) Update(rw http.ResponseWriter, req *http.Request) {\n\tstartTime := time.Now()\n\n\tdefer func() {\n\t\th.metrics.HTTPCreateUpdateTime(time.Since(startTime))\n\t}()\n\n\trequest, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\tcommon.WriteError(rw, http.StatusBadRequest, err)\n\n\t\treturn\n\t}\n\n\tlogger.Debug(\"Processing update request\", logfields.WithRequestBody(request))\n\n\tresponse, err := h.doUpdate(request)\n\tif err != nil {\n\t\tcommon.WriteError(rw, err.(*common.HTTPError).Status(), err)\n\n\t\treturn\n\t}\n\tcommon.WriteResponse(rw, http.StatusOK, response)\n}", "func NewUpdateHandler(\n\tendpoint goa.Endpoint,\n\tmux goahttp.Muxer,\n\tdecoder func(*http.Request) goahttp.Decoder,\n\tencoder func(context.Context, http.ResponseWriter) goahttp.Encoder,\n\terrhandler func(context.Context, http.ResponseWriter, error),\n\tformatter func(err error) goahttp.Statuser,\n) http.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeUpdateRequest(mux, decoder)\n\t\tencodeResponse = EncodeUpdateResponse(encoder)\n\t\tencodeError = EncodeUpdateError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"update\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "func (ctx *HealthHealthContext) OK(r *JSON) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func echoContextHandlerAppData(ctx context.Context, in io.Reader, out io.Writer) {\n\tnctx := GetContext(ctx)\n\n\tif resp, ok := out.(http.ResponseWriter); ok {\n\t\tresp.Header().Add(\"AppId\", nctx.AppID())\n\t\tresp.Header().Add(\"AppName\", nctx.AppName())\n\t\tresp.Header().Add(\"FnId\", nctx.FnID())\n\t\tresp.Header().Add(\"FnName\", nctx.FnName())\n\t\tresp.Header().Add(\"CallId\", nctx.CallID())\n\t}\n\t// XXX(reed): could configure this to test too\n\n\tWriteStatus(out, http.StatusTeapot+2)\n\tio.Copy(out, in)\n}", "func (_obj *DataService) SetApplyStatusOneWayWithContext(tarsCtx context.Context, wx_id string, club_id string, apply_status int32, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32(apply_status, 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 4)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"setApplyStatus\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (s *HelloSystem) Update(ctx core.UpdateCtx) {}", "func (a API) Updated(data interface{}) (int, model.MessageResponse) {\n\treturn http.StatusOK, model.MessageResponse{\n\t\tData: data,\n\t\tMessages: model.Responses{{Code: RecordUpdated, Message: \"¡listo!\"}},\n\t}\n}", "func (t *ThreadController) Update(c *gin.Context) {\n\n\tif err := model.ValidateParams(c, \"tid\"); err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\n\t\t\t\"errors\": err,\n\t\t})\n\t\treturn\n\t}\n\n\tif err := model.ValidatePostFromParams(c, \"title\", \"body\"); err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\n\t\t\t\"errors\": err,\n\t\t})\n\t\treturn\n\t}\n\n\tts.Update(c)\n\n\tc.Redirect(http.StatusFound, \"/t\")\n}", "func (o *sampleUpdateHandler) Update(rw http.ResponseWriter, req *http.Request) {\n\to.UpdateHandler.Update(rw, req)\n}", "func UpdateTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func Handler(res http.ResponseWriter, req *http.Request) {\n\t// First, decode the JSON response body\n\tfullBody := &types.Update{}\n\n\tif err := json.NewDecoder(req.Body).Decode(fullBody); err != nil {\n\t\tfmt.Println(\"could not decode request full body\", err)\n\t\treturn\n\t}\n\tfmt.Println(\"PRINTING REQUEST FULL BODY\")\n\tfmt.Printf(\"%+v\\n\", fullBody)\n\tif fullBody.Message == nil {\n\t\treturn\n\t}\n\tfmt.Printf(\"%+v\\n\", fullBody.Message.Text)\n\t// Check if the message contains the word \"marco\"\n\t// if not, return without doing anything\n\tif strings.Contains(fullBody.Message.Text,\"testDB\"){\n\t\tdb.Add(fullBody.Message.Text)\n\t}\n\tif strings.Contains(fullBody.Message.Text,\"testTag\"){\n\t\terr := say(fullBody.Message.Chat,fullBody.Message.From, fmt.Sprintf(\"[inline mention of a user](tg://user?id=%d)\",fullBody.Message.From.ID))\n\t\tif err != nil {\n\t\t\tfmt.Println(\"error in sending reply:\", err)\n\t\t\treturn\n\t\t}\n\t}\n\tif !strings.Contains(strings.ToLower(fullBody.Message.Text), \"marco\") {\n\t\treturn\n\t}\n\n\t// If the text contains marco, call the `sayPolo` function, which\n\t// is defined below\n\tif err := sayPolo(fullBody.Message.Chat.ID); err != nil {\n\t\tfmt.Println(\"error in sending reply:\", err)\n\t\treturn\n\t}\n\n\n\t// log a confirmation message if the message is sent successfully\n\tfmt.Println(\"reply sent\")\n}", "func (ctx *GetFilterContext) OK(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (o *UpdateActionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func ExampleUpdater() error {\n\tconf := updater.Config{\n\t\tOmahaURL: \"http://test.omahaserver.com/v1/update/\",\n\t\tAppID: \"application_id\",\n\t\tChannel: \"stable\",\n\t\tInstanceID: uuid.NewString(),\n\t\tInstanceVersion: \"0.0.1\",\n\t}\n\n\tappUpdater, err := updater.New(conf)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"init updater: %w\", err)\n\t}\n\n\tctx := context.TODO()\n\n\tupdateInfo, err := appUpdater.CheckForUpdates(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"checking updates for app: %q, err: %w\", conf.AppID, err)\n\t}\n\n\tif !updateInfo.HasUpdate {\n\t\treturn fmt.Errorf(\"No update exists for the application\")\n\t}\n\n\t// So we got an update, let's report we'll start downloading it.\n\tif err := appUpdater.ReportProgress(ctx, updater.ProgressDownloadStarted); err != nil {\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"Reporting progress error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"reporting download started: %w\", err)\n\t}\n\n\t// This should be implemented by the caller.\n\tfilePath, err := someFunctionThatDownloadsAFile(ctx, updateInfo.URL())\n\tif err != nil {\n\t\t// Oops something went wrong.\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"reporting error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"downloading update: %w\", err)\n\t}\n\n\t// The download was successful, let's inform that to the Omaha server.\n\tif err := appUpdater.ReportProgress(ctx, updater.ProgressDownloadFinished); err != nil {\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"Reporting progress error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"reporting download finished: %w\", err)\n\t}\n\n\t// We got our update file, let's install it!\n\tif err := appUpdater.ReportProgress(ctx, updater.ProgressInstallationStarted); err != nil {\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"reporting progress error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"reporting installation started: %w\", err)\n\t}\n\n\t// This should be your own implementation.\n\tif err := someFunctionThatExtractsTheUpdateAndInstallIt(ctx, filePath); err != nil {\n\t\t// Oops something went wrong.\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"Reporting error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"applying update: %w\", err)\n\t}\n\n\tif err := appUpdater.CompleteUpdate(ctx, updateInfo); err != nil {\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"reporting progress error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"reporting complete update: %w\", err)\n\t}\n\n\treturn nil\n}", "func sendUpdateReturn(o *writeOptions, err error) error {\n\tif o != nil && o.updates != nil {\n\t\to.updates <- v1.Update{\n\t\t\tError: err,\n\t\t}\n\t}\n\treturn err\n}", "func (h Handler) Update(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tdata := postData{}\n\terr := json.NewDecoder(r.Body).Decode(&data)\n\tif err != nil {\n\t\th.log.Println(err)\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was an problem, please try again\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\tif data.Name == \"\" || data.Desc == \"\" {\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"Empty post values\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\tid, err := strconv.ParseUint(p.ByName(\"id\"), 10, 64)\n\tif err != nil {\n\t\th.log.Println(err)\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was an problem, please try again\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\ttodo, err := h.m.Update(id, model.Todo{Name: data.Name, Description: data.Desc})\n\tif err != nil {\n\t\th.log.Println(err)\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was an problem, please try again\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\tres := response.Resp{\n\t\tStatus: \"succes\",\n\t\tData: todo,\n\t}\n\tresponse.Writer(w, res)\n}", "func ok(w http.ResponseWriter, r *http.Request, c *Context) {\n\tfmt.Fprintln(w, \"ok\")\n}", "func (ctx *MoveLinkWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"text/plain\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func OkFormated(c *routing.Context, msg string, service string) error {\n\tResponse(c, `{\"error\": false, \"msg\": \"`+msg+`\"}`, 200, service, \"application/json\")\n\treturn nil\n}", "func Ok(ctx *fiber.Ctx, msg string, data interface{}) error {\n\treturn Success(ctx, msg, data, http.StatusOK)\n}", "func (feed *NewsLetterFeed) Update(entries []FeedEntry) error {\n\tfeed.Entries = entries\n\n\tfeed.Updated = time.Now().Format(time.RFC1123Z)\n\n\tfeedFilePath := \"./data/feeds/\" + feed.ID + \".xml\"\n\n\tfeedFile, err := os.OpenFile(feedFilePath, os.O_WRONLY|os.O_CREATE, 0755)\n\tdefer feedFile.Close()\n\tif err != nil {\n\t\tlog.Printf(\"failed to open feed file to write: %v\", err)\n\t\treturn err\n\t}\n\n\terr = feedTmpl.Execute(feedFile, feed)\n\tif err != nil {\n\t\tlog.Printf(\"failed to execute feed template: %v\", err)\n\t\treturn err\n\t}\n\n\tlog.Printf(\"updated feed with %d entries\", len(entries))\n\treturn nil\n}", "func NewUpdateOutputContext(ctx context.Context, r *http.Request, service *goa.Service) (*UpdateOutputContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := UpdateOutputContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\tif id, err2 := strconv.Atoi(rawID); err2 == nil {\n\t\t\trctx.ID = id\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"id\", rawID, \"integer\"))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func NewUpdateNamespaceOK() *UpdateNamespaceOK {\n\treturn &UpdateNamespaceOK{}\n}", "func Handler() int {\n\targs, err := ParseArgs(os.Args)\n\tif err != nil {\n\t\tif args.Debug {\n\t\t\tlog.Println(err.Error())\n\t\t}\n\t\tLogErrorMsg(args, err.Error())\n\t\tLogOutputInfoMsg(args, err.Error())\n\t\treturn EXIT_ERROR\n\t}\n\n\t// check for updates\n\tinfo := Info{}\n\tif args.Quickcheck && args.Justcheck {\n\t\t// Quickcheck\n\t\tif args.Debug {\n\t\t\tlog.Println(\"Quick Check and Just Check checking for Updates...\")\n\t\t}\n\n\t\trc, err := CheckForUpdateHandler(info, args)\n\t\tif nil != err {\n\t\t\tif args.Debug {\n\t\t\t\tlog.Println(err.Error())\n\t\t\t}\n\t\t\tLogErrorMsg(args, err.Error())\n\t\t\tLogOutputInfoMsg(args, err.Error())\n\t\t}\n\n\t\tif args.Debug {\n\t\t\tswitch rc {\n\t\t\tcase EXIT_NO_UPDATE:\n\t\t\t\tlog.Println(\"No update available\")\n\t\t\tcase EXIT_UPDATE_AVALIABLE:\n\t\t\t\tlog.Println(\"Update available\")\n\t\t\t}\n\t\t}\n\n\t\t// End Quickcheck\n\t\treturn rc\n\t}\n\n\t// update\n\tif args.Fromservice {\n\t\tif args.Debug {\n\t\t\tlog.Println(\"Updating...\")\n\t\t}\n\n\t\trc, err := UpdateHandler(info, (args))\n\t\tif err != nil {\n\t\t\tif args.Debug {\n\t\t\t\tlog.Println(err.Error())\n\t\t\t}\n\t\t\tLogErrorMsg(args, err.Error())\n\t\t\tLogOutputInfoMsg(args, err.Error())\n\t\t}\n\n\t\tif args.Debug && rc == 0 {\n\t\t\tlog.Println(\"Update successful\")\n\t\t}\n\t\treturn rc\n\t}\n\n\treturn EXIT_ERROR\n}", "func NewEndpointGroupUpdateOK() *EndpointGroupUpdateOK {\n\treturn &EndpointGroupUpdateOK{}\n}", "func (c *Component) updateController(args Arguments) error {\n\t// We only need to update the controller if we already have a rest config\n\t// generated and our client args haven't changed since the last call.\n\tif reflect.DeepEqual(c.args.Client, args.Client) && c.restConfig != nil {\n\t\treturn nil\n\t}\n\n\tcfg, err := args.Client.BuildRESTConfig(c.log)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"building Kubernetes config: %w\", err)\n\t}\n\tc.restConfig = cfg\n\n\treturn c.controller.UpdateConfig(cfg)\n}", "func OK(payload interface{}) Response {\n\treturn Response{\n\t\tStatusCode: http.StatusOK,\n\t\tPayload: payload,\n\t}\n}", "func (c *SeaterController) OK(data interface{}) {\n\tc.Code(200)\n\tc.jsonResp(data)\n}", "func (handler WebserviceHandler) UpdateFaq(res http.ResponseWriter, req *http.Request) {\n\thandler.Logger.Info(\"Received \" + req.Method + \" request at path: \" + req.URL.Path)\n\n\t// Setting headers for CORS\n\tres.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tres.Header().Set(\"Access-Control-Allow-Headers\", \"Authorization\")\n\tif req.Method == http.MethodOptions {\n\t\treturn\n\t}\n\n\tvar err error\n\tvar updatedFaq Faq\n\n\t// Parsing the request body\n\terr = json.NewDecoder(req.Body).Decode(&updatedFaq)\n\tif err != nil {\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Checking request, verifying if ID is in query params\n\thandler.Logger.Debug(\"Starting to check the ID\")\n\tvar id string\n\tok := checkID(handler, res, req)\n\tif !ok {\n\t\treturn\n\t}\n\tids, ok := req.URL.Query()[\"id\"]\n\tid = ids[0]\n\thandler.Logger.Debug(\"Request correct, ID inserted as query params\")\n\n\thandler.Logger.Info(\"ID: \" + id)\n\n\t// Transforming data for presentation\n\thandler.Logger.Debug(\"Starting to transform data for presentation\")\n\tusecasesFaq := webserviceFaqToUsecaseFaq(updatedFaq)\n\thandler.Logger.Debug(\"Data transformed for presentation\")\n\n\t// Updating faq\n\thandler.Logger.Debug(\"Starting to update faq\")\n\terr = handler.KnowledgeBaseInteractor.Update(id, usecasesFaq)\n\tif err != nil {\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\thandler.Logger.Debug(\"Faq updated\")\n\n\t// Preparing response\n\tres.WriteHeader(200)\n\thandler.Logger.Info(\"Returning response\")\n\treturn\n}", "func (u *Update) Apply() (*model.Response, error) {\n\treturn u.config.Transport.Update(u.ctx, u.meta, u.op, u.find, u.update)\n}" ]
[ "0.6790955", "0.6332872", "0.600783", "0.60064185", "0.6000949", "0.5941861", "0.5867134", "0.5576903", "0.5501957", "0.53754264", "0.537458", "0.52796775", "0.52268994", "0.518783", "0.5086248", "0.50318146", "0.5029032", "0.50122094", "0.4994141", "0.49535656", "0.49184948", "0.48996192", "0.48647553", "0.48607865", "0.4845588", "0.48367456", "0.48244578", "0.4787822", "0.47850215", "0.47780612", "0.47752556", "0.47752285", "0.47647336", "0.4760676", "0.4754731", "0.47490916", "0.47446704", "0.47446704", "0.47446704", "0.47441915", "0.47128937", "0.47120824", "0.47093394", "0.46986374", "0.46884817", "0.4687087", "0.46821648", "0.4675769", "0.4667809", "0.46607798", "0.4650247", "0.4638092", "0.46184322", "0.46136245", "0.46104735", "0.46103245", "0.4608177", "0.46023685", "0.45992786", "0.45965868", "0.45935082", "0.45791763", "0.457255", "0.4570193", "0.45597154", "0.45398217", "0.45373207", "0.45331857", "0.45329598", "0.45117438", "0.45106402", "0.44935775", "0.44912586", "0.4489665", "0.44889027", "0.44750383", "0.44626436", "0.44494602", "0.44471484", "0.44462192", "0.444557", "0.4442476", "0.44360718", "0.4434082", "0.44288686", "0.44282243", "0.4425637", "0.4424584", "0.44158393", "0.4400871", "0.43954316", "0.43908975", "0.43899107", "0.43870828", "0.43854737", "0.43752962", "0.43750334", "0.43745482", "0.4374233", "0.4373728" ]
0.73602074
0
UpdateFeedOKLink runs the method Update of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func UpdateFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedLink) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} if tags != nil { sliceVal := []string{*tags} query["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} query["title"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), RawQuery: query.Encode(), } req, err := http.NewRequest("PUT", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if tags != nil { sliceVal := []string{*tags} prms["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} prms["title"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) updateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.Update(updateCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 200 { t.Errorf("invalid response status code: got %+v, expected 200", rw.Code) } var mt *app.FeedLink if resp != nil { var _ok bool mt, _ok = resp.(*app.FeedLink) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func UpdateFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateFeedContext) OKLink(r *FeedLink) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *UpdateFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func GetFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *GetFeedContext) OKLink(r *FeedLink) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func UpdateFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateOutputContext) OK(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func (ctx *GetFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (r *resourceFrameworkShare) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {\n}", "func (ctx *MoveLinkWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"text/plain\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func NewUpdateFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*UpdateFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := UpdateFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\tparamTags := req.Params[\"tags\"]\n\tif len(paramTags) > 0 {\n\t\trawTags := paramTags[0]\n\t\trctx.Tags = &rawTags\n\t}\n\tparamTitle := req.Params[\"title\"]\n\tif len(paramTitle) > 0 {\n\t\trawTitle := paramTitle[0]\n\t\trctx.Title = &rawTitle\n\t}\n\treturn &rctx, err\n}", "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *AddLinkWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"text/plain\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func (ctx *UpdateFilterContext) OK(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func handleActivityUpdate(w http.ResponseWriter, r *http.Request) {\r\n\t//[TODO: query param approach is not the effecient way to handle, as the parameters values in the url are visible to anyone,a nd it could pose security issues. so, need to explore the way in which we can pass the values as part of the HTTP header/body instead of URL]\r\n\ti := strings.Index(r.RequestURI, \"?\") // since url.ParseQuery is not able to retrieve the first key (of the query string) correctly, find the position of ? in the url and\r\n\tqs := r.RequestURI[i+1 : len(r.RequestURI)] // substring it and then\r\n\r\n\tm, _ := url.ParseQuery(qs) // parse it\r\n\tc := appengine.NewContext(r)\r\n\r\n\terr := helpers.UpdateActivity(c, m[\"ActivityName\"][0], m[\"StartTime\"][0], m[\"Status\"][0], m[\"NewStatus\"][0])\r\n\r\n\tif err != nil {\r\n\t\thttp.Error(w, \"Error while changing the status: \"+err.Error(), http.StatusInternalServerError)\r\n\t\treturn\r\n\t}\r\n\r\n\thttp.Redirect(w, r, \"/\", http.StatusFound)\r\n}", "func NewApplyUpdateOK() *ApplyUpdateOK {\n\treturn &ApplyUpdateOK{}\n}", "func (ctx *ShowBottleContext) OK(r *GoaExampleBottle) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.example.bottle+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *GetOutputContext) OK(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *DeleteLinkWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"text/plain\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func update(w http.ResponseWriter, req *http.Request) {\n\tresponse := \"\"\n\tswitch req.RequestURI {\n\tcase \"/get/accounts\":\n\t\tmapD := map[string]int{\"apple\": 5, \"lettuce\": 7}\n\t\tmapB, _ := json.Marshal(mapD)\n\t\tresponse = string(mapB)\n\t\tbreak\n\tdefault:\n\t\tr, _ := json.Marshal(\"Request not found\")\n\t\tresponse = string(r)\n\t\tbreak\n\t}\n\n\tcontext := Context{Title: response}\n\trender(w, \"api\", context)\n}", "func NewFormatScoreServiceUpdateOK() *FormatScoreServiceUpdateOK {\n\treturn &FormatScoreServiceUpdateOK{}\n}", "func (lr *FakeLinkDao) Update(ctx context.Context, l *shortener.Link) error {\n\tlr.UpdateCalled = true\n\treturn lr.UpdateFn(ctx, l)\n}", "func NewUpdateHookOK() *UpdateHookOK {\n\treturn &UpdateHookOK{}\n}", "func (ctx *UpdateUsersContext) OK(r *User) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"user\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *UpdateUserContext) OK(r *User) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.user+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler.ProgressEvent, error) {\n\t// Add your code here:\n\t// * Make API calls (use req.Session)\n\t// * Mutate the model\n\t// * Check/set any callback context (req.CallbackContext / response.CallbackContext)\n\n\t// Construct a new handler.ProgressEvent and return it\n\tresponse := handler.ProgressEvent{\n\t\tOperationStatus: handler.Success,\n\t\tMessage: \"Update complete\",\n\t\tResourceModel: currentModel,\n\t}\n\n\treturn response, nil\n\n\t// Not implemented, return an empty handler.ProgressEvent\n\t// and an error\n\treturn handler.ProgressEvent{}, errors.New(\"Not implemented: Update\")\n}", "func NewEndpointUpdateOK() *EndpointUpdateOK {\n\treturn &EndpointUpdateOK{}\n}", "func (ctx *ListFeedContext) OK(r FeedCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.feed.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = FeedCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func ExampleLinkerClient_BeginUpdate() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armservicelinker.NewClientFactory(cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewLinkerClient().BeginUpdate(ctx, \"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app\", \"linkName\", armservicelinker.LinkerPatch{\n\t\tProperties: &armservicelinker.LinkerProperties{\n\t\t\tAuthInfo: &armservicelinker.ServicePrincipalSecretAuthInfo{\n\t\t\t\tAuthType: to.Ptr(armservicelinker.AuthTypeServicePrincipalSecret),\n\t\t\t\tClientID: to.Ptr(\"name\"),\n\t\t\t\tPrincipalID: to.Ptr(\"id\"),\n\t\t\t\tSecret: to.Ptr(\"secret\"),\n\t\t\t},\n\t\t\tTargetService: &armservicelinker.AzureResource{\n\t\t\t\tType: to.Ptr(armservicelinker.TargetServiceTypeAzureResource),\n\t\t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db\"),\n\t\t\t},\n\t\t},\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\tres, err := poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.LinkerResource = armservicelinker.LinkerResource{\n\t// \tName: to.Ptr(\"linkName\"),\n\t// \tType: to.Ptr(\"Microsoft.ServiceLinker/links\"),\n\t// \tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app/providers/Microsoft.ServiceLinker/links/linkName\"),\n\t// \tProperties: &armservicelinker.LinkerProperties{\n\t// \t\tAuthInfo: &armservicelinker.ServicePrincipalSecretAuthInfo{\n\t// \t\t\tAuthType: to.Ptr(armservicelinker.AuthTypeServicePrincipalSecret),\n\t// \t\t\tClientID: to.Ptr(\"name\"),\n\t// \t\t\tPrincipalID: to.Ptr(\"id\"),\n\t// \t\t},\n\t// \t\tTargetService: &armservicelinker.AzureResource{\n\t// \t\t\tType: to.Ptr(armservicelinker.TargetServiceTypeAzureResource),\n\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db\"),\n\t// \t\t},\n\t// \t},\n\t// }\n}", "func UpdateWidget(res http.ResponseWriter, req *http.Request) {\n\tresp := response.New()\n\n\tresp.Render(res, req)\n}", "func (ctx *UpdateFeedContext) OKTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *ShowBottleContext) OK(r *GoaExampleBottle) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.example.bottle+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewUpdateLinkInPostOK() *UpdateLinkInPostOK {\n\n\treturn &UpdateLinkInPostOK{}\n}", "func (r *GowebHTTPResponder) WithOK(ctx context.Context) error {\n\treturn r.WithStatus(ctx, http.StatusOK)\n}", "func Update(ctx *gin.Context, data interface{}) {\n\tctx.JSON(http.StatusAccepted, gin.H{\"code\": merrors.ErrSuccess, \"data\": data})\n\treturn\n}", "func (o *sampleUpdateHandler) Update(rw http.ResponseWriter, req *http.Request) {\n\to.UpdateHandler.Update(rw, req)\n}", "func (lr *FakeLinkRepo) Update(ctx context.Context, l *shortener.Link) error {\n\tlr.UpdateCalled = true\n\treturn lr.UpdateFn(ctx, l)\n}", "func (client *Client) UpdateResourceDLinkWithCallback(request *UpdateResourceDLinkRequest, callback func(response *UpdateResourceDLinkResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *UpdateResourceDLinkResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.UpdateResourceDLink(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (c *ServiceCreate) update() error {\n\tcmd := exec.Command(\"go\", \"get\", \"-u\", \"github.com/RobyFerro/go-web-framework\")\n\tcmd.Dir = c.Args\n\n\treturn cmd.Run()\n}", "func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (a *Client) Update(params *UpdateParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Update\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/api/v1/AgreementReports/{agreementId}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/*+json\", \"application/json\", \"application/json-patch+json\", \"text/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*UpdateOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for Update: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func ExampleUpdater() error {\n\tconf := updater.Config{\n\t\tOmahaURL: \"http://test.omahaserver.com/v1/update/\",\n\t\tAppID: \"application_id\",\n\t\tChannel: \"stable\",\n\t\tInstanceID: uuid.NewString(),\n\t\tInstanceVersion: \"0.0.1\",\n\t}\n\n\tappUpdater, err := updater.New(conf)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"init updater: %w\", err)\n\t}\n\n\tctx := context.TODO()\n\n\tupdateInfo, err := appUpdater.CheckForUpdates(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"checking updates for app: %q, err: %w\", conf.AppID, err)\n\t}\n\n\tif !updateInfo.HasUpdate {\n\t\treturn fmt.Errorf(\"No update exists for the application\")\n\t}\n\n\t// So we got an update, let's report we'll start downloading it.\n\tif err := appUpdater.ReportProgress(ctx, updater.ProgressDownloadStarted); err != nil {\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"Reporting progress error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"reporting download started: %w\", err)\n\t}\n\n\t// This should be implemented by the caller.\n\tfilePath, err := someFunctionThatDownloadsAFile(ctx, updateInfo.URL())\n\tif err != nil {\n\t\t// Oops something went wrong.\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"reporting error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"downloading update: %w\", err)\n\t}\n\n\t// The download was successful, let's inform that to the Omaha server.\n\tif err := appUpdater.ReportProgress(ctx, updater.ProgressDownloadFinished); err != nil {\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"Reporting progress error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"reporting download finished: %w\", err)\n\t}\n\n\t// We got our update file, let's install it!\n\tif err := appUpdater.ReportProgress(ctx, updater.ProgressInstallationStarted); err != nil {\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"reporting progress error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"reporting installation started: %w\", err)\n\t}\n\n\t// This should be your own implementation.\n\tif err := someFunctionThatExtractsTheUpdateAndInstallIt(ctx, filePath); err != nil {\n\t\t// Oops something went wrong.\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"Reporting error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"applying update: %w\", err)\n\t}\n\n\tif err := appUpdater.CompleteUpdate(ctx, updateInfo); err != nil {\n\t\tif progressErr := appUpdater.ReportError(ctx, nil); progressErr != nil {\n\t\t\tfmt.Println(\"reporting progress error:\", progressErr)\n\t\t}\n\t\treturn fmt.Errorf(\"reporting complete update: %w\", err)\n\t}\n\n\treturn nil\n}", "func (s *APIServer) UpdateApps(c *gin.Context) {\n}", "func (a *Client) Link(params *LinkParams) (*LinkOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewLinkParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"link\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/links/{itemName}/{channelUID}\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &LinkReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*LinkOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for link: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (s *HelloSystem) Update(ctx core.UpdateCtx) {}", "func (ctx *UpdateListenContext) OK(r *AntRegResult) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.reg.result+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewUpdateAppOK() *UpdateAppOK {\n\treturn &UpdateAppOK{}\n}", "func NewUpdateAppOK() *UpdateAppOK {\n\treturn &UpdateAppOK{}\n}", "func NewUpdateAppOK() *UpdateAppOK {\n\treturn &UpdateAppOK{}\n}", "func NewUpdateAPIOK() *UpdateAPIOK {\n\treturn &UpdateAPIOK{}\n}", "func NewUpdateConsumerOK() *UpdateConsumerOK {\n\treturn &UpdateConsumerOK{}\n}", "func (u Update) Invoke(parameters map[string]interface{}) *context.ActivityContext {\n\n\t// getting and assign the values from the MAP to internal variables\n\tsecurityToken := parameters[\"securityToken\"].(string)\n\t/*log := parameters[\"log\"].(string)*/\n\tdomain := parameters[\"namespace\"].(string)\n\tclass := parameters[\"class\"].(string)\n\tJSON_Document := parameters[\"JSON\"].(string)\n\n\t//creating new instance of context.ActivityContext\n\tvar activityContext = new(context.ActivityContext)\n\n\t//creating new instance of context.ActivityError\n\tvar activityError context.ActivityError\n\n\t//setting activityError proprty values\n\tactivityError.Encrypt = false\n\tactivityError.ErrorString = \"No Exception\"\n\tactivityError.Forward = false\n\tactivityError.SeverityLevel = context.Info\n\n\t// preparing the data relevent to make the objectstore API\n\t//url := \"http://\" + Common.GetObjectstoreIP() + \"/\" + domain + \"/\" + class\n\turl := \"http://\" + domain + \"/data/\" + domain + \"/\" + class + \"?securityToken=\" + securityToken\n\n\treq, err := http.NewRequest(\"PUT\", url, bytes.NewBuffer([]byte(JSON_Document)))\n\t/*req.Header.Set(\"securityToken\", securityToken)\n\treq.Header.Set(\"log\", log)*/\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\t// once the request is made according to the response the following is done\n\tif err != nil {\n\t\tactivityError.ErrorString = err.Error()\n\t\tactivityContext.ActivityStatus = false\n\t\tactivityContext.Message = \"Connection to server failed! Check connectivity.\"\n\t\tactivityContext.ErrorState = activityError\n\t} else {\n\t\tactivityContext.ActivityStatus = true\n\t\tactivityContext.Message = \"Data Successfully Updated!\"\n\t\tactivityContext.ErrorState = activityError\n\t}\n\tdefer resp.Body.Close()\n\t// once the functionality of the method completes it returns the processed data\n\treturn activityContext\n}", "func refreshFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tif err := s.RefreshFeed(plugin); err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error listing the plugins\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n}", "func WrapUpdateMe(h Handler, w http.ResponseWriter, r *http.Request) {\n\tvar aUpdateUser Profile\n\n\tif r.Body == nil {\n\t\thttp.Error(w, \"Parameter 'update_user' expected in body, but got no body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\t{\n\t\tvar err error\n\t\tr.Body = http.MaxBytesReader(w, r.Body, 1024*1024)\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Body unreadable: \"+err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\terr = ValidateAgainstProfileSchema(body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Failed to validate against schema: \"+err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\terr = json.Unmarshal(body, &aUpdateUser)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Error JSON-decoding body parameter 'update_user': \"+err.Error(),\n\t\t\t\thttp.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\th.UpdateMe(w,\n\t\tr,\n\t\taUpdateUser)\n}", "func (c *UsersController) Update(ctx *app.UpdateUsersContext) error {\n\treturn proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())\n}", "func MakeUpdateEndpoint(service integratedservices.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(UpdateRequest)\n\n\t\terr := service.Update(ctx, req.ClusterID, req.ServiceName, req.Spec)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn UpdateResponse{Err: err}, nil\n\t\t\t}\n\n\t\t\treturn UpdateResponse{Err: err}, err\n\t\t}\n\n\t\treturn UpdateResponse{}, nil\n\t}\n}", "func (r *ManagedServiceUpdateRequest) SendContext(ctx context.Context) (result *ManagedServiceUpdateResponse, err error) {\n\tquery := helpers.CopyQuery(r.query)\n\theader := helpers.CopyHeader(r.header)\n\tbuffer := &bytes.Buffer{}\n\terr = writeManagedServiceUpdateRequest(r, buffer)\n\tif err != nil {\n\t\treturn\n\t}\n\turi := &url.URL{\n\t\tPath: r.path,\n\t\tRawQuery: query.Encode(),\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"PATCH\",\n\t\tURL: uri,\n\t\tHeader: header,\n\t\tBody: io.NopCloser(buffer),\n\t}\n\tif ctx != nil {\n\t\trequest = request.WithContext(ctx)\n\t}\n\tresponse, err := r.transport.RoundTrip(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tresult = &ManagedServiceUpdateResponse{}\n\tresult.status = response.StatusCode\n\tresult.header = response.Header\n\treader := bufio.NewReader(response.Body)\n\t_, err = reader.Peek(1)\n\tif err == io.EOF {\n\t\terr = nil\n\t\treturn\n\t}\n\tif result.status >= 400 {\n\t\tresult.err, err = errors.UnmarshalErrorStatus(reader, result.status)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = result.err\n\t\treturn\n\t}\n\terr = readManagedServiceUpdateResponse(result, reader)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func NewUpdateOutputContext(ctx context.Context, r *http.Request, service *goa.Service) (*UpdateOutputContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := UpdateOutputContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\tif id, err2 := strconv.Atoi(rawID); err2 == nil {\n\t\t\trctx.ID = id\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"id\", rawID, \"integer\"))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func (ctx *ShowStatusContext) OK(r *Status) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.status+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func Ok(c *routing.Context, msg string, service string) error {\n\tResponse(c, msg, 200, service, \"application/json\")\n\treturn nil\n}", "func OK(r *http.ResponseWriter) error {\n\tresponse := *r\n\tresponse.WriteHeader(200)\n\treturn nil\n}", "func makeUpdateBookEndpoint(svc BookService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t// convert request into a updateBookRequest\n\t\treq := request.(updateBookRequest)\n\n\t\t// call actual service with data from the req (putBookRequest)\n\t\tbook, err := svc.UpdateBook(\n\t\t\treq.Bearer,\n\t\t\treq.BookId,\n\t\t\treq.AuthorId,\n\t\t\treq.Description,\n\t\t\treq.FirstPublishedYear,\n\t\t\treq.GoodReadsUrl,\n\t\t\treq.ImageLarge,\n\t\t\treq.ImageMedium,\n\t\t\treq.ImageSmall,\n\t\t\treq.Isbns,\n\t\t\treq.OpenlibraryWorkUrl,\n\t\t\treq.Subjects,\n\t\t\treq.Title)\n\n\t\treturn updateBookResponse{\n\t\t\tData: book,\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func (c *ClusterConf) UpdateService(req *acomm.Request) (interface{}, *url.URL, error) {\n\tvar args ServicePayload\n\tif err := req.UnmarshalArgs(&args); err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif args.Service == nil {\n\t\treturn nil, nil, errors.Newv(\"missing arg: service\", map[string]interface{}{\"args\": args})\n\t}\n\targs.Service.c = c\n\n\tif args.Service.ID == \"\" {\n\t\targs.Service.ID = uuid.New()\n\t}\n\n\tif err := args.Service.update(); err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn &ServicePayload{args.Service}, nil, nil\n}", "func (h *UpdateHandler) Update(rw http.ResponseWriter, req *http.Request) {\n\tstartTime := time.Now()\n\n\tdefer func() {\n\t\th.metrics.HTTPCreateUpdateTime(time.Since(startTime))\n\t}()\n\n\trequest, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\tcommon.WriteError(rw, http.StatusBadRequest, err)\n\n\t\treturn\n\t}\n\n\tlogger.Debug(\"Processing update request\", logfields.WithRequestBody(request))\n\n\tresponse, err := h.doUpdate(request)\n\tif err != nil {\n\t\tcommon.WriteError(rw, err.(*common.HTTPError).Status(), err)\n\n\t\treturn\n\t}\n\tcommon.WriteResponse(rw, http.StatusOK, response)\n}", "func (client *Client) UpdateAppInfoWithOptions(request *UpdateAppInfoRequest, runtime *util.RuntimeOptions) (_result *UpdateAppInfoResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.AppId)) {\n\t\tquery[\"AppId\"] = request.AppId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.AppName)) {\n\t\tquery[\"AppName\"] = request.AppName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Description)) {\n\t\tquery[\"Description\"] = request.Description\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Status)) {\n\t\tquery[\"Status\"] = request.Status\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"UpdateAppInfo\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &UpdateAppInfoResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (a *APIUpdatingApplicator) Apply(ctx context.Context, o client.Object, ao ...ApplyOption) error {\n\tm, ok := o.(Object)\n\tif !ok {\n\t\treturn errors.New(\"cannot access object metadata\")\n\t}\n\n\tif m.GetName() == \"\" && m.GetGenerateName() != \"\" {\n\t\treturn errors.Wrap(a.client.Create(ctx, o), \"cannot create object\")\n\t}\n\n\tcurrent := o.DeepCopyObject().(client.Object)\n\n\terr := a.client.Get(ctx, types.NamespacedName{Name: m.GetName(), Namespace: m.GetNamespace()}, current)\n\tif kerrors.IsNotFound(err) {\n\t\t// TODO: Apply ApplyOptions here too?\n\t\treturn errors.Wrap(a.client.Create(ctx, m), \"cannot create object\")\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot get object\")\n\t}\n\n\tfor _, fn := range ao {\n\t\tif err := fn(ctx, current, m); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// NOTE: we must set the resource version of the desired object\n\t// to that of the current or the update will always fail.\n\tm.SetResourceVersion(current.(metav1.Object).GetResourceVersion())\n\treturn errors.Wrap(a.client.Update(ctx, m), \"cannot update object\")\n}", "func (a *CheckoutApiService) UpdatePaymentLink(ctx context.Context, body UpdatePaymentLinkRequest, id string) (UpdatePaymentLinkResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue UpdatePaymentLinkResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v2/online-checkout/payment-links/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &body\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v UpdatePaymentLinkResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func OK(w http.ResponseWriter, r *http.Request, body interface{}) {\n\tbuilder := response.New(w, r)\n\tbuilder.WithHeader(\"Content-Type\", \"text/xml; charset=utf-8\")\n\tbuilder.WithBody(body)\n\tbuilder.Write()\n}", "func (ctx *PutEventContext) OK(r *AntResult) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"vnd.ant.result+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func UpdateTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func NewUpdateClientForDeveloperOK() *UpdateClientForDeveloperOK {\n\treturn &UpdateClientForDeveloperOK{}\n}", "func (handler *ObjectWebHandler) Update(w http.ResponseWriter, r *http.Request) {\n\trespondWithError(w, http.StatusNotImplemented, \"Not implemented\", nil)\n}", "func HandlerClientInfoUpdate(responseWriter http.ResponseWriter, request *http.Request) {\n\trequest.ParseForm()\n\n\tbody := request.Form\n\tlog.Printf(\"aRequest.Form=%s\", body)\n\tvar strApiKey string\n\tvar strClientId string\n\tvar strName string\n\tapiKeys := body[API_KEY_apikey]\n\tclientIds := body[API_KEY_clientid]\n\tnames := body[API_KEY_name]\n\tif apiKeys != nil && len(apiKeys) > 0 {\n\t\tstrApiKey = apiKeys[0]\n\t} else {\n\t\tServeError(responseWriter, STR_MSG_invalidapikey, STR_template_page_error_html)\n\t\treturn\n\t}\n\tif clientIds != nil && len(clientIds) > 0 {\n\t\tstrClientId = clientIds[0]\n\t} else {\n\t\tServeError(responseWriter, STR_MSG_invalidclientid, STR_template_page_error_html)\n\t\treturn\n\t}\n\tif names != nil && len(names) > 0 {\n\t\tstrName = names[0]\n\t}\n\n\tvar isApiKeyValid = false\n\tif strApiKey != STR_EMPTY {\n\t\tisApiKeyValid, _ = IsApiKeyValid(strApiKey)\n\t}\n\tif !isApiKeyValid {\n\t\tresult := new(objects.Result)\n\t\tresult.ErrorMessage = STR_MSG_invalidapikey\n\t\tresult.ResultCode = http.StatusOK\n\t\tServeResult(responseWriter, result, STR_template_result)\n\t\treturn\n\t}\n\n\terrorUpdate := DbUpdateClientInfo(strApiKey, strClientId, strName, nil)\n\tif errorUpdate != nil {\n\t\tlog.Printf(\"HandlerClientInfo, errorUpdate=%s\", errorUpdate.Error())\n\t\tServeError(responseWriter, errorUpdate.Error(), STR_template_page_error_html)\n\t\treturn\n\t}\n\n\thttp.Redirect(responseWriter, request, (GetApiUrlListClientIds() + \"?apikey=\" + strApiKey + \"&clientid=\" + strClientId), http.StatusTemporaryRedirect)\n}", "func NewContainerUpdateOKBody(warnings []string) *ContainerUpdateOKBody {\n\tthis := ContainerUpdateOKBody{}\n\tthis.Warnings = warnings\n\treturn &this\n}", "func (w *ServiceWriter) Flush() {\n\tif !w.updated {\n\t\treturn\n\t}\n\tw.updated = false\n\n\tserviceBuffer := w.serviceBuffer\n\n\tlog.Debugf(\"going to flush updated service metadata, %d services\", len(serviceBuffer))\n\tatomic.StoreInt64(&w.stats.Services, int64(len(serviceBuffer)))\n\n\tdata, err := model.EncodeServicesPayload(serviceBuffer)\n\tif err != nil {\n\t\tlog.Errorf(\"encoding issue: %v\", err)\n\t\treturn\n\t}\n\n\theaders := map[string]string{\n\t\tlanguageHeaderKey: strings.Join(info.Languages(), \"|\"),\n\t\t\"Content-Type\": \"application/json\",\n\t}\n\n\tatomic.AddInt64(&w.stats.Bytes, int64(len(data)))\n\n\tstartFlush := time.Now()\n\n\t// Send the payload to the endpoint\n\terr = w.endpoint.Write(data, headers)\n\n\tflushTime := time.Since(startFlush)\n\n\t// TODO: if error, depending on why, replay later.\n\tif err != nil {\n\t\tatomic.AddInt64(&w.stats.Errors, 1)\n\t\tlog.Errorf(\"failed to flush service payload, time:%s, size:%d bytes, error: %s\", flushTime, len(data), err)\n\t\treturn\n\t}\n\n\tlog.Infof(\"flushed service payload to the API, time:%s, size:%d bytes\", flushTime, len(data))\n\tstatsd.Client.Gauge(\"datadog.trace_agent.service_writer.flush_duration\", flushTime.Seconds(), nil, 1)\n\tatomic.AddInt64(&w.stats.Payloads, 1)\n}", "func NewDeploymentUpdateOK() *DeploymentUpdateOK {\n\treturn &DeploymentUpdateOK{}\n}", "func (handler WebserviceHandler) UpdateKeyword(res http.ResponseWriter, req *http.Request) {\n\thandler.Logger.Info(\"Received \" + req.Method + \" request at path: \" + req.URL.Path)\n\n\t// Setting headers for CORS\n\tres.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tres.Header().Set(\"Access-Control-Allow-Headers\", \"Authorization\")\n\tif req.Method == http.MethodOptions {\n\t\treturn\n\t}\n\n\tvar err error\n\n\t// Checking request, verifying if ID is in query params\n\thandler.Logger.Debug(\"Starting to check the ID\")\n\tvar id string\n\tok := checkID(handler, res, req)\n\tif !ok {\n\t\treturn\n\t}\n\tids, ok := req.URL.Query()[\"id\"]\n\tid = ids[0]\n\thandler.Logger.Debug(\"Request correct, ID inserted as query params\")\n\n\thandler.Logger.Debug(\"Starting to retrieve value from queryparams\")\n\tvar value string\n\tvalues, ok := req.URL.Query()[\"value\"]\n\tvalue = values[0]\n\thandler.Logger.Debug(\"Param value retrieved\")\n\n\thandler.Logger.Info(\"ID: \" + id + \" value: \" + value)\n\n\tvar updatedKeyword = Keyword{ID: id, DisplayText: value}\n\n\t// Data transformation for presentation\n\thandler.Logger.Debug(\"Starting to transform data for presentation\")\n\tusecasesKeyword := webserviceKeywordToUsecaseKeyword(updatedKeyword)\n\thandler.Logger.Debug(\"Data transformed\")\n\n\t// Updating keyword\n\thandler.Logger.Debug(\"Starting to update keyword\")\n\terr = handler.KeywordsInteractor.Update(id, usecasesKeyword)\n\tif err != nil {\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\thandler.Logger.Debug(\"Keyword updated\")\n\n\t// Preparing response\n\tres.WriteHeader(200)\n\thandler.Logger.Info(\"Returning response\")\n\treturn\n}", "func TestChannelUpdate(t *testing.T) {\n\t// mock UpdateID function\n\tfn := func(_ context.Context, str string, v are_hub.Archetype) error {\n\t\t_, e := findChannelID(nil, str)\n\n\t\t// the update itself has no bearing on the test so simply return\n\t\t// the error (if there was one)\n\t\treturn e\n\t}\n\n\t// create mock repo and controller\n\trepo := &mock.ChannelRepo{UpdateIDFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// mock channel\n\twrt := are_hub.Channel{Name: \"Belgian Audi Club WRT\", Password: \"abc123\"}\n\n\t// create mock request\n\tp := httprouter.Param{Key: \"id\", Value: \"1\"}\n\treq, e := http.NewRequest(http.MethodPut, \"/channel/\"+p.Value, nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// embed the updated channel in the request's context\n\treq = req.WithContext(wrt.ToCtx(req.Context()))\n\n\t// embed parameters in the request's context\n\tuf.EmbedParams(req, p)\n\n\t// create a response recorder run the update method\n\tw := httptest.NewRecorder()\n\te = controller.Update(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tres := w.Result()\n\n\t// check if repo was hit\n\tif !repo.UpdateIDCalled {\n\t\tt.Error(\"Did not call repo.UpdateID\")\n\t}\n\n\t// ensure the content type is applicaton/json\n\tcheckCT(res, t)\n\n\t// read and unmarshal the body\n\tdefer res.Body.Close()\n\tresBody, e := io.ReadAll(res.Body)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\treceived := are_hub.Channel{}\n\te = json.Unmarshal(resBody, &received)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// compare the sent and received channels\n\tif wrt.Name != received.Name {\n\t\tt.Fatalf(\"Expected: %+v. Actual: %+v\", wrt, received)\n\t}\n\n\t// check if Update returns a 404 error on an invalid ID\n\tp = httprouter.Param{Key: \"id\", Value: \"-1\"}\n\treq, e = http.NewRequest(http.MethodPut, \"/channel/\"+p.Value, nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// embed non-existant channel into the request's context\n\tgpx := are_hub.Channel{Name: \"Grand Prix Extreme\", Password: \"porsche\"}\n\treq = req.WithContext(gpx.ToCtx(req.Context()))\n\n\t// embed parameters\n\tuf.EmbedParams(req, p)\n\n\t// create a new response recorder and call the update method\n\tw = httptest.NewRecorder()\n\te = controller.Update(w, req)\n\n\tif e == nil {\n\t\tt.Fatal(\"Expected: 404 Not found error. Actual: nil\")\n\t}\n\n\the, ok := e.(uf.HttpError)\n\n\tif !ok {\n\t\tt.Fatalf(\"Expected: 404 Not Found error. Actual: %+v\", e)\n\t}\n\n\tif he.Code != http.StatusNotFound {\n\t\tt.Fatalf(\"Expected: %d. Actual: %d\", http.StatusNotFound, he.Code)\n\t}\n}", "func (is *InfluxStats) WriteOkUpdate(ps int64, wt time.Duration) {\n\tis.mutex.Lock()\n\tdefer is.mutex.Unlock()\n\tif is.PSentMax < ps {\n\t\tis.PSentMax = ps\n\t}\n\tif is.WriteTimeMax < wt {\n\t\tis.WriteTimeMax = wt\n\t}\n\tis.WriteSent++\n\tis.PSent += ps\n\tis.WriteTime += wt\n}", "func (h *Handler) put(c echo.Context) (e error) {\n\tctx := c.(*cuxs.Context)\n\tvar r updateRequest\n\tvar sd *auth.SessionData\n\tvar id int64\n\tvar sr *model.SalesReturn\n\n\tif sd, e = auth.UserSession(ctx); e == nil {\n\t\tr.SessionData = sd\n\n\t\tif id, e = common.Decrypt(ctx.Param(\"id\")); e == nil {\n\t\t\tif sr, e = ShowSalesReturn(\"id\", id); e == nil {\n\t\t\t\tr.SR = sr\n\t\t\t\tr.SO = sr.SalesOrder\n\t\t\t\tif e = ctx.Bind(&r); e == nil {\n\t\t\t\t\tu := r.Transform(sr)\n\n\t\t\t\t\tif e = u.Save(\"recognition_date\", \"note\", \"updated_by\", \"updated_at\", \"total_amount\", \"document_status\"); e == nil {\n\t\t\t\t\t\tif e = UpdateSalesReturnItem(sr.SalesReturnItems, u.SalesReturnItems); e == nil {\n\t\t\t\t\t\t\tctx.Data(u)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\te = echo.ErrNotFound\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ctx.Serve(e)\n}", "func (s *Server) update(w http.ResponseWriter, r *http.Request) {\n\tv := mux.Vars(r)\n\tlogID, err := url.PathUnescape(v[\"logid\"])\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"cannot parse URL: %v\", err.Error()), http.StatusBadRequest)\n\t}\n\tbody, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"cannot read request body: %v\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\tvar req api.UpdateRequest\n\tif err := json.Unmarshal(body, &req); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"cannot parse request body as proper JSON struct: %v\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\t// Get the output from the witness.\n\tsth, err := s.w.Update(r.Context(), logID, req.STH, req.Proof)\n\tif err != nil {\n\t\t// If there was a failed precondition it's possible the caller was\n\t\t// just out of date. Give the returned STH to help them\n\t\t// form a new request.\n\t\tif c := status.Code(err); c == codes.FailedPrecondition {\n\t\t\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\t\t\tw.WriteHeader(httpForCode(c))\n\t\t\t// The returned STH gets written a few lines below.\n\t\t} else {\n\t\t\thttp.Error(w, fmt.Sprintf(\"failed to update to new STH: %v\", err), httpForCode(http.StatusInternalServerError))\n\t\t\treturn\n\t\t}\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tif _, err := w.Write(sth); err != nil {\n\t\tklog.Errorf(\"Write(): %v\", err)\n\t}\n}", "func echoContextHandlerAppData(ctx context.Context, in io.Reader, out io.Writer) {\n\tnctx := GetContext(ctx)\n\n\tif resp, ok := out.(http.ResponseWriter); ok {\n\t\tresp.Header().Add(\"AppId\", nctx.AppID())\n\t\tresp.Header().Add(\"AppName\", nctx.AppName())\n\t\tresp.Header().Add(\"FnId\", nctx.FnID())\n\t\tresp.Header().Add(\"FnName\", nctx.FnName())\n\t\tresp.Header().Add(\"CallId\", nctx.CallID())\n\t}\n\t// XXX(reed): could configure this to test too\n\n\tWriteStatus(out, http.StatusTeapot+2)\n\tio.Copy(out, in)\n}", "func NewUpdateRuleSetOK() *UpdateRuleSetOK {\n\treturn &UpdateRuleSetOK{}\n}", "func (r repository) Update(ctx context.Context, link entity.Link) error {\n\treturn r.db.With(ctx).Model(&link).Update()\n}", "func Ok(ctx context.Context, w http.ResponseWriter, response interface{}) {\n\treader, err := FormatOk(response)\n\tif err != nil {\n\t\tlog.Error(ctx, \"unable marshal response\", \"err\", err, \"type\", \"reply\")\n\t\tErr(ctx, w, http.StatusInternalServerError, \"internal error\")\n\t\treturn\n\t}\n\n\tFromContext(ctx).Reply(ctx, w, http.StatusOK, reader)\n}", "func Do(ctx context.Context, config Config) error {\n\tif config.Auth == nil {\n\t\treturn errors.New(\"config.Auth is nil\")\n\t}\n\tauthorization := fmt.Sprintf(\"Bearer %s\", config.Auth.Token)\n\treq := &request{Metadata: config.Metadata}\n\tvar resp struct{}\n\turlpath := fmt.Sprintf(\"/api/v1/update/%s\", config.ClientID)\n\treturn (&jsonapi.Client{\n\t\tAuthorization: authorization,\n\t\tBaseURL: config.BaseURL,\n\t\tHTTPClient: config.HTTPClient,\n\t\tLogger: config.Logger,\n\t\tUserAgent: config.UserAgent,\n\t}).Update(ctx, urlpath, req, &resp)\n}", "func UpdateHandler(infoer Infoer, args Args) (int, error) {\n\tcandidateUpdateReq, err := NewCandidateUpdateRequest(args, infoer)\n\tif err != nil {\n\t\treturn EXIT_ERROR, err\n\t}\n\n\ttmpDir, err := CreateTempDir()\n\tif nil != err {\n\t\terr = fmt.Errorf(\"failed to create temp dir; %w\", err)\n\t\treturn EXIT_ERROR, err\n\t}\n\tdefer DeleteDirectory(tmpDir)\n\n\t// write the contents of the wys file to disk (contains details about the available update)\n\twysFilePath := filepath.Join(tmpDir, \"wys\")\n\terr = os.WriteFile(wysFilePath, candidateUpdateReq.CandidateWysFileContent.Bytes(), 0644)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to write WYS file to: %v; %w\", wysFilePath, err)\n\t\treturn EXIT_ERROR, err\n\t}\n\n\t// download WYU (this is the archive with the updated files)\n\twys := candidateUpdateReq.ConfigWYS\n\twyuFilePath := filepath.Join(tmpDir, \"wyu\")\n\tif err := wys.getWyuFile(args, wyuFilePath); err != nil {\n\t\treturn EXIT_ERROR, err\n\t}\n\n\tiuc := candidateUpdateReq.ConfigIUC\n\tif iuc.IucPublicKey.Value != nil {\n\t\tif len(wys.FileSha1) == 0 {\n\t\t\terr = fmt.Errorf(\"The update is not signed. All updates must be signed in order to be installed.\")\n\t\t\treturn EXIT_ERROR, err\n\t\t}\n\n\t\t// convert the public key from the WYC file to an rsa.PublicKey\n\t\tkey, err := ParsePublicKey(string(iuc.IucPublicKey.Value))\n\t\tvar rsa rsa.PublicKey\n\t\trsa.N = key.Modulus\n\t\trsa.E = key.Exponent\n\n\t\t// hash the downloaded WYU file\n\t\tsha1hash, err := GenerateSHA1HashFromFilePath(wyuFilePath)\n\t\tif nil != err {\n\t\t\terr = fmt.Errorf(\"The downloaded file \\\"%s\\\" failed the signature validation: %w\", wyuFilePath, err)\n\t\t\treturn EXIT_ERROR, err\n\t\t}\n\n\t\t// verify the signature of the WYU file (the signed hash is included in the WYS file)\n\t\terr = VerifyHash(&rsa, sha1hash, wys.FileSha1)\n\t\tif nil != err {\n\t\t\terr = fmt.Errorf(\"The downloaded file \\\"%s\\\" is not signed. %w\", wyuFilePath, err)\n\t\t\treturn EXIT_ERROR, err\n\t\t}\n\t}\n\n\t// extract the WYU to tmpDir\n\t_, files, err := Unzip(wyuFilePath, tmpDir)\n\tif nil != err {\n\t\terr = fmt.Errorf(\"error unzipping %s; %w\", wyuFilePath, err)\n\t\treturn EXIT_ERROR, err\n\t}\n\n\t// get the details of the update\n\t// the update \"config\" is \"updtdetails.udt\"\n\t// the \"files\" are the updated files\n\tudt, updates, err := GetUpdateDetails(files)\n\tif nil != err {\n\t\treturn EXIT_ERROR, err\n\t}\n\n\t// backup the existing files that will be overwritten by the update\n\tinstDir := GetExeDir()\n\tbackupDir, err := BackupFiles(updates, instDir)\n\tdefer DeleteDirectory(backupDir)\n\tif nil != err {\n\t\t// Errors from rollback may occur from missing expected files - ignore\n\t\tRollbackFiles(backupDir, instDir)\n\t\treturn EXIT_ERROR, err\n\t}\n\n\t// TODO is there a way to clean this up\n\terr = InstallUpdate(udt, updates, instDir)\n\tif nil != err {\n\t\terr = fmt.Errorf(\"error applying update; %w\", err)\n\t\t// TODO rollback should restore client.wyc\n\t\tRollbackFiles(backupDir, instDir)\n\n\t\terr = os.Rename(wysFilePath, filepath.Join(instDir, INSTALL_FAILED_SENTINAL_WYS_FILE_NAME))\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"error renaming %s to failed install sentinel; %w\", wysFilePath, err)\n\t\t}\n\n\t\t// start services, best effort\n\t\tfor _, s := range udt.ServiceToStartAfterUpdate {\n\t\t\tsvc := ValueToString(&s)\n\t\t\t_ = StartService(svc)\n\t\t}\n\t\treturn EXIT_ERROR, err\n\t}\n\n\t// we haven't erred, write latest version number and exit\n\t// Newest version is recorded and we wipe out all temp files\n\tUpdateWYCWithNewVersionNumber(iuc, args.Cdata, wys.VersionToUpdate)\n\treturn EXIT_SUCCESS, nil\n}", "func (_obj *Apichannels) Channels_exportMessageLinkOneWayWithContext(tarsCtx context.Context, params *TLchannels_exportMessageLink, _opt ...map[string]string) (ret ExportedMessageLink, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"channels_exportMessageLink\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (ctx *GetOpmlContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/xml\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func (c *Component) updateController(args Arguments) error {\n\t// We only need to update the controller if we already have a rest config\n\t// generated and our client args haven't changed since the last call.\n\tif reflect.DeepEqual(c.args.Client, args.Client) && c.restConfig != nil {\n\t\treturn nil\n\t}\n\n\tcfg, err := args.Client.BuildRESTConfig(c.log)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"building Kubernetes config: %w\", err)\n\t}\n\tc.restConfig = cfg\n\n\treturn c.controller.UpdateConfig(cfg)\n}", "func (ctx *ListOutputContext) OK(r OutputCollection) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.feedpushr.output.v1+json; type=collection\")\n\t}\n\tif r == nil {\n\t\tr = OutputCollection{}\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func mainHandler(w http.ResponseWriter, req *http.Request) {\n\tif req.Method != \"GET\" {\n\t\tw.Header().Set(\"Allow\", \"GET\")\n\t\thttp.Error(w, \"method should be GET\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\n\tdata := struct {\n\t\tProduction bool\n\t\tHTTPAddr string\n\t}{\n\t\tProduction: production,\n\t\tHTTPAddr: *httpFlag,\n\t}\n\terr := t.ExecuteTemplate(w, \"head.html.tmpl\", data)\n\tif err != nil {\n\t\tlog.Println(\"ExecuteTemplate head.html.tmpl:\", err)\n\t\treturn\n\t}\n\n\tflusher := w.(http.Flusher)\n\tflusher.Flush()\n\n\tvar updatesAvailable = 0\n\tvar wroteInstalledUpdatesHeader bool\n\n\tfor repoPresentation := range c.pipeline.RepoPresentations() {\n\t\tif !repoPresentation.Updated {\n\t\t\tupdatesAvailable++\n\t\t}\n\n\t\tif repoPresentation.Updated && !wroteInstalledUpdatesHeader {\n\t\t\t// Make 'Installed Updates' header visible now.\n\t\t\tio.WriteString(w, `<div id=\"installed_updates\"><h3 style=\"text-align: center;\">Installed Updates</h3></div>`)\n\n\t\t\twroteInstalledUpdatesHeader = true\n\t\t}\n\n\t\terr := t.ExecuteTemplate(w, \"repo.html.tmpl\", repoPresentation)\n\t\tif err != nil {\n\t\t\tlog.Println(\"ExecuteTemplate repo.html.tmpl:\", err)\n\t\t\treturn\n\t\t}\n\n\t\tflusher.Flush()\n\t}\n\n\tif !wroteInstalledUpdatesHeader {\n\t\t// TODO: Make installed_updates available before all packages finish loading, so that it works when you update a package early. This will likely require a fully dynamically rendered frontend.\n\t\t// Append 'Installed Updates' header, but keep it hidden.\n\t\tio.WriteString(w, `<div id=\"installed_updates\" style=\"display: none;\"><h3 style=\"text-align: center;\">Installed Updates</h3></div>`)\n\t}\n\n\tif updatesAvailable == 0 {\n\t\tio.WriteString(w, `<script>document.getElementById(\"no_updates\").style.display = \"\";</script>`)\n\t}\n\n\terr = t.ExecuteTemplate(w, \"tail.html.tmpl\", nil)\n\tif err != nil {\n\t\tlog.Println(\"ExecuteTemplate tail.html.tmpl:\", err)\n\t\treturn\n\t}\n}", "func (ctx *ShowWorkflowContext) OK(resp []byte) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/xml\")\n\t}\n\tctx.ResponseData.WriteHeader(200)\n\t_, err := ctx.ResponseData.Write(resp)\n\treturn err\n}", "func NewEndpointGroupUpdateOK() *EndpointGroupUpdateOK {\n\treturn &EndpointGroupUpdateOK{}\n}", "func sendUpdateReturn(o *writeOptions, err error) error {\n\tif o != nil && o.updates != nil {\n\t\to.updates <- v1.Update{\n\t\t\tError: err,\n\t\t}\n\t}\n\treturn err\n}", "func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler.ProgressEvent, error) {\n\t// Add your code here:\n\t// * Make API calls (use req.Session)\n\t// * Mutate the model\n\t// * Check/set any callback context (req.CallbackContext / response.CallbackContext)\n\tiotSvc := iot.New(req.Session)\n\n\t_, err := iotSvc.UpdateCertificate(&iot.UpdateCertificateInput{\n\t\tCertificateId: currentModel.Id,\n\t\tNewStatus: currentModel.Status,\n\t})\n\n\tif err != nil {\n\t\taerr, ok := err.(awserr.Error)\n\t\tif ok {\n\t\t\tfmt.Printf(\"%v\", aerr)\n\t\t}\n\t\tresponse := handler.ProgressEvent{\n\t\t\tOperationStatus: handler.Failed,\n\t\t\tMessage: aerr.Error(),\n\t\t}\n\t\treturn response, nil\n\n\t}\n\t// Not implemented, return an empty handler.ProgressEvent\n\t// and an error\n\tresponse := handler.ProgressEvent{\n\t\tOperationStatus: handler.Success,\n\t\tMessage: \"Certificate updated successfully\",\n\t\tResourceModel: currentModel,\n\t}\n\treturn response, nil\n}" ]
[ "0.68222636", "0.63349605", "0.62158406", "0.6024096", "0.57931787", "0.5790857", "0.5630501", "0.54284674", "0.5401969", "0.5250832", "0.5180465", "0.5072021", "0.48976818", "0.48828763", "0.48104432", "0.47606224", "0.47587568", "0.47215855", "0.47129136", "0.4706033", "0.46966034", "0.46545076", "0.46408123", "0.4630078", "0.46276233", "0.46159202", "0.46073407", "0.46033648", "0.45965973", "0.45928633", "0.4590045", "0.45889986", "0.4587625", "0.45847446", "0.45773208", "0.45764914", "0.45575422", "0.45558694", "0.4542952", "0.45239937", "0.45176587", "0.45016927", "0.4499655", "0.44973835", "0.44714335", "0.44714218", "0.44702494", "0.4460595", "0.4454019", "0.4447169", "0.4440691", "0.4440691", "0.4440691", "0.44320282", "0.44299713", "0.44111305", "0.43994933", "0.43820074", "0.4374201", "0.43733984", "0.43706474", "0.43699533", "0.43672532", "0.43584305", "0.43576127", "0.43567777", "0.43531916", "0.434676", "0.43465748", "0.43400195", "0.43382773", "0.43337265", "0.4327694", "0.43230662", "0.432209", "0.43192744", "0.43138117", "0.4310691", "0.42926762", "0.42795068", "0.42792422", "0.42698598", "0.42570177", "0.4253735", "0.42532304", "0.42504466", "0.4250192", "0.42408052", "0.42395473", "0.42333108", "0.4232194", "0.4223689", "0.42223126", "0.42219102", "0.42217708", "0.4219613", "0.42193767", "0.4216686", "0.42097133", "0.42083883" ]
0.7468822
0
UpdateFeedOKTiny runs the method Update of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.
func UpdateFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedTiny) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r } ) if service == nil { service = goatest.Service(&logBuf, respSetter) } else { logger := log.New(&logBuf, "", log.Ltime) service.WithLogger(goa.NewLogger(logger)) newEncoder := func(io.Writer) goa.Encoder { return respSetter } service.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder service.Encoder.Register(newEncoder, "*/*") } // Setup request context rw := httptest.NewRecorder() query := url.Values{} if tags != nil { sliceVal := []string{*tags} query["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} query["title"] = sliceVal } u := &url.URL{ Path: fmt.Sprintf("/v1/feeds/%v", id), RawQuery: query.Encode(), } req, err := http.NewRequest("PUT", u.String(), nil) if err != nil { panic("invalid test " + err.Error()) // bug } prms := url.Values{} prms["id"] = []string{fmt.Sprintf("%v", id)} if tags != nil { sliceVal := []string{*tags} prms["tags"] = sliceVal } if title != nil { sliceVal := []string{*title} prms["title"] = sliceVal } if ctx == nil { ctx = context.Background() } goaCtx := goa.NewContext(goa.WithAction(ctx, "FeedTest"), rw, req, prms) updateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service) if _err != nil { e, ok := _err.(goa.ServiceError) if !ok { panic("invalid test data " + _err.Error()) // bug } t.Errorf("unexpected parameter validation error: %+v", e) return nil, nil } // Perform action _err = ctrl.Update(updateCtx) // Validate response if _err != nil { t.Fatalf("controller returned %+v, logs:\n%s", _err, logBuf.String()) } if rw.Code != 200 { t.Errorf("invalid response status code: got %+v, expected 200", rw.Code) } var mt *app.FeedTiny if resp != nil { var _ok bool mt, _ok = resp.(*app.FeedTiny) if !_ok { t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny", resp, resp) } _err = mt.Validate() if _err != nil { t.Errorf("invalid response media type: %s", _err) } } // Return results return rw, mt }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func UpdateFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedOKLink(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, *app.FeedLink) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedLink\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedLink)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedLink\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func UpdateTodosOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) (http.ResponseWriter, *app.Todo) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Todo\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(*app.Todo)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Todo\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ctx *UpdateOutputContext) OK(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (ctx *UpdateFeedContext) OKTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func UpdateFeedNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func GetFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.FeedTiny) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.FeedTiny\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.FeedTiny)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTiny\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func UpdateFeedBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string, tags *string, title *string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tquery[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tquery[\"title\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif tags != nil {\n\t\tsliceVal := []string{*tags}\n\t\tprms[\"tags\"] = sliceVal\n\t}\n\tif title != nil {\n\t\tsliceVal := []string{*title}\n\t\tprms[\"title\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (t *ThreadController) Update(c *gin.Context) {\n\n\tif err := model.ValidateParams(c, \"tid\"); err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\n\t\t\t\"errors\": err,\n\t\t})\n\t\treturn\n\t}\n\n\tif err := model.ValidatePostFromParams(c, \"title\", \"body\"); err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\n\t\t\t\"errors\": err,\n\t\t})\n\t\treturn\n\t}\n\n\tts.Update(c)\n\n\tc.Redirect(http.StatusFound, \"/t\")\n}", "func UpdateWidget(res http.ResponseWriter, req *http.Request) {\n\tresp := response.New()\n\n\tresp.Render(res, req)\n}", "func (w *ServiceWriter) Flush() {\n\tif !w.updated {\n\t\treturn\n\t}\n\tw.updated = false\n\n\tserviceBuffer := w.serviceBuffer\n\n\tlog.Debugf(\"going to flush updated service metadata, %d services\", len(serviceBuffer))\n\tatomic.StoreInt64(&w.stats.Services, int64(len(serviceBuffer)))\n\n\tdata, err := model.EncodeServicesPayload(serviceBuffer)\n\tif err != nil {\n\t\tlog.Errorf(\"encoding issue: %v\", err)\n\t\treturn\n\t}\n\n\theaders := map[string]string{\n\t\tlanguageHeaderKey: strings.Join(info.Languages(), \"|\"),\n\t\t\"Content-Type\": \"application/json\",\n\t}\n\n\tatomic.AddInt64(&w.stats.Bytes, int64(len(data)))\n\n\tstartFlush := time.Now()\n\n\t// Send the payload to the endpoint\n\terr = w.endpoint.Write(data, headers)\n\n\tflushTime := time.Since(startFlush)\n\n\t// TODO: if error, depending on why, replay later.\n\tif err != nil {\n\t\tatomic.AddInt64(&w.stats.Errors, 1)\n\t\tlog.Errorf(\"failed to flush service payload, time:%s, size:%d bytes, error: %s\", flushTime, len(data), err)\n\t\treturn\n\t}\n\n\tlog.Infof(\"flushed service payload to the API, time:%s, size:%d bytes\", flushTime, len(data))\n\tstatsd.Client.Gauge(\"datadog.trace_agent.service_writer.flush_duration\", flushTime.Seconds(), nil, 1)\n\tatomic.AddInt64(&w.stats.Payloads, 1)\n}", "func (h *UpdateHandler) Update(rw http.ResponseWriter, req *http.Request) {\n\tstartTime := time.Now()\n\n\tdefer func() {\n\t\th.metrics.HTTPCreateUpdateTime(time.Since(startTime))\n\t}()\n\n\trequest, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\tcommon.WriteError(rw, http.StatusBadRequest, err)\n\n\t\treturn\n\t}\n\n\tlogger.Debug(\"Processing update request\", logfields.WithRequestBody(request))\n\n\tresponse, err := h.doUpdate(request)\n\tif err != nil {\n\t\tcommon.WriteError(rw, err.(*common.HTTPError).Status(), err)\n\n\t\treturn\n\t}\n\tcommon.WriteResponse(rw, http.StatusOK, response)\n}", "func (e Endpoints) Update(ctx context.Context, todo io.Todo) (t io.Todo, error error) {\n\trequest := UpdateRequest{Todo: todo}\n\tresponse, err := e.UpdateEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(UpdateResponse).T, response.(UpdateResponse).Error\n}", "func (w *ServiceWriter) Run() {\n\tw.exitWG.Add(1)\n\tdefer w.exitWG.Done()\n\n\t// for now, simply flush every x seconds\n\tflushTicker := time.NewTicker(5 * time.Second)\n\tdefer flushTicker.Stop()\n\n\tupdateInfoTicker := time.NewTicker(1 * time.Minute)\n\tdefer updateInfoTicker.Stop()\n\n\tlog.Debug(\"starting service writer\")\n\n\tfor {\n\t\tselect {\n\t\tcase sm := <-w.InServices:\n\t\t\tupdated := w.serviceBuffer.Update(sm)\n\t\t\tif updated {\n\t\t\t\tw.updated = updated\n\t\t\t\tstatsd.Client.Count(\"datadog.trace_agent.writer.services.updated\", 1, nil, 1)\n\t\t\t}\n\t\tcase <-flushTicker.C:\n\t\t\tw.Flush()\n\t\tcase <-updateInfoTicker.C:\n\t\t\tgo w.updateInfo()\n\t\tcase <-w.exit:\n\t\t\tlog.Info(\"exiting service writer, flushing all modified services\")\n\t\t\tw.Flush()\n\t\t\treturn\n\t\t}\n\t}\n}", "func (s *Server) update(w http.ResponseWriter, r *http.Request) {\n\tv := mux.Vars(r)\n\tlogID, err := url.PathUnescape(v[\"logid\"])\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"cannot parse URL: %v\", err.Error()), http.StatusBadRequest)\n\t}\n\tbody, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"cannot read request body: %v\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\tvar req api.UpdateRequest\n\tif err := json.Unmarshal(body, &req); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"cannot parse request body as proper JSON struct: %v\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\t// Get the output from the witness.\n\tsth, err := s.w.Update(r.Context(), logID, req.STH, req.Proof)\n\tif err != nil {\n\t\t// If there was a failed precondition it's possible the caller was\n\t\t// just out of date. Give the returned STH to help them\n\t\t// form a new request.\n\t\tif c := status.Code(err); c == codes.FailedPrecondition {\n\t\t\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\t\t\tw.WriteHeader(httpForCode(c))\n\t\t\t// The returned STH gets written a few lines below.\n\t\t} else {\n\t\t\thttp.Error(w, fmt.Sprintf(\"failed to update to new STH: %v\", err), httpForCode(http.StatusInternalServerError))\n\t\t\treturn\n\t\t}\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tif _, err := w.Write(sth); err != nil {\n\t\tklog.Errorf(\"Write(): %v\", err)\n\t}\n}", "func update(w http.ResponseWriter, req *http.Request) {\n\tresponse := \"\"\n\tswitch req.RequestURI {\n\tcase \"/get/accounts\":\n\t\tmapD := map[string]int{\"apple\": 5, \"lettuce\": 7}\n\t\tmapB, _ := json.Marshal(mapD)\n\t\tresponse = string(mapB)\n\t\tbreak\n\tdefault:\n\t\tr, _ := json.Marshal(\"Request not found\")\n\t\tresponse = string(r)\n\t\tbreak\n\t}\n\n\tcontext := Context{Title: response}\n\trender(w, \"api\", context)\n}", "func (c *ServiceCreate) update() error {\n\tcmd := exec.Command(\"go\", \"get\", \"-u\", \"github.com/RobyFerro/go-web-framework\")\n\tcmd.Dir = c.Args\n\n\treturn cmd.Run()\n}", "func Update(r *http.Request, cfg config.Config) (int, http.Header, []byte, error) {\n\t//STANDARD DECLARATIONS START\n\tcode := http.StatusOK\n\th := http.Header{}\n\toutput := []byte(\"\")\n\terr := error(nil)\n\tcharset := \"utf-8\"\n\t//STANDARD DECLARATIONS END\n\n\tvars := mux.Vars(r)\n\turlValues := r.URL.Query()\n\tdateStr := urlValues.Get(\"date\")\n\t// Set Content-Type response Header value\n\tcontentType := r.Header.Get(\"Accept\")\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\tdt, dateStr, err := utils.ParseZuluDate(dateStr)\n\tif err != nil {\n\t\tcode = http.StatusBadRequest\n\t\toutput, _ = respond.MarshalContent(respond.ErrBadRequestDetails(err.Error()), contentType, \"\", \" \")\n\t\treturn code, h, output, err\n\t}\n\n\t// Grab Tenant DB configuration from context\n\ttenantDbConfig := context.Get(r, \"tenant_conf\").(config.MongoConfig)\n\n\tincoming := Weights{}\n\n\t// ingest body data\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, cfg.Server.ReqSizeLimit))\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\tif err := r.Body.Close(); err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\t// parse body json\n\tif err := json.Unmarshal(body, &incoming); err != nil {\n\t\toutput, _ = respond.MarshalContent(respond.BadRequestInvalidJSON, contentType, \"\", \" \")\n\t\tcode = 400\n\t\treturn code, h, output, err\n\t}\n\n\tincoming.DateInt = dt\n\tincoming.Date = dateStr\n\n\tsession, err := mongo.OpenSession(tenantDbConfig)\n\tdefer mongo.CloseSession(session)\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\t// create filter to retrieve specific profile with id\n\tfilter := bson.M{\"id\": vars[\"ID\"]}\n\n\tincoming.ID = vars[\"ID\"]\n\n\t// Retrieve Results from database\n\tresults := []Weights{}\n\terr = mongo.Find(session, tenantDbConfig.Db, weightCol, filter, \"name\", &results)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\t// Check if nothing found\n\tif len(results) < 1 {\n\t\toutput, _ = respond.MarshalContent(respond.ErrNotFound, contentType, \"\", \" \")\n\t\tcode = 404\n\t\treturn code, h, output, err\n\t}\n\n\t// check if the weights dataset name is unique\n\tif incoming.Name != results[0].Name {\n\n\t\tresults = []Weights{}\n\t\tquery := bson.M{\"name\": incoming.Name, \"id\": bson.M{\"$ne\": vars[\"ID\"]}}\n\n\t\terr = mongo.Find(session, tenantDbConfig.Db, weightCol, query, \"\", &results)\n\n\t\tif err != nil {\n\t\t\tcode = http.StatusInternalServerError\n\t\t\treturn code, h, output, err\n\t\t}\n\n\t\t// If results are returned for the specific name\n\t\t// then we already have an existing operations profile and we must\n\t\t// abort creation notifying the user\n\t\tif len(results) > 0 {\n\t\t\toutput, _ = respond.MarshalContent(respond.ErrConflict(\"Weights resource with the same name already exists\"), contentType, \"\", \" \")\n\t\t\tcode = http.StatusConflict\n\t\t\treturn code, h, output, err\n\t\t}\n\t}\n\t// run the update query\n\twCol := session.DB(tenantDbConfig.Db).C(weightCol)\n\tinfo, err := wCol.Upsert(bson.M{\"id\": vars[\"ID\"], \"date_integer\": dt}, incoming)\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\tupdMsg := \"Weights resource successfully updated\"\n\n\tif info.Updated <= 0 {\n\t\tupdMsg = \"Weights resource successfully updated (new history snapshot)\"\n\t}\n\n\t// Create view for response message\n\toutput, err = createMsgView(updMsg, 200) //Render the results into JSON\n\tcode = 200\n\treturn code, h, output, err\n}", "func (r *resourceFrameworkShare) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {\n}", "func GetFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, id string) (http.ResponseWriter, *app.Feed) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.Feed\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.Feed)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.Feed\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (s *HelloSystem) Update(ctx core.UpdateCtx) {}", "func (h Handler) Update(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tdata := postData{}\n\terr := json.NewDecoder(r.Body).Decode(&data)\n\tif err != nil {\n\t\th.log.Println(err)\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was an problem, please try again\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\tif data.Name == \"\" || data.Desc == \"\" {\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"Empty post values\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\tid, err := strconv.ParseUint(p.ByName(\"id\"), 10, 64)\n\tif err != nil {\n\t\th.log.Println(err)\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was an problem, please try again\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\ttodo, err := h.m.Update(id, model.Todo{Name: data.Name, Description: data.Desc})\n\tif err != nil {\n\t\th.log.Println(err)\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was an problem, please try again\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\tres := response.Resp{\n\t\tStatus: \"succes\",\n\t\tData: todo,\n\t}\n\tresponse.Writer(w, res)\n}", "func UpdateTodosNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "func tenantUpdateHandler(formatter *render.Render) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tsetupResponse(&w, req)\n\t\n\t\tif (*req).Method == \"OPTIONS\" {\n\t\t\tfmt.Println(\"PREFLIGHT Request\")\n\t\t\treturn\n\t\t}\n\n \tvar m Tenant\n \t_ = json.NewDecoder(req.Body).Decode(&m)\t\t\n\n \tfmt.Println(\"Update Tenant Products To: \", m.Products)\n\t\tsession, err := mgo.Dial(mongodb_server)\n if err != nil {\n panic(err)\n }\n defer session.Close()\n session.SetMode(mgo.Monotonic, true)\n c := session.DB(mongodb_database).C(mongodb_collection)\n query := bson.M{\"id\" : m.ID}\n change := bson.M{\"$set\": bson.M{ \"products\" : m.Products}}\n _,err = c.UpdateAll(query, change)\n if err != nil {\n log.Fatal(err)\n }\n \tvar result bson.M\n err = c.Find(bson.M{\"id\" : m.ID}).One(&result)\n if err != nil {\n log.Fatal(err)\n } \n fmt.Println(\"Tenant Products Updated\", result )\n\t\tformatter.JSON(w, http.StatusOK, result)\n\t}\n}", "func (h *TFPConfigHandler) Update(c echo.Context) error {\n\tvar err error\n\tctx := c.Request().Context()\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tc.Response().Header().Set(echo.HeaderContentType, jsonapi.MediaType)\n\n\tconfig := &models.TFPConfig{}\n\tif err = jsonapi.UnmarshalPayload(c.Request().Body, config); err != nil {\n\t\tc.Response().WriteHeader(http.StatusBadRequest)\n\t\treturn jsonapi.MarshalErrors(c.Response(), []*jsonapi.ErrorObject{\n\t\t\t{\n\t\t\t\tStatus: fmt.Sprintf(\"%d\", http.StatusBadRequest),\n\t\t\t\tTitle: \"Error when update tfp_config\",\n\t\t\t\tDetail: err.Error(),\n\t\t\t},\n\t\t})\n\t}\n\tid, err := strconv.ParseUint(c.Param(\"id\"), 10, 64)\n\tif err != nil {\n\t\tc.Response().WriteHeader(http.StatusBadRequest)\n\t\treturn jsonapi.MarshalErrors(c.Response(), []*jsonapi.ErrorObject{\n\t\t\t{\n\t\t\t\tStatus: fmt.Sprintf(\"%d\", http.StatusBadRequest),\n\t\t\t\tTitle: \"Error when update tfp_config\",\n\t\t\t\tDetail: err.Error(),\n\t\t\t},\n\t\t})\n\t}\n\tconfig.ID = uint(id)\n\n\tlog.Debugf(\"Data: %+v\", config)\n\n\tif err = h.us.Update(ctx, config); err != nil {\n\t\tlog.Errorf(\"Error when update tfp_config: %s\", err.Error())\n\t\tc.Response().WriteHeader(http.StatusInternalServerError)\n\t\treturn jsonapi.MarshalErrors(c.Response(), []*jsonapi.ErrorObject{\n\t\t\t{\n\t\t\t\tStatus: fmt.Sprintf(\"%d\", http.StatusInternalServerError),\n\t\t\t\tTitle: \"Error when update tfp_config\",\n\t\t\t\tDetail: err.Error(),\n\t\t\t},\n\t\t})\n\t}\n\n\tc.Response().WriteHeader(http.StatusCreated)\n\treturn jsonapi.MarshalOnePayloadEmbedded(c.Response(), config)\n}", "func UpdateTodosBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.TodosController, id int, body string, isFinished bool) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{body}\n\t\tquery[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tquery[\"is_finished\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/todos/%v\", id),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\t{\n\t\tsliceVal := []string{body}\n\t\tprms[\"body\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", isFinished)}\n\t\tprms[\"is_finished\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"TodosTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdateTodosContext(goaCtx, req, service)\n\tif _err != nil {\n\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t}\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (ts *TaskService) Update(requestCtx context.Context, req *taskAPI.UpdateTaskRequest) (*types.Empty, error) {\n\tdefer logPanicAndDie(log.G(requestCtx))\n\tlog.G(requestCtx).WithField(\"id\", req.ID).Debug(\"update\")\n\n\tresp, err := ts.runcService.Update(requestCtx, req)\n\tif err != nil {\n\t\tlog.G(requestCtx).WithError(err).Error(\"update failed\")\n\t\treturn nil, err\n\t}\n\n\tlog.G(requestCtx).Debug(\"update succeeded\")\n\treturn resp, nil\n}", "func (r *ManagedServiceUpdateRequest) SendContext(ctx context.Context) (result *ManagedServiceUpdateResponse, err error) {\n\tquery := helpers.CopyQuery(r.query)\n\theader := helpers.CopyHeader(r.header)\n\tbuffer := &bytes.Buffer{}\n\terr = writeManagedServiceUpdateRequest(r, buffer)\n\tif err != nil {\n\t\treturn\n\t}\n\turi := &url.URL{\n\t\tPath: r.path,\n\t\tRawQuery: query.Encode(),\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"PATCH\",\n\t\tURL: uri,\n\t\tHeader: header,\n\t\tBody: io.NopCloser(buffer),\n\t}\n\tif ctx != nil {\n\t\trequest = request.WithContext(ctx)\n\t}\n\tresponse, err := r.transport.RoundTrip(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tresult = &ManagedServiceUpdateResponse{}\n\tresult.status = response.StatusCode\n\tresult.header = response.Header\n\treader := bufio.NewReader(response.Body)\n\t_, err = reader.Peek(1)\n\tif err == io.EOF {\n\t\terr = nil\n\t\treturn\n\t}\n\tif result.status >= 400 {\n\t\tresult.err, err = errors.UnmarshalErrorStatus(reader, result.status)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = result.err\n\t\treturn\n\t}\n\terr = readManagedServiceUpdateResponse(result, reader)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (ctx *GetFeedContext) OKTiny(r *FeedTiny) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler.ProgressEvent, error) {\n\t// Add your code here:\n\t// * Make API calls (use req.Session)\n\t// * Mutate the model\n\t// * Check/set any callback context (req.CallbackContext / response.CallbackContext)\n\n\t// Construct a new handler.ProgressEvent and return it\n\tresponse := handler.ProgressEvent{\n\t\tOperationStatus: handler.Success,\n\t\tMessage: \"Update complete\",\n\t\tResourceModel: currentModel,\n\t}\n\n\treturn response, nil\n\n\t// Not implemented, return an empty handler.ProgressEvent\n\t// and an error\n\treturn handler.ProgressEvent{}, errors.New(\"Not implemented: Update\")\n}", "func (o *sampleUpdateHandler) Update(rw http.ResponseWriter, req *http.Request) {\n\to.UpdateHandler.Update(rw, req)\n}", "func Update(ctx *gin.Context, data interface{}) {\n\tctx.JSON(http.StatusAccepted, gin.H{\"code\": merrors.ErrSuccess, \"data\": data})\n\treturn\n}", "func (ctx *GetFeedContext) OK(r *Feed) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func NewUpdateFeedContext(ctx context.Context, r *http.Request, service *goa.Service) (*UpdateFeedContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := UpdateFeedContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\trctx.ID = rawID\n\t}\n\tparamTags := req.Params[\"tags\"]\n\tif len(paramTags) > 0 {\n\t\trawTags := paramTags[0]\n\t\trctx.Tags = &rawTags\n\t}\n\tparamTitle := req.Params[\"title\"]\n\tif len(paramTitle) > 0 {\n\t\trawTitle := paramTitle[0]\n\t\trctx.Title = &rawTitle\n\t}\n\treturn &rctx, err\n}", "func (op *updateServiceUpdateServiceOperation) do(ctx context.Context, r *Service, c *Client) error {\n\t_, err := c.GetService(ctx, r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu, err := r.updateURL(c.Config.BasePath, \"UpdateService\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tmask := dcl.UpdateMask(op.FieldDiffs)\n\tu, err = dcl.AddQueryParams(u, map[string]string{\"updateMask\": mask})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := newUpdateServiceUpdateServiceRequest(ctx, r, c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.Config.Logger.InfoWithContextf(ctx, \"Created update: %#v\", req)\n\tbody, err := marshalUpdateServiceUpdateServiceRequest(c, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = dcl.SendRequest(ctx, c.Config, \"PATCH\", u, bytes.NewBuffer(body), c.Config.RetryProvider)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func ListFeedOKTiny(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedTinyCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedTinyCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedTinyCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedTinyCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func handleActivityUpdate(w http.ResponseWriter, r *http.Request) {\r\n\t//[TODO: query param approach is not the effecient way to handle, as the parameters values in the url are visible to anyone,a nd it could pose security issues. so, need to explore the way in which we can pass the values as part of the HTTP header/body instead of URL]\r\n\ti := strings.Index(r.RequestURI, \"?\") // since url.ParseQuery is not able to retrieve the first key (of the query string) correctly, find the position of ? in the url and\r\n\tqs := r.RequestURI[i+1 : len(r.RequestURI)] // substring it and then\r\n\r\n\tm, _ := url.ParseQuery(qs) // parse it\r\n\tc := appengine.NewContext(r)\r\n\r\n\terr := helpers.UpdateActivity(c, m[\"ActivityName\"][0], m[\"StartTime\"][0], m[\"Status\"][0], m[\"NewStatus\"][0])\r\n\r\n\tif err != nil {\r\n\t\thttp.Error(w, \"Error while changing the status: \"+err.Error(), http.StatusInternalServerError)\r\n\t\treturn\r\n\t}\r\n\r\n\thttp.Redirect(w, r, \"/\", http.StatusFound)\r\n}", "func (s *sdHandler) updateService(ctx context.Context, serv *sdpb.Service) (*sdpb.Service, error) {\n\tif serv.Metadata == nil {\n\t\tserv.Metadata = map[string]string{}\n\t}\n\tserv.Metadata[\"owner\"] = \"cnwan-operator\"\n\n\treq := &sdpb.UpdateServiceRequest{\n\t\tService: serv,\n\t\tUpdateMask: &field_mask.FieldMask{\n\t\t\tPaths: []string{\"metadata\"},\n\t\t},\n\t}\n\n\treturn s.client.UpdateService(ctx, req)\n}", "func Do(ctx context.Context, config Config) error {\n\tif config.Auth == nil {\n\t\treturn errors.New(\"config.Auth is nil\")\n\t}\n\tauthorization := fmt.Sprintf(\"Bearer %s\", config.Auth.Token)\n\treq := &request{Metadata: config.Metadata}\n\tvar resp struct{}\n\turlpath := fmt.Sprintf(\"/api/v1/update/%s\", config.ClientID)\n\treturn (&jsonapi.Client{\n\t\tAuthorization: authorization,\n\t\tBaseURL: config.BaseURL,\n\t\tHTTPClient: config.HTTPClient,\n\t\tLogger: config.Logger,\n\t\tUserAgent: config.UserAgent,\n\t}).Update(ctx, urlpath, req, &resp)\n}", "func MakeUpdateEndpoint(service integratedservices.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(UpdateRequest)\n\n\t\terr := service.Update(ctx, req.ClusterID, req.ServiceName, req.Spec)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn UpdateResponse{Err: err}, nil\n\t\t\t}\n\n\t\t\treturn UpdateResponse{Err: err}, err\n\t\t}\n\n\t\treturn UpdateResponse{}, nil\n\t}\n}", "func (op *updateAttestorUpdateAttestorOperation) do(ctx context.Context, r *Attestor, c *Client) error {\n\t_, err := c.GetAttestor(ctx, r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu, err := r.updateURL(c.Config.BasePath, \"UpdateAttestor\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := newUpdateAttestorUpdateAttestorRequest(ctx, r, c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.Config.Logger.InfoWithContextf(ctx, \"Created update: %#v\", req)\n\tbody, err := marshalUpdateAttestorUpdateAttestorRequest(c, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = dcl.SendRequest(ctx, c.Config, \"PUT\", u, bytes.NewBuffer(body), c.Config.RetryProvider)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (h *Handler) serveUpdateDBUser(w http.ResponseWriter, r *http.Request) {}", "func MakeUpdateEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(UpdateRequest)\n\t\tt, error := s.Update(ctx, req.Todo)\n\t\treturn UpdateResponse{\n\t\t\tError: error,\n\t\t\tT: t,\n\t\t}, nil\n\t}\n}", "func (h *Handler) put(c echo.Context) (e error) {\n\tctx := c.(*cuxs.Context)\n\tvar r updateRequest\n\tvar sd *auth.SessionData\n\tvar id int64\n\tvar sr *model.SalesReturn\n\n\tif sd, e = auth.UserSession(ctx); e == nil {\n\t\tr.SessionData = sd\n\n\t\tif id, e = common.Decrypt(ctx.Param(\"id\")); e == nil {\n\t\t\tif sr, e = ShowSalesReturn(\"id\", id); e == nil {\n\t\t\t\tr.SR = sr\n\t\t\t\tr.SO = sr.SalesOrder\n\t\t\t\tif e = ctx.Bind(&r); e == nil {\n\t\t\t\t\tu := r.Transform(sr)\n\n\t\t\t\t\tif e = u.Save(\"recognition_date\", \"note\", \"updated_by\", \"updated_at\", \"total_amount\", \"document_status\"); e == nil {\n\t\t\t\t\t\tif e = UpdateSalesReturnItem(sr.SalesReturnItems, u.SalesReturnItems); e == nil {\n\t\t\t\t\t\t\tctx.Data(u)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\te = echo.ErrNotFound\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ctx.Serve(e)\n}", "func (u *Update) Apply() (*model.Response, error) {\n\treturn u.config.Transport.Update(u.ctx, u.meta, u.op, u.find, u.update)\n}", "func Handler(res http.ResponseWriter, req *http.Request) {\n\t// First, decode the JSON response body\n\tfullBody := &types.Update{}\n\n\tif err := json.NewDecoder(req.Body).Decode(fullBody); err != nil {\n\t\tfmt.Println(\"could not decode request full body\", err)\n\t\treturn\n\t}\n\tfmt.Println(\"PRINTING REQUEST FULL BODY\")\n\tfmt.Printf(\"%+v\\n\", fullBody)\n\tif fullBody.Message == nil {\n\t\treturn\n\t}\n\tfmt.Printf(\"%+v\\n\", fullBody.Message.Text)\n\t// Check if the message contains the word \"marco\"\n\t// if not, return without doing anything\n\tif strings.Contains(fullBody.Message.Text,\"testDB\"){\n\t\tdb.Add(fullBody.Message.Text)\n\t}\n\tif strings.Contains(fullBody.Message.Text,\"testTag\"){\n\t\terr := say(fullBody.Message.Chat,fullBody.Message.From, fmt.Sprintf(\"[inline mention of a user](tg://user?id=%d)\",fullBody.Message.From.ID))\n\t\tif err != nil {\n\t\t\tfmt.Println(\"error in sending reply:\", err)\n\t\t\treturn\n\t\t}\n\t}\n\tif !strings.Contains(strings.ToLower(fullBody.Message.Text), \"marco\") {\n\t\treturn\n\t}\n\n\t// If the text contains marco, call the `sayPolo` function, which\n\t// is defined below\n\tif err := sayPolo(fullBody.Message.Chat.ID); err != nil {\n\t\tfmt.Println(\"error in sending reply:\", err)\n\t\treturn\n\t}\n\n\n\t// log a confirmation message if the message is sent successfully\n\tfmt.Println(\"reply sent\")\n}", "func WrapUpdateMe(h Handler, w http.ResponseWriter, r *http.Request) {\n\tvar aUpdateUser Profile\n\n\tif r.Body == nil {\n\t\thttp.Error(w, \"Parameter 'update_user' expected in body, but got no body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\t{\n\t\tvar err error\n\t\tr.Body = http.MaxBytesReader(w, r.Body, 1024*1024)\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Body unreadable: \"+err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\terr = ValidateAgainstProfileSchema(body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Failed to validate against schema: \"+err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\terr = json.Unmarshal(body, &aUpdateUser)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Error JSON-decoding body parameter 'update_user': \"+err.Error(),\n\t\t\t\thttp.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\th.UpdateMe(w,\n\t\tr,\n\t\taUpdateUser)\n}", "func doUpdate(w http.ResponseWriter, r *http.Request) {\n\ts, err := newServerCGI(w, r)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tlog.Println(\"failed to create cgi struct\")\n\t\treturn\n\t}\n\treg := regexp.MustCompile(`^update/(\\w+)/(\\d+)/(\\w+)/([^\\+]*)(\\+.*)`)\n\tm := reg.FindStringSubmatch(s.path())\n\tif m == nil {\n\t\tlog.Println(\"illegal url\")\n\t\treturn\n\t}\n\tdatfile, stamp, id, hostport, path := m[1], m[2], m[3], m[4], m[5]\n\thost, portstr, err := net.SplitHostPort(hostport)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tport, err := strconv.Atoi(portstr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\thost = s.remoteIP(host)\n\tif host == \"\" {\n\t\tlog.Println(\"host is null\")\n\t\treturn\n\t}\n\n\tn, err := node.MakeNode(host, path, port)\n\tif err != nil || !n.IsAllowed() {\n\t\tlog.Println(\"detects spam\")\n\t\treturn\n\t}\n\ts.NodeManager.AppendToTable(datfile, n)\n\ts.NodeManager.Sync()\n\tnstamp, err := strconv.ParseInt(stamp, 10, 64)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tif !thread.IsInUpdateRange(nstamp) {\n\t\treturn\n\t}\n\trec := thread.NewRecord(datfile, stamp+\"_\"+id)\n\tgo s.UpdateQue.UpdateNodes(rec, n)\n\tfmt.Fprintln(w, \"OK\")\n}", "func (svc *AdminSvcService) Update(s *library.Service) (*library.Service, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/service\"\n\n\t// library Service type we want to return\n\tv := new(library.Service)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, s, v)\n\n\treturn v, resp, err\n}", "func (c *Component) updateController(args Arguments) error {\n\t// We only need to update the controller if we already have a rest config\n\t// generated and our client args haven't changed since the last call.\n\tif reflect.DeepEqual(c.args.Client, args.Client) && c.restConfig != nil {\n\t\treturn nil\n\t}\n\n\tcfg, err := args.Client.BuildRESTConfig(c.log)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"building Kubernetes config: %w\", err)\n\t}\n\tc.restConfig = cfg\n\n\treturn c.controller.UpdateConfig(cfg)\n}", "func (ctl *Controller) Update() error {\n\tn, err := ctl.spi.Write(ctl.buffer)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif n != len(ctl.buffer) {\n\t\treturn errors.New(\"Unable to send the full LED colour buffer to device\")\n\t}\n\treturn nil\n}", "func NewUpdateOutputContext(ctx context.Context, r *http.Request, service *goa.Service) (*UpdateOutputContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := UpdateOutputContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamID := req.Params[\"id\"]\n\tif len(paramID) > 0 {\n\t\trawID := paramID[0]\n\t\tif id, err2 := strconv.Atoi(rawID); err2 == nil {\n\t\t\trctx.ID = id\n\t\t} else {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidParamTypeError(\"id\", rawID, \"integer\"))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "func (ctx *UpdateFilterContext) OK(r *Filter) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func UpdateTask(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprint(w, \"UpdateTask\\n\")\n}", "func (u Update) Invoke(parameters map[string]interface{}) *context.ActivityContext {\n\n\t// getting and assign the values from the MAP to internal variables\n\tsecurityToken := parameters[\"securityToken\"].(string)\n\t/*log := parameters[\"log\"].(string)*/\n\tdomain := parameters[\"namespace\"].(string)\n\tclass := parameters[\"class\"].(string)\n\tJSON_Document := parameters[\"JSON\"].(string)\n\n\t//creating new instance of context.ActivityContext\n\tvar activityContext = new(context.ActivityContext)\n\n\t//creating new instance of context.ActivityError\n\tvar activityError context.ActivityError\n\n\t//setting activityError proprty values\n\tactivityError.Encrypt = false\n\tactivityError.ErrorString = \"No Exception\"\n\tactivityError.Forward = false\n\tactivityError.SeverityLevel = context.Info\n\n\t// preparing the data relevent to make the objectstore API\n\t//url := \"http://\" + Common.GetObjectstoreIP() + \"/\" + domain + \"/\" + class\n\turl := \"http://\" + domain + \"/data/\" + domain + \"/\" + class + \"?securityToken=\" + securityToken\n\n\treq, err := http.NewRequest(\"PUT\", url, bytes.NewBuffer([]byte(JSON_Document)))\n\t/*req.Header.Set(\"securityToken\", securityToken)\n\treq.Header.Set(\"log\", log)*/\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\t// once the request is made according to the response the following is done\n\tif err != nil {\n\t\tactivityError.ErrorString = err.Error()\n\t\tactivityContext.ActivityStatus = false\n\t\tactivityContext.Message = \"Connection to server failed! Check connectivity.\"\n\t\tactivityContext.ErrorState = activityError\n\t} else {\n\t\tactivityContext.ActivityStatus = true\n\t\tactivityContext.Message = \"Data Successfully Updated!\"\n\t\tactivityContext.ErrorState = activityError\n\t}\n\tdefer resp.Body.Close()\n\t// once the functionality of the method completes it returns the processed data\n\treturn activityContext\n}", "func (is *InfluxStats) WriteOkUpdate(ps int64, wt time.Duration) {\n\tis.mutex.Lock()\n\tdefer is.mutex.Unlock()\n\tif is.PSentMax < ps {\n\t\tis.PSentMax = ps\n\t}\n\tif is.WriteTimeMax < wt {\n\t\tis.WriteTimeMax = wt\n\t}\n\tis.WriteSent++\n\tis.PSent += ps\n\tis.WriteTime += wt\n}", "func NewUpdateHandler(\n\tendpoint goa.Endpoint,\n\tmux goahttp.Muxer,\n\tdecoder func(*http.Request) goahttp.Decoder,\n\tencoder func(context.Context, http.ResponseWriter) goahttp.Encoder,\n\terrhandler func(context.Context, http.ResponseWriter, error),\n\tformatter func(err error) goahttp.Statuser,\n) http.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeUpdateRequest(mux, decoder)\n\t\tencodeResponse = EncodeUpdateResponse(encoder)\n\t\tencodeError = EncodeUpdateError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"update\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "func MakeUpdateSiteThemeEndpoint(svc service.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (response interface{}, err error) {\n\t\treq := request.(UpdateSiteThemeRequest)\n\t\terr = svc.UpdateSiteTheme(ctx, req.SiteID, req.Theme)\n\t\treturn UpdateSiteThemeResponse{Err: err}, nil\n\t}\n}", "func (_obj *WebApiAuth) LoginLog_UpdateOneWayWithContext(tarsCtx context.Context, id int32, req *LoginLog, res *LoginLog, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(id, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"LoginLog_Update\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (c *Component) updateTailer(args Arguments) error {\n\tif reflect.DeepEqual(c.args.Client, args.Client) && c.lastOptions != nil {\n\t\treturn nil\n\t}\n\n\tcfg, err := args.Client.BuildRESTConfig(c.log)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"building Kubernetes config: %w\", err)\n\t}\n\tclientSet, err := kubeclient.NewForConfig(cfg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"building Kubernetes client: %w\", err)\n\t}\n\n\tmanagerOpts := &kubetail.Options{\n\t\tClient: clientSet,\n\t\tHandler: loki.NewEntryHandler(c.handler.Chan(), func() {}),\n\t\tPositions: c.positions,\n\t}\n\tc.lastOptions = managerOpts\n\n\t// Options changed; pass it to the tailer. This will never fail because it\n\t// only fails if the context gets canceled.\n\t//\n\t// TODO(rfratto): should we have a generous update timeout to prevent this\n\t// from potentially hanging forever?\n\t_ = c.tailer.UpdateOptions(context.Background(), managerOpts)\n\treturn nil\n}", "func UpdateTodoHandler(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tvars := mux.Vars(r)\n\tlog.Print(\"update\")\n\n\ttasks := strings.Split(vars[\"todo\"], \",\")\n\n\tw.WriteHeader(http.StatusOK)\n\n\tusername := context.Get(r, \"username\")\n\n\tlog.Print(username)\n\tlog.Print(tasks)\n\n\tstatus, err := models.SaveTodos(username.(string), tasks)\n\tjsonErr, _ := json.Marshal(err)\n\tjsonStatus, _ := json.Marshal(status)\n\tif err != nil {\n\t\tw.Write(jsonErr)\n\t}\n\tw.Write(jsonStatus)\n}", "func (s *Service) UpdateService(parser *ServiceParser) error {\n\tif s.Key == \"\" || s.Host == \"\" {\n\t\treturn fmt.Errorf(\"Miss Key and Host\")\n\t}\n\tkey := GenKey(s.Key)\n\n\tvar err error\n\tvar value []byte\n\tif parser == nil {\n\t\tvalue, err = s.DefaultServiceParser().ToJSON()\n\t} else {\n\t\tvalue, err = parser.ToJSON()\n\t}\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Can't get value in UpdateService\")\n\t}\n\t//log.Printf(\"[DEBUG]UPdateService key: %v.\\n\", key)\n\t//log.Printf(\"[DEBUG]UPdateService value: %v.\\n\", string(value))\n\n\tif err := DefaultBackend.UpdateKV(key, string(value), s.Ttl); err == nil {\n\t\treturn nil\n\t} else {\n\t\treturn err\n\t}\n}", "func makeUpdateTagHandler(m *http.ServeMux, endpoints endpoint.Endpoints, options []http1.ServerOption) {\n\tm.Handle(\"/update-tag\", http1.NewServer(endpoints.UpdateTagEndpoint, decodeUpdateTagRequest, encodeUpdateTagResponse, options...))\n}", "func Update(writer http.ResponseWriter, request *http.Request) {\n\tsp := getByID(request.FormValue(\"id\"))\n\tfmt.Println(sp)\n\ttemplate_html.ExecuteTemplate(writer, \"Update\", sp)\n}", "func MakeUpdateCategoryEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(UpdateCategoryRequest)\n\t\tc, error := s.UpdateCategory(ctx, req.Category)\n\t\treturn UpdateCategoryResponse{\n\t\t\tC: c,\n\t\t\tError: error,\n\t\t}, nil\n\t}\n}", "func (c Controller) update(client Client, d *dc.DeploymentConfig, b *bc.BuildConfig, template *Template, nameSpace string, instanceID string, deploy *Payload) (*Dispatched, error) {\n\tvar (\n\t\tdispatched = &Dispatched{}\n\t\tstatusKey = StatusKey(instanceID, \"provision\")\n\t)\n\tfor _, ob := range template.Objects {\n\t\tswitch ob.(type) {\n\t\tcase *dc.DeploymentConfig:\n\t\t\tdeployment := ob.(*dc.DeploymentConfig)\n\t\t\tdeployment.SetResourceVersion(d.GetResourceVersion())\n\t\t\tdeployed, err := client.UpdateDeployConfigInNamespace(nameSpace, deployment)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"error updating deploy config: \")\n\t\t\t}\n\t\t\tdispatched.DeploymentName = deployed.Name\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \"updated DeploymentConfig\")\n\t\tcase *bc.BuildConfig:\n\t\t\tob.(*bc.BuildConfig).SetResourceVersion(b.GetResourceVersion())\n\t\t\tif _, err := client.UpdateBuildConfigInNamespace(nameSpace, ob.(*bc.BuildConfig)); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"error updating build config: \")\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \"updated BuildConfig\")\n\t\tcase *route.Route:\n\t\t\tr, err := client.UpdateRouteInNamespace(nameSpace, ob.(*route.Route))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdispatched.Route = r\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \"updated Route\")\n\t\t}\n\t}\n\treturn dispatched, nil\n}", "func HTTPAPIServerStreamChannelEdit(c *gin.Context) {\n\tvar ch gss.ChannelST\n\terr := c.BindJSON(&ch)\n\tif err != nil {\n\t\tc.IndentedJSON(400, Message{Status: 0, Payload: err.Error()})\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"module\": \"http_stream\",\n\t\t\t\"stream\": c.Param(\"uuid\"),\n\t\t\t\"channel\": c.Param(\"channel\"),\n\t\t\t\"func\": \"HTTPAPIServerStreamEdit\",\n\t\t\t\"call\": \"BindJSON\",\n\t\t}).Errorln(err.Error())\n\t\treturn\n\t}\n\terr = service.ChannelUpdate(context.TODO(), c.Param(\"uuid\"), c.Param(\"channel\"), &ch)\n\tif err != nil {\n\t\tc.IndentedJSON(500, Message{Status: 0, Payload: err.Error()})\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"module\": \"http_stream\",\n\t\t\t\"stream\": c.Param(\"uuid\"),\n\t\t\t\"channel\": c.Param(\"channel\"),\n\t\t\t\"func\": \"HTTPAPIServerStreamChannelEdit\",\n\t\t\t\"call\": \"StreamChannelEdit\",\n\t\t}).Errorln(err.Error())\n\t\treturn\n\t}\n\tc.IndentedJSON(200, Message{Status: 1, Payload: gss.Success})\n}", "func (s *APIServer) UpdateApps(c *gin.Context) {\n}", "func (_obj *DataService) UpdateActivityOneWayWithContext(tarsCtx context.Context, activityIndo *ActivityInfo, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = activityIndo.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"updateActivity\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (ctx *UpdateUsersContext) OK(r *User) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"user\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (_obj *Apichannels) Channels_editBannedWithContext(tarsCtx context.Context, params *TLchannels_editBanned, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_editBanned\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (h *Handler) UpdateHandler(w http.ResponseWriter, r *http.Request) {\n\tvar u, updatedUser user.User\n\terr := json.NewDecoder(r.Body).Decode(&u)\n\tif err != nil {\n\t\th.log.Error(err)\n\t\t_ = response.HTTPError(w, http.StatusBadRequest, response.ErrorParsingUser.Error())\n\t\treturn\n\t}\n\n\tid := chi.URLParam(r, \"id\")\n\n\tcu, err := auth.GetID(r)\n\tif err != nil {\n\t\t_ = response.HTTPError(w, http.StatusBadRequest, response.ErrorBadRequest.Error())\n\t\treturn\n\t}\n\trole, err := auth.GetRole(r)\n\tif err != nil {\n\t\t_ = response.HTTPError(w, http.StatusBadRequest, response.ErrorBadRequest.Error())\n\t\treturn\n\t}\n\n\tctx, cancel := context.WithCancel(r.Context())\n\tdefer cancel()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\t_ = response.HTTPError(w, http.StatusBadGateway, response.ErrTimeout.Error())\n\t\treturn\n\tdefault:\n\t\tupdatedUser, err = h.service.Update(ctx, id, cu, role, &u)\n\t}\n\n\tif err != nil {\n\t\th.log.Error(err)\n\t\t_ = response.HTTPError(w, http.StatusNotFound, err.Error())\n\t\treturn\n\t}\n\n\trender.JSON(w, r, render.M{\"user\": updatedUser})\n}", "func (_obj *DataService) UpdateActivityWithContext(tarsCtx context.Context, activityIndo *ActivityInfo, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = activityIndo.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"updateActivity\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*affectRows), 2, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (a *App) update(c *echo.Context) error {\n\tid := c.Param(\"id\")\n\ttask := &model.Task{}\n\tif a.GetDB().First(task, id) != nil {\n\t\terr := errors.New(\"Task is not found.\")\n\t\tc.JSON(http.StatusNotFound, ErrorMsg{Msg: err.Error()})\n\t\treturn err\n\t}\n\tstatus, err := task.Update(a.GetDB(), c)\n\tif err == nil {\n\t\tc.JSON(status, task)\n\t} else {\n\t\tc.JSON(status, ErrorMsg{Msg: err.Error()})\n\t}\n\treturn err\n}", "func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error {\n\tserviceID, serviceVersion, err := cmd.ServiceDetails(cmd.ServiceDetailsOpts{\n\t\tAutoCloneFlag: c.autoClone,\n\t\tAPIClient: c.Globals.APIClient,\n\t\tManifest: c.manifest,\n\t\tOut: out,\n\t\tServiceNameFlag: c.serviceName,\n\t\tServiceVersionFlag: c.serviceVersion,\n\t\tVerboseMode: c.Globals.Flags.Verbose,\n\t})\n\tif err != nil {\n\t\tc.Globals.ErrLog.AddWithContext(err, map[string]any{\n\t\t\t\"Service ID\": serviceID,\n\t\t\t\"Service Version\": errors.ServiceVersion(serviceVersion),\n\t\t})\n\t\treturn err\n\t}\n\n\tc.input.ServiceID = serviceID\n\tc.input.ServiceVersion = serviceVersion.Number\n\n\tif !c.comment.WasSet {\n\t\treturn fmt.Errorf(\"error parsing arguments: required flag --comment not provided\")\n\t}\n\n\tc.input.Comment = &c.comment.Value\n\n\tver, err := c.Globals.APIClient.UpdateVersion(&c.input)\n\tif err != nil {\n\t\tc.Globals.ErrLog.AddWithContext(err, map[string]any{\n\t\t\t\"Service ID\": serviceID,\n\t\t\t\"Service Version\": serviceVersion.Number,\n\t\t\t\"Comment\": c.comment.Value,\n\t\t})\n\t\treturn err\n\t}\n\n\ttext.Success(out, \"Updated service %s version %d\", ver.ServiceID, c.input.ServiceVersion)\n\treturn nil\n}", "func (u *Update) Apply(ctx context.Context) (*types.Response, error) {\n\treturn u.config.Transport.DoDBRequest(ctx, u.meta, u.createUpdateReq())\n}", "func mainHandler(w http.ResponseWriter, req *http.Request) {\n\tif req.Method != \"GET\" {\n\t\tw.Header().Set(\"Allow\", \"GET\")\n\t\thttp.Error(w, \"method should be GET\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\n\tdata := struct {\n\t\tProduction bool\n\t\tHTTPAddr string\n\t}{\n\t\tProduction: production,\n\t\tHTTPAddr: *httpFlag,\n\t}\n\terr := t.ExecuteTemplate(w, \"head.html.tmpl\", data)\n\tif err != nil {\n\t\tlog.Println(\"ExecuteTemplate head.html.tmpl:\", err)\n\t\treturn\n\t}\n\n\tflusher := w.(http.Flusher)\n\tflusher.Flush()\n\n\tvar updatesAvailable = 0\n\tvar wroteInstalledUpdatesHeader bool\n\n\tfor repoPresentation := range c.pipeline.RepoPresentations() {\n\t\tif !repoPresentation.Updated {\n\t\t\tupdatesAvailable++\n\t\t}\n\n\t\tif repoPresentation.Updated && !wroteInstalledUpdatesHeader {\n\t\t\t// Make 'Installed Updates' header visible now.\n\t\t\tio.WriteString(w, `<div id=\"installed_updates\"><h3 style=\"text-align: center;\">Installed Updates</h3></div>`)\n\n\t\t\twroteInstalledUpdatesHeader = true\n\t\t}\n\n\t\terr := t.ExecuteTemplate(w, \"repo.html.tmpl\", repoPresentation)\n\t\tif err != nil {\n\t\t\tlog.Println(\"ExecuteTemplate repo.html.tmpl:\", err)\n\t\t\treturn\n\t\t}\n\n\t\tflusher.Flush()\n\t}\n\n\tif !wroteInstalledUpdatesHeader {\n\t\t// TODO: Make installed_updates available before all packages finish loading, so that it works when you update a package early. This will likely require a fully dynamically rendered frontend.\n\t\t// Append 'Installed Updates' header, but keep it hidden.\n\t\tio.WriteString(w, `<div id=\"installed_updates\" style=\"display: none;\"><h3 style=\"text-align: center;\">Installed Updates</h3></div>`)\n\t}\n\n\tif updatesAvailable == 0 {\n\t\tio.WriteString(w, `<script>document.getElementById(\"no_updates\").style.display = \"\";</script>`)\n\t}\n\n\terr = t.ExecuteTemplate(w, \"tail.html.tmpl\", nil)\n\tif err != nil {\n\t\tlog.Println(\"ExecuteTemplate tail.html.tmpl:\", err)\n\t\treturn\n\t}\n}", "func refreshFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tif err := s.RefreshFeed(plugin); err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error listing the plugins\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n}", "func (ctx *UpdateUserContext) OK(r *User) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.user+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func (c *UsersController) Update(ctx *app.UpdateUsersContext) error {\n\treturn proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())\n}", "func taskDefUpdateHandler(w http.ResponseWriter, r *http.Request, isReplace bool) {\r\n\r\n\t// decode json run \"public\" metadata\r\n\tvar tpd db.TaskDefPub\r\n\tif !jsonRequestDecode(w, r, true, &tpd) {\r\n\t\treturn // error at json decode, response done with http error\r\n\t}\r\n\r\n\t// if task name is empty then automatically generate name\r\n\tif tpd.Name == \"\" {\r\n\t\tts, _ := theCatalog.getNewTimeStamp()\r\n\t\ttpd.Name = \"task_\" + ts\r\n\t}\r\n\r\n\t// update task definition in model catalog\r\n\tok, dn, tn, err := theCatalog.UpdateTaskDef(isReplace, &tpd)\r\n\tif err != nil {\r\n\t\tomppLog.Log(err.Error())\r\n\t\thttp.Error(w, \"Modeling task merge failed \"+dn+\": \"+tn, http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\tif ok {\r\n\t\tw.Header().Set(\"Content-Location\", \"/api/model/\"+dn+\"/task/\"+tn)\r\n\t\tjsonResponse(w, r,\r\n\t\t\tstruct {\r\n\t\t\t\tName string // task name\r\n\t\t\t}{\r\n\t\t\t\tName: tn,\r\n\t\t\t},\r\n\t\t)\r\n\t}\r\n}", "func (_obj *WebApiAuth) LoginLog_UpdateWithContext(tarsCtx context.Context, id int32, req *LoginLog, res *LoginLog, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(id, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"LoginLog_Update\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 3, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func Update(w http.ResponseWriter, r *http.Request) {\n\tauthUser, err := auth.GetUserFromJWT(w, r)\n\tif err != nil {\n\t\tresponse.FormatStandardResponse(false, \"error-auth\", \"\", err.Error(), w)\n\t\treturn\n\t}\n\n\tdefer r.Body.Close()\n\n\t// Decode the JSON body\n\tacct := datastore.Account{}\n\terr = json.NewDecoder(r.Body).Decode(&acct)\n\tswitch {\n\t// Check we have some data\n\tcase err == io.EOF:\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tresponse.FormatStandardResponse(false, \"error-account-data\", \"\", \"No account data supplied\", w)\n\t\treturn\n\t\t// Check for parsing errors\n\tcase err != nil:\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tresponse.FormatStandardResponse(false, \"error-decode-json\", \"\", err.Error(), w)\n\t\treturn\n\t}\n\n\tupdateHandler(w, authUser, false, acct)\n}", "func echoContextHandlerAppData(ctx context.Context, in io.Reader, out io.Writer) {\n\tnctx := GetContext(ctx)\n\n\tif resp, ok := out.(http.ResponseWriter); ok {\n\t\tresp.Header().Add(\"AppId\", nctx.AppID())\n\t\tresp.Header().Add(\"AppName\", nctx.AppName())\n\t\tresp.Header().Add(\"FnId\", nctx.FnID())\n\t\tresp.Header().Add(\"FnName\", nctx.FnName())\n\t\tresp.Header().Add(\"CallId\", nctx.CallID())\n\t}\n\t// XXX(reed): could configure this to test too\n\n\tWriteStatus(out, http.StatusTeapot+2)\n\tio.Copy(out, in)\n}", "func (ctx *GetOutputContext) OK(r *Output) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "func EditHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Received a content request. Preparing response\")\n\tresp := response{\n\t\tSuccessful: false,\n\t\tErrMsg: errors.New(\"Unknown failure\"),\n\t}\n\twriter := json.NewEncoder(w)\n\tdefer writer.Encode(resp)\n\n\t// Parse the request.\n\tfmt.Println(\"Parsing request\")\n\tdata := form{}\n\tresp.ErrMsg = json.NewDecoder(r.Body).Decode(&data)\n\n\tfmt.Println(\"Obtained following data: \")\n\tfmt.Printf(\"%+v\\n\", data)\n\n\t// Validate requestor token\n\tvalid := true\n\tvalid, resp.ErrMsg = session.Validate(data.User, data.Token)\n\n\tfilepath = path + data.ID + data.ContentType\n\n\tmodErr = update.ModifyContentFilePath(filepath)\n\twriteErr = write(filepath, data.Content)\n\tif modErr != nil {\n\t\tresp.ErrMsg = modErr\n\t} else {\n\t\tresp.ErrMsg = writeErr\n\t}\n\n}", "func getFeedHandler(s service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tplugin := chi.URLParam(r, \"plugin\")\n\t\tif plugin == \"\" {\n\t\t\thttp.Error(w, errors.New(\"plugin not allowed to be empty\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tformat := chi.URLParam(r, \"format\")\n\t\tif format == \"\" {\n\t\t\tformat = \"rss\"\n\t\t}\n\t\ts, err := s.ServeFeed(format, plugin)\n\t\tif err != nil {\n\t\t\thttp.Error(w, errors.New(\"there was an error serving the feed\").Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tswitch format {\n\t\tcase \"atom\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/atom+xml\")\n\t\tcase \"json\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tdefault:\n\t\t\tw.Header().Set(\"Content-Type\", \"application/rss+xml\")\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(s))\n\t}\n}", "func (_obj *DataService) SetApplyStatusOneWayWithContext(tarsCtx context.Context, wx_id string, club_id string, apply_status int32, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32(apply_status, 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 4)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"setApplyStatus\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func ListFeedOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, limit int, page int) (http.ResponseWriter, app.FeedCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/feeds\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"FeedTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListFeedContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.FeedCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.FeedCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.FeedCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func (_obj *WebApiAuth) SysConfig_UpdateOneWayWithContext(tarsCtx context.Context, id int32, req *SysConfig, res *SysConfig, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(id, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"SysConfig_Update\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func UpdateService(w http.ResponseWriter, r *http.Request) {\n\ttokenerr := CheckToken(w, r)\n\tif tokenerr != nil {\n\t\tJSONError(w, r, \"Token not authorized\", http.StatusForbidden)\n\t\treturn\n\t}\n\tvar service models.Service\n\tvars := mux.Vars(r)\n\tif bson.IsObjectIdHex(vars[\"serviceID\"]) != true {\n\t\tJSONError(w, r, \"bad entry for id\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjson.NewDecoder(r.Body).Decode(&service)\n\tif service.Name == \"\" || service.Description == \"\" || service.Status > 2 {\n\t\tJSONError(w, r, \"Incorrect body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tserviceID := bson.ObjectIdHex(vars[\"serviceID\"])\n\tsession := Session.Copy()\n\tdefer session.Close()\n\tservice.ID = serviceID\n\tservice.UpdatedAt = time.Now()\n\tcollection := session.DB(DBNAME).C(SERVICES)\n\terr := collection.Update(bson.M{\"_id\": serviceID}, &service)\n\tif err != nil {\n\t\tJSONError(w, r, \"Could not find service \"+string(serviceID.Hex())+\" to update\", http.StatusNotFound)\n\t\treturn\n\t}\n\tJSONResponse(w, r, []byte{}, http.StatusNoContent)\n}", "func makeUpdateBookEndpoint(svc BookService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t// convert request into a updateBookRequest\n\t\treq := request.(updateBookRequest)\n\n\t\t// call actual service with data from the req (putBookRequest)\n\t\tbook, err := svc.UpdateBook(\n\t\t\treq.Bearer,\n\t\t\treq.BookId,\n\t\t\treq.AuthorId,\n\t\t\treq.Description,\n\t\t\treq.FirstPublishedYear,\n\t\t\treq.GoodReadsUrl,\n\t\t\treq.ImageLarge,\n\t\t\treq.ImageMedium,\n\t\t\treq.ImageSmall,\n\t\t\treq.Isbns,\n\t\t\treq.OpenlibraryWorkUrl,\n\t\t\treq.Subjects,\n\t\t\treq.Title)\n\n\t\treturn updateBookResponse{\n\t\t\tData: book,\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func (a *Client) Update(params *UpdateParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Update\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/api/v1/AgreementReports/{agreementId}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/*+json\", \"application/json\", \"application/json-patch+json\", \"text/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*UpdateOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for Update: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (_obj *Apichannels) Channels_editBannedOneWayWithContext(tarsCtx context.Context, params *TLchannels_editBanned, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"channels_editBanned\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (handler WebserviceHandler) UpdateKeyword(res http.ResponseWriter, req *http.Request) {\n\thandler.Logger.Info(\"Received \" + req.Method + \" request at path: \" + req.URL.Path)\n\n\t// Setting headers for CORS\n\tres.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tres.Header().Set(\"Access-Control-Allow-Headers\", \"Authorization\")\n\tif req.Method == http.MethodOptions {\n\t\treturn\n\t}\n\n\tvar err error\n\n\t// Checking request, verifying if ID is in query params\n\thandler.Logger.Debug(\"Starting to check the ID\")\n\tvar id string\n\tok := checkID(handler, res, req)\n\tif !ok {\n\t\treturn\n\t}\n\tids, ok := req.URL.Query()[\"id\"]\n\tid = ids[0]\n\thandler.Logger.Debug(\"Request correct, ID inserted as query params\")\n\n\thandler.Logger.Debug(\"Starting to retrieve value from queryparams\")\n\tvar value string\n\tvalues, ok := req.URL.Query()[\"value\"]\n\tvalue = values[0]\n\thandler.Logger.Debug(\"Param value retrieved\")\n\n\thandler.Logger.Info(\"ID: \" + id + \" value: \" + value)\n\n\tvar updatedKeyword = Keyword{ID: id, DisplayText: value}\n\n\t// Data transformation for presentation\n\thandler.Logger.Debug(\"Starting to transform data for presentation\")\n\tusecasesKeyword := webserviceKeywordToUsecaseKeyword(updatedKeyword)\n\thandler.Logger.Debug(\"Data transformed\")\n\n\t// Updating keyword\n\thandler.Logger.Debug(\"Starting to update keyword\")\n\terr = handler.KeywordsInteractor.Update(id, usecasesKeyword)\n\tif err != nil {\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\thandler.Logger.Debug(\"Keyword updated\")\n\n\t// Preparing response\n\tres.WriteHeader(200)\n\thandler.Logger.Info(\"Returning response\")\n\treturn\n}", "func (svc *AdminHookService) Update(h *library.Hook) (*library.Hook, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/hook\"\n\n\t// library Hook type we want to return\n\tv := new(library.Hook)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, h, v)\n\n\treturn v, resp, err\n}", "func (_obj *Apichannels) Channels_editPhotoOneWayWithContext(tarsCtx context.Context, params *TLchannels_editPhoto, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"channels_editPhoto\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *Service) Update() (*restapi.StringResponse, error) {\n\tif o.ID == \"\" {\n\t\terrormsg := fmt.Sprintf(\"Missing ID for %s\", GetVarType(0))\n\t\tlogger.Errorf(errormsg)\n\t\treturn nil, fmt.Errorf(errormsg)\n\t}\n\n\terr := o.resolveIDs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar queryArg = make(map[string]interface{})\n\tqueryArg, err = generateRequestMap(o)\n\tif err != nil {\n\t\tlogger.Errorf(err.Error())\n\t\treturn nil, err\n\t}\n\n\tlogger.Debugf(\"Generated Map for Update(): %+v\", queryArg)\n\tresp, err := o.client.CallStringAPI(o.apiUpdate, queryArg)\n\tif err != nil {\n\t\tlogger.Errorf(err.Error())\n\t\treturn nil, err\n\t}\n\tif !resp.Success {\n\t\terrmsg := fmt.Sprintf(\"%s %s\", resp.Message, resp.Exception)\n\t\tlogger.Errorf(errmsg)\n\t\treturn nil, fmt.Errorf(errmsg)\n\t}\n\n\treturn resp, nil\n}", "func (_obj *Apichannels) Channels_editAdminWithContext(tarsCtx context.Context, params *TLchannels_editAdmin, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_editAdmin\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}" ]
[ "0.6693498", "0.57586306", "0.5688609", "0.5678572", "0.5487265", "0.54762554", "0.54671514", "0.5407507", "0.5280156", "0.5235148", "0.50652224", "0.5046637", "0.49830616", "0.49826995", "0.49817708", "0.49686095", "0.49455008", "0.49357328", "0.4911863", "0.49016795", "0.48646945", "0.48358512", "0.48334336", "0.4775896", "0.47564957", "0.4753348", "0.47506753", "0.47481135", "0.47411475", "0.47362474", "0.47334492", "0.47264054", "0.47184637", "0.47029683", "0.46787834", "0.46688876", "0.46625605", "0.46570873", "0.46546805", "0.46470687", "0.4643856", "0.46392414", "0.46245432", "0.4617156", "0.46155703", "0.4613053", "0.4606212", "0.45834565", "0.45745558", "0.45660037", "0.4562545", "0.45444393", "0.45420656", "0.45415518", "0.45384794", "0.45347965", "0.45308003", "0.45173872", "0.4502368", "0.4500047", "0.449615", "0.44934708", "0.44922462", "0.44894725", "0.44888374", "0.4485061", "0.44728664", "0.44720998", "0.44623482", "0.4459746", "0.44595572", "0.4453845", "0.44456586", "0.4442585", "0.44408324", "0.44405365", "0.443811", "0.4432916", "0.44189247", "0.44121167", "0.44120073", "0.4410848", "0.4409857", "0.44070646", "0.44057444", "0.43966076", "0.43868473", "0.43840283", "0.43788287", "0.43760195", "0.4369853", "0.43676135", "0.43646306", "0.43631715", "0.4361762", "0.43612733", "0.43556827", "0.43509924", "0.433901", "0.43384925" ]
0.6932362
0
NewBackendService creates a new BackendService stack from a manifest file.
func NewBackendService(mft *manifest.BackendService, env, app string, rc RuntimeConfig) (*BackendService, error) { parser := template.New() addons, err := addon.New(aws.StringValue(mft.Name)) if err != nil { return nil, fmt.Errorf("new addons: %w", err) } envManifest, err := mft.ApplyEnv(env) // Apply environment overrides to the manifest values. if err != nil { return nil, fmt.Errorf("apply environment %s override: %s", env, err) } return &BackendService{ svc: &svc{ name: aws.StringValue(mft.Name), env: env, app: app, tc: envManifest.BackendServiceConfig.TaskConfig, rc: rc, parser: parser, addons: addons, }, manifest: envManifest, parser: parser, }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func New(service Service) interface {\n\tmodule.Module\n\tbackend.Module\n} {\n\treturn newBackendModule(service)\n}", "func (g *Google) createBackendService(healthCheckLink, instanceGroupLink string) (string, error) {\n\tif backend, err := g.getBackendService(); err == nil {\n\t\tlog.Infof(\"found BackendService %s: %s\", backendServiceName, backend.SelfLink)\n\t\treturn backend.SelfLink, nil\n\t}\n\n\top, err := g.computeService.BackendServices.Insert(g.project,\n\t\t&compute.BackendService{\n\t\t\tName: backendServiceName,\n\t\t\tHealthChecks: []string{healthCheckLink},\n\t\t\tBackends: []*compute.Backend{\n\t\t\t\t{Group: instanceGroupLink},\n\t\t\t},\n\t\t}).Do()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := g.waitForOperation(op); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlog.Infof(\"created BackendService %s: %s\", backendServiceName, op.TargetLink)\n\treturn op.TargetLink, nil\n}", "func NewBackend(conf *conf.Conf) (*Backend, error) {\n\tbackend := &Backend{}\n\n\tcfg := api.DefaultConfig()\n\tcfg.Address = conf.ConsulAddr\n\n\tif conf.Timeout != 0 {\n\t\tcfg.HttpClient.Timeout = time.Duration(conf.Timeout) * time.Second\n\t}\n\n\tif conf.Token != \"\" {\n\t\tcfg.Token = conf.Token\n\t}\n\n\tif conf.AuthEnabled {\n\t\tcfg.HttpAuth = &api.HttpBasicAuth{\n\t\t\tUsername: conf.AuthUserName,\n\t\t\tPassword: conf.AuthPassword,\n\t\t}\n\t}\n\n\tcli, err := api.NewClient(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbackend.cli = cli\n\tbackend.agent = cli.Agent()\n\n\treturn backend, nil\n}", "func createService(cluster *client.VanClient, name string, annotations map[string]string) (*corev1.Service, error) {\n\n\tsvc := &corev1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": \"nginx\",\n\t\t\t},\n\t\t\tAnnotations: annotations,\n\t\t},\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tPorts: []corev1.ServicePort{\n\t\t\t\t{Name: \"web\", Port: 8080},\n\t\t\t},\n\t\t\tSelector: map[string]string{\n\t\t\t\t\"app\": \"nginx\",\n\t\t\t},\n\t\t\tType: corev1.ServiceTypeLoadBalancer,\n\t\t},\n\t}\n\n\t// Creating the new service\n\tsvc, err := cluster.KubeClient.CoreV1().Services(cluster.Namespace).Create(context.TODO(), svc, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Populate services map by namespace\n\tservices := []string{svc.Name}\n\tvar ok bool\n\tif services, ok = servicesMap[cluster.Namespace]; ok {\n\t\tservices = append(services, svc.Name)\n\t}\n\tservicesMap[cluster.Namespace] = services\n\n\treturn svc, nil\n}", "func constructServiceFromFile(cmd *cobra.Command, editFlags ConfigurationEditFlags, name, namespace string) (*servingv1.Service, error) {\n\tvar service servingv1.Service\n\tfile, err := os.Open(editFlags.Filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdecoder := yaml.NewYAMLOrJSONDecoder(file, 512)\n\n\terr = decoder.Decode(&service)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif name == \"\" && service.Name != \"\" {\n\t\t// keep provided service.Name if name param is empty\n\t} else if name != \"\" && service.Name == \"\" {\n\t\tservice.Name = name\n\t} else if name != \"\" && service.Name != \"\" {\n\t\t// throw error if names differ, otherwise use already set value\n\t\tif name != service.Name {\n\t\t\treturn nil, fmt.Errorf(\"provided service name '%s' doesn't match name from file '%s'\", name, service.Name)\n\t\t}\n\t} else {\n\t\treturn nil, fmt.Errorf(\"no service name provided in command parameter or file\")\n\t}\n\n\t// Set namespace in case it's specified as --namespace\n\tservice.ObjectMeta.Namespace = namespace\n\n\t// Apply options provided from cmdline\n\terr = editFlags.Apply(&service, nil, cmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &service, nil\n}", "func NewService(db *bolt.DB) (*Service, error) {\n\terr := internal.CreateBucket(db, BucketName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Service{\n\t\tdb: db,\n\t}, nil\n}", "func NewService(db *bolt.DB) (*Service, error) {\n\terr := internal.CreateBucket(db, BucketName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Service{\n\t\tdb: db,\n\t}, nil\n}", "func constructService(cmd *cobra.Command, editFlags ConfigurationEditFlags, name string, namespace string) (*servingv1.Service,\n\terror) {\n\n\tif name == \"\" || namespace == \"\" {\n\t\treturn nil, errors.New(\"internal: no name or namespace provided when constructing a service\")\n\t}\n\n\tservice := servingv1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t}\n\n\tservice.Spec.Template = servingv1.RevisionTemplateSpec{\n\t\tSpec: servingv1.RevisionSpec{},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tservinglib.UserImageAnnotationKey: \"\", // Placeholder. Will be replaced or deleted as we apply mutations.\n\t\t\t},\n\t\t},\n\t}\n\tservice.Spec.Template.Spec.Containers = []corev1.Container{{}}\n\n\terr := editFlags.Apply(&service, nil, cmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &service, nil\n}", "func NewBackend(impl, addr, prefix string, tags ...string) (Backend, error) {\n\tvar err error\n\tvar b Backend\n\tswitch strings.ToLower(impl) {\n\tcase \"datadog\":\n\t\tb, err = NewDatadogBackend(addr, prefix, tags)\n\tcase \"log\":\n\t\tb = NewLogBackend(prefix, tags)\n\tcase \"null\":\n\t\tb = NewNullBackend()\n\tdefault:\n\t\treturn nil, errors.WithStack(ErrUnknownBackend)\n\t}\n\n\treturn b, errors.WithStack(err)\n}", "func New(c *Config) (*Backend, error) {\n\tif err := validation.Validate.Struct(c); err != nil {\n\t\treturn nil, err\n\t}\n\tb := &Backend{\n\t\tkeys: make(chan *template.Key, 500),\n\t\tlog: c.Logger,\n\t\tsvc: c.SSM,\n\t}\n\treturn b, nil\n}", "func NewBackend(ipc string, logger dex.Logger, network dex.Network) (*Backend, error) {\n\tcfg, err := load(ipc, network)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn unconnectedETH(logger, cfg), nil\n}", "func NewService(cfg *backendConfig.Config, db *gorm.DB) (Service, error) {\n\tmapper, err := backend.NewSQLMapper(cfg)\n\tif err != nil {\n\t\treturn Service{}, err\n\t}\n\n\tsqlWriteReadDeleter := view.NewBoltWriteReadDeleter(cfg.PersistenceFileName)\n\n\treturn Service{\n\t\tWrapper: backendConfig.NewWrapper(cfg),\n\t\tMapper: mapper,\n\t\tWriteReadDeleter: sqlWriteReadDeleter,\n\t\tUserService: userSrv.NewPGService(db),\n\t\tGroupService: groupSrv.NewPGService(db),\n\t\tPermissionService: permissionSrv.NewPGService(db),\n\t}, nil\n}", "func NewService(coreConfig *core.Config, basefs *basefs.BaseFS) *Service {\n\n\tserviceConfig := Config{}\n\tlog.Println(\"Initializing\", pname, \"service\")\n\tlog.Println(\"Source config:\", coreConfig.Source)\n\n\terr := coreutil.ParseConfig(coreConfig.Source, &serviceConfig)\n\tif err != nil {\n\t\terrlog.Fatalf(\"Unable to read <source>: %v\", err)\n\t}\n\t// Initialize cloud service here\n\tm := mega.New()\n\tm.Login(serviceConfig.Credentials.Email, serviceConfig.Credentials.Password)\n\n\treturn &Service{m, basefs}\n\n}", "func newServiceWithSuffix(suffix string, component string, cr *argoprojv1a1.ArgoCD) *corev1.Service {\n\treturn newServiceWithName(fmt.Sprintf(\"%s-%s\", cr.Name, suffix), component, cr)\n}", "func newService(name, project, image string, envs map[string]string, options options) *runapi.Service {\n\tvar envVars []*runapi.EnvVar\n\tfor k, v := range envs {\n\t\tenvVars = append(envVars, &runapi.EnvVar{Name: k, Value: v})\n\t}\n\n\tsvc := &runapi.Service{\n\t\tApiVersion: \"serving.knative.dev/v1\",\n\t\tKind: \"Service\",\n\t\tMetadata: &runapi.ObjectMeta{\n\t\t\tAnnotations: make(map[string]string),\n\t\t\tName: name,\n\t\t\tNamespace: project,\n\t\t},\n\t\tSpec: &runapi.ServiceSpec{\n\t\t\tTemplate: &runapi.RevisionTemplate{\n\t\t\t\tMetadata: &runapi.ObjectMeta{\n\t\t\t\t\tName: generateRevisionName(name, 0),\n\t\t\t\t\tAnnotations: make(map[string]string),\n\t\t\t\t},\n\t\t\t\tSpec: &runapi.RevisionSpec{\n\t\t\t\t\tContainerConcurrency: int64(options.Concurrency),\n\t\t\t\t\tContainers: []*runapi.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tEnv: envVars,\n\t\t\t\t\t\t\tResources: optionsToResourceRequirements(options),\n\t\t\t\t\t\t\tPorts: []*runapi.ContainerPort{optionsToContainerSpec(options)},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tForceSendFields: nil,\n\t\t\t\tNullFields: nil,\n\t\t\t},\n\t\t},\n\t}\n\n\tapplyMeta(svc.Metadata, image)\n\tapplyMeta(svc.Spec.Template.Metadata, image)\n\tapplyScaleMeta(svc.Spec.Template.Metadata, \"maxScale\", options.MaxInstances)\n\n\treturn svc\n}", "func NewBackend(conf config.Config) (scheduler.Backend, error) {\n\t// TODO need GCE scheduler config validation. If zone is missing, nothing works.\n\n\t// Create a client for talking to the funnel scheduler\n\tclient, err := scheduler.NewClient(conf.Worker)\n\tif err != nil {\n\t\tlog.Error(\"Can't connect scheduler client\", err)\n\t\treturn nil, err\n\t}\n\n\t// Create a client for talking to the GCE API\n\tgce, gerr := newClientFromConfig(conf)\n\tif gerr != nil {\n\t\tlog.Error(\"Can't connect GCE client\", gerr)\n\t\treturn nil, gerr\n\t}\n\n\treturn &Backend{\n\t\tconf: conf,\n\t\tclient: client,\n\t\tgce: gce,\n\t}, nil\n}", "func (k *KubernetesClient) CreateService(resourceFile string) (*v1.Service, error) {\n\tservice := v1.Service{}\n\tdata, err := ioutil.ReadFile(resourceFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treader := bytes.NewReader(data)\n\tdecoder := yaml.NewYAMLOrJSONDecoder(reader, 1024)\n\terr = decoder.Decode(&service)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcreatedService, err := k.client.CoreV1().Services(namespace).Create(context.TODO(), &service, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn createdService, nil\n}", "func NewBackend(client *clientv3.Client, prefix string) *Backend {\n\treturn &Backend{\n\t\tclient: client,\n\t\tprefix: prefix,\n\t}\n}", "func NewService(args []string, p person.Service, ns serializer.Serializer) error {\n\tcli := service{args, p, ns}\n\tif err := cli.checkArgs(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := cli.runArgs(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewBackend(conf config.Config) (*Backend, error) {\n\tlog.WithFields(log.Fields{\n\t\t\"event_url\": conf.Backend.Concentratord.EventURL,\n\t\t\"command_url\": conf.Backend.Concentratord.CommandURL,\n\t}).Info(\"backend/concentratord: setting up backend\")\n\n\tb := Backend{\n\t\teventURL: conf.Backend.Concentratord.EventURL,\n\t\tcommandURL: conf.Backend.Concentratord.CommandURL,\n\n\t\tcrcCheck: conf.Backend.Concentratord.CRCCheck,\n\t}\n\n\treturn &b, nil\n}", "func newService(namespace, name string) *v1.Service {\n\treturn &v1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: labelMap(),\n\t\t},\n\t\tSpec: v1.ServiceSpec{\n\t\t\tSelector: labelMap(),\n\t\t\tPorts: []v1.ServicePort{\n\t\t\t\t{Name: \"port-1338\", Port: 1338, Protocol: \"TCP\", TargetPort: intstr.FromInt(1338)},\n\t\t\t\t{Name: \"port-1337\", Port: 1337, Protocol: \"TCP\", TargetPort: intstr.FromInt(1337)},\n\t\t\t},\n\t\t},\n\t}\n\n}", "func newService(serviceName string) *Service {\n\treturn &Service{\n\t\tpluginDir: serverless.PluginDir,\n\t\tname: serviceName,\n\t\tinterf: nil,\n\t}\n}", "func NewService(config Config) (*common.HTTPHandler, error) {\n\tnewServer := rpc.NewServer()\n\tcodec := json.NewCodec()\n\tnewServer.RegisterCodec(codec, \"application/json\")\n\tnewServer.RegisterCodec(codec, \"application/json;charset=UTF-8\")\n\tif err := newServer.RegisterService(&Admin{\n\t\tConfig: config,\n\t\tprofiler: profiler.New(config.ProfileDir),\n\t}, \"admin\"); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &common.HTTPHandler{Handler: newServer}, nil\n}", "func StartBackend(cfg *gw.Config) (*Services, error) {\n\tac, err := NewAccessConfig(cfg.AccessConfigFile)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(\n\t\t\terr, \"loading repository access configuration failed\")\n\t}\n\n\tldb, err := OpenLeaseDB(cfg.LeaseDB, cfg)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not create lease DB\")\n\t}\n\n\tpool, err := receiver.StartPool(cfg.ReceiverPath, cfg.NumReceivers, cfg.MockReceiver)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not start receiver pool\")\n\t}\n\n\tns, err := NewNotificationSystem(cfg.WorkDir)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not initialize notification system\")\n\t}\n\n\treturn &Services{Access: *ac, Leases: ldb, Pool: pool, Notifications: ns, Config: *cfg}, nil\n}", "func New(capsuleChan chan *capsule.Capsule) (*Backend, error) {\n\t// Loads a new structured configuration with the informations of a given\n\t// configuration file.\n\tproviderConfig, err := loadConfig()\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"initiliazing backend\")\n\t}\n\n\t// Loads backend providers defined as activated.\n\tp, err := loadProvider(providerConfig)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"initiliazing backend\")\n\t}\n\n\treturn &Backend{\n\t\tactivatedProvider: p,\n\t\tcapsule: capsuleChan,\n\t\twg: &sync.WaitGroup{},\n\t}, nil\n}", "func newService(kogitoApp *v1alpha1.KogitoApp, deploymentConfig *appsv1.DeploymentConfig) (service *corev1.Service) {\n\tif deploymentConfig == nil {\n\t\t// we can't create a service without a DC\n\t\treturn nil\n\t}\n\n\tports := buildServicePorts(deploymentConfig)\n\tif len(ports) == 0 {\n\t\treturn nil\n\t}\n\n\tservice = &corev1.Service{\n\t\tObjectMeta: *deploymentConfig.ObjectMeta.DeepCopy(),\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tSelector: deploymentConfig.Spec.Selector,\n\t\t\tType: corev1.ServiceTypeClusterIP,\n\t\t\tPorts: ports,\n\t\t},\n\t}\n\n\tmeta.SetGroupVersionKind(&service.TypeMeta, meta.KindService)\n\taddDefaultMeta(&service.ObjectMeta, kogitoApp)\n\taddServiceLabels(&service.ObjectMeta, kogitoApp)\n\timportPrometheusAnnotations(deploymentConfig, service)\n\tservice.ResourceVersion = \"\"\n\treturn service\n}", "func (p *k8sCluster) CreateService(spec ServiceSpec) (string, error) {\n\tpodname := fmt.Sprintf(\"tenant-%s\", spec.TenantId)\n\tp.mutex.Lock()\n\tdefer p.mutex.Unlock()\n\tdeploymentsClient := p.clientset.AppsV1beta1().Deployments(apiv1.NamespaceDefault)\n\tdeployment := &appsv1beta1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: spec.ServiceName,\n\t\t},\n\t\tSpec: appsv1beta1.DeploymentSpec{\n\t\t\tReplicas: int32ptr(spec.Replicas),\n\t\t\tTemplate: apiv1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": spec.ServiceName,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: apiv1.PodSpec{\n\t\t\t\t\tContainers: []apiv1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: podname,\n\t\t\t\t\t\t\tImage: spec.Image,\n\t\t\t\t\t\t\tPorts: []apiv1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: spec.ServiceName,\n\t\t\t\t\t\t\t\t\tProtocol: apiv1.ProtocolTCP,\n\t\t\t\t\t\t\t\t\tContainerPort: 80,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tresult, err := deploymentsClient.Create(deployment)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tglog.Infof(\"broker deployment created:%q.\\n\", result.GetObjectMeta().GetName())\n\treturn podname, nil\n}", "func NewBackend(ctrl *gomock.Controller) *Backend {\n\tmock := &Backend{ctrl: ctrl}\n\tmock.recorder = &BackendMockRecorder{mock}\n\treturn mock\n}", "func (c PGClient) NewService(name string, binsIB int64, host string, port int, typeService string, runSTR string, projects []string, owner string) (err error) {\n\t_, err = c.DB.Query(\"select new_service_function($1,$2,$3,$4,$5,$6,$7,$8)\", name, binsIB, host, port, typeService, runSTR, pg.Array(projects), owner)\n\treturn err\n}", "func newDeployment(t *testing.T, procUpdates func(ProcessUpdate), kubeClient kubernetes.Interface) *Deployment {\n\tcompList, err := config.NewComponentList(\"../test/data/componentlist.yaml\")\n\tassert.NoError(t, err)\n\tconfig := &config.Config{\n\t\tCancelTimeout: cancelTimeout,\n\t\tQuitTimeout: quitTimeout,\n\t\tBackoffInitialIntervalSeconds: 1,\n\t\tBackoffMaxElapsedTimeSeconds: 1,\n\t\tLog: logger.NewLogger(true),\n\t\tComponentList: compList,\n\t}\n\tcore := newCore(config, &overrides.Builder{}, kubeClient, procUpdates)\n\treturn &Deployment{core}\n}", "func New(name string, options NewOptions) {\n\t// get dir for the service\n\tdir, err := GoServicePath(name)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tSimpleExec(\"git\", \"init\", dir)\n\tSimpleExecInPath(dir, \"git\", \"remote\", \"add\", \"origin\", fmt.Sprintf(GitLabTemplate, name))\n\tlog.Printf(\"Remember to create the %s repository in gitlab: https://your_gitlab_url_goes_here/projects/new\\n\", name)\n\n\t// add REST API if there was a source specified\n\tif options.RestSource != \"\" {\n\t\trestDir := filepath.Join(dir, \"internal\", \"http\", \"rest\")\n\t\terr := os.MkdirAll(restDir, 0770) // nolint: gosec\n\t\tif err != nil {\n\t\t\tlog.Fatal(fmt.Printf(\"Failed to generate dir for rest api %s: %v\", restDir, err))\n\t\t}\n\n\t\tgenerate.Rest(generate.RestOptions{\n\t\t\tPath: filepath.Join(restDir, \"jsonapi.go\"),\n\t\t\tPkgName: \"rest\",\n\t\t\tSource: options.RestSource,\n\t\t})\n\t}\n\n\tSimpleExecInPath(dir, \"go\", \"mod\", \"init\", GoServicePackagePath(name))\n\n\t// Generate commands, docker- and makefile\n\tcommands := generate.NewCommandOptions(name)\n\tgenerate.Commands(dir, commands)\n\tgenerate.Dockerfile(filepath.Join(dir, \"Dockerfile\"), generate.DockerfileOptions{\n\t\tName: name,\n\t\tCommands: commands,\n\t})\n\tgenerate.Makefile(filepath.Join(dir, \"Makefile\"), generate.MakefileOptions{\n\t\tName: name,\n\t})\n\n\tSimpleExecInPath(dir, \"go\", \"mod\", \"vendor\")\n}", "func newServiceForCR(cr *interviewv1alpha1.Minecraft) *corev1.Service {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n\t}\n\n\treturn &corev1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name + \"-lb-service\",\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tPorts: []corev1.ServicePort{\n\t\t\t\t{\n\t\t\t\t\tPort: 25565,\n\t\t\t\t},\n\t\t\t},\n\t\t\tType: corev1.ServiceTypeLoadBalancer,\n\t\t\tSelector: labels,\n\t\t},\n\t}\n}", "func NewService(fileName string) (*Service, error) {\n\tif klog.V(5) {\n\t\tklog.Info(\"Initializing message service...\")\n\t\tdefer klog.Info(\"Done initializing message service\")\n\t}\n\n\ted, err := readEventDefinition(fileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := &Service{\n\t\ted,\n\t\tmake(map[string]Provider),\n\t}\n\n\t// Create the messaging providers\n\tfor _, provider := range ed.Providers {\n\t\tif klog.V(6) {\n\t\t\tklog.Infof(\"Creating %s provider '%s'\", provider.ProviderType, provider.Name)\n\t\t}\n\n\t\tvar newProvider Provider\n\t\tswitch provider.ProviderType {\n\t\tcase \"nats\":\n\t\t\tnewProvider, err = newNATSProvider(provider)\n\t\tcase \"rest\":\n\t\t\tnewProvider, err = newRESTProvider(provider)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"provider '%s' for '%s' is not recognized\", provider.ProviderType, provider.Name)\n\t\t}\n\n\t\t/* Error from trying to create new provider */\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to create %s provider '%s': %v\", provider.ProviderType, provider.Name, err)\n\t\t}\n\n\t\terr = s.Register(provider.Name, newProvider)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to register %s provider '%s': %v\", provider.ProviderType, provider.Name, err)\n\t\t}\n\t}\n\n\treturn s, nil\n}", "func NewService[T ConfigProvider](svr bs.Server) registry.RegistrableService {\n\tserver, ok := svr.(*Server)\n\tif !ok {\n\t\tlog.Fatal(\"create scheduling server failed\")\n\t}\n\treturn &Service{\n\t\tServer: server,\n\t}\n}", "func NewService(server string) (Service, error) {\n\tif strings.HasPrefix(server, \"ssh://\") {\n\t\treturn NewSSHService(server)\n\t}\n\n\tif strings.HasPrefix(server, \"mrt://\") {\n\t\treturn NewMarathonService(server)\n\t}\n\n\treturn nil, ErrServiceNotFound\n}", "func NewService(cfg aws.Config) *Service {\n\treturn &Service{\n\t\tacm: acm.NewFromConfig(cfg), // v2\n\t\trds: rds.NewFromConfig(cfg), // v2\n\t\tiam: iam.NewFromConfig(cfg), // v2\n\t\ts3: s3.NewFromConfig(cfg), // v2\n\t\troute53: route53.NewFromConfig(cfg), // v2\n\t\tsecretsManager: secretsmanager.NewFromConfig(cfg), // v2\n\t\tresourceGroupsTagging: resourcegroupstaggingapi.NewFromConfig(cfg), // v2\n\t\tec2: ec2.NewFromConfig(cfg), // v2\n\t\tkms: kms.NewFromConfig(cfg), // v2\n\t\tdynamodb: dynamodb.NewFromConfig(cfg), // v2\n\t\tsts: sts.NewFromConfig(cfg), // v2\n\t\teks: eks.NewFromConfig(cfg), // v2\n\t\telb: newElasticLoadbalancerFromConfig(cfg),\n\t}\n}", "func NewService(ctx *pulumi.Context,\n\tname string, args *ServiceArgs, opts ...pulumi.ResourceOption) (*Service, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.TaskSpec == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'TaskSpec'\")\n\t}\n\tvar resource Service\n\terr := ctx.RegisterResource(\"docker:index/service:Service\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewService(\n\tlc fx.Lifecycle,\n\tcfg *config.Config,\n\tcfgManager *config.DynamicConfigManager,\n\tcustomProvider *region.DataProvider,\n\tetcdClient *clientv3.Client,\n\tpdClient *pd.Client,\n\tdb *dbstore.DB,\n\ttidbClient *tidb.Client,\n) *Service {\n\ts := &Service{\n\t\tstatus: utils.NewServiceStatus(),\n\t\tconfig: cfg,\n\t\tcfgManager: cfgManager,\n\t\tcustomProvider: customProvider,\n\t\tetcdClient: etcdClient,\n\t\tpdClient: pdClient,\n\t\tdb: db,\n\t\ttidbClient: tidbClient,\n\t}\n\n\tlc.Append(s.managerHook())\n\n\treturn s\n}", "func NewService(ctx *pulumi.Context,\n\tname string, args *ServiceArgs, opts ...pulumi.ResourceOption) (*Service, error) {\n\tif args == nil {\n\t\targs = &ServiceArgs{}\n\t}\n\n\tvar resource Service\n\terr := ctx.RegisterResource(\"aws:vpclattice/service:Service\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewService(name string, options types.ServiceCreateOptions) (*Service, error) {\n\tuuid, err := generateEntityID()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turls := strings.Split(options.URLs, \",\")\n\n\tfor _, u := range urls {\n\t\tu = strings.Trim(u, \" \")\n\t}\n\n\ts := Service{\n\t\tID: uuid,\n\t\tName: name,\n\t\tURLs: urls,\n\t\tTargetVersion: \"\",\n\t\tBalancingMethod: options.Balancing,\n\t\tIsEnabled: options.Enable,\n\t}\n\n\treturn &s, nil\n}", "func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) {\n\tc, err := parseConfig(m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgatewaySelector, err := pool.GatewaySelector(c.GatewayAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tservice := &service{\n\t\tconf: c,\n\t\tgatewaySelector: gatewaySelector,\n\t}\n\n\treturn service, nil\n}", "func NewService(config *Config) storage.Service {\n\treturn &service{config: config}\n}", "func New(server *grpc.Server) Service {\n\ts := &service{}\n\tpb.RegisterRuntimeServiceServer(server, s)\n\tpb.RegisterImageServiceServer(server, s)\n\treturn s\n}", "func CreateService(ctx *gin.Context) {\n\tlog := logger.RuntimeLog\n\tvar svcModel *model.Service\n\tif err := ctx.BindJSON(&svcModel); err != nil {\n\t\tSendResponse(ctx, err, \"Request Body Invalid\")\n\t}\n\n\tsvcNamespace := strings.ToLower(svcModel.SvcMeta.Namespace)\n\tsvcZone := svcModel.SvcMeta.AppMeta.ZoneName\n\tsvcName := svcModel.SvcMeta.Name\n\n\t// fetch k8s-client hander by zoneName\n\tkclient, err := GetClientByAzCode(svcZone)\n\tif err != nil {\n\t\tlog.WithError(err)\n\t\tSendResponse(ctx, errno.ErrTokenInvalid, nil)\n\t\treturn\n\t}\n\n\tstartAt := time.Now() // used to record operation time cost\n\t_, err = kclient.CoreV1().Services(svcNamespace).Create(makeupServiceData(ctx, svcModel))\n\tif err != nil {\n\t\tSendResponse(ctx, err, \"create Service fail.\")\n\t\treturn\n\t}\n\tlogger.MetricsEmit(\n\t\tSVC_CONST.K8S_LOG_Method_CreateService,\n\t\tutil.GetReqID(ctx),\n\t\tfloat32(time.Since(startAt)/time.Millisecond),\n\t\terr == err,\n\t)\n\tSendResponse(ctx, errno.OK, fmt.Sprintf(\"Create Service %s success.\", svcName))\n}", "func New(name string, c *config.Config) (*Service, error) {\n\tdb, err := dnsdb.New(c.DBFile)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not open database\")\n\t}\n\n\tcert, err := c.Certificate.NewCert()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"invalid certificate configuration\")\n\t}\n\n\tsrv := dnsserver.NewWithDB(c.Domain, db)\n\tgrpcS := proto.Boot(srv)\n\tl, err := transport.Listen(cert, \"tcp\", c.GRPCListen)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"while configuring grpc listener\")\n\t}\n\n\treturn &Service{\n\t\tl: l,\n\t\tgrpcS: grpcS,\n\t\thandler: srv,\n\t\tappName: name,\n\t\tconfig: c,\n\t}, nil\n}", "func New(conf Config) (*Service, error) {\n\tvar service Service\n\n\t// launch server\n\tserver, err := transport.Launch(conf.Addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// prepare backend and configure logger\n\tbackend := newBackend(conf)\n\tbackend.Logger = service.eventHandler\n\n\t// prepare engine\n\tengine := broker.NewEngine(backend)\n\n\t// prepare server client for publishing outbox to device\n\tserverClient := client.New()\n\tcid := fmt.Sprintf(\"%s-%d\", serverClientID, time.Now().Unix())\n\t_, err = serverClient.Connect(client.NewConfigWithClientID(conf.Addr, cid))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tengine.Accept(server)\n\n\t// compose service\n\tservice.config = conf\n\tservice.client = serverClient\n\tservice.stats.ActiveClients = map[string]time.Time{}\n\tservice.activeClientFn = func(string) {}\n\tservice.closeFn = func() error {\n\t\tif err = serverClient.Disconnect(); err != nil {\n\t\t\treturn fmt.Errorf(\"closing client error\")\n\t\t}\n\n\t\tif !backend.Close(2 * time.Second) {\n\t\t\treturn fmt.Errorf(\"closing backend timed-out\")\n\t\t}\n\n\t\tif err = server.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tengine.Close()\n\t\treturn nil\n\t}\n\treturn &service, nil\n}", "func NewService(s Storage) *Service {\n\treturn &Service{s}\n}", "func NewService(s Storage) *Service {\n\treturn &Service{s}\n}", "func New(config Config) (*Service, error) {\n\t// Settings.\n\tif config.Flag == nil {\n\t\treturn nil, microerror.Maskf(invalidConfigError, \"config.Flag must not be empty\")\n\t}\n\tif config.Viper == nil {\n\t\treturn nil, microerror.Maskf(invalidConfigError, \"config.Viper must not be empty\")\n\t}\n\n\tvar err error\n\n\tvar k8sClient kubernetes.Interface\n\t{\n\t\tk8sConfig := k8sclient.DefaultConfig()\n\n\t\tk8sConfig.Logger = config.Logger\n\n\t\tk8sConfig.Address = config.Viper.GetString(config.Flag.Service.Kubernetes.Address)\n\t\tk8sConfig.InCluster = config.Viper.GetBool(config.Flag.Service.Kubernetes.InCluster)\n\t\tk8sConfig.TLS.CAFile = config.Viper.GetString(config.Flag.Service.Kubernetes.TLS.CAFile)\n\t\tk8sConfig.TLS.CrtFile = config.Viper.GetString(config.Flag.Service.Kubernetes.TLS.CrtFile)\n\t\tk8sConfig.TLS.KeyFile = config.Viper.GetString(config.Flag.Service.Kubernetes.TLS.KeyFile)\n\n\t\tk8sClient, err = k8sclient.New(k8sConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar vaultClient *vaultapi.Client\n\t{\n\t\tvaultConfig := vaultutil.Config{\n\t\t\tFlag: config.Flag,\n\t\t\tViper: config.Viper,\n\t\t}\n\n\t\tvaultClient, err = vaultutil.NewClient(vaultConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar crdFramework *framework.Framework\n\t{\n\t\tcrdFramework, err = newCRDFramework(config)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar customObjectFramework *framework.Framework\n\t{\n\t\tcustomObjectFramework, err = newCustomObjectFramework(config)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar healthzService *healthz.Service\n\t{\n\t\thealthzConfig := healthz.DefaultConfig()\n\n\t\thealthzConfig.K8sClient = k8sClient\n\t\thealthzConfig.Logger = config.Logger\n\t\thealthzConfig.VaultClient = vaultClient\n\n\t\thealthzService, err = healthz.New(healthzConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar versionService *version.Service\n\t{\n\t\tversionConfig := version.DefaultConfig()\n\n\t\tversionConfig.Description = config.Description\n\t\tversionConfig.GitCommit = config.GitCommit\n\t\tversionConfig.Name = config.Name\n\t\tversionConfig.Source = config.Source\n\t\tversionConfig.VersionBundles = NewVersionBundles()\n\n\t\tversionService, err = version.New(versionConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tnewService := &Service{\n\t\t// Dependencies.\n\t\tCRDFramework: crdFramework,\n\t\tCustomObjectFramework: customObjectFramework,\n\t\tHealthz: healthzService,\n\t\tVersion: versionService,\n\n\t\t// Internals\n\t\tbootOnce: sync.Once{},\n\t}\n\n\treturn newService, nil\n}", "func (r *reconciler) createLoadBalancerService(service *corev1.Service) error {\n\tif err := r.client.Create(context.TODO(), service); err != nil {\n\t\treturn fmt.Errorf(\"failed to create load balancer service %s/%s: %v\", service.Namespace, service.Name, err)\n\t}\n\tlog.Info(\"created load balancer service\", \"namespace\", service.Namespace, \"name\", service.Name)\n\treturn nil\n}", "func (s *K8sSvc) CreateService(ctx context.Context, opts *containersvc.CreateServiceOptions) error {\n\trequuid := utils.GetReqIDFromContext(ctx)\n\n\tlabels := make(map[string]string)\n\tlabels[serviceNameLabel] = opts.Common.ServiceName\n\tlabels[serviceUUIDLabel] = opts.Common.ServiceUUID\n\n\t// create the headless service\n\terr := s.createHeadlessService(ctx, opts, labels, requuid)\n\tif err != nil {\n\t\tif !k8errors.IsAlreadyExists(err) {\n\t\t\tglog.Errorln(\"create headless service error\", err, \"requuid\", requuid, opts.Common)\n\t\t\treturn err\n\t\t}\n\t\tglog.Infoln(\"the headless service already exists, requuid\", requuid, opts.Common)\n\t} else {\n\t\tglog.Infoln(\"created headless service, requuid\", requuid, opts.Common)\n\t}\n\n\t// create the storage class\n\terr = s.createStorageClass(ctx, opts, requuid)\n\tif err != nil {\n\t\tglog.Errorln(\"create storage class error\", err, \"requuid\", requuid, opts.Common)\n\t\treturn err\n\t}\n\n\t// create the statefulset\n\terr = s.createStatefulSet(ctx, opts, labels, requuid)\n\tif err != nil {\n\t\tif !k8errors.IsAlreadyExists(err) {\n\t\t\tglog.Errorln(\"create statefulset error\", err, \"requuid\", requuid, opts.Common)\n\t\t\treturn err\n\t\t}\n\t\tglog.Infoln(\"the statefulset exists, requuid\", requuid, opts.Common)\n\t} else {\n\t\tglog.Infoln(\"created the statefulset, requuid\", requuid, opts.Common)\n\t}\n\n\treturn nil\n}", "func NewBackend(input *NewBackendInput) Backend {\n\treturn &backendImpl{\n\t\trecordDB: input.RecordDB,\n\t}\n}", "func New(ctx context.Context, m map[string]interface{}) (rgrpc.Service, error) {\n\tvar c config\n\tif err := cfg.Decode(m, &c); err != nil {\n\t\treturn nil, err\n\t}\n\n\trepo, err := getShareRepository(ctx, &c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tservice := &service{\n\t\tconf: &c,\n\t\trepo: repo,\n\t}\n\n\treturn service, nil\n}", "func (s *deploymentServer) applyService(ctx context.Context, manifest []byte) error {\n\tdecoder := k8sYaml.NewYAMLOrJSONDecoder(bytes.NewReader(manifest), 1000)\n\n\tsrv := &apiv1.Service{}\n\n\tif err := decoder.Decode(&srv); err != nil {\n\t\treturn err\n\t}\n\n\tprintln(\" applyService \" + srv.Namespace + \":\" + srv.Name)\n\n\tapi := s.clientset.CoreV1()\n\tapiServices := api.Services(srv.Namespace)\n\tif _, err := apiServices.Get(ctx, srv.Name, metav1.GetOptions{}); err != nil {\n\t\t// create service\n\t\tlog.Printf(\"Error getting service: %v\\n\", err)\n\t\tif _, err := apiServices.Create(ctx, srv, metav1.CreateOptions{}); err != nil {\n\t\t\treturn fmt.Errorf(\"service create error '%s'\", err.Error())\n\t\t}\n\t}\n\treturn nil\n}", "func newStainlessService(context *onet.Context) (onet.Service, error) {\n\tservice := &Stainless{\n\t\tServiceProcessor: onet.NewServiceProcessor(context),\n\t}\n\n\tfor _, srv := range []interface{}{\n\t\tservice.Verify,\n\t\tservice.GenBytecode,\n\t\tservice.DeployContract,\n\t\tservice.ExecuteTransaction,\n\t\tservice.FinalizeTransaction,\n\t\tservice.Call,\n\t} {\n\t\terr := service.RegisterHandler(srv)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn service, nil\n}", "func New(s pb.AppServer) (engine *bm.Engine, err error) {\n\tvar (\n\t\tcfg bm.ServerConfig\n\t\tbbr bbr.Config\n\t\tkeep keepConfig\n\t\tct paladin.TOML\n\t)\n\terr = paladin.Get(\"http.toml\").Unmarshal(&ct)\n\thelper.Panic(err)\n\terr = config.Env(&ct, &cfg, \"Server\")\n\thelper.Panic(err)\n\terr = config.Env(&ct, &bbr, \"Bbr\")\n\thelper.Panic(err)\n\terr = config.Env(&ct, &keep, \"Keep\")\n\thelper.Panic(err)\n\tsvc = s\n\tengine = bm.DefaultServer(&cfg)\n\tlimiter := bm.NewRateLimiter(&bbr)\n\tengine.Use(limiter.Limit())\n\tengine.Use(keepAlive(&keep))\n\tcors := bm.CORS([]string{\"null\"})\n\tengine.Use(cors)\n\tpb.RegisterAppBMServer(engine, s)\n\t//initRouter(engine)\n\terr = engine.Start()\n\treturn\n}", "func newService(c *onet.Context) (onet.Service, error) {\n\ts := &ServiceState{\n\t\tServiceProcessor: onet.NewServiceProcessor(c),\n\t}\n\thelloMsg := network.RegisterMessage(HelloMsg{})\n\tstopMsg := network.RegisterMessage(StopProtocol{})\n\tconnMsg := network.RegisterMessage(ConnectionRequest{})\n\tdisconnectMsg := network.RegisterMessage(DisconnectionRequest{})\n\n\tc.RegisterProcessorFunc(helloMsg, s.HandleHelloMsg)\n\tc.RegisterProcessorFunc(stopMsg, s.HandleStop)\n\tc.RegisterProcessorFunc(connMsg, s.HandleConnection)\n\tc.RegisterProcessorFunc(disconnectMsg, s.HandleDisconnection)\n\n\tif err := s.tryLoad(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn s, nil\n}", "func New(awsConfig client.ConfigProvider, logger *zap.SugaredLogger, opts Opts) (*Service, error) {\n\t// set up database\n\tdb, err := database.New(awsConfig, logger)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to init database: %s\", err.Error())\n\t}\n\n\t// create service\n\ts := &Service{\n\t\tl: logger.Named(\"service\"),\n\t\tdb: db,\n\t\tgateway: opts.GatewayOpts,\n\t}\n\n\t// Construct verification email - TODO: remove from ENV\n\ts.mail, err = mailer.New(os.Getenv(\"MAILER_USER\"), os.Getenv(\"MAILER_PASS\"))\n\tif err != nil {\n\t\ts.l.Warnw(\"failed to instantiate mailer\",\n\t\t\t\"user\", os.Getenv(\"MAILER_USER\"))\n\t}\n\n\t// set up logging params\n\tserverOpts := make([]grpc.ServerOption, 0)\n\tgrpcLogger := s.l.Desugar().Named(\"grpc\")\n\tgrpc_zap.ReplaceGrpcLogger(grpcLogger)\n\tzapOpts := []grpc_zap.Option{\n\t\tgrpc_zap.WithDurationField(func(duration time.Duration) zapcore.Field {\n\t\t\treturn zap.Duration(\"grpc.duration\", duration)\n\t\t}),\n\t}\n\n\t// set up interceptors\n\tauthUnaryInterceptor, authStreamingInterceptor := newAuthInterceptors(opts.Token)\n\n\t// instantiate server options\n\tserverOpts = append(serverOpts,\n\t\tgrpc_middleware.WithUnaryServerChain(\n\t\t\tgrpc_ctxtags.UnaryServerInterceptor(grpc_ctxtags.WithFieldExtractor(grpc_ctxtags.CodeGenRequestFieldExtractor)),\n\t\t\tgrpc_zap.UnaryServerInterceptor(grpcLogger, zapOpts...),\n\t\t\tauthUnaryInterceptor),\n\t\tgrpc_middleware.WithStreamServerChain(\n\t\t\tgrpc_ctxtags.StreamServerInterceptor(grpc_ctxtags.WithFieldExtractor(grpc_ctxtags.CodeGenRequestFieldExtractor)),\n\t\t\tgrpc_zap.StreamServerInterceptor(grpcLogger, zapOpts...),\n\t\t\tauthStreamingInterceptor))\n\n\t// set up TLS credentials\n\tif opts.TLSOpts.CertFile != \"\" {\n\t\ts.l.Info(\"setting up TLS\")\n\t\tcreds, err := credentials.NewServerTLSFromFile(opts.TLSOpts.CertFile, opts.TLSOpts.KeyFile)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not load TLS keys: %s\", err)\n\t\t}\n\t\tserverOpts = append(serverOpts, grpc.Creds(creds))\n\t}\n\n\t// create server\n\ts.grpc = grpc.NewServer(serverOpts...)\n\tpinpoint.RegisterCoreServer(s.grpc, s)\n\n\t// create service\n\treturn s, nil\n}", "func NewBackend() *Server {\n\treturn &Server{\n\t\tIdleTimeout: 620 * time.Second,\n\t\tTCPKeepAlivePeriod: 3 * time.Minute,\n\t\tGraceTimeout: 30 * time.Second,\n\t\tWaitBeforeShutdown: 10 * time.Second,\n\t\tTrustProxy: Trusted(),\n\t\tH2C: true,\n\t\tHandler: http.NotFoundHandler(),\n\t}\n}", "func NewService(tr Transactioner, storage Storage) *Service {\n\treturn &Service{tr: tr, storage: storage}\n}", "func (f *Framework) CreateService(namespace, name string, fn ServiceCustomizer) (*corev1.Service, error) {\n\tsvc := &corev1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tAnnotations: make(map[string]string),\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t},\n\t}\n\tif fn != nil {\n\t\tfn(svc)\n\t}\n\treturn f.KubeClient.CoreV1().Services(namespace).Create(svc)\n}", "func NewService() *grpc.Server {\n\treturn factory.NewApplicationFactory(&server{})\n}", "func (s *Deployment) createService() error {\n\tsvc := s.getService(s.stos.Spec.GetServiceName())\n\tsvc.Spec = corev1.ServiceSpec{\n\t\tType: corev1.ServiceType(s.stos.Spec.GetServiceType()),\n\t\tPorts: []corev1.ServicePort{\n\t\t\t{\n\t\t\t\tName: s.stos.Spec.GetServiceName(),\n\t\t\t\tProtocol: \"TCP\",\n\t\t\t\tPort: int32(s.stos.Spec.GetServiceInternalPort()),\n\t\t\t\tTargetPort: intstr.IntOrString{Type: intstr.Int, IntVal: int32(s.stos.Spec.GetServiceExternalPort())},\n\t\t\t},\n\t\t},\n\t\tSelector: map[string]string{\n\t\t\t\"app\": appName,\n\t\t\t\"kind\": daemonsetKind,\n\t\t},\n\t}\n\n\tif err := s.client.Create(context.Background(), svc); err != nil && !apierrors.IsAlreadyExists(err) {\n\t\treturn fmt.Errorf(\"failed to create %s: %v\", svc.GroupVersionKind().Kind, err)\n\t}\n\t// if err := s.createOrUpdateObject(svc); err != nil {\n\t// \treturn err\n\t// }\n\n\t// Patch storageos-api secret with above service IP in apiAddress.\n\tif !s.stos.Spec.CSI.Enable {\n\t\tsecret := &corev1.Secret{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tKind: \"Secret\",\n\t\t\t\tAPIVersion: \"v1\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: s.stos.Spec.SecretRefName,\n\t\t\t\tNamespace: s.stos.Spec.SecretRefNamespace,\n\t\t\t},\n\t\t}\n\t\tnsNameSecret := types.NamespacedName{\n\t\t\tNamespace: secret.ObjectMeta.GetNamespace(),\n\t\t\tName: secret.ObjectMeta.GetName(),\n\t\t}\n\t\tif err := s.client.Get(context.Background(), nsNameSecret, secret); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnsNameService := types.NamespacedName{\n\t\t\tNamespace: svc.ObjectMeta.GetNamespace(),\n\t\t\tName: svc.ObjectMeta.GetName(),\n\t\t}\n\t\tif err := s.client.Get(context.Background(), nsNameService, svc); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tapiAddress := fmt.Sprintf(\"tcp://%s:5705\", svc.Spec.ClusterIP)\n\t\tsecret.Data[apiAddressKey] = []byte(apiAddress)\n\n\t\tif err := s.client.Update(context.Background(), secret); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func NewService(conf Config, deps Dependencies) (Service, error) {\n\treturn &service{\n\t\tConfig: conf,\n\t\tDependencies: deps,\n\t}, nil\n}", "func createLatestService(t *testing.T, clients *test.Clients, names test.ResourceNames) (*v1alpha1.Service, error) {\n\topt := v1alpha1testing.WithInlineConfigSpec(*v1a1test.ConfigurationSpec(names.Image, &v1a1test.Options{}))\n\tservice := v1alpha1testing.ServiceWithoutNamespace(names.Service, opt)\n\tv1a1test.LogResourceObject(t, v1a1test.ResourceObjects{Service: service})\n\treturn clients.ServingAlphaClient.Services.Create(service)\n}", "func New(s *service.Service) (engine *bm.Engine, err error) {\n\tvar (\n\t\tcfg struct {\n\t\t\tbm.ServerConfig\n\t\t\tCrossDomains []string\n\t\t}\n\t\tct paladin.TOML\n\t)\n\tif err = paladin.Get(\"http.toml\").Unmarshal(&ct); err != nil {\n\t\treturn\n\t}\n\tif err = ct.Get(\"Server\").UnmarshalTOML(&cfg); err != nil {\n\t\treturn\n\t}\n\tengine = bm.DefaultServer(&cfg.ServerConfig)\n\tengine.Use(s.As.CORS(cfg.CrossDomains))\n\tengine.Use(gzip.Gzip(gzip.DefaultCompression))\n\tinitRouter(engine, s)\n\terr = engine.Start()\n\treturn\n}", "func New(config *Config) Service {\n\tconfig.Init()\n\treturn &service{\n\t\tfs: afs.New(),\n\t\tConfig: config,\n\t}\n}", "func NewStorageService(conf *myconf.Config) (*StorageService, error) {\n\tbranch := util.GetRequiredEnv(\"BRANCH\")\n\tvar svc *minio.Client\n\tvar err error\n\tif branch != \"production\" {\n\t\tcredentials, err := myaws.NewSession().Config.Credentials.Get()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tendPoint := \"s3.amazonaws.com\"\n\t\tuseSSL := true\n\t\tsvc, err = minio.NewWithRegion(\n\t\t\tendPoint,\n\t\t\tcredentials.AccessKeyID,\n\t\t\tcredentials.SecretAccessKey,\n\t\t\tuseSSL,\n\t\t\tmyaws.AWSRegion,\n\t\t)\n\t\tif err != nil {\n\t\t\tmylog.Log.WithError(err).Error(util.Trace(\"\"))\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tiam := minioCreds.NewIAM(\"\")\n\t\tendPoint := \"s3.amazonaws.com\"\n\t\tuseSSL := true\n\t\tsvc, err = minio.NewWithCredentials(\n\t\t\tendPoint,\n\t\t\tiam,\n\t\t\tuseSSL,\n\t\t\tmyaws.AWSRegion,\n\t\t)\n\t\tif err != nil {\n\t\t\tmylog.Log.WithError(err).Error(util.Trace(\"\"))\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// svc.TraceOn(nil)\n\treturn &StorageService{\n\t\tbucket: conf.AWSUploadBucket,\n\t\tsvc: svc,\n\t}, nil\n}", "func NewBackend(arguments *arguments.Arguments, environment Environment) (*Backend, error) {\n\tlog := logging.Get().WithGroup(\"backend\")\n\tconfig, err := config.NewConfig(arguments.AppConfigFilename(), arguments.AccountsConfigFilename())\n\tif err != nil {\n\t\treturn nil, errp.WithStack(err)\n\t}\n\tlog.Infof(\"backend config: %+v\", config.AppConfig().Backend)\n\tlog.Infof(\"frontend config: %+v\", config.AppConfig().Frontend)\n\tbackend := &Backend{\n\t\targuments: arguments,\n\t\tenvironment: environment,\n\t\tconfig: config,\n\t\tevents: make(chan interface{}, 1000),\n\n\t\tdevices: map[string]device.Interface{},\n\t\tcoins: map[coinpkg.Code]coinpkg.Coin{},\n\t\taccounts: []accounts.Interface{},\n\t\taopp: AOPP{State: aoppStateInactive},\n\n\t\tmakeBtcAccount: func(config *accounts.AccountConfig, coin *btc.Coin, gapLimits *types.GapLimits, log *logrus.Entry) accounts.Interface {\n\t\t\treturn btc.NewAccount(config, coin, gapLimits, log)\n\t\t},\n\t\tmakeEthAccount: func(config *accounts.AccountConfig, coin *eth.Coin, httpClient *http.Client, log *logrus.Entry) accounts.Interface {\n\t\t\treturn eth.NewAccount(config, coin, httpClient, log)\n\t\t},\n\n\t\tlog: log,\n\t}\n\tnotifier, err := NewNotifier(filepath.Join(arguments.MainDirectoryPath(), \"notifier.db\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbackend.notifier = notifier\n\tbackend.socksProxy = socksproxy.NewSocksProxy(\n\t\tbackend.config.AppConfig().Backend.Proxy.UseProxy,\n\t\tbackend.config.AppConfig().Backend.Proxy.ProxyAddress,\n\t)\n\thclient, err := backend.socksProxy.GetHTTPClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbackend.httpClient = hclient\n\tbackend.etherScanHTTPClient = ratelimit.FromTransport(hclient.Transport, etherscan.CallInterval)\n\n\tratesCache := filepath.Join(arguments.CacheDirectoryPath(), \"exchangerates\")\n\tif err := os.MkdirAll(ratesCache, 0700); err != nil {\n\t\tlog.Errorf(\"RateUpdater DB cache dir: %v\", err)\n\t}\n\tbackend.ratesUpdater = rates.NewRateUpdater(hclient, ratesCache)\n\tbackend.ratesUpdater.Observe(backend.Notify)\n\n\tbackend.banners = banners.NewBanners()\n\tbackend.banners.Observe(backend.Notify)\n\n\treturn backend, nil\n}", "func NewFileService(ctx context.Context, directory file.Path) (*stash.Client, error) {\n\ts := &fileStore{directory: directory}\n\ts.entityIndex.init()\n\tos.MkdirAll(directory.System(), 0755)\n\tfiles, err := ioutil.ReadDir(directory.System())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, file := range files {\n\t\tfilename := directory.Join(file.Name())\n\t\tif filename.Ext() != metaExtension {\n\t\t\tcontinue\n\t\t}\n\t\tdata, err := ioutil.ReadFile(filename.System())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tentity := &stash.Entity{}\n\t\tif err := proto.Unmarshal(data, entity); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ts.lockedAddEntry(ctx, entity)\n\t}\n\treturn &stash.Client{Service: s}, nil\n}", "func CreateService(clientset *kubernetes.Clientset, funcSpecs types.FuncSpecs) (string, error) {\n\tservicesClient := clientset.CoreV1().Services(apiv1.NamespaceDefault)\n\n\tnewService := &apiv1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: fmt.Sprintf(\"%s-service\", funcSpecs.FuncName),\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": funcSpecs.FuncName,\n\t\t\t},\n\t\t},\n\t\tSpec: apiv1.ServiceSpec{\n\t\t\tType: apiv1.ServiceTypeClusterIP,\n\t\t\tSelector: map[string]string{\n\t\t\t\t\"app\": funcSpecs.FuncName,\n\t\t\t},\n\t\t\tPorts: []apiv1.ServicePort{\n\t\t\t\t{\n\t\t\t\t\tPort: 80,\n\t\t\t\t\tTargetPort: intstr.FromInt(int(funcSpecs.FuncPort)),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tlog.Println(\"Creating service...\")\n\tresult, err := servicesClient.Create(context.TODO(), newService, metav1.CreateOptions{})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", err\n\t}\n\n\tserviceName := result.GetObjectMeta().GetName()\n\tlog.Printf(\"Created service %q.\\n\", serviceName)\n\n\treturn serviceName, nil\n}", "func NewService(cfg *ServiceConfig) (*Service, error) {\n\tswitch {\n\tcase cfg.Backend == nil:\n\t\treturn nil, trace.BadParameter(\"backend is required\")\n\tcase cfg.Embeddings == nil:\n\t\treturn nil, trace.BadParameter(\"embeddings is required\")\n\tcase cfg.Authorizer == nil:\n\t\treturn nil, trace.BadParameter(\"authorizer is required\")\n\tcase cfg.ResourceGetter == nil:\n\t\treturn nil, trace.BadParameter(\"resource getter is required\")\n\tcase cfg.Logger == nil:\n\t\tcfg.Logger = logrus.WithField(trace.Component, \"assist.service\")\n\t}\n\t// Embedder can be nil is the OpenAI API key is not set.\n\n\treturn &Service{\n\t\tbackend: cfg.Backend,\n\t\tembeddings: cfg.Embeddings,\n\t\tembedder: cfg.Embedder,\n\t\tauthorizer: cfg.Authorizer,\n\t\tresourceGetter: cfg.ResourceGetter,\n\t\tlog: cfg.Logger,\n\t}, nil\n}", "func New(s *service.Service) (engine *bm.Engine) {\n\tvar (\n\t\thc struct {\n\t\t\tServer *bm.ServerConfig\n\t\t}\n\t)\n\tif err := paladin.Get(\"http.toml\").UnmarshalTOML(&hc); err != nil {\n\t\tif err != paladin.ErrNotExist {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tsvc = s\n\tengine = bm.DefaultServer(hc.Server)\n\tinitRouter(engine)\n\tif err := engine.Start(); err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "func New() servicespec.FSService {\n\treturn &service{}\n}", "func (c *backingservices) Create(p *backingserviceapi.BackingService) (result *backingserviceapi.BackingService, err error) {\n\tresult = &backingserviceapi.BackingService{}\n\terr = c.r.Post().Namespace(c.ns).Resource(\"backingservices\").Body(p).Do().Into(result)\n\treturn\n}", "func New() iface.Backend {\n\treturn &Backend{\n\t\tBackend: common.NewBackend(new(config.Config)),\n\t\tgroups: make(map[string][]string),\n\t\ttasks: make(map[string][]byte),\n\t}\n}", "func New(cfg *cfg.File, backend string, productionFlag bool) (p *FeedService, err error) {\n\tp = &FeedService{\n\t\tproductionFlag: productionFlag,\n\t\tmux: new(sync.Mutex),\n\t\tcfg: cfg,\n\t}\n\n\tp.errs = NewPE(\n\t\tp.mux,\n\t\tp.productionFlag,\n\t)\n\n\tp.backend, err = checkBackend(backend)\n\tif err != nil {\n\t\treturn p, err\n\t}\n\n\treturn p, nil\n}", "func NewService(savedPath string) *Service {\n\treturn &Service{\n\t\tsavedPath: savedPath,\n\t}\n}", "func newService(m *influxdatav1alpha1.Influxdb) *corev1.Service {\n\tls := labelsForInfluxdb(m.Name)\n\n\treturn &corev1.Service{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"v1\",\n\t\t\tKind: \"Service\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: m.Name + \"-svc\",\n\t\t\tNamespace: m.Namespace,\n\t\t\tLabels: ls,\n\t\t},\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tSelector: ls,\n\t\t\tType: \"ClusterIP\",\n\t\t\tPorts: newServicePorts(m),\n\t\t},\n\t}\n}", "func newK8sSvcWithConfig(cluster string, cloudPlatform string, dbType string, namespace string, config *rest.Config) (*K8sSvc, error) {\n\t// creates the clientset\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\tglog.Errorln(\"kubernetes.NewForConfig error\", err)\n\t\treturn nil, err\n\t}\n\n\tprovisioner := awsStorageProvisioner\n\tif cloudPlatform != common.CloudPlatformAWS {\n\t\tglog.Errorln(\"unsupport cloud platform\", cloudPlatform)\n\t\treturn nil, common.ErrNotSupported\n\t}\n\n\tsvc := &K8sSvc{\n\t\tcliset: clientset,\n\t\tcluster: cluster,\n\t\tnamespace: namespace,\n\t\tprovisioner: provisioner,\n\t\tcloudPlatform: cloudPlatform,\n\t\tdbType: dbType,\n\t}\n\treturn svc, nil\n}", "func (c *FakeIngressBackends) Create(ctx context.Context, ingressBackend *v1alpha1.IngressBackend, opts v1.CreateOptions) (result *v1alpha1.IngressBackend, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewCreateAction(ingressbackendsResource, c.ns, ingressBackend), &v1alpha1.IngressBackend{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.IngressBackend), err\n}", "func New(codeService domains.CodeService) (*Service, error) {\n\tsrv := Service{\n\t\tcodeService:codeService,\n\t}\n\t\n\treturn &srv, nil\n}", "func newRPCServerService() (*rpcServerService, error) {\n return &rpcServerService{serviceMap: util.NewSyncMap()}, nil\n}", "func NewService(cfg *Config) (*Service, error) {\n\t//Router map only required in the context of this function\n\tif len(cfg.Handlers) == 0 {\n\t\treturn nil, fmt.Errorf(\"no handlers registered for service\")\n\t}\n\n\tif cfg.ListenAddress == \"\" {\n\t\treturn nil, fmt.Errorf(\"listen address must be valid\")\n\t}\n\n\tgin.SetMode(gin.ReleaseMode)\n\trouter := gin.New()\n\tlogger := log.CreateLogger(cfg.LogLevel)\n\trouter.Use(ginlogrus.Logger(logger))\n\n\t//Set CORS to the default if it's enabled and no override passed in.\n\tsetupCors(router, cfg.Cors)\n\n\tif cfg.ReadinessCheck {\n\t\t//The readiness handler shouldn't need any middleware to run on it.\n\t\trouterGroup := router.Group(\"/\")\n\t\trouterGroup.GET(ReadinessEndpoint, readinessHandler())\n\t}\n\n\tif cfg.Metrics {\n\t\trouter.Handle(http.MethodGet, \"metrics\", gin.WrapH(promhttp.Handler()))\n\t}\n\n\tsetupRateLimiting(cfg.RateLimit, router)\n\tsetupMiddleware(cfg.MiddlewareHandlers, router)\n\tsetupEndpoints(cfg.Handlers, router)\n\n\tserver := &http.Server{\n\t\tAddr: cfg.ListenAddress,\n\t\tHandler: router,\n\t}\n\n\treturn &Service{Server: server, config: cfg}, nil\n}", "func (h *httpHandler) CreateServiceBroker(w http.ResponseWriter, r *http.Request) {\n\tvar sbReq scmodel.CreateServiceBrokerRequest\n\terr := util.BodyToObject(r, &sbReq)\n\tif err != nil {\n\t\tlog.Printf(\"Error unmarshaling: %#v\\n\", err)\n\t\tutil.WriteResponse(w, 400, err)\n\t\treturn\n\t}\n\n\tsb := scmodel.ServiceBroker{\n\t\tGUID: uuid.NewV4().String(),\n\t\tName: sbReq.Name,\n\t\tBrokerURL: sbReq.BrokerURL,\n\t\tAuthUsername: sbReq.AuthUsername,\n\t\tAuthPassword: sbReq.AuthPassword,\n\n\t\tCreated: time.Now().Unix(),\n\t\tUpdated: 0,\n\t}\n\tsb.SelfURL = \"/v2/service_brokers/\" + sb.GUID\n\n\t// TODO: This should just store the record in k8s storage. FIX ME.\n\tcreated, err := h.controller.CreateServiceBroker(&sb)\n\tif err != nil {\n\t\tlog.Printf(\"Error creating a service broker: %v\\n\", err)\n\t\tutil.WriteResponse(w, 400, err)\n\t\treturn\n\t}\n\tsbRes := scmodel.CreateServiceBrokerResponse{\n\t\tMetadata: scmodel.ServiceBrokerMetadata{\n\t\t\tGUID: created.GUID,\n\t\t\tCreatedAt: time.Unix(created.Created, 0).Format(time.RFC3339),\n\t\t\tURL: created.SelfURL,\n\t\t},\n\t\tEntity: scmodel.ServiceBrokerEntity{\n\t\t\tName: created.Name,\n\t\t\tBrokerURL: created.BrokerURL,\n\t\t\tAuthUsername: created.AuthUsername,\n\t\t},\n\t}\n\tutil.WriteResponse(w, 200, sbRes)\n}", "func NewService(clusterUID, apiName string, queue Queue, storage Storage, logger *zap.SugaredLogger) Service {\n\treturn &service{\n\t\tlogger: logger,\n\t\tqueue: queue,\n\t\tstorage: storage,\n\t\tclusterUID: clusterUID,\n\t\tapiName: apiName,\n\t}\n}", "func New(t string, opt []byte) (Service, error) {\n\tswitch t {\n\tcase constants.ServiceFs:\n\t\treturn fs.New(opt)\n\tcase constants.ServiceMySQL:\n\t\treturn mysql.New(opt)\n\tcase constants.ServiceRedis:\n\t\treturn redis.New(constants.ServiceRedis, opt)\n\tcase constants.ServiceRedisSentinel:\n\t\treturn redis.New(constants.ServiceRedisSentinel, opt)\n\tdefault:\n\t\treturn nil, constants.ErrServiceInvalid\n\t}\n}", "func New(cfg *config.Config) (sp *Service, err error) {\n\tvar s Service\n\ts.cfg = cfg\n\n\tif err = os.Chdir(s.cfg.Dir); err != nil {\n\t\terr = fmt.Errorf(\"error changing directory: %v\", err)\n\t\treturn\n\t}\n\n\tif s.plog, err = newPanicLog(); err != nil {\n\t\treturn\n\t}\n\n\tif err = initDir(s.cfg.Environment[\"dataDir\"]); err != nil {\n\t\terr = fmt.Errorf(\"error initializing data directory: %v\", err)\n\t\treturn\n\t}\n\n\tif err = initDir(\"build\"); err != nil {\n\t\terr = fmt.Errorf(\"error initializing plugin build directory: %v\", err)\n\t\treturn\n\t}\n\n\ts.srv = httpserve.New()\n\tif err = s.initPlugins(); err != nil {\n\t\terr = fmt.Errorf(\"error loading plugins: %v\", err)\n\t\treturn\n\t}\n\n\tif err = s.loadPlugins(); err != nil {\n\t\terr = fmt.Errorf(\"error initializing plugins: %v\", err)\n\t\treturn\n\t}\n\n\tif err = s.initGroups(); err != nil {\n\t\terr = fmt.Errorf(\"error initializing groups: %v\", err)\n\t\treturn\n\t}\n\n\tif err = s.initRoutes(); err != nil {\n\t\terr = fmt.Errorf(\"error initializing routes: %v\", err)\n\t\treturn\n\t}\n\n\t// TODO: Move this to docs/testing only?\n\tif err = s.initRouteExamples(); err != nil {\n\t\terr = fmt.Errorf(\"error initializing routes: %v\", err)\n\t\treturn\n\t}\n\n\tsp = &s\n\treturn\n}", "func NewService(name string, namespace string, servicePorts []core.ServicePort) *core.Service {\n\n\tlabels := GetCommonLabels()\n\n\treturn &core.Service{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Service\",\n\t\t\tAPIVersion: core.SchemeGroupVersion.String(),\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: core.ServiceSpec{\n\t\t\tSelector: map[string]string{\n\t\t\t\t\"component\": AppName,\n\t\t\t},\n\t\t\tPorts: servicePorts,\n\t\t},\n\t}\n}", "func newService(cr *argoprojv1a1.ArgoCD) *corev1.Service {\n\treturn &corev1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: argoutil.LabelsForCluster(cr),\n\t\t},\n\t}\n}", "func (j *ServiceTestJig) newServiceTemplate(namespace string, proto api.Protocol, port int32) *api.Service {\n\tservice := &api.Service{\n\t\tObjectMeta: api.ObjectMeta{\n\t\t\tNamespace: namespace,\n\t\t\tName: j.Name,\n\t\t\tLabels: j.Labels,\n\t\t},\n\t\tSpec: api.ServiceSpec{\n\t\t\tSelector: j.Labels,\n\t\t\tPorts: []api.ServicePort{\n\t\t\t\t{\n\t\t\t\t\tProtocol: proto,\n\t\t\t\t\tPort: port,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn service\n}", "func NewServiceController(filename string) (c *ServiceController, err error) {\n\tb, err := ioutil.ReadFile(filename)\n\tif err == nil {\n\t\tc = new(ServiceController)\n\t\terr = json.Unmarshal(b, &c)\n\t\treturn c, err\n\t}\n\tc = new(ServiceController)\n\tc.Hosts = make(map[string]*Host)\n\tc.ResourcePools = make(map[string]*ResourcePool)\n\tc.Services = make(map[string]*Service)\n\tc.SystemId, err = newUuid()\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tc.filename = filename\n\treturn c, c.Save()\n}", "func NewService(\n\tconfigFile string,\n\tconfigApply []func(cfg *config.Config) error,\n\tgetScrapeStatus func(map[string][]*discovery.SDTargets) (map[uint64]*target.ScrapeStatus, error),\n\tgetActiveTargets func() map[string][]*discovery.SDTargets,\n\tgetDropTargets func() map[string][]*discovery.SDTargets,\n\tlg logrus.FieldLogger) *Service {\n\tw := &Service{\n\t\tEngine: gin.Default(),\n\t\tlg: lg,\n\t\tconfigFile: configFile,\n\t\tconfigApply: configApply,\n\t\tgetScrapeStatus: getScrapeStatus,\n\t\tgetActiveTargets: getActiveTargets,\n\t\tgetDropTargets: getDropTargets,\n\t}\n\tpprof.Register(w.Engine)\n\n\tw.GET(\"/api/v1/targets\", api.Wrap(lg, w.targets))\n\tw.POST(\"/-/reload\", api.Wrap(lg, func(ctx *gin.Context) *api.Result {\n\t\treturn prom.APIReloadConfig(lg, configFile, configApply)\n\t}))\n\tw.GET(\"/api/v1/status/config\", api.Wrap(lg, func(ctx *gin.Context) *api.Result {\n\t\treturn prom.APIReadConfig(configFile)\n\t}))\n\treturn w\n}", "func NewService(brigadestore storage.Store) Service {\n\treturn &service{\n\t\tclient: brigadestore,\n\t}\n}", "func New(config Config) (*Service, error) {\n\tvar err error\n\n\tvar k8sService healthz.Service\n\t{\n\t\tk8sConfig := k8shealthz.DefaultConfig()\n\n\t\tk8sConfig.K8sClient = config.K8sClient\n\t\tk8sConfig.Logger = config.Logger\n\n\t\tk8sService, err = k8shealthz.New(k8sConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar vaultService healthz.Service\n\t{\n\t\tvaultConfig := vaulthealthz.DefaultConfig()\n\n\t\tvaultConfig.Logger = config.Logger\n\t\tvaultConfig.VaultClient = config.VaultClient\n\n\t\tvaultService, err = vaulthealthz.New(vaultConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tnewService := &Service{\n\t\tK8s: k8sService,\n\t\tVault: vaultService,\n\t}\n\n\treturn newService, nil\n}", "func newDeployment(deploymentName string, replicas int32, podLabels map[string]string, containerName, image string, strategyType appsv1.DeploymentStrategyType) *appsv1.Deployment {\n\tzero := int64(0)\n\treturn &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: deploymentName,\n\t\t\tLabels: podLabels,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: &metav1.LabelSelector{MatchLabels: podLabels},\n\t\t\tStrategy: appsv1.DeploymentStrategy{\n\t\t\t\tType: strategyType,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: podLabels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tTerminationGracePeriodSeconds: &zero,\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: containerName,\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tSecurityContext: &corev1.SecurityContext{},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func NewService(ctx *pulumi.Context,\n\tname string, args *ServiceArgs, opts ...pulumi.ResourceOption) (*Service, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Location == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Location'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Service\n\terr := ctx.RegisterResource(\"gcp:cloudrun/service:Service\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewService(\n\tfileService file.Service,\n) Service {\n\thashAdapter := hash.NewAdapter()\n\treturn createService(hashAdapter, fileService)\n}", "func NewService(fileService file.Service) Service {\n\tadapter := NewAdapter()\n\treturn createService(adapter, fileService)\n}", "func newBackingServices(c *Client, namespace string) *backingservices {\n\treturn &backingservices{\n\t\tr: c,\n\t\tns: namespace,\n\t}\n}" ]
[ "0.6328136", "0.5948253", "0.59010786", "0.57716334", "0.57035434", "0.5683676", "0.5683676", "0.5682846", "0.56765646", "0.56700146", "0.5617953", "0.5595298", "0.5586421", "0.5583956", "0.55812603", "0.5576246", "0.55182314", "0.5511223", "0.5505915", "0.5479159", "0.54635596", "0.5447173", "0.54451936", "0.5441743", "0.5430765", "0.54258686", "0.54236954", "0.5359806", "0.5352728", "0.5315468", "0.53089523", "0.5280996", "0.5280732", "0.5280279", "0.527431", "0.52663726", "0.5254374", "0.52516365", "0.5247231", "0.52438456", "0.5235623", "0.52268136", "0.5224834", "0.52107877", "0.52091587", "0.5208204", "0.51939476", "0.51939476", "0.5187626", "0.51872057", "0.5186081", "0.51829845", "0.5181035", "0.5178174", "0.5161824", "0.5158928", "0.51554596", "0.5155246", "0.51507026", "0.51493484", "0.5146969", "0.5144989", "0.514429", "0.51413864", "0.5132773", "0.51325", "0.51310277", "0.51293755", "0.51250607", "0.51212585", "0.512002", "0.5116795", "0.51102227", "0.5107871", "0.51062304", "0.5104391", "0.5100072", "0.5095053", "0.5089093", "0.5086198", "0.50852287", "0.5075313", "0.507241", "0.50677204", "0.5066145", "0.5065908", "0.50635594", "0.5062313", "0.5056217", "0.50476444", "0.50378597", "0.5035713", "0.50289047", "0.5028", "0.502045", "0.50162363", "0.50149274", "0.5013087", "0.5012033", "0.50102293" ]
0.74691314
0
Template returns the CloudFormation template for the backend service.
func (s *BackendService) Template() (string, error) { outputs, err := s.addonsOutputs() if err != nil { return "", err } sidecars, err := s.manifest.Sidecar.SidecarsOpts() if err != nil { return "", fmt.Errorf("convert the sidecar configuration for service %s: %w", s.name, err) } content, err := s.parser.ParseBackendService(template.ServiceOpts{ Variables: s.manifest.BackendServiceConfig.Variables, Secrets: s.manifest.BackendServiceConfig.Secrets, NestedStack: outputs, Sidecars: sidecars, HealthCheck: s.manifest.BackendServiceConfig.Image.HealthCheckOpts(), LogConfig: s.manifest.LogConfigOpts(), }) if err != nil { return "", fmt.Errorf("parse backend service template: %w", err) } return content.String(), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c Controller) Template(client Client, template, nameSpace string, payload *Payload) (*Dispatched, error) {\n\tvar (\n\t\tbuf bytes.Buffer\n\t\tdispatched *Dispatched\n\t\tinstanceID string\n\t\toperation = \"provision\"\n\t)\n\n\t// wrap up the logic for instansiating a build or not\n\tinstansiateBuild := func(service *Dispatched) (*Dispatched, error) {\n\n\t\tif template != templateCloudApp {\n\t\t\tdispatched.WatchURL = client.DeployLogURL(nameSpace, service.DeploymentName)\n\t\t\treturn dispatched, nil\n\t\t}\n\n\t\tbuild, err := client.InstantiateBuild(nameSpace, service.DeploymentName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif build == nil {\n\t\t\treturn nil, errors.New(\"no build returned from call to OSCP. Unable to continue\")\n\t\t}\n\t\tdispatched.WatchURL = client.BuildConfigLogURL(nameSpace, build.Name)\n\t\tdispatched.BuildURL = client.BuildURL(nameSpace, build.Name, payload.CloudAppGUID)\n\t\treturn dispatched, nil\n\t}\n\n\tif nameSpace == \"\" {\n\t\treturn nil, errors.New(\"an empty namespace cannot be provided\")\n\t}\n\tif err := payload.Validate(template); err != nil {\n\t\treturn nil, err\n\t}\n\tinstanceID = InstanceID(nameSpace, payload.ServiceName)\n\tstatusKey := StatusKey(instanceID, operation)\n\tif err := c.statusPublisher.Clear(statusKey); err != nil {\n\t\tc.Logger.Error(\"failed to clear status key \" + statusKey + \" continuing\")\n\t}\n\tif err := c.statusPublisher.Publish(statusKey, configInProgress, \"starting deployment of service \"+payload.ServiceName); err != nil {\n\t\tc.Logger.Error(\"failed to publish status key \" + statusKey + \" continuing\")\n\t}\n\ttpl, err := c.templateLoader.Load(template)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to load template \"+template+\": \")\n\t}\n\tif err := tpl.ExecuteTemplate(&buf, template, payload); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to execute template: \")\n\t}\n\tosTemplate, err := c.TemplateDecoder.Decode(buf.Bytes())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to decode into an os template: \")\n\t}\n\tsearchCrit := map[string]string{\"rhmap/name\": payload.ServiceName}\n\tif payload.CloudAppGUID != \"\" {\n\t\tsearchCrit = map[string]string{\"rhmap/guid\": payload.CloudAppGUID}\n\t}\n\tdcs, err := client.FindDeploymentConfigsByLabel(nameSpace, searchCrit)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error trying to find deployment config: \")\n\t}\n\tbc, err := client.FindBuildConfigByLabel(nameSpace, searchCrit)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error trying to find build config: \")\n\t}\n\t//check if already deployed\n\tif len(dcs) > 0 || (nil != bc && len(dcs) > 0) {\n\t\tif err := c.statusPublisher.Publish(statusKey, configInProgress, \"service already exists updating\"); err != nil {\n\t\t\tc.Logger.Error(\"failed to publish status key \" + statusKey + \" continuing \" + err.Error())\n\t\t}\n\t\tdispatched, err = c.update(client, &dcs[0], bc, osTemplate, nameSpace, instanceID, payload)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Error updating deploy: \")\n\t\t}\n\t\tdispatched.InstanceID = instanceID\n\t\tdispatched.Operation = operation\n\t\tconfigurationDetails := &Configuration{Action: operation, DeploymentName: dispatched.DeploymentName, InstanceID: dispatched.InstanceID, NameSpace: nameSpace}\n\t\tc.ConfigurationController.Configure(client, configurationDetails)\n\t\treturn instansiateBuild(dispatched)\n\t}\n\tif err := c.statusPublisher.Publish(statusKey, configInProgress, \"service does not exist creating\"); err != nil {\n\t\tc.Logger.Error(\"failed to publish status key \" + statusKey + \" continuing \" + err.Error())\n\t}\n\t_, err = deployDependencyServices(c, client, osTemplate, nameSpace, payload)\n\tif err != nil {\n\t\tc.statusPublisher.Publish(statusKey, configError, err.Error())\n\t\treturn nil, err\n\t}\n\n\tdispatched, err = c.create(client, osTemplate, nameSpace, instanceID, payload)\n\tif err != nil {\n\t\tc.statusPublisher.Publish(statusKey, configError, err.Error())\n\t\treturn nil, err\n\t}\n\tdispatched.InstanceID = instanceID\n\tdispatched.Operation = operation\n\tconfigurationDetails := &Configuration{Action: operation, DeploymentName: dispatched.DeploymentName, InstanceID: dispatched.InstanceID, NameSpace: nameSpace}\n\tc.ConfigurationController.Configure(client, configurationDetails)\n\treturn instansiateBuild(dispatched)\n\n}", "func (o ServiceOutput) Template() ServiceTemplatePtrOutput {\n\treturn o.ApplyT(func(v *Service) ServiceTemplatePtrOutput { return v.Template }).(ServiceTemplatePtrOutput)\n}", "func (e *ComponentStackConfig) Template() (string, error) {\n\tworkloadTemplate, err := e.box.FindString(templatePath)\n\tif err != nil {\n\t\treturn \"\", &ErrTemplateNotFound{templateLocation: templatePath, parentErr: err}\n\t}\n\n\ttemplate, err := template.New(\"template\").\n\t\tFuncs(templateFunctions).\n\t\tFuncs(sprig.FuncMap()).\n\t\tParse(workloadTemplate)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar buf bytes.Buffer\n\tif err := template.Execute(&buf, e.ComponentInput); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(buf.Bytes()), nil\n}", "func Handler(pipe *pipe.Pipe, ctx *pipe.Context) error {\n\tt := new(Template)\n\ta := ctx.Get(\"app\").(*app.App)\n\tc := ctx.Get(\"compose\").(*compose.Compose)\n\tif len(c.Config.Services) < 1 {\n\t\treturn fmt.Errorf(\"no service found in compose\")\n\t}\n\tservice := c.Config.Services[0]\n\n\tt.Type = 1\n\tt.Title = a.Name\n\tt.Description = a.Data.GetString(\"description\")\n\tt.Categories = a.Data.GetStringSlice(\"categories\")\n\tt.Platform = \"linux\"\n\tt.Note = a.Data.GetString(\"note\")\n\tif v := ctx.Get(\"icon\"); v != nil {\n\t\tt.Logo = v.(*icon.Icon).URL\n\t}\n\n\tt.Name = service.ContainerName\n\tt.Image = service.Image\n\tif service.Restart == \"always\" {\n\t\tt.RestartPolicy = \"unless-stopped\"\n\t}\n\n\tif len(service.Ports) > 0 {\n\t\tt.Ports = []map[string]string{}\n\t\tports := map[string]string{}\n\n\t\tfor _, port := range service.Ports {\n\t\t\tpublished := strconv.Itoa(int(port.Published))\n\t\t\ttarget := strconv.Itoa(int(port.Target))\n\t\t\tports[target] = published + \":\" + target + \"/\" + port.Protocol\n\t\t}\n\n\t\tt.Ports = []map[string]string{ports}\n\t}\n\n\tif len(service.Volumes) > 0 {\n\t\tt.Volumes = []VolumeConfig{}\n\n\t\tfor _, volumn := range service.Volumes {\n\t\t\tt.Volumes = append(t.Volumes, VolumeConfig{\n\t\t\t\tContainer: volumn.Target,\n\t\t\t\tBind: volumn.Source,\n\t\t\t})\n\t\t}\n\t}\n\n\tif len(service.Environment) > 0 {\n\t\tt.Environment = []EnvironmentConfig{}\n\n\t\tfor name, point := range service.Environment {\n\t\t\tvalue := \"\"\n\t\t\tif point != nil {\n\t\t\t\tvalue = *point\n\t\t\t}\n\t\t\tt.Environment = append(t.Environment, EnvironmentConfig{\n\t\t\t\tName: name,\n\t\t\t\tLabel: name,\n\t\t\t\tDefault: value,\n\t\t\t})\n\t\t}\n\t}\n\n\tdataset := pipe.Get(\"yacht\").(*Dataset)\n\tdataset.Templates = append(dataset.Templates, t)\n\n\treturn nil\n}", "func (tc *STemplatesController) Create(st *srv_tmpl.ServiceTemplate) error {\n\tbody := make(map[string]interface{})\n\n\t// Get Template.Body as map\n\ttmpl_byte, err := json.Marshal(st.Template.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n json.Unmarshal(tmpl_byte, &body)\n\n\t// Get response\n\tresponse, err := tc.c.ClientFlow.HTTPMethod(\"POST\", endpointFTemplate, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !response.status {\n\t\treturn errors.New(response.body)\n\t}\n\n\t// Update current ServiceTemplate with new values\n\tstemplate_str, err := json.Marshal(response.BodyMap()[\"DOCUMENT\"])\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = json.Unmarshal(stemplate_str, st)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (g project) GetTemplates(serviceName string) {\n\tcontents := `#!/usr/bin/env bash\n\tservicename=$1;\n\tcd $servicename;\n\tgit init;\n\tgit remote add origin [email protected]:yowez/skeleton-service.git;\n\tgit remote -v;\n\tgit fetch;\t\n\tgit pull origin master;\n\trm -rf .git;\n\tcd ..;\n`\n\tbt := []byte(contents)\n\terr := ioutil.WriteFile(template, bt, 0644)\n\tif err != nil {\n\t\tg.rollbackWhenError(\"fail when create scaffold script\")\n\t}\n\tdefer func() {\n\t\t_ = os.Remove(template)\n\t}()\n\tcmd := exec.Command(bash, template, serviceName)\n\terr = g.runCmd(cmd)\n\tif err != nil {\n\t\tlog.Fatal(\"fail run scaffold script\")\n\t}\n\n}", "func (s *Stack) ApplyTemplate(c *stack.Credential) (*stack.Template, error) {\n\tcred, ok := c.Credential.(*Credential)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"credential is not of type do.Credential: %T\", c.Credential)\n\t}\n\n\tbootstrap, ok := c.Bootstrap.(*Bootstrap)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"bootstrap is not of type do.Bootstrap: %T\", c.Bootstrap)\n\t}\n\n\ttemplate := s.Builder.Template\n\ttemplate.Provider[\"digitalocean\"] = map[string]interface{}{\n\t\t\"token\": cred.AccessToken,\n\t}\n\n\tkeyID, err := strconv.Atoi(bootstrap.KeyID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdroplet, err := s.modifyDroplets(keyID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttemplate.Resource[\"digitalocean_droplet\"] = droplet\n\n\tif err := template.ShadowVariables(\"FORBIDDEN\", \"digitalocean_access_token\"); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := template.Flush(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcontent, err := template.JsonOutput()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &stack.Template{\n\t\tContent: content,\n\t}, nil\n}", "func (r *AWSSESTemplate_Template) AWSCloudFormationType() string {\n\treturn \"AWS::SES::Template.Template\"\n}", "func GenerateTemplate(params cloudformation.GenerateParams) {\n\toutput, _ := GenerateYamlTemplate(params)\n\tprepareOutputDir(params.Directory)\n\tif params.WriteParams {\n\t\twriteParamMap(params.Filename, params.Directory, params.ParamMap)\n\t}\n\twriteOutput(params.Filename, params.Directory, output)\n}", "func (c ClientWrapper) CreateTemplate(ttype string) es.TemplateCreateService {\n\treturn WrapESTemplateCreateService(c.client.IndexPutTemplate(ttype))\n}", "func (tc *STemplateController) Instantiate(extra_tmpl string) (*service.Service, error) {\n\turl := urlTemplateAction(tc.ID)\n\taction := make(map[string]interface{})\n\targs := make(map[string]interface{})\n\tparams := make(map[string]interface{})\n\n\tif extra_tmpl != \"\" {\n\t\terr := json.Unmarshal([]byte(extra_tmpl), &args)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tparams[\"merge_template\"] = args\n\t}\n\n\t// Create request\n\taction[\"action\"] = map[string]interface{}{\n\t\t\"perform\": \"instantiate\",\n\t\t\"params\": params,\n\t}\n\n\t//Get response\n\tresponse, err := tc.c.ClientFlow.HTTPMethod(\"POST\", url, action)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !response.status {\n\t\treturn nil, errors.New(response.body)\n\t}\n\n\t//Build Service from response\n\tservice := &service.Service{}\n\tservice_str, err := json.Marshal(response.BodyMap()[\"DOCUMENT\"])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(service_str, service)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn service, nil\n}", "func (c *CloudwatchLogs) Template() *cloudformation.Template {\n\tprefix := func(suffix string) string {\n\t\treturn normalizeResourceName(\"fnb\" + c.config.Name + suffix)\n\t}\n\n\ttemplate := cloudformation.NewTemplate()\n\tfor idx, trigger := range c.config.Triggers {\n\t\t// doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html\n\t\ttemplate.Resources[prefix(\"Permission\"+strconv.Itoa(idx))] = &cloudformation.AWSLambdaPermission{\n\t\t\tAction: \"lambda:InvokeFunction\",\n\t\t\tFunctionName: cloudformation.GetAtt(prefix(\"\"), \"Arn\"),\n\t\t\tPrincipal: cloudformation.Join(\"\", []string{\n\t\t\t\t\"logs.\",\n\t\t\t\tcloudformation.Ref(\"AWS::Region\"), // Use the configuration region.\n\t\t\t\t\".\",\n\t\t\t\tcloudformation.Ref(\"AWS::URLSuffix\"), // awsamazon.com or .com.ch\n\t\t\t}),\n\t\t\tSourceArn: cloudformation.Join(\n\t\t\t\t\"\",\n\t\t\t\t[]string{\n\t\t\t\t\t\"arn:\",\n\t\t\t\t\tcloudformation.Ref(\"AWS::Partition\"),\n\t\t\t\t\t\":logs:\",\n\t\t\t\t\tcloudformation.Ref(\"AWS::Region\"),\n\t\t\t\t\t\":\",\n\t\t\t\t\tcloudformation.Ref(\"AWS::AccountId\"),\n\t\t\t\t\t\":log-group:\",\n\t\t\t\t\tstring(trigger.LogGroupName),\n\t\t\t\t\t\":*\",\n\t\t\t\t},\n\t\t\t),\n\t\t}\n\n\t\t// doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html\n\t\ttemplate.Resources[prefix(\"SF\")+normalizeResourceName(string(trigger.LogGroupName))] = &AWSLogsSubscriptionFilter{\n\t\t\tDestinationArn: cloudformation.GetAtt(prefix(\"\"), \"Arn\"),\n\t\t\tFilterPattern: trigger.FilterPattern,\n\t\t\tLogGroupName: string(trigger.LogGroupName),\n\t\t}\n\t}\n\treturn template\n}", "func (Api) CloudFormationType() string { return \"AWS::ApiGatewayV2::Api\" }", "func getSVCTemplate(instanceName string) *corev1.Service {\n\treturn &corev1.Service{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"v1\",\n\t\t\tKind: \"Service\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"sqldb-\" + instanceName + \"-svc\",\n\t\t\tNamespace: \"default\",\n\t\t},\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tSelector: map[string]string{\n\t\t\t\t\"sqldb\": instanceName,\n\t\t\t},\n\t\t\tPorts: []corev1.ServicePort{\n\t\t\t\t{\n\t\t\t\t\tProtocol: \"TCP\",\n\t\t\t\t\tPort: 5432,\n\t\t\t\t\tTargetPort: intstr.FromInt(5432),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func NewTemplate(c *DQLConfig) (*TemplateConfig, error) {\n\t// instantiate\n\tt := &TemplateConfig{\n\t\tProjectPath: helpers.GetProjectPath(c.ProjectPath),\n\t\tTransform: \"AWS::Serverless-2016-10-31\",\n\t\tGlobals: GlobalConfig{\n\t\t\tFunction: SAMFnProp{\n\t\t\t\tEnvironment: FnEnvironment{\n\t\t\t\t\tVariables: map[string]string{\n\t\t\t\t\t\t\"LOCAL\": \"TRUE\",\n\t\t\t\t\t\t\"ENDPOINT\": \"http://dynamodb:8000\",\n\t\t\t\t\t\t\"REGION\": c.Region,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\ts, err := c.ReadServerlessConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt.addFunctions(s)\n\tt.addResourceEnvs(s)\n\n\treturn t, nil\n}", "func RenderTemplate(deployment Deployment) {\n\tlog.Info(\"Generating Terraform data\")\n\n\terr := os.MkdirAll(deployment.Name + \".data\", os.ModePerm)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdata, err := Asset(\"templates/\" + deployment.Provider + \".tf\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\ttmpl, err := template.New(\"terraform\").Parse(string(data))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfile, err := os.Create(deployment.Name + \".data/\" + deployment.Provider + \".tf\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = tmpl.Execute(file, deployment)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdata, err = Asset(\"templates/\" + deployment.Provider + \"_variables.tf\")\n\tif err == nil {\n\t\ttmpl, err = template.New(\"terraform\").Parse(string(data))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tfile, err = os.Create(deployment.Name + \".data/\" + deployment.Provider + \"variables.tf\")\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\terr = tmpl.Execute(file, deployment)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func GetVPCTemplate() (string, error) {\n\treturn internalcloudformation.GetCloudFormationTemplate(\n\t\tglobal.Config.Distribution.EKS.TemplateLocation, eksVPCTemplateName,\n\t)\n}", "func ExampleTemplate() {\n\ttemplate := &sp.Template{}\n\tjsonStr := `{\n\t\t\"name\": \"testy template\",\n\t\t\"content\": {\n\t\t\t\"html\": \"this is a <b>test</b> email!\",\n\t\t\t\"subject\": \"test email\",\n\t\t\t\"from\": {\n\t\t\t\t\"name\": \"tester\",\n\t\t\t\t\"email\": \"[email protected]\"\n\t\t\t},\n\t\t\t\"reply_to\": \"[email protected]\"\n\t\t}\n\t}`\n\terr := json.Unmarshal([]byte(jsonStr), template)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (c *ClusterResourceSet) Template() gfn.Template {\n\treturn *c.rs.template\n}", "func GetServerTpl() string {\n\treturn `// Code generated by Kitex {{.Version}}. DO NOT EDIT.\npackage {{ToLower .ServiceName}}\n\nimport (\n {{- range $path, $alias := .Imports}}\n {{$alias }}\"{{$path}}\"\n {{- end}}\n)\n\n// NewServer creates a server.Server with the given handler and options.\nfunc NewServer(handler {{call .ServiceTypeName}}, opts ...server.Option) server.Server {\n var options []server.Option\n` + strings.Join(serverOptionTpl, \"\\n\") + `\n options = append(options, opts...)\n\n svr := server.NewServer(options...)\n if err := svr.RegisterService(serviceInfo(), handler); err != nil {\n panic(err)\n }\n return svr\n}\n` + strings.Join(serverExtendTpl, \"\\n\")\n}", "func templateDeploy(cmd *cobra.Command, args []string) {\n\t//Check deploy template file.\n\tif len(args) <= 0 || utils.IsFileExist(args[0]) == false {\n\t\tfmt.Fprintf(os.Stderr, \"the deploy template file is required, %s\\n\", \"see https://github.com/Huawei/containerops/singular for more detail.\")\n\t\tos.Exit(1)\n\t}\n\n\ttemplate := args[0]\n\td := new(objects.Deployment)\n\n\t//Read template file and parse.\n\tif err := d.ParseFromFile(template, output); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"parse deploy template error: %s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t//Set private key file path.\n\tif privateKey != \"\" {\n\t\td.Tools.SSH.Private, d.Tools.SSH.Public = privateKey, publicKey\n\t}\n\n\t//The integrity checking of deploy template.\n\tif err := d.Check(); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"parse deploy template error: %s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t//Set log and error io.Writer\n\tvar logWriters io.Writer\n\n\t//Generate stdout/stderr io.Writer\n\tstdoutFile, _ := os.Create(path.Join(d.Config, \"deploy.log\"))\n\tdefer stdoutFile.Close()\n\n\t//Using MultiWriter log and error.\n\tif verbose == true {\n\t\tlogWriters = io.MultiWriter(stdoutFile, os.Stdout)\n\t} else {\n\t\tlogWriters = io.MultiWriter(stdoutFile)\n\t}\n\n\t//Deploy cloud native stack\n\tif err := module.DeployInfraStacks(d, db, logWriters, timestamp); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t//Delete droplets\n\tif del == true {\n\t\tif err := module.DeleteInfraStacks(d, logWriters, timestamp); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"%s\\n\", err.Error())\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "func (in *RecordSetGroup) GetTemplate(client dynamic.Interface) (string, error) {\n\tif client == nil {\n\t\treturn \"\", fmt.Errorf(\"k8s client not loaded for template\")\n\t}\n\ttemplate := cloudformation.NewTemplate()\n\n\ttemplate.Description = \"AWS Controller - route53.RecordSetGroup (ac-{TODO})\"\n\n\ttemplate.Outputs = map[string]interface{}{\n\t\t\"ResourceRef\": map[string]interface{}{\n\t\t\t\"Value\": cloudformation.Ref(\"RecordSetGroup\"),\n\t\t\t\"Export\": map[string]interface{}{\n\t\t\t\t\"Name\": in.Name + \"Ref\",\n\t\t\t},\n\t\t},\n\t}\n\n\troute53RecordSetGroup := &route53.RecordSetGroup{}\n\n\tif in.Spec.Comment != \"\" {\n\t\troute53RecordSetGroup.Comment = in.Spec.Comment\n\t}\n\n\t// TODO(christopherhein) move these to a defaulter\n\troute53RecordSetGroupHostedZoneRefItem := in.Spec.HostedZoneRef.DeepCopy()\n\n\tif route53RecordSetGroupHostedZoneRefItem.ObjectRef.Namespace == \"\" {\n\t\troute53RecordSetGroupHostedZoneRefItem.ObjectRef.Namespace = in.Namespace\n\t}\n\n\tin.Spec.HostedZoneRef = *route53RecordSetGroupHostedZoneRefItem\n\thostedZoneId, err := in.Spec.HostedZoneRef.String(client)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif hostedZoneId != \"\" {\n\t\troute53RecordSetGroup.HostedZoneId = hostedZoneId\n\t}\n\n\tif in.Spec.HostedZoneName != \"\" {\n\t\troute53RecordSetGroup.HostedZoneName = in.Spec.HostedZoneName\n\t}\n\n\troute53RecordSetGroupRecordSets := []route53.RecordSetGroup_RecordSet{}\n\n\tfor _, item := range in.Spec.RecordSets {\n\t\troute53RecordSetGroupRecordSet := route53.RecordSetGroup_RecordSet{}\n\n\t\tif !reflect.DeepEqual(item.AliasTarget, RecordSetGroup_AliasTarget{}) {\n\t\t\troute53RecordSetGroupRecordSetAliasTarget := route53.RecordSetGroup_AliasTarget{}\n\n\t\t\tif item.AliasTarget.DNSName != \"\" {\n\t\t\t\troute53RecordSetGroupRecordSetAliasTarget.DNSName = item.AliasTarget.DNSName\n\t\t\t}\n\n\t\t\tif item.AliasTarget.EvaluateTargetHealth || !item.AliasTarget.EvaluateTargetHealth {\n\t\t\t\troute53RecordSetGroupRecordSetAliasTarget.EvaluateTargetHealth = item.AliasTarget.EvaluateTargetHealth\n\t\t\t}\n\n\t\t\t// TODO(christopherhein) move these to a defaulter\n\t\t\troute53RecordSetGroupRecordSetAliasTargetHostedZoneRefItem := item.AliasTarget.HostedZoneRef.DeepCopy()\n\n\t\t\tif route53RecordSetGroupRecordSetAliasTargetHostedZoneRefItem.ObjectRef.Namespace == \"\" {\n\t\t\t\troute53RecordSetGroupRecordSetAliasTargetHostedZoneRefItem.ObjectRef.Namespace = in.Namespace\n\t\t\t}\n\n\t\t\titem.AliasTarget.HostedZoneRef = *route53RecordSetGroupRecordSetAliasTargetHostedZoneRefItem\n\t\t\thostedZoneId, err := item.AliasTarget.HostedZoneRef.String(client)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\n\t\t\tif hostedZoneId != \"\" {\n\t\t\t\troute53RecordSetGroupRecordSetAliasTarget.HostedZoneId = hostedZoneId\n\t\t\t}\n\n\t\t\troute53RecordSetGroupRecordSet.AliasTarget = &route53RecordSetGroupRecordSetAliasTarget\n\t\t}\n\n\t\tif item.Comment != \"\" {\n\t\t\troute53RecordSetGroupRecordSet.Comment = item.Comment\n\t\t}\n\n\t\tif item.Failover != \"\" {\n\t\t\troute53RecordSetGroupRecordSet.Failover = item.Failover\n\t\t}\n\n\t\tif !reflect.DeepEqual(item.GeoLocation, RecordSetGroup_GeoLocation{}) {\n\t\t\troute53RecordSetGroupRecordSetGeoLocation := route53.RecordSetGroup_GeoLocation{}\n\n\t\t\tif item.GeoLocation.ContinentCode != \"\" {\n\t\t\t\troute53RecordSetGroupRecordSetGeoLocation.ContinentCode = item.GeoLocation.ContinentCode\n\t\t\t}\n\n\t\t\tif item.GeoLocation.CountryCode != \"\" {\n\t\t\t\troute53RecordSetGroupRecordSetGeoLocation.CountryCode = item.GeoLocation.CountryCode\n\t\t\t}\n\n\t\t\tif item.GeoLocation.SubdivisionCode != \"\" {\n\t\t\t\troute53RecordSetGroupRecordSetGeoLocation.SubdivisionCode = item.GeoLocation.SubdivisionCode\n\t\t\t}\n\n\t\t\troute53RecordSetGroupRecordSet.GeoLocation = &route53RecordSetGroupRecordSetGeoLocation\n\t\t}\n\n\t\t// TODO(christopherhein) move these to a defaulter\n\t\troute53RecordSetGroupRecordSetHealthCheckRefItem := item.HealthCheckRef.DeepCopy()\n\n\t\tif route53RecordSetGroupRecordSetHealthCheckRefItem.ObjectRef.Namespace == \"\" {\n\t\t\troute53RecordSetGroupRecordSetHealthCheckRefItem.ObjectRef.Namespace = in.Namespace\n\t\t}\n\n\t\titem.HealthCheckRef = *route53RecordSetGroupRecordSetHealthCheckRefItem\n\t\thealthCheckId, err := item.HealthCheckRef.String(client)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif healthCheckId != \"\" {\n\t\t\troute53RecordSetGroupRecordSet.HealthCheckId = healthCheckId\n\t\t}\n\n\t\t// TODO(christopherhein) move these to a defaulter\n\t\troute53RecordSetGroupRecordSetHostedZoneRefItem := item.HostedZoneRef.DeepCopy()\n\n\t\tif route53RecordSetGroupRecordSetHostedZoneRefItem.ObjectRef.Namespace == \"\" {\n\t\t\troute53RecordSetGroupRecordSetHostedZoneRefItem.ObjectRef.Namespace = in.Namespace\n\t\t}\n\n\t\titem.HostedZoneRef = *route53RecordSetGroupRecordSetHostedZoneRefItem\n\t\thostedZoneId, err := item.HostedZoneRef.String(client)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif hostedZoneId != \"\" {\n\t\t\troute53RecordSetGroupRecordSet.HostedZoneId = hostedZoneId\n\t\t}\n\n\t\tif item.HostedZoneName != \"\" {\n\t\t\troute53RecordSetGroupRecordSet.HostedZoneName = item.HostedZoneName\n\t\t}\n\n\t\tif item.MultiValueAnswer || !item.MultiValueAnswer {\n\t\t\troute53RecordSetGroupRecordSet.MultiValueAnswer = item.MultiValueAnswer\n\t\t}\n\n\t\tif item.Name != \"\" {\n\t\t\troute53RecordSetGroupRecordSet.Name = item.Name\n\t\t}\n\n\t\tif item.Region != \"\" {\n\t\t\troute53RecordSetGroupRecordSet.Region = item.Region\n\t\t}\n\n\t\tif len(item.ResourceRecords) > 0 {\n\t\t\troute53RecordSetGroupRecordSet.ResourceRecords = item.ResourceRecords\n\t\t}\n\n\t\tif item.SetIdentifier != \"\" {\n\t\t\troute53RecordSetGroupRecordSet.SetIdentifier = item.SetIdentifier\n\t\t}\n\n\t\tif item.TTL != \"\" {\n\t\t\troute53RecordSetGroupRecordSet.TTL = item.TTL\n\t\t}\n\n\t\tif item.Type != \"\" {\n\t\t\troute53RecordSetGroupRecordSet.Type = item.Type\n\t\t}\n\n\t\tif item.Weight != route53RecordSetGroupRecordSet.Weight {\n\t\t\troute53RecordSetGroupRecordSet.Weight = item.Weight\n\t\t}\n\n\t}\n\n\tif len(route53RecordSetGroupRecordSets) > 0 {\n\t\troute53RecordSetGroup.RecordSets = route53RecordSetGroupRecordSets\n\t}\n\n\ttemplate.Resources = map[string]cloudformation.Resource{\n\t\t\"RecordSetGroup\": route53RecordSetGroup,\n\t}\n\n\t// json, err := template.JSONWithOptions(&intrinsics.ProcessorOptions{NoEvaluateConditions: true})\n\tjson, err := template.JSON()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(json), nil\n}", "func (j *ServiceTestJig) newServiceTemplate(namespace string, proto api.Protocol, port int32) *api.Service {\n\tservice := &api.Service{\n\t\tObjectMeta: api.ObjectMeta{\n\t\t\tNamespace: namespace,\n\t\t\tName: j.Name,\n\t\t\tLabels: j.Labels,\n\t\t},\n\t\tSpec: api.ServiceSpec{\n\t\t\tSelector: j.Labels,\n\t\t\tPorts: []api.ServicePort{\n\t\t\t\t{\n\t\t\t\t\tProtocol: proto,\n\t\t\t\t\tPort: port,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn service\n}", "func (tc *STemplateController) Info() (*srv_tmpl.ServiceTemplate, error) {\n\turl := urlTemplate(tc.ID)\n\tresponse, err := tc.c.ClientFlow.HTTPMethod(\"GET\", url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !response.status {\n\t\treturn nil, errors.New(response.body)\n\t}\n\n\tstemplate := &srv_tmpl.ServiceTemplate{}\n\tstemplate_str, err := json.Marshal(response.BodyMap()[\"DOCUMENT\"])\n\terr = json.Unmarshal(stemplate_str, stemplate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn stemplate, nil\n}", "func (csets *CloudSpecificExtensionTemplateService) CreateTemplate(\n\ttemplateParams *map[string]interface{},\n) (template *types.CloudSpecificExtensionTemplate, err error) {\n\tlog.Debug(\"CreateTemplate\")\n\n\tdata, status, err := csets.concertoService.Post(APIPathCseTemplates, templateParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = utils.CheckStandardStatus(status, data); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = json.Unmarshal(data, &template); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn template, nil\n}", "func Template() (c *TemplateController) {\n\treturn &TemplateController{\n\t\tList: templateList,\n\t\tNew: templateNew,\n\t\tCreate: templateCreate,\n\t\tEdit: templateEdit,\n\t\tUpdate: templateUpdate,\n\t\tDelete: templateDelete,\n\t}\n}", "func (c TemplateCreateServiceWrapper) Body(mapping string) es.TemplateCreateService {\n\treturn WrapESTemplateCreateService(c.mappingCreateService.BodyString(mapping))\n}", "func NewCloudFormationTemplate(name string) *CloudFormationTemplate {\n\tc := CloudFormationTemplate{Name: name}\n\tc.ReadFile(name)\n\treturn &c\n}", "func (d *workloadDeployer) AddonsTemplate() (string, error) {\n\tif d.addons == nil {\n\t\treturn \"\", nil\n\t}\n\treturn d.addons.Template()\n}", "func (ftc *FlavorTemplateController) Create(w http.ResponseWriter, r *http.Request) (interface{}, int, error) {\n\tdefaultLog.Trace(\"controllers/flavortemplate_controller:Create() Entering\")\n\tdefer defaultLog.Trace(\"controllers/flavortemplate_controller:Create() Leaving\")\n\n\tflavorTemplateReq, err := ftc.getFlavorTemplateCreateReq(r)\n\tif err != nil {\n\t\tdefaultLog.WithError(err).Error(\"controllers/flavortemplate_controller:Create() Failed to complete create flavor template\")\n\t\tswitch errorType := err.(type) {\n\t\tcase *commErr.UnsupportedMediaError:\n\t\t\treturn nil, http.StatusUnsupportedMediaType, &commErr.ResourceError{Message: errorType.Message}\n\t\tcase *commErr.BadRequestError:\n\t\t\treturn nil, http.StatusBadRequest, &commErr.ResourceError{Message: errorType.Message}\n\t\tdefault:\n\t\t\treturn nil, http.StatusInternalServerError, &commErr.ResourceError{Message: err.Error()}\n\t\t}\n\t}\n\n\t//FTStore this template into database.\n\tflavorTemplate, err := ftc.FTStore.Create(&flavorTemplateReq.FlavorTemplate)\n\tif err != nil {\n\t\tdefaultLog.WithError(err).Error(\"controllers/flavortemplate_controller:Create() Failed to create flavor template\")\n\t\treturn nil, http.StatusInternalServerError, &commErr.ResourceError{Message: \"Failed to create flavor template\"}\n\t}\n\n\tvar fgNames []string\n\tif len(flavorTemplateReq.FlavorgroupNames) != 0 {\n\t\tfgNames = flavorTemplateReq.FlavorgroupNames\n\t} else {\n\t\tdefaultLog.Debug(\"Flavorgroup names not present in request, associating with default ones\")\n\t\tfgNames = append(fgNames, models.FlavorGroupsAutomatic.String())\n\t}\n\tdefaultLog.Debugf(\"Associating Flavor-Template %s with flavorgroups %+q\", flavorTemplate.ID, fgNames)\n\tif len(fgNames) > 0 {\n\t\tif err := ftc.linkFlavorgroupsToFlavorTemplate(fgNames, flavorTemplate.ID); err != nil {\n\t\t\tdefaultLog.WithError(err).Error(\"controllers/flavortemplate_controller:Create() Flavor-Template FlavorGroup association failed\")\n\t\t\treturn nil, http.StatusInternalServerError, &commErr.ResourceError{Message: \"Failed to associate Flavor-Template with flavorgroups\"}\n\t\t}\n\t}\n\n\treturn flavorTemplate, http.StatusCreated, nil\n}", "func GenerateTemplate(name, data string) *template.WorkflowTemplate {\n\treturn &template.WorkflowTemplate{\n\t\tName: name,\n\t\tData: data,\n\t}\n}", "func renderTemplate(context *templateContext, file string) (string, error) {\n\tfuncMap := template.FuncMap{\n\t\t\"getAWSAccountID\": getAWSAccountID,\n\t\t\"base64\": base64Encode,\n\t\t\"base64Decode\": base64Decode,\n\t\t\"manifestHash\": func(template string) (string, error) {\n\t\t\treturn manifestHash(context, file, template)\n\t\t},\n\t\t\"sha256\": func(value string) (string, error) {\n\t\t\treturn fmt.Sprintf(\"%x\", sha256.Sum256([]byte(value))), nil\n\t\t},\n\t\t\"asgSize\": asgSize,\n\t\t\"azID\": azID,\n\t\t\"azCount\": azCount,\n\t\t\"split\": split,\n\t\t\"mountUnitName\": mountUnitName,\n\t\t\"accountID\": accountID,\n\t\t\"portRanges\": portRanges,\n\t\t\"sgIngressRanges\": sgIngressRanges,\n\t\t\"splitHostPort\": splitHostPort,\n\t\t\"extractEndpointHosts\": extractEndpointHosts,\n\t\t\"publicKey\": publicKey,\n\t\t\"stupsNATSubnets\": stupsNATSubnets,\n\t\t\"amiID\": func(imageName, imageOwner string) (string, error) {\n\t\t\treturn amiID(context.awsAdapter, imageName, imageOwner)\n\t\t},\n\t\t// TODO: this function is kept for backward compatibility while\n\t\t// the the use of `nodeCIDRMaxNodesPodCIDR` is being rolled out\n\t\t// to all channels of kubernetes-on-aws. After a full rollout\n\t\t// this can be dropped.\n\t\t\"nodeCIDRMaxNodes\": func(maskSize int64, reserved int64) (int64, error) {\n\t\t\treturn nodeCIDRMaxNodes(16, maskSize, reserved)\n\t\t},\n\t\t\"nodeCIDRMaxNodesPodCIDR\": nodeCIDRMaxNodes,\n\t\t\"nodeCIDRMaxPods\": nodeCIDRMaxPods,\n\t\t\"parseInt64\": parseInt64,\n\t\t\"generateJWKSDocument\": generateJWKSDocument,\n\t\t\"generateOIDCDiscoveryDocument\": generateOIDCDiscoveryDocument,\n\t\t\"kubernetesSizeToKiloBytes\": kubernetesSizeToKiloBytes,\n\t\t\"indexedList\": indexedList,\n\t\t\"zoneDistributedNodePoolGroups\": zoneDistributedNodePoolGroups,\n\t\t\"nodeLifeCycleProviderPerNodePoolGroup\": nodeLifeCycleProviderPerNodePoolGroup,\n\t\t\"certificateExpiry\": certificateExpiry,\n\t\t\"sumQuantities\": sumQuantities,\n\t\t\"awsValidID\": awsValidID,\n\t\t\"indent\": sprig.GenericFuncMap()[\"indent\"],\n\t}\n\n\tcontent, ok := context.fileData[file]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"template file not found: %s\", file)\n\t}\n\tt, err := template.New(file).Option(\"missingkey=error\").Funcs(funcMap).Parse(string(content))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvar out bytes.Buffer\n\n\tdata := &templateData{\n\t\tAlias: context.cluster.Alias,\n\t\tAPIServerURL: context.cluster.APIServerURL,\n\t\tChannel: context.cluster.Channel,\n\t\tConfigItems: context.cluster.ConfigItems,\n\t\tCriticalityLevel: context.cluster.CriticalityLevel,\n\t\tEnvironment: context.cluster.Environment,\n\t\tID: context.cluster.ID,\n\t\tInfrastructureAccount: context.cluster.InfrastructureAccount,\n\t\tLifecycleStatus: context.cluster.LifecycleStatus,\n\t\tLocalID: context.cluster.LocalID,\n\t\tNodePools: context.cluster.NodePools,\n\t\tRegion: context.cluster.Region,\n\t\tOwner: context.cluster.Owner,\n\t\tCluster: context.cluster,\n\t\tValues: context.values,\n\t\tNodePool: context.nodePool,\n\t}\n\n\tif ud, ok := context.values[userDataValuesKey]; ok {\n\t\tdata.UserData = ud.(string)\n\t}\n\n\tif s3path, ok := context.values[s3GeneratedFilesPathValuesKey]; ok {\n\t\tdata.S3GeneratedFilesPath = s3path.(string)\n\t}\n\n\terr = t.Execute(&out, data)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttemplateData := out.String()\n\tcontext.templateData[file] = templateData\n\n\treturn templateData, nil\n}", "func Template(templatePath string) Result {\n\tconfig := config.GetLoadedConfig()\n\tfullPath := filepath.Join(config.GetTemplatePath(), templatePath)\n\n\tif f, err := os.Open(fullPath); err != nil {\n\t\tlog.Printf(\"could not open template file %s\\n\", fullPath)\n\t} else {\n\t\tif bytes, err := io.ReadAll(f); err != nil {\n\t\t\tlog.Printf(\"could not read template file %s\\n\", fullPath)\n\t\t} else {\n\t\t\treturn StringResult(bytes)\n\t\t}\n\t}\n\n\treturn StringResult(\"\")\n}", "func NewTemplate(ctx *pulumi.Context,\n\tname string, args *TemplateArgs, opts ...pulumi.ResourceOption) (*Template, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.GcsPath == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'GcsPath'\")\n\t}\n\tif args.JobName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'JobName'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"location\",\n\t\t\"project\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Template\n\terr := ctx.RegisterResource(\"google-native:dataflow/v1b3:Template\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (client *v3Client) Template(releaseName, releaseNamespace string, values map[interface{}]interface{}, helmConfig *latest.HelmConfig) (string, error) {\n\tif releaseNamespace == \"\" {\n\t\treleaseNamespace = client.kubectl.Namespace()\n\t}\n\n\tvar (\n\t\tsettings = cli.New()\n\t\tchartName = strings.TrimSpace(helmConfig.Chart.Name)\n\t\tchartRepo = helmConfig.Chart.RepoURL\n\t\tgetter = genericclioptions.NewConfigFlags(true)\n\t\tcfg = &action.Configuration{\n\t\t\tRESTClientGetter: getter,\n\t\t\tReleases: storage.Init(driver.NewMemory()),\n\t\t\tKubeClient: kube.New(getter),\n\t\t\tLog: func(msg string, params ...interface{}) {\n\t\t\t\t// We don't log helm messages\n\t\t\t},\n\t\t}\n\t)\n\n\tif strings.HasPrefix(chartName, \"stable/\") && chartRepo == \"\" {\n\t\tchartName = chartName[7:]\n\t\tchartRepo = stableChartRepo\n\t}\n\n\t// Get values\n\tvals := yamlutil.Convert(values).(map[string]interface{})\n\n\t// If a release does not exist, install it. If another error occurs during\n\t// the check, ignore the error and continue with the upgrade.\n\tinstClient := action.NewInstall(cfg)\n\tinstClient.ChartPathOptions.Version = helmConfig.Chart.Version\n\tinstClient.ChartPathOptions.RepoURL = chartRepo\n\tinstClient.ChartPathOptions.Username = helmConfig.Chart.Username\n\tinstClient.ChartPathOptions.Password = helmConfig.Chart.Password\n\tinstClient.DryRun = true\n\tinstClient.ClientOnly = true\n\tinstClient.DisableHooks = helmConfig.DisableHooks\n\tif helmConfig.Timeout != nil {\n\t\tinstClient.Timeout = time.Duration(*helmConfig.Timeout)\n\t}\n\tinstClient.Wait = helmConfig.Wait || helmConfig.Atomic\n\tinstClient.Namespace = releaseNamespace\n\tinstClient.Atomic = helmConfig.Atomic\n\n\tchartPath, err := instClient.ChartPathOptions.LocateChart(chartName, settings)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\trel, err := install(releaseName, releaseNamespace, chartPath, instClient, vals, settings)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn strings.TrimSpace(rel.Manifest), nil\n}", "func (sm *MultiFactorSMS) Template() (*MultiFactorSMSTemplate, error) {\n\tt := new(MultiFactorSMSTemplate)\n\terr := sm.m.get(sm.m.uri(\"guardian\", \"factors\", \"sms\", \"templates\"), t)\n\treturn t, err\n}", "func KustomizeService(kustomization *Kustomization, tmpl *template.Template) ([]byte, error) {\n\tdata := serviceData{\n\t\tNs: kustomization.Ns,\n\t\tTier: kustomization.Tier,\n\t\tName: kustomization.Name,\n\t\tTimeout: kustomization.Service.Timeout,\n\t}\n\n\tmanifestBuffer := new(bytes.Buffer)\n\terr := tmpl.Execute(manifestBuffer, data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can not apply variables to service template: %v\", err)\n\t}\n\treturn manifestBuffer.Bytes(), nil\n}", "func RenderTemplate(t *testing.T, options *Options, chartDir string, releaseName string, templateFiles []string) string {\n\tout, err := RenderTemplateE(t, options, chartDir, releaseName, templateFiles)\n\trequire.NoError(t, err)\n\treturn out\n}", "func RenderStackTemplate(state *State) flaw.Flaw {\n\tfmt.Println(\" rendering stack template...\")\n\t// make new branch directory in artifacts\n\tbranchName := filepath.Join(\n\t\tos.Getenv(\"DE_ARTIFACTS_PATH\"),\n\t\tos.Getenv(\"DE_GIT_BRANCH\"),\n\t)\n\n\terr := os.MkdirAll(branchName, 0755)\n\tif err != nil {\n\t\treturn flaw.From(err)\n\t}\n\n\t// create file\n\tstate.RenderedTemplateLocal = filepath.Join(\n\t\tbranchName,\n\t\t\"completeStack\",\n\t)\n\tnewStackFile, err := os.Create(state.RenderedTemplateLocal)\n\tif err != nil {\n\t\tfmt.Println(\"trouble creating file:\", err)\n\t}\n\n\tbranchStackTemplate := template.New(\"root.gotemplate\")\n\n\tbranchStackTemplate.Delims(\"{{{\", \"}}}\")\n\n\t_, err = branchStackTemplate.ParseGlob(\"aws/stack-templates/*.gotemplate\")\n\n\tif err != nil {\n\t\thalt.Panic(flaw.From(err))\n\t}\n\n\terr = branchStackTemplate.Execute(newStackFile, nil)\n\n\tif err != nil {\n\t\thalt.Panic(flaw.From(err))\n\t}\n\n\treturn nil\n}", "func New(sess *session.Session) CloudFormation {\n\treturn CloudFormation{\n\t\tclient: cloudformation.New(sess),\n\t\tbox: templates.Box(),\n\t}\n}", "func Template(w http.ResponseWriter, r *http.Request, tmpl string, td *models.TemplateData) error {\n\n\tvar tc map[string]*template.Template\n\n\t//posso scegliere se usare la cache o no (intanto che sviluppo non la uso, così vedo subito le modifiche)\n\tif app.UseCache {\n\t\t// get the template cach from the app config\n\t\ttc = app.TemplateCache\n\t} else {\n\t\ttc, _ = CreateTemplateCache()\n\t}\n\n\tt, ok := tc[tmpl]\n\tif !ok {\n\t\t//log.Fatal(\"could not get template from template cache\")\n\t\treturn errors.New(\"could not get template from cache\")\n\t}\n\n\tbuf := new(bytes.Buffer)\n\n\ttd = AddDefaultData(td, r)\n\n\t_ = t.Execute(buf, td)\n\n\t_, err := buf.WriteTo(w)\n\tif err != nil {\n\t\tfmt.Println(\"Error writing template to browser\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s ServiceTemplate) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (t *EmailTemplate) Template() *mailtmpl.Template {\n\treturn &mailtmpl.Template{\n\t\tName: t.Name,\n\t\tSubjectTextTemplate: t.SubjectTextTemplate,\n\t\tBodyHTMLTemplate: t.BodyHTMLTemplate,\n\t\tDefinitionURL: t.DefinitionURL,\n\t}\n}", "func (r *Campaign_TemplateConfiguration) AWSCloudFormationType() string {\n\treturn \"AWS::Pinpoint::Campaign.TemplateConfiguration\"\n}", "func (b Builder) GetTemplateName(t settings.Theme) string {\n\treturn \"builder.html\"\n}", "func (r *applicationResolver) ApplicationTemplate(ctx context.Context, obj *graphql.Application) (*graphql.ApplicationTemplate, error) {\n\treturn r.app.ApplicationTemplate(ctx, obj)\n}", "func CreateTemplate(oc *exutil.CLI, baseName string, ns string, configPath string, numObjects int, tuning *TuningSetType) {\n\t// Try to read the file\n\tcontent, err := ioutil.ReadFile(configPath)\n\tif err != nil {\n\t\tframework.Failf(\"Error reading file: %s\", err)\n\t}\n\n\t// ${IDENTIFER} is what we're replacing in the file\n\tregex, err := regexp.Compile(\"\\\\${IDENTIFIER}\")\n\tif err != nil {\n\t\tframework.Failf(\"Error compiling regex: %v\", err)\n\t}\n\n\tfor i := 0; i < numObjects; i++ {\n\t\tresult := regex.ReplaceAll(content, []byte(strconv.Itoa(i)))\n\n\t\ttmpfile, err := ioutil.TempFile(\"\", \"cl\")\n\t\tif err != nil {\n\t\t\te2e.Failf(\"Error creating new tempfile: %v\", err)\n\t\t}\n\t\tdefer os.Remove(tmpfile.Name())\n\n\t\tif _, err := tmpfile.Write(result); err != nil {\n\t\t\te2e.Failf(\"Error writing to tempfile: %v\", err)\n\t\t}\n\t\tif err := tmpfile.Close(); err != nil {\n\t\t\te2e.Failf(\"Error closing tempfile: %v\", err)\n\t\t}\n\n\t\terr = oc.Run(\"new-app\").Args(\"-f\", tmpfile.Name(), getNsCmdFlag(ns)).Execute()\n\t\te2e.Logf(\"%d/%d : Created template %s\", i+1, numObjects, baseName)\n\n\t\t// If there is a tuning set defined for this template\n\t\tif tuning != nil {\n\t\t\tif tuning.Templates.RateLimit.Delay != 0 {\n\t\t\t\te2e.Logf(\"Sleeping %d ms between template creation.\", tuning.Templates.RateLimit.Delay)\n\t\t\t\ttime.Sleep(time.Duration(tuning.Templates.RateLimit.Delay) * time.Millisecond)\n\t\t\t}\n\t\t\tif tuning.Templates.Stepping.StepSize != 0 && (i+1)%tuning.Templates.Stepping.StepSize == 0 {\n\t\t\t\te2e.Logf(\"We have created %d templates and are now sleeping for %d seconds\", i+1, tuning.Templates.Stepping.Pause)\n\t\t\t\ttime.Sleep(time.Duration(tuning.Templates.Stepping.Pause) * time.Second)\n\t\t\t}\n\t\t}\n\t}\n}", "func Template(c web.C, w http.ResponseWriter, r *http.Request, templates []string, name string, data map[string]interface{}) error {\n\tfuncMap := template.FuncMap{\n\t\t\"formatTime\": formatTime,\n\t}\n\n\tt, err := template.New(\"\").Delims(\"{{{\", \"}}}\").Funcs(funcMap).ParseFiles(templates...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar loggedIn bool\n\tuser, err := helpers.CurrentUser(c)\n\n\tif err != nil {\n\t\tloggedIn = false\n\t} else {\n\t\tloggedIn = true\n\t}\n\n\tdata[\"CurrentUser\"] = user\n\tdata[\"UserSignedIn\"] = loggedIn\n\n\tsession := helpers.CurrentSession(c)\n\tdata[\"Flashes\"] = session.Flashes()\n\tsession.Save(r, w)\n\n\terr = t.ExecuteTemplate(w, name, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func newCloudFormationTemplates(c *ServiceoperatorV1alpha1Client, namespace string) *cloudFormationTemplates {\n\treturn &cloudFormationTemplates{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "func templateChart(c *stablev1.Chart) ([]byte, error) {\n\tvalues := buildValuesString(c)\n\tcmd := exec.Command(\"helm\",\n\t\t\"template\",\n\t\t\"--name=\"+c.GetName(),\n\t\t\"--set=\"+values,\n\t\t\"--namespace=\"+c.Spec.NameSpaceSelector,\n\t\t\"chart/\"+c.Spec.Version+\"/\"+c.Spec.Chart)\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprint(err) + \": \" + stderr.String())\n\t\treturn nil, err\n\t}\n\treturn out.Bytes(), nil\n}", "func GetTemplate() *template.Template {\n\treturn template.New(\"t\").Funcs(template.FuncMap{\n\t\t\"upperFirst\": func(origin string) string {\n\t\t\treturn strings.Title(strings.ToLower(origin))\n\t\t},\n\t\t\"lowerCamel\": func(origin string) string {\n\t\t\treturn strcase.ToLowerCamel(origin)\n\t\t},\n\t\t\"camel\": func(origin string) string {\n\t\t\treturn strcase.ToCamel(origin)\n\t\t},\n\t})\n}", "func (r *AssetRendering) Template() {\n\tv := \"template\"\n\tr.Value = &v\n}", "func infrastructureMachineTemplateNamePrefix(clusterName, machineDeploymentTopologyName string) string {\n\treturn fmt.Sprintf(\"%s-%s-\", clusterName, machineDeploymentTopologyName)\n}", "func RenderTemplate(inputTemplate string, vars map[string]interface{}) (string, error) {\n\ttpl := template.Must(\n\t\ttemplate.New(\"gotpl\").Funcs(\n\t\t\tsprig.TxtFuncMap()).Funcs(CustomFunctions).Parse(inputTemplate))\n\n\tbuf := bytes.NewBuffer(nil)\n\terr := tpl.Execute(buf, vars)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"Error executing template %s with vars %#v\", inputTemplate, vars)\n\t}\n\n\treturn buf.String(), nil\n}", "func (c Controller) create(client Client, template *Template, nameSpace, instanceID string, deploy *Payload) (*Dispatched, error) {\n\tvar (\n\t\tdispatched = &Dispatched{}\n\t\tstatusKey = StatusKey(instanceID, \"provision\")\n\t)\n\tfor _, ob := range template.Objects {\n\t\tswitch ob.(type) {\n\t\tcase *dc.DeploymentConfig:\n\t\t\tdeployment := ob.(*dc.DeploymentConfig)\n\t\t\tdeployed, err := client.CreateDeployConfigInNamespace(nameSpace, deployment)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdispatched.DeploymentName = deployed.Name\n\t\t\tdispatched.DeploymentLabels = deployed.Labels\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \"deployment created \"+deployed.Name)\n\t\tcase *k8api.Service:\n\t\t\tif _, err := client.CreateServiceInNamespace(nameSpace, ob.(*k8api.Service)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created service definition \")\n\t\tcase *route.Route:\n\t\t\tr, err := client.CreateRouteInNamespace(nameSpace, ob.(*route.Route))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdispatched.Route = r\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created route definition \")\n\t\tcase *image.ImageStream:\n\t\t\tif _, err := client.CreateImageStream(nameSpace, ob.(*image.ImageStream)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created imageStream definition \")\n\t\tcase *bc.BuildConfig:\n\t\t\tbConfig := ob.(*bc.BuildConfig)\n\t\t\tif _, err := client.CreateBuildConfigInNamespace(nameSpace, bConfig); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created buildConfig definition \")\n\t\tcase *k8api.Secret:\n\t\t\tif _, err := client.CreateSecretInNamespace(nameSpace, ob.(*k8api.Secret)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created secret definition \")\n\t\tcase *k8api.PersistentVolumeClaim:\n\t\t\tif _, err := client.CreatePersistentVolumeClaim(nameSpace, ob.(*k8api.PersistentVolumeClaim)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created PersistentVolumeClaim definition \")\n\t\tcase *k8api.Pod:\n\t\t\tif _, err := client.CreatePod(nameSpace, ob.(*k8api.Pod)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created Pod definition \")\n\t\tcase *k8api.ConfigMap:\n\t\t\tfmt.Println(\"creating config map\")\n\t\t\tif _, err := client.CreateConfigMap(nameSpace, ob.(*k8api.ConfigMap)); err != nil {\n\t\t\t\tfmt.Println(\"creating config map\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc.statusPublisher.Publish(statusKey, configInProgress, \" created ConfigMap definition \")\n\t\t}\n\t}\n\treturn dispatched, nil\n}", "func (controller *Controller) GetTemplate(c web.C) *template.Template {\n\treturn c.Env[\"Template\"].(*template.Template)\n}", "func (c *Client) Template(sourceFilePath, destinationFilePath string, perms os.FileMode, appendMap, envMap map[string]string) error {\n\ttemplateText, err := readTemplate(sourceFilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttemplateResultBuffer, err := c.renderTemplate(templateText, appendMap, envMap)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn writeTemplateResults(destinationFilePath, templateResultBuffer, perms)\n}", "func (t Tmpl) RenderTemplate(w http.ResponseWriter, req *http.Request, name string, args map[string]interface{}) {\n\t// Check if app is running on dev mode\n\tif Config.Configuration.IsDev() {\n\n\t\t// Lock mutex\n\t\tt.rw.Lock()\n\t\tdefer t.rw.Unlock()\n\n\t\t// Create new template\n\t\tt = NewTemplate(\"castro\")\n\n\t\t// Set template FuncMap\n\t\tt.Tmpl.Funcs(FuncMap)\n\n\t\t// Reload all templates\n\t\tif err := t.LoadTemplates(\"views/\"); err != nil {\n\t\t\tLogger.Logger.Error(err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Reload all templates\n\t\tif err := t.LoadTemplates(\"pages/\"); err != nil {\n\t\t\tLogger.Logger.Error(err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Reload all extension templates\n\t\tif err := t.LoadExtensionTemplates(\"pages\"); err != nil {\n\t\t\tLogger.Logger.Errorf(\"Cannot load extension subtopic template: %v\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Reload all template hooks\n\t\tt.LoadTemplateHooks()\n\t}\n\n\t// Check if args is a valid map\n\tif args == nil {\n\t\targs = map[string]interface{}{}\n\t}\n\n\t// Load microtime from the microtimeHandler\n\tmicrotime, ok := req.Context().Value(\"microtime\").(time.Time)\n\tif !ok {\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(\"Cannot read microtime value\"))\n\t\treturn\n\t}\n\n\t// Get csrf token\n\ttkn, ok := req.Context().Value(\"csrf-token\").(*models.CsrfToken)\n\tif !ok {\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(\"Cannot read csrf token value\"))\n\t\treturn\n\t}\n\n\t// Get nonce value\n\tnonce, ok := req.Context().Value(\"nonce\").(string)\n\n\tif !ok {\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(\"Cannot read nonce value\"))\n\t\treturn\n\t}\n\n\t// Get session map\n\tsession, ok := req.Context().Value(\"session\").(map[string]interface{})\n\n\tif !ok {\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(\"Cannot read session map\"))\n\t\treturn\n\t}\n\n\t// Set session map\n\targs[\"session\"] = session\n\n\t// Set nonce value\n\targs[\"nonce\"] = nonce\n\n\t// Set token value\n\targs[\"csrfToken\"] = tkn.Token\n\n\t// Set microtime value\n\targs[\"microtime\"] = fmt.Sprintf(\"%9.4f seconds\", time.Since(microtime).Seconds())\n\n\t// Render template and log error\n\tif err := t.Tmpl.ExecuteTemplate(w, name, args); err != nil {\n\t\tLogger.Logger.Error(err.Error())\n\t}\n}", "func main() {\n\tc := framework.TemplateProcessor{\n\t\tTemplateData: &API{},\n\t\tPatchTemplates: []framework.PatchTemplate{&framework.ResourcePatchTemplate{\n\t\t\tSelector: &framework.Selector{\n\t\t\t\tKinds: []string{\"Deployment\"},\n\t\t\t\tNames: []string{\"controller-manager\"},\n\t\t\t},\n\t\t\tTemplates: parser.TemplateStrings(`\nspec:\n replicas: {{.Replicas}}\n`),\n\t\t}},\n\t}\n\n\tcmd := command.Build(&c, command.StandaloneEnabled, false)\n\tif err := cmd.Execute(); err != nil {\n\t\tfmt.Fprintln(os.Stderr, err.Error())\n\t\tos.Exit(1)\n\t}\n}", "func (r *DataSource_ServiceNowConfiguration) AWSCloudFormationType() string {\n\treturn \"AWS::Kendra::DataSource.ServiceNowConfiguration\"\n}", "func TemplateBody(TemplateBody string) func(*cfn.UpdateStackInput) {\n\treturn func(params *cfn.UpdateStackInput) {\n\t\tparams.TemplateBody = aws.String(TemplateBody)\n\t}\n}", "func (m *TeamItemRequestBuilder) Template()(*i04a148e32be31a86cd21b897c8b55a4508d63dbae47a02eaeb122662dbd2ff9b.TemplateRequestBuilder) {\n return i04a148e32be31a86cd21b897c8b55a4508d63dbae47a02eaeb122662dbd2ff9b.NewTemplateRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (c *CloudFormationTemplate) CreateStack(suffix string) {\n\tfmt.Printf(\"\\nRunning CloudFormation stack [%s]\", c.Name)\n\tsess := session.Must(session.NewSession(&aws.Config{\n\t\tRegion: aws.String(\"us-west-2\"),\n\t}))\n\tsvc := cloudformation.New(sess)\n\n\ttemplateBody := string(c.Bytes)\n\tc.StackName = c.Name + \"-\" + suffix\n\tcloudFormationValues := make(map[string]string)\n\n\tcreateStackParams := &cloudformation.CreateStackInput{\n\t\tStackName: aws.String(c.StackName),\n\t\tTemplateBody: aws.String(templateBody),\n\t}\n\n\tdescribeStacksParams := &cloudformation.DescribeStacksInput{\n\t\tStackName: aws.String(c.StackName),\n\t}\n\n\tout, err := svc.CreateStack(createStackParams)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"AlreadyExistsException\") {\n\t\t\tfmt.Printf(\"\\nCloudFormation stack [%s] already exists. Skipping...\", c.Name)\n\t\t\tdescOut, err := svc.DescribeStacks(describeStacksParams)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tc.ParseOutput(descOut, cloudFormationValues)\n\t\t\treturn\n\t\t} else {\n\t\t\tfmt.Printf(\"%s\", err)\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tfmt.Printf(\"%s\", out)\n\t}\n\n\tstackReady := false\n\n\tfor stackReady != true {\n\n\t\tdescOut, err := svc.DescribeStacks(describeStacksParams)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"%s\", err)\n\t\t\tpanic(err)\n\t\t} else {\n\t\t\tfmt.Printf(\"\\nCloudFormation stack [%s] is creating...\", c.Name)\n\t\t}\n\n\t\tif *descOut.Stacks[0].StackStatus == \"CREATE_COMPLETE\" {\n\t\t\tstackReady = true\n\t\t\tfmt.Printf(\"\\nCloudFormation stack [%s] ready...\\n\", c.Name)\n\t\t\tc.ParseOutput(descOut, cloudFormationValues)\n\t\t}\n\n\t\ttime.Sleep(time.Second * 7)\n\t}\n\n}", "func baseTemplate() *datamodel.NodeBootstrappingConfiguration {\n\tvar (\n\t\ttrueConst = true\n\t\tfalseConst = false\n\t)\n\treturn &datamodel.NodeBootstrappingConfiguration{\n\t\tContainerService: &datamodel.ContainerService{\n\t\t\tID: \"\",\n\t\t\tLocation: \"eastus\",\n\t\t\tName: \"\",\n\t\t\tPlan: nil,\n\t\t\tTags: map[string]string(nil),\n\t\t\tType: \"Microsoft.ContainerService/ManagedClusters\",\n\t\t\tProperties: &datamodel.Properties{\n\t\t\t\tClusterID: \"\",\n\t\t\t\tProvisioningState: \"\",\n\t\t\t\tOrchestratorProfile: &datamodel.OrchestratorProfile{\n\t\t\t\t\tOrchestratorType: \"Kubernetes\",\n\t\t\t\t\tOrchestratorVersion: \"1.26.0\",\n\t\t\t\t\tKubernetesConfig: &datamodel.KubernetesConfig{\n\t\t\t\t\t\tKubernetesImageBase: \"\",\n\t\t\t\t\t\tMCRKubernetesImageBase: \"\",\n\t\t\t\t\t\tClusterSubnet: \"\",\n\t\t\t\t\t\tNetworkPolicy: \"\",\n\t\t\t\t\t\tNetworkPlugin: \"kubenet\",\n\t\t\t\t\t\tNetworkMode: \"\",\n\t\t\t\t\t\tContainerRuntime: \"\",\n\t\t\t\t\t\tMaxPods: 0,\n\t\t\t\t\t\tDockerBridgeSubnet: \"\",\n\t\t\t\t\t\tDNSServiceIP: \"\",\n\t\t\t\t\t\tServiceCIDR: \"\",\n\t\t\t\t\t\tUseManagedIdentity: false,\n\t\t\t\t\t\tUserAssignedID: \"\",\n\t\t\t\t\t\tUserAssignedClientID: \"\",\n\t\t\t\t\t\tCustomHyperkubeImage: \"\",\n\t\t\t\t\t\tCustomKubeProxyImage: \"mcr.microsoft.com/oss/kubernetes/kube-proxy:v1.26.0.1\",\n\t\t\t\t\t\tCustomKubeBinaryURL: \"https://acs-mirror.azureedge.net/kubernetes/v1.26.0/binaries/kubernetes-node-linux-amd64.tar.gz\",\n\t\t\t\t\t\tMobyVersion: \"\",\n\t\t\t\t\t\tContainerdVersion: \"\",\n\t\t\t\t\t\tWindowsNodeBinariesURL: \"\",\n\t\t\t\t\t\tWindowsContainerdURL: \"\",\n\t\t\t\t\t\tWindowsSdnPluginURL: \"\",\n\t\t\t\t\t\tUseInstanceMetadata: &trueConst,\n\t\t\t\t\t\tEnableRbac: nil,\n\t\t\t\t\t\tEnableSecureKubelet: nil,\n\t\t\t\t\t\tPrivateCluster: nil,\n\t\t\t\t\t\tGCHighThreshold: 0,\n\t\t\t\t\t\tGCLowThreshold: 0,\n\t\t\t\t\t\tEnableEncryptionWithExternalKms: nil,\n\t\t\t\t\t\tAddons: nil,\n\t\t\t\t\t\tContainerRuntimeConfig: map[string]string(nil),\n\t\t\t\t\t\tControllerManagerConfig: map[string]string(nil),\n\t\t\t\t\t\tSchedulerConfig: map[string]string(nil),\n\t\t\t\t\t\tCloudProviderBackoffMode: \"v2\",\n\t\t\t\t\t\tCloudProviderBackoff: &trueConst,\n\t\t\t\t\t\tCloudProviderBackoffRetries: 6,\n\t\t\t\t\t\tCloudProviderBackoffJitter: 0.0,\n\t\t\t\t\t\tCloudProviderBackoffDuration: 5,\n\t\t\t\t\t\tCloudProviderBackoffExponent: 0.0,\n\t\t\t\t\t\tCloudProviderRateLimit: &trueConst,\n\t\t\t\t\t\tCloudProviderRateLimitQPS: 10.0,\n\t\t\t\t\t\tCloudProviderRateLimitQPSWrite: 10.0,\n\t\t\t\t\t\tCloudProviderRateLimitBucket: 100,\n\t\t\t\t\t\tCloudProviderRateLimitBucketWrite: 100,\n\t\t\t\t\t\tCloudProviderDisableOutboundSNAT: &falseConst,\n\t\t\t\t\t\tNodeStatusUpdateFrequency: \"\",\n\t\t\t\t\t\tLoadBalancerSku: \"Standard\",\n\t\t\t\t\t\tExcludeMasterFromStandardLB: nil,\n\t\t\t\t\t\tAzureCNIURLLinux: \"https://acs-mirror.azureedge.net/azure-cni/v1.1.8/binaries/azure-vnet-cni-linux-amd64-v1.1.8.tgz\",\n\t\t\t\t\t\tAzureCNIURLARM64Linux: \"\",\n\t\t\t\t\t\tAzureCNIURLWindows: \"\",\n\t\t\t\t\t\tMaximumLoadBalancerRuleCount: 250,\n\t\t\t\t\t\tPrivateAzureRegistryServer: \"\",\n\t\t\t\t\t\tNetworkPluginMode: \"\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tAgentPoolProfiles: []*datamodel.AgentPoolProfile{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"nodepool2\",\n\t\t\t\t\t\tVMSize: \"Standard_DS1_v2\",\n\t\t\t\t\t\tKubeletDiskType: \"\",\n\t\t\t\t\t\tWorkloadRuntime: \"\",\n\t\t\t\t\t\tDNSPrefix: \"\",\n\t\t\t\t\t\tOSType: \"Linux\",\n\t\t\t\t\t\tPorts: nil,\n\t\t\t\t\t\tAvailabilityProfile: \"VirtualMachineScaleSets\",\n\t\t\t\t\t\tStorageProfile: \"ManagedDisks\",\n\t\t\t\t\t\tVnetSubnetID: \"\",\n\t\t\t\t\t\tDistro: \"aks-ubuntu-containerd-18.04-gen2\",\n\t\t\t\t\t\tCustomNodeLabels: map[string]string{\n\t\t\t\t\t\t\t\"kubernetes.azure.com/mode\": \"system\",\n\t\t\t\t\t\t\t\"kubernetes.azure.com/node-image-version\": \"AKSUbuntu-1804gen2containerd-2022.01.19\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tPreprovisionExtension: nil,\n\t\t\t\t\t\tKubernetesConfig: &datamodel.KubernetesConfig{\n\t\t\t\t\t\t\tKubernetesImageBase: \"\",\n\t\t\t\t\t\t\tMCRKubernetesImageBase: \"\",\n\t\t\t\t\t\t\tClusterSubnet: \"\",\n\t\t\t\t\t\t\tNetworkPolicy: \"\",\n\t\t\t\t\t\t\tNetworkPlugin: \"\",\n\t\t\t\t\t\t\tNetworkMode: \"\",\n\t\t\t\t\t\t\tContainerRuntime: \"containerd\",\n\t\t\t\t\t\t\tMaxPods: 0,\n\t\t\t\t\t\t\tDockerBridgeSubnet: \"\",\n\t\t\t\t\t\t\tDNSServiceIP: \"\",\n\t\t\t\t\t\t\tServiceCIDR: \"\",\n\t\t\t\t\t\t\tUseManagedIdentity: false,\n\t\t\t\t\t\t\tUserAssignedID: \"\",\n\t\t\t\t\t\t\tUserAssignedClientID: \"\",\n\t\t\t\t\t\t\tCustomHyperkubeImage: \"\",\n\t\t\t\t\t\t\tCustomKubeProxyImage: \"\",\n\t\t\t\t\t\t\tCustomKubeBinaryURL: \"\",\n\t\t\t\t\t\t\tMobyVersion: \"\",\n\t\t\t\t\t\t\tContainerdVersion: \"\",\n\t\t\t\t\t\t\tWindowsNodeBinariesURL: \"\",\n\t\t\t\t\t\t\tWindowsContainerdURL: \"\",\n\t\t\t\t\t\t\tWindowsSdnPluginURL: \"\",\n\t\t\t\t\t\t\tUseInstanceMetadata: nil,\n\t\t\t\t\t\t\tEnableRbac: nil,\n\t\t\t\t\t\t\tEnableSecureKubelet: nil,\n\t\t\t\t\t\t\tPrivateCluster: nil,\n\t\t\t\t\t\t\tGCHighThreshold: 0,\n\t\t\t\t\t\t\tGCLowThreshold: 0,\n\t\t\t\t\t\t\tEnableEncryptionWithExternalKms: nil,\n\t\t\t\t\t\t\tAddons: nil,\n\t\t\t\t\t\t\tContainerRuntimeConfig: map[string]string(nil),\n\t\t\t\t\t\t\tControllerManagerConfig: map[string]string(nil),\n\t\t\t\t\t\t\tSchedulerConfig: map[string]string(nil),\n\t\t\t\t\t\t\tCloudProviderBackoffMode: \"\",\n\t\t\t\t\t\t\tCloudProviderBackoff: nil,\n\t\t\t\t\t\t\tCloudProviderBackoffRetries: 0,\n\t\t\t\t\t\t\tCloudProviderBackoffJitter: 0.0,\n\t\t\t\t\t\t\tCloudProviderBackoffDuration: 0,\n\t\t\t\t\t\t\tCloudProviderBackoffExponent: 0.0,\n\t\t\t\t\t\t\tCloudProviderRateLimit: nil,\n\t\t\t\t\t\t\tCloudProviderRateLimitQPS: 0.0,\n\t\t\t\t\t\t\tCloudProviderRateLimitQPSWrite: 0.0,\n\t\t\t\t\t\t\tCloudProviderRateLimitBucket: 0,\n\t\t\t\t\t\t\tCloudProviderRateLimitBucketWrite: 0,\n\t\t\t\t\t\t\tCloudProviderDisableOutboundSNAT: nil,\n\t\t\t\t\t\t\tNodeStatusUpdateFrequency: \"\",\n\t\t\t\t\t\t\tLoadBalancerSku: \"\",\n\t\t\t\t\t\t\tExcludeMasterFromStandardLB: nil,\n\t\t\t\t\t\t\tAzureCNIURLLinux: \"\",\n\t\t\t\t\t\t\tAzureCNIURLARM64Linux: \"\",\n\t\t\t\t\t\t\tAzureCNIURLWindows: \"\",\n\t\t\t\t\t\t\tMaximumLoadBalancerRuleCount: 0,\n\t\t\t\t\t\t\tPrivateAzureRegistryServer: \"\",\n\t\t\t\t\t\t\tNetworkPluginMode: \"\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tVnetCidrs: nil,\n\t\t\t\t\t\tWindowsNameVersion: \"\",\n\t\t\t\t\t\tCustomKubeletConfig: nil,\n\t\t\t\t\t\tCustomLinuxOSConfig: nil,\n\t\t\t\t\t\tMessageOfTheDay: \"\",\n\t\t\t\t\t\tNotRebootWindowsNode: nil,\n\t\t\t\t\t\tAgentPoolWindowsProfile: nil,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tLinuxProfile: &datamodel.LinuxProfile{\n\t\t\t\t\tAdminUsername: \"azureuser\",\n\t\t\t\t\tSSH: struct {\n\t\t\t\t\t\tPublicKeys []datamodel.PublicKey \"json:\\\"publicKeys\\\"\"\n\t\t\t\t\t}{\n\t\t\t\t\t\tPublicKeys: []datamodel.PublicKey{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tKeyData: \"dummysshkey\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tSecrets: nil,\n\t\t\t\t\tDistro: \"\",\n\t\t\t\t\tCustomSearchDomain: nil,\n\t\t\t\t},\n\t\t\t\tWindowsProfile: nil,\n\t\t\t\tExtensionProfiles: nil,\n\t\t\t\tDiagnosticsProfile: nil,\n\t\t\t\tServicePrincipalProfile: &datamodel.ServicePrincipalProfile{\n\t\t\t\t\tClientID: \"msi\",\n\t\t\t\t\tSecret: \"msi\",\n\t\t\t\t\tObjectID: \"\",\n\t\t\t\t\tKeyvaultSecretRef: nil,\n\t\t\t\t},\n\t\t\t\tCertificateProfile: &datamodel.CertificateProfile{\n\t\t\t\t\tCaCertificate: \"\",\n\t\t\t\t\tAPIServerCertificate: \"\",\n\t\t\t\t\tClientCertificate: \"\",\n\t\t\t\t\tClientPrivateKey: \"\",\n\t\t\t\t\tKubeConfigCertificate: \"\",\n\t\t\t\t\tKubeConfigPrivateKey: \"\",\n\t\t\t\t},\n\t\t\t\tAADProfile: nil,\n\t\t\t\tCustomProfile: nil,\n\t\t\t\tHostedMasterProfile: &datamodel.HostedMasterProfile{\n\t\t\t\t\tFQDN: \"\",\n\t\t\t\t\tIPAddress: \"\",\n\t\t\t\t\tDNSPrefix: \"\",\n\t\t\t\t\tFQDNSubdomain: \"\",\n\t\t\t\t\tSubnet: \"\",\n\t\t\t\t\tAPIServerWhiteListRange: nil,\n\t\t\t\t\tIPMasqAgent: true,\n\t\t\t\t},\n\t\t\t\tAddonProfiles: map[string]datamodel.AddonProfile(nil),\n\t\t\t\tFeatureFlags: nil,\n\t\t\t\tCustomCloudEnv: nil,\n\t\t\t\tCustomConfiguration: nil,\n\t\t\t},\n\t\t},\n\t\tCloudSpecConfig: &datamodel.AzureEnvironmentSpecConfig{\n\t\t\tCloudName: \"AzurePublicCloud\",\n\t\t\tDockerSpecConfig: datamodel.DockerSpecConfig{\n\t\t\t\tDockerEngineRepo: \"https://aptdocker.azureedge.net/repo\",\n\t\t\t\tDockerComposeDownloadURL: \"https://github.com/docker/compose/releases/download\",\n\t\t\t},\n\t\t\tKubernetesSpecConfig: datamodel.KubernetesSpecConfig{\n\t\t\t\tAzureTelemetryPID: \"\",\n\t\t\t\tKubernetesImageBase: \"k8s.gcr.io/\",\n\t\t\t\tTillerImageBase: \"gcr.io/kubernetes-helm/\",\n\t\t\t\tACIConnectorImageBase: \"microsoft/\",\n\t\t\t\tMCRKubernetesImageBase: \"mcr.microsoft.com/\",\n\t\t\t\tNVIDIAImageBase: \"nvidia/\",\n\t\t\t\tAzureCNIImageBase: \"mcr.microsoft.com/containernetworking/\",\n\t\t\t\tCalicoImageBase: \"calico/\",\n\t\t\t\tEtcdDownloadURLBase: \"\",\n\t\t\t\tKubeBinariesSASURLBase: \"https://acs-mirror.azureedge.net/kubernetes/\",\n\t\t\t\tWindowsTelemetryGUID: \"fb801154-36b9-41bc-89c2-f4d4f05472b0\",\n\t\t\t\tCNIPluginsDownloadURL: \"https://acs-mirror.azureedge.net/cni/cni-plugins-amd64-v0.7.6.tgz\",\n\t\t\t\tVnetCNILinuxPluginsDownloadURL: \"https://acs-mirror.azureedge.net/azure-cni/v1.1.3/binaries/azure-vnet-cni-linux-amd64-v1.1.3.tgz\",\n\t\t\t\tVnetCNIWindowsPluginsDownloadURL: \"https://acs-mirror.azureedge.net/azure-cni/v1.1.3/binaries/azure-vnet-cni-singletenancy-windows-amd64-v1.1.3.zip\",\n\t\t\t\tContainerdDownloadURLBase: \"https://storage.googleapis.com/cri-containerd-release/\",\n\t\t\t\tCSIProxyDownloadURL: \"https://acs-mirror.azureedge.net/csi-proxy/v0.1.0/binaries/csi-proxy.tar.gz\",\n\t\t\t\tWindowsProvisioningScriptsPackageURL: \"https://acs-mirror.azureedge.net/aks-engine/windows/provisioning/signedscripts-v0.2.2.zip\",\n\t\t\t\tWindowsPauseImageURL: \"mcr.microsoft.com/oss/kubernetes/pause:1.4.0\",\n\t\t\t\tAlwaysPullWindowsPauseImage: false,\n\t\t\t\tCseScriptsPackageURL: \"https://acs-mirror.azureedge.net/aks/windows/cse/csescripts-v0.0.1.zip\",\n\t\t\t\tCNIARM64PluginsDownloadURL: \"https://acs-mirror.azureedge.net/cni-plugins/v0.8.7/binaries/cni-plugins-linux-arm64-v0.8.7.tgz\",\n\t\t\t\tVnetCNIARM64LinuxPluginsDownloadURL: \"https://acs-mirror.azureedge.net/azure-cni/v1.4.13/binaries/azure-vnet-cni-linux-arm64-v1.4.14.tgz\",\n\t\t\t},\n\t\t\tEndpointConfig: datamodel.AzureEndpointConfig{\n\t\t\t\tResourceManagerVMDNSSuffix: \"cloudapp.azure.com\",\n\t\t\t},\n\t\t\tOSImageConfig: map[datamodel.Distro]datamodel.AzureOSImageConfig(nil),\n\t\t},\n\t\tK8sComponents: &datamodel.K8sComponents{\n\t\t\tPodInfraContainerImageURL: \"mcr.microsoft.com/oss/kubernetes/pause:3.6\",\n\t\t\tHyperkubeImageURL: \"mcr.microsoft.com/oss/kubernetes/\",\n\t\t\tWindowsPackageURL: \"windowspackage\",\n\t\t},\n\t\tAgentPoolProfile: &datamodel.AgentPoolProfile{\n\t\t\tName: \"nodepool2\",\n\t\t\tVMSize: \"Standard_DS1_v2\",\n\t\t\tKubeletDiskType: \"\",\n\t\t\tWorkloadRuntime: \"\",\n\t\t\tDNSPrefix: \"\",\n\t\t\tOSType: \"Linux\",\n\t\t\tPorts: nil,\n\t\t\tAvailabilityProfile: \"VirtualMachineScaleSets\",\n\t\t\tStorageProfile: \"ManagedDisks\",\n\t\t\tVnetSubnetID: \"\",\n\t\t\tDistro: \"aks-ubuntu-containerd-18.04-gen2\",\n\t\t\tCustomNodeLabels: map[string]string{\n\t\t\t\t\"kubernetes.azure.com/mode\": \"system\",\n\t\t\t\t\"kubernetes.azure.com/node-image-version\": \"AKSUbuntu-1804gen2containerd-2022.01.19\",\n\t\t\t},\n\t\t\tPreprovisionExtension: nil,\n\t\t\tKubernetesConfig: &datamodel.KubernetesConfig{\n\t\t\t\tKubernetesImageBase: \"\",\n\t\t\t\tMCRKubernetesImageBase: \"\",\n\t\t\t\tClusterSubnet: \"\",\n\t\t\t\tNetworkPolicy: \"\",\n\t\t\t\tNetworkPlugin: \"\",\n\t\t\t\tNetworkMode: \"\",\n\t\t\t\tContainerRuntime: \"containerd\",\n\t\t\t\tMaxPods: 0,\n\t\t\t\tDockerBridgeSubnet: \"\",\n\t\t\t\tDNSServiceIP: \"\",\n\t\t\t\tServiceCIDR: \"\",\n\t\t\t\tUseManagedIdentity: false,\n\t\t\t\tUserAssignedID: \"\",\n\t\t\t\tUserAssignedClientID: \"\",\n\t\t\t\tCustomHyperkubeImage: \"\",\n\t\t\t\tCustomKubeProxyImage: \"\",\n\t\t\t\tCustomKubeBinaryURL: \"\",\n\t\t\t\tMobyVersion: \"\",\n\t\t\t\tContainerdVersion: \"\",\n\t\t\t\tWindowsNodeBinariesURL: \"\",\n\t\t\t\tWindowsContainerdURL: \"\",\n\t\t\t\tWindowsSdnPluginURL: \"\",\n\t\t\t\tUseInstanceMetadata: nil,\n\t\t\t\tEnableRbac: nil,\n\t\t\t\tEnableSecureKubelet: nil,\n\t\t\t\tPrivateCluster: nil,\n\t\t\t\tGCHighThreshold: 0,\n\t\t\t\tGCLowThreshold: 0,\n\t\t\t\tEnableEncryptionWithExternalKms: nil,\n\t\t\t\tAddons: nil,\n\t\t\t\tContainerRuntimeConfig: map[string]string(nil),\n\t\t\t\tControllerManagerConfig: map[string]string(nil),\n\t\t\t\tSchedulerConfig: map[string]string(nil),\n\t\t\t\tCloudProviderBackoffMode: \"\",\n\t\t\t\tCloudProviderBackoff: nil,\n\t\t\t\tCloudProviderBackoffRetries: 0,\n\t\t\t\tCloudProviderBackoffJitter: 0.0,\n\t\t\t\tCloudProviderBackoffDuration: 0,\n\t\t\t\tCloudProviderBackoffExponent: 0.0,\n\t\t\t\tCloudProviderRateLimit: nil,\n\t\t\t\tCloudProviderRateLimitQPS: 0.0,\n\t\t\t\tCloudProviderRateLimitQPSWrite: 0.0,\n\t\t\t\tCloudProviderRateLimitBucket: 0,\n\t\t\t\tCloudProviderRateLimitBucketWrite: 0,\n\t\t\t\tCloudProviderDisableOutboundSNAT: nil,\n\t\t\t\tNodeStatusUpdateFrequency: \"\",\n\t\t\t\tLoadBalancerSku: \"\",\n\t\t\t\tExcludeMasterFromStandardLB: nil,\n\t\t\t\tAzureCNIURLLinux: \"\",\n\t\t\t\tAzureCNIURLARM64Linux: \"\",\n\t\t\t\tAzureCNIURLWindows: \"\",\n\t\t\t\tMaximumLoadBalancerRuleCount: 0,\n\t\t\t\tPrivateAzureRegistryServer: \"\",\n\t\t\t\tNetworkPluginMode: \"\",\n\t\t\t},\n\t\t\tVnetCidrs: nil,\n\t\t\tWindowsNameVersion: \"\",\n\t\t\tCustomKubeletConfig: nil,\n\t\t\tCustomLinuxOSConfig: nil,\n\t\t\tMessageOfTheDay: \"\",\n\t\t\tNotRebootWindowsNode: nil,\n\t\t\tAgentPoolWindowsProfile: nil,\n\t\t},\n\t\tTenantID: \"\",\n\t\tSubscriptionID: \"\",\n\t\tResourceGroupName: \"\",\n\t\tUserAssignedIdentityClientID: \"\",\n\t\tOSSKU: \"\",\n\t\tConfigGPUDriverIfNeeded: true,\n\t\tDisable1804SystemdResolved: false,\n\t\tEnableGPUDevicePluginIfNeeded: false,\n\t\tEnableKubeletConfigFile: false,\n\t\tEnableNvidia: false,\n\t\tEnableACRTeleportPlugin: false,\n\t\tTeleportdPluginURL: \"\",\n\t\tContainerdVersion: \"\",\n\t\tRuncVersion: \"\",\n\t\tContainerdPackageURL: \"\",\n\t\tRuncPackageURL: \"\",\n\t\tKubeletClientTLSBootstrapToken: nil,\n\t\tFIPSEnabled: false,\n\t\tHTTPProxyConfig: &datamodel.HTTPProxyConfig{\n\t\t\tHTTPProxy: nil,\n\t\t\tHTTPSProxy: nil,\n\t\t\tNoProxy: &[]string{\n\t\t\t\t\"localhost\",\n\t\t\t\t\"127.0.0.1\",\n\t\t\t\t\"168.63.129.16\",\n\t\t\t\t\"169.254.169.254\",\n\t\t\t\t\"10.0.0.0/16\",\n\t\t\t\t\"agentbaker-agentbaker-e2e-t-8ecadf-c82d8251.hcp.eastus.azmk8s.io\",\n\t\t\t},\n\t\t\tTrustedCA: nil,\n\t\t},\n\t\tKubeletConfig: map[string]string{\n\t\t\t\"--address\": \"0.0.0.0\",\n\t\t\t\"--anonymous-auth\": \"false\",\n\t\t\t\"--authentication-token-webhook\": \"true\",\n\t\t\t\"--authorization-mode\": \"Webhook\",\n\t\t\t\"--azure-container-registry-config\": \"/etc/kubernetes/azure.json\",\n\t\t\t\"--cgroups-per-qos\": \"true\",\n\t\t\t\"--client-ca-file\": \"/etc/kubernetes/certs/ca.crt\",\n\t\t\t\"--cloud-config\": \"/etc/kubernetes/azure.json\",\n\t\t\t\"--cloud-provider\": \"azure\",\n\t\t\t\"--cluster-dns\": \"10.0.0.10\",\n\t\t\t\"--cluster-domain\": \"cluster.local\",\n\t\t\t\"--dynamic-config-dir\": \"/var/lib/kubelet\",\n\t\t\t\"--enforce-node-allocatable\": \"pods\",\n\t\t\t\"--event-qps\": \"0\",\n\t\t\t\"--eviction-hard\": \"memory.available<750Mi,nodefs.available<10%,nodefs.inodesFree<5%\",\n\t\t\t\"--feature-gates\": \"RotateKubeletServerCertificate=true\",\n\t\t\t\"--image-gc-high-threshold\": \"85\",\n\t\t\t\"--image-gc-low-threshold\": \"80\",\n\t\t\t\"--keep-terminated-pod-volumes\": \"false\",\n\t\t\t\"--kube-reserved\": \"cpu=100m,memory=1638Mi\",\n\t\t\t\"--kubeconfig\": \"/var/lib/kubelet/kubeconfig\",\n\t\t\t\"--max-pods\": \"110\",\n\t\t\t\"--network-plugin\": \"kubenet\",\n\t\t\t\"--node-status-update-frequency\": \"10s\",\n\t\t\t\"--pod-infra-container-image\": \"mcr.microsoft.com/oss/kubernetes/pause:3.6\",\n\t\t\t\"--pod-manifest-path\": \"/etc/kubernetes/manifests\",\n\t\t\t\"--pod-max-pids\": \"-1\",\n\t\t\t\"--protect-kernel-defaults\": \"true\",\n\t\t\t\"--read-only-port\": \"0\",\n\t\t\t\"--resolv-conf\": \"/run/systemd/resolve/resolv.conf\",\n\t\t\t\"--rotate-certificates\": \"false\",\n\t\t\t\"--streaming-connection-idle-timeout\": \"4h\",\n\t\t\t\"--tls-cert-file\": \"/etc/kubernetes/certs/kubeletserver.crt\",\n\t\t\t\"--tls-cipher-suites\": \"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256\",\n\t\t\t\"--tls-private-key-file\": \"/etc/kubernetes/certs/kubeletserver.key\",\n\t\t},\n\t\tKubeproxyConfig: map[string]string(nil),\n\t\tEnableRuncShimV2: false,\n\t\tGPUInstanceProfile: \"\",\n\t\tPrimaryScaleSetName: \"\",\n\t\tSIGConfig: datamodel.SIGConfig{\n\t\t\tTenantID: \"tenantID\",\n\t\t\tSubscriptionID: \"subID\",\n\t\t\tGalleries: map[string]datamodel.SIGGalleryConfig{\n\t\t\t\t\"AKSUbuntu\": {\n\t\t\t\t\tGalleryName: \"aksubuntu\",\n\t\t\t\t\tResourceGroup: \"resourcegroup\",\n\t\t\t\t},\n\t\t\t\t\"AKSCBLMariner\": {\n\t\t\t\t\tGalleryName: \"akscblmariner\",\n\t\t\t\t\tResourceGroup: \"resourcegroup\",\n\t\t\t\t},\n\t\t\t\t\"AKSWindows\": {\n\t\t\t\t\tGalleryName: \"AKSWindows\",\n\t\t\t\t\tResourceGroup: \"AKS-Windows\",\n\t\t\t\t},\n\t\t\t\t\"AKSUbuntuEdgeZone\": {\n\t\t\t\t\tGalleryName: \"AKSUbuntuEdgeZone\",\n\t\t\t\t\tResourceGroup: \"AKS-Ubuntu-EdgeZone\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tIsARM64: false,\n\t\tCustomCATrustConfig: nil,\n\t\tDisableUnattendedUpgrades: true,\n\t\tSSHStatus: 0,\n\t\tDisableCustomData: false,\n\t}\n}", "func UploaderTemplate(template string) (func(context *gin.Context)) {\n\treturn func(context *gin.Context) {\n\t\theader := context.Writer.Header()\n\t\theader.Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\tcontext.String(200, `\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title>Upload</title>\n</head>\n<body>\n<form action=\"`+ Config.UrlPrefix+ `/upload/image\" method=\"post\" enctype=\"multipart/form-data\">\n <h2>Image Upload</h2>\n <input type=\"file\" name=\"file\">\n <input type=\"submit\" value=\"Upload\">\n</form>\n\n</hr>\n\n<form action=\"`+ Config.UrlPrefix+ `/upload/file\" method=\"post\" enctype=\"multipart/form-data\">\n <h2>File Upload</h2>\n <input type=\"file\" name=\"file\">\n <input type=\"submit\" value=\"Upload\">\n</form>\n\n</body>\n</html>\n\t`)\n\t}\n\n}", "func (t Tmpl) RenderTemplate(w http.ResponseWriter, req *http.Request, name string, args map[string]interface{}) {\n\t// Check if app is running on dev mode\n\tif Config.Configuration.IsDev() {\n\n\t\t// Lock mutex\n\t\tt.rw.Lock()\n\t\tdefer t.rw.Unlock()\n\n\t\t// Create new template\n\t\tt = NewTemplate(\"castro\")\n\n\t\t// Set template FuncMap\n\t\tt.Tmpl.Funcs(FuncMap)\n\n\t\t// Reload all templates\n\t\tif err := t.LoadTemplates(\"views/\"); err != nil {\n\t\t\tLogger.Logger.Error(err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Reload all templates\n\t\tif err := t.LoadTemplates(\"pages/\"); err != nil {\n\t\t\tLogger.Logger.Error(err.Error())\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Check if args is a valid map\n\tif args == nil {\n\t\targs = map[string]interface{}{}\n\t}\n\n\t// Load microtime from the microtimeHandler\n\tmicrotime, ok := req.Context().Value(\"microtime\").(time.Time)\n\tif !ok {\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(\"Cannot read microtime value\"))\n\t\treturn\n\t}\n\n\t// Get csrf token\n\ttkn, ok := req.Context().Value(\"csrf-token\").(*models.CsrfToken)\n\tif !ok {\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(\"Cannot read csrf token value\"))\n\t\treturn\n\t}\n\n\t// Get nonce value\n\tnonce, ok := req.Context().Value(\"nonce\").(string)\n\n\tif !ok {\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(\"Cannot read nonce value\"))\n\t\treturn\n\t}\n\n\t// Set nonce value\n\targs[\"nonce\"] = nonce\n\n\t// Set token value\n\targs[\"csrfToken\"] = tkn.Token\n\n\t// Set microtime value\n\targs[\"microtime\"] = fmt.Sprintf(\"%9.4f seconds\", time.Since(microtime).Seconds())\n\n\t// Render template and log error\n\tif err := t.Tmpl.ExecuteTemplate(w, name, args); err != nil {\n\t\tLogger.Logger.Error(err.Error())\n\t}\n}", "func (kb *KubeAPIServer) Service() (s string, err error) {\n\ttpl := template.Must(template.New(\"kubeAPIServerTemplate\").Parse(kubeAPIServerTemplate))\n\tbuf := bytes.NewBuffer(nil)\n\tkv := kubeAPIServerTemplateInfo{KubeAPIServerPath: kb.Path}\n\tif err := tpl.Execute(buf, kv); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn buf.String(), nil\n}", "func (n *ScopePrefix) Template(s string) string {\n\treturn prefixVariable.ReplaceAllString(n.String, s)\n}", "func (e *rhcosEditor) CreateMinimalISOTemplate(serviceBaseURL string) (string, error) {\n\tif err := e.isoHandler.Extract(); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif err := os.Remove(e.isoHandler.ExtractedPath(\"images/pxeboot/rootfs.img\")); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif err := e.embedInitrdPlaceholders(); err != nil {\n\t\te.log.WithError(err).Warnf(\"Failed to embed initrd placeholders\")\n\t\treturn \"\", err\n\t}\n\n\t// ToDo: store placeholders' offsets in system area\n\n\tif err := e.fixTemplateConfigs(serviceBaseURL); err != nil {\n\t\te.log.WithError(err).Warnf(\"Failed to edit template configs\")\n\t\treturn \"\", err\n\t}\n\n\te.log.Info(\"Creating minimal ISO template\")\n\treturn e.create()\n}", "func generateServiceDocumentation(svc *broker.ServiceDefinition) string {\n\tcatalog, err := svc.CatalogEntry()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error getting catalog entry for service %s, %v\", svc.Name, err)\n\t}\n\n\tvars := map[string]interface{}{\n\t\t\"catalog\": catalog,\n\t\t\"metadata\": catalog.Metadata,\n\t\t\"bindIn\": svc.BindInputVariables,\n\t\t\"bindOut\": svc.BindOutputVariables,\n\t\t\"provisionInputVars\": svc.ProvisionInputVariables,\n\t\t\"examples\": svc.Examples,\n\t}\n\n\tfuncMap := template.FuncMap{\n\t\t\"code\": mdCode,\n\t\t\"join\": strings.Join,\n\t\t\"varNotes\": varNotes,\n\t\t\"jsonCodeBlock\": jsonCodeBlock,\n\t\t\"exampleCommands\": func(example broker.ServiceExample) string {\n\t\t\tplanName := \"unknown-plan\"\n\t\t\tfor _, plan := range catalog.Plans {\n\t\t\t\tif plan.ID == example.PlanId {\n\t\t\t\t\tplanName = plan.Name\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tparams, err := json.Marshal(example.ProvisionParams)\n\t\t\tif err != nil {\n\t\t\t\treturn err.Error()\n\t\t\t}\n\t\t\tprovision := fmt.Sprintf(\"$ cf create-service %s %s my-%s-example -c `%s`\", catalog.Name, planName, catalog.Name, params)\n\n\t\t\tparams, err = json.Marshal(example.BindParams)\n\t\t\tif err != nil {\n\t\t\t\treturn err.Error()\n\t\t\t}\n\t\t\tbind := fmt.Sprintf(\"$ cf bind-service my-app my-%s-example -c `%s`\", catalog.Name, params)\n\t\t\treturn provision + \"\\n\" + bind\n\t\t},\n\t}\n\n\ttemplateText := `\n--------------------------------------------------------------------------------\n\n# <a name=\"{{ .catalog.Name }}\"></a> ![]({{ .metadata.ImageUrl }}) {{ .metadata.DisplayName }}\n{{ .metadata.LongDescription }}\n\n * [Documentation]({{.metadata.DocumentationUrl }})\n * [Support]({{ .metadata.SupportUrl }})\n * Catalog Metadata ID: {{code .catalog.ID}}\n * Tags: {{ join .catalog.Tags \", \" }}\n * Service Name: {{ code .catalog.Name }}\n\n## Provisioning\n\n**Request Parameters**\n\n{{ if eq (len .provisionInputVars) 0 }}_No parameters supported._{{ end }}\n{{ range $i, $var := .provisionInputVars }} * {{ varNotes $var }}\n{{ end }}\n\n## Binding\n\n**Request Parameters**\n\n{{ if eq (len .bindIn) 0 }}_No parameters supported._{{ end }}\n{{ range $i, $var := .bindIn }} * {{ varNotes $var }}\n{{ end }}\n**Response Parameters**\n\n{{ range $i, $var := .bindOut }} * {{ varNotes $var }}\n{{ end }}\n## Plans\n\nThe following plans are built-in to the GCP Service Broker and may be overriden\nor disabled by the broker administrator.\n\n{{ if eq (len .catalog.Plans) 0 }}_No plans available_{{ end }}\n{{ range $i, $plan := .catalog.Plans }} * **{{ $plan.Name }}**: {{ $plan.Description }} Plan ID: {{code $plan.ID}}.\n{{ end }}\n\n## Examples\n\n{{ if eq (len .examples) 0 }}_No examples._{{ end }}\n\n{{ range $i, $example := .examples}}\n### {{ $example.Name }}\n\n\n{{ $example.Description }}\nUses plan: {{ code $example.PlanId }}.\n\n**Provision**\n\n{{ jsonCodeBlock $example.ProvisionParams }}\n\n**Bind**\n\n{{ jsonCodeBlock $example.BindParams }}\n\n**Cloud Foundry Example**\n\n<pre>\n{{exampleCommands $example}}\n</pre>\n\n{{ end }}\n`\n\n\ttmpl, err := template.New(\"titleTest\").Funcs(funcMap).Parse(templateText)\n\tif err != nil {\n\t\tlog.Fatalf(\"parsing: %s\", err)\n\t}\n\n\t// Run the template to verify the output.\n\tvar buf bytes.Buffer\n\terr = tmpl.Execute(&buf, vars)\n\tif err != nil {\n\t\tlog.Fatalf(\"execution: %s\", err)\n\t}\n\n\treturn buf.String()\n\n}", "func Template(templateFileName string, data interface{}) (templateByte []byte, err error) {\n\ttemplatePath, err := filepath.Abs(templateFileName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid template name\")\n\t}\n\n\tt, err := template.ParseFiles(templatePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tif err = t.Execute(buf, data); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "func (r *Api) AWSCloudFormationType() string {\n\treturn \"AWS::Serverless::Api\"\n}", "func (csets *CloudSpecificExtensionTemplateService) GetTemplate(\n\ttemplateID string,\n) (template *types.CloudSpecificExtensionTemplate, err error) {\n\tlog.Debug(\"GetTemplate\")\n\n\tdata, status, err := csets.concertoService.Get(fmt.Sprintf(APIPathCseTemplate, templateID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = utils.CheckStandardStatus(status, data); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = json.Unmarshal(data, &template); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn template, nil\n}", "func jobGenerate(ctx context.Context, cfg *Config, cluster string, tmplFN string, output io.Writer, queues *Queues) (err kv.Error) {\n\n\t// Open the template file to be used\n\ttmplFile, errGo := os.Open(tmplFN)\n\tif errGo != nil {\n\t\treturn kv.Wrap(errGo).With(\"stack\", stack.Trace().TrimRuntime())\n\t}\n\n\t// Get a working directory to be used for generating values files\n\ttmpDir, errGo := ioutil.TempDir(\"\", \"\")\n\tif errGo != nil {\n\t\treturn kv.Wrap(errGo).With(\"stack\", stack.Trace().TrimRuntime())\n\t}\n\tdefer func() {\n\t\tos.RemoveAll(tmpDir)\n\t}()\n\n\tif logger.IsDebug() {\n\t\tnames := []string{}\n\t\tfor qName, _ := range *queues {\n\t\t\tnames = append(names, qName)\n\t\t}\n\t\tlogger.Debug(\"generating job templates\", \"queues\", strings.Join(names, \", \"), \"stack\", stack.Trace().TrimRuntime())\n\t}\n\n\tfor qName, qDetails := range *queues {\n\t\tjson, errGo := json.MarshalIndent(qDetails, \"\", \" \")\n\t\tif errGo != nil {\n\t\t\treturn kv.Wrap(errGo).With(\"stack\", stack.Trace().TrimRuntime())\n\t\t}\n\n\t\tqVarsFN := filepath.Join(tmpDir, qName+\".json\")\n\t\tif errGo = ioutil.WriteFile(qVarsFN, json, 0600); errGo != nil {\n\t\t\treturn kv.Wrap(errGo).With(\"stack\", stack.Trace().TrimRuntime())\n\t\t}\n\n\t\topts := stencil.TemplateOptions{\n\t\t\tIOFiles: []stencil.TemplateIOFiles{{\n\t\t\t\tIn: tmplFile,\n\t\t\t\tOut: output,\n\t\t\t}},\n\t\t\tValueFiles: []string{qVarsFN},\n\t\t\tOverrideValues: map[string]string{\n\t\t\t\t\"QueueName\": qName,\n\t\t\t},\n\t\t}\n\t\terr, warns := stencil.Template(opts)\n\t\tlogger.Warn(spew.Sdump(warns))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttmplFile.Seek(0, io.SeekStart) // The template is read multiple times so we rewindow between each\n\t\t// Write comments in the output to ensure kubernetes resource sections in the file are split\n\t\toutput.Write([]byte(\"\\n---\\n\"))\n\t}\n\treturn nil\n}", "func Template(props *TemplateProps, children ...Element) *TemplateElem {\n\trProps := &_TemplateProps{\n\t\tBasicHTMLElement: newBasicHTMLElement(),\n\t}\n\n\tif props != nil {\n\t\tprops.assign(rProps)\n\t}\n\n\treturn &TemplateElem{\n\t\tElement: createElement(\"template\", rProps, children...),\n\t}\n}", "func (r *AWSEC2LaunchTemplate_Monitoring) AWSCloudFormationType() string {\n\treturn \"AWS::EC2::LaunchTemplate.Monitoring\"\n}", "func New(gen Generator, tmplStr string, funcMap ...template.FuncMap) *Service {\n\tvar tmpl *template.Template\n\tif len(funcMap) > 0 {\n\t\ttmpl = template.New(gen.Name()).Funcs(funcMap[0])\n\t} else {\n\t\ttmpl = template.New(gen.Name())\n\t}\n\n\treturn &Service{\n\t\tgenerator: gen,\n\t\ttmpl: template.Must(tmpl.Parse(tmplStr)),\n\t}\n}", "func (app *App) HandleDeployTemplate(w http.ResponseWriter, r *http.Request) {\n\tprojID, err := strconv.ParseUint(chi.URLParam(r, \"project_id\"), 0, 64)\n\n\tif err != nil || projID == 0 {\n\t\tapp.handleErrorFormDecoding(err, ErrProjectDecode, w)\n\t\treturn\n\t}\n\n\tname := chi.URLParam(r, \"name\")\n\tversion := chi.URLParam(r, \"version\")\n\n\t// if version passed as latest, pass empty string to loader to get latest\n\tif version == \"latest\" {\n\t\tversion = \"\"\n\t}\n\n\tgetChartForm := &forms.ChartForm{\n\t\tName: name,\n\t\tVersion: version,\n\t\tRepoURL: app.ServerConf.DefaultApplicationHelmRepoURL,\n\t}\n\n\t// if a repo_url is passed as query param, it will be populated\n\tvals, err := url.ParseQuery(r.URL.RawQuery)\n\n\tif err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrReleaseDecode, w)\n\t\treturn\n\t}\n\n\tclusterID, err := strconv.ParseUint(vals[\"cluster_id\"][0], 10, 64)\n\n\tif err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrReleaseDecode, w)\n\t\treturn\n\t}\n\n\tgetChartForm.PopulateRepoURLFromQueryParams(vals)\n\n\tchart, err := loader.LoadChartPublic(getChartForm.RepoURL, getChartForm.Name, getChartForm.Version)\n\n\tif err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrReleaseDecode, w)\n\t\treturn\n\t}\n\n\tform := &forms.InstallChartTemplateForm{\n\t\tReleaseForm: &forms.ReleaseForm{\n\t\t\tForm: &helm.Form{\n\t\t\t\tRepo: app.Repo,\n\t\t\t\tDigitalOceanOAuth: app.DOConf,\n\t\t\t},\n\t\t},\n\t\tChartTemplateForm: &forms.ChartTemplateForm{},\n\t}\n\n\tform.ReleaseForm.PopulateHelmOptionsFromQueryParams(\n\t\tvals,\n\t\tapp.Repo.Cluster,\n\t)\n\n\tif err := json.NewDecoder(r.Body).Decode(form); err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrUserDecode, w)\n\t\treturn\n\t}\n\n\tagent, err := app.getAgentFromReleaseForm(\n\t\tw,\n\t\tr,\n\t\tform.ReleaseForm,\n\t)\n\n\tif err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrUserDecode, w)\n\t\treturn\n\t}\n\n\tregistries, err := app.Repo.Registry.ListRegistriesByProjectID(uint(projID))\n\n\tif err != nil {\n\t\tapp.handleErrorDataRead(err, w)\n\t\treturn\n\t}\n\n\tconf := &helm.InstallChartConfig{\n\t\tChart: chart,\n\t\tName: form.ChartTemplateForm.Name,\n\t\tNamespace: form.ReleaseForm.Form.Namespace,\n\t\tValues: form.ChartTemplateForm.FormValues,\n\t\tCluster: form.ReleaseForm.Cluster,\n\t\tRepo: *app.Repo,\n\t\tRegistries: registries,\n\t}\n\n\trel, err := agent.InstallChart(conf, app.DOConf)\n\n\tif err != nil {\n\t\tapp.sendExternalError(err, http.StatusInternalServerError, HTTPError{\n\t\t\tCode: ErrReleaseDeploy,\n\t\t\tErrors: []string{\"error installing a new chart: \" + err.Error()},\n\t\t}, w)\n\n\t\treturn\n\t}\n\n\ttoken, err := repository.GenerateRandomBytes(16)\n\n\tif err != nil {\n\t\tapp.handleErrorInternal(err, w)\n\t\treturn\n\t}\n\n\t// create release with webhook token in db\n\timage, ok := rel.Config[\"image\"].(map[string]interface{})\n\tif !ok {\n\t\tapp.handleErrorInternal(fmt.Errorf(\"Could not find field image in config\"), w)\n\t\treturn\n\t}\n\n\trepository := image[\"repository\"]\n\trepoStr, ok := repository.(string)\n\n\tif !ok {\n\t\tapp.handleErrorInternal(fmt.Errorf(\"Could not find field repository in config\"), w)\n\t\treturn\n\t}\n\n\trelease := &models.Release{\n\t\tClusterID: form.ReleaseForm.Form.Cluster.ID,\n\t\tProjectID: form.ReleaseForm.Form.Cluster.ProjectID,\n\t\tNamespace: form.ReleaseForm.Form.Namespace,\n\t\tName: form.ChartTemplateForm.Name,\n\t\tWebhookToken: token,\n\t\tImageRepoURI: repoStr,\n\t}\n\n\t_, err = app.Repo.Release.CreateRelease(release)\n\n\tif err != nil {\n\t\tapp.sendExternalError(err, http.StatusInternalServerError, HTTPError{\n\t\t\tCode: ErrReleaseDeploy,\n\t\t\tErrors: []string{\"error creating a webhook: \" + err.Error()},\n\t\t}, w)\n\t}\n\n\t// if github action config is linked, call the github action config handler\n\tif form.GithubActionConfig != nil {\n\t\tgaForm := &forms.CreateGitAction{\n\t\t\tRelease: release,\n\n\t\t\tGitRepo: form.GithubActionConfig.GitRepo,\n\t\t\tGitBranch: form.GithubActionConfig.GitBranch,\n\t\t\tImageRepoURI: form.GithubActionConfig.ImageRepoURI,\n\t\t\tDockerfilePath: form.GithubActionConfig.DockerfilePath,\n\t\t\tGitRepoID: form.GithubActionConfig.GitRepoID,\n\t\t\tRegistryID: form.GithubActionConfig.RegistryID,\n\n\t\t\tShouldGenerateOnly: false,\n\t\t\tShouldCreateWorkflow: form.GithubActionConfig.ShouldCreateWorkflow,\n\t\t}\n\n\t\t// validate the form\n\t\tif err := app.validator.Struct(form); err != nil {\n\t\t\tapp.handleErrorFormValidation(err, ErrProjectValidateFields, w)\n\t\t\treturn\n\t\t}\n\n\t\tapp.createGitActionFromForm(projID, clusterID, form.ChartTemplateForm.Name, gaForm, w, r)\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n}", "func (app *App) Template() *Template {\n\tif app.template == nil {\n\t\tapp.template = make(map[string]*tmpl)\n\t}\n\treturn &Template{\n\t\tlist: app.template,\n\t\tfuncs: append([]template.FuncMap{template.FuncMap{\n\t\t\t\"route\": app.Route,\n\t\t\t\"global\": app.Global,\n\t\t}}, app.templateFuncs...),\n\t}\n}", "func NewTemplate(name string, platforms []string, path, format string, parentUI *ui.UI, envConfig map[string]string) (*Kluster, error) {\n\tif len(format) == 0 {\n\t\tformat = DefaultFormat\n\t}\n\tif !validFormat(format) {\n\t\treturn nil, fmt.Errorf(\"invalid format %q for the kubernetes cluster config file\", format)\n\t}\n\tpath = filepath.Join(path, name+\".\"+format)\n\n\tnewUI := parentUI.Copy()\n\n\tcluster := Kluster{\n\t\tVersion: Version,\n\t\tKind: \"template\",\n\t\tName: name,\n\t\tpath: path,\n\t\tui: newUI,\n\t}\n\n\tif _, err := os.Stat(path); os.IsExist(err) {\n\t\treturn nil, fmt.Errorf(\"the template file %q already exists\", path)\n\t}\n\n\tallPlatforms := provisioner.SupportedPlatforms(name, envConfig, newUI, Version)\n\n\tif len(platforms) == 0 {\n\t\tfor k := range allPlatforms {\n\t\t\tplatforms = append(platforms, k)\n\t\t}\n\t}\n\n\tcluster.Platforms = make(map[string]interface{}, len(platforms))\n\n\tfor _, pName := range platforms {\n\t\tplatform, ok := allPlatforms[pName]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"platform %q is not supported\", pName)\n\t\t}\n\t\tcluster.Platforms[pName] = platform.Config()\n\t}\n\n\tvar err error\n\tcluster.Config, err = configurator.DefaultConfig(envConfig)\n\tcluster.Resources = resources.DefaultResourcesFor()\n\n\treturn &cluster, err\n}", "func BootstrapTemplate() *template.Template {\n\treturn bootstrap\n}", "func (r *Container_ContainerServiceDeployment) AWSCloudFormationType() string {\n\treturn \"AWS::Lightsail::Container.ContainerServiceDeployment\"\n}", "func (g *Gear) TemplateName() string {\n\treturn g.name + \"Template\"\n}", "func templateExecute(ctx interface{}, w io.Writer, templateContent string) {\n\ttmpl, err := template.New(\"docker build template\").Parse(templateContent)\n\tif err == nil {\n\t\ttmpl.Execute(w, ctx)\n\t}\n}", "func completmentAPIServerTemplate(vcns string, apiserverBdl *tenancyv1alpha1.StatefulSetSvcBundle) {\n\tapiserverBdl.StatefulSet.ObjectMeta.Namespace = vcns\n\tapiserverBdl.Service.ObjectMeta.Namespace = vcns\n}", "func (c TemplateCreateServiceWrapper) Do(ctx context.Context) (*elastic.IndicesPutTemplateResponse, error) {\n\treturn c.mappingCreateService.Do(ctx)\n}", "func (c *cloudFormationTemplates) Create(cloudFormationTemplate *v1alpha1.CloudFormationTemplate) (result *v1alpha1.CloudFormationTemplate, err error) {\n\tresult = &v1alpha1.CloudFormationTemplate{}\n\terr = c.client.Post().\n\t\tNamespace(c.ns).\n\t\tResource(\"cloudformationtemplates\").\n\t\tBody(cloudFormationTemplate).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "func (r *AWSECSService_DeploymentConfiguration) AWSCloudFormationType() string {\n\treturn \"AWS::ECS::Service.DeploymentConfiguration\"\n}", "func (*Template) ResourceType() string {\n\treturn \"Template\"\n}", "func New(c *Config) (*Backend, error) {\n\tif err := validation.Validate.Struct(c); err != nil {\n\t\treturn nil, err\n\t}\n\tb := &Backend{\n\t\tkeys: make(chan *template.Key, 500),\n\t\tlog: c.Logger,\n\t\tsvc: c.SSM,\n\t}\n\treturn b, nil\n}", "func Create (appName string) {\n\n checkGopath ()\n checkContainer (appName)\n\n app := Application { Name: appName }\n\n app.createContainer ()\n\n err := app.copyFileTree (\n GOPATH + slash + applicationTemplatesPath,\n GOPATH_SRC + app.Name,\n )\n\n if err != nil {\n log.Fatal (err)\n }\n}", "func readYamlTemplate(templateFile string, requirements *config.RequirementsConfig, svc *corev1.Service) ([]byte, error) {\n\t_, name := filepath.Split(templateFile)\n\tfuncMap := helm.NewFunctionMap()\n\ttmpl, err := template.New(name).Option(\"missingkey=error\").Funcs(funcMap).ParseFiles(templateFile)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to parse Secrets template: %s\", templateFile)\n\t}\n\n\trequirementsMap, err := requirements.ToMap()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed turn requirements into a map: %v\", requirements)\n\t}\n\n\tsvcMap, err := createServiceMap(svc)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed turn Service into a map: %v\", svc)\n\t}\n\n\ttemplateData := map[string]interface{}{\n\t\t\"Requirements\": chartutil.Values(requirementsMap),\n\t\t\"Environments\": chartutil.Values(requirements.EnvironmentMap()),\n\t\t\"Service\": chartutil.Values(svcMap),\n\t}\n\tvar buf bytes.Buffer\n\terr = tmpl.Execute(&buf, templateData)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to execute Secrets template: %s\", templateFile)\n\t}\n\tdata := buf.Bytes()\n\treturn data, nil\n}", "func NewTemplate(a *config.AppConfig) {\n\tapp = a\n}", "func (o JobSpecOutput) Template() corev1.PodTemplateSpecPtrOutput {\n\treturn o.ApplyT(func(v JobSpec) *corev1.PodTemplateSpec { return v.Template }).(corev1.PodTemplateSpecPtrOutput)\n}", "func GenerateTemplate(in *GenerateTemplateInput) (*unstructured.Unstructured, error) {\n\ttemplate, found, err := unstructured.NestedMap(in.Template.Object, \"spec\", \"template\")\n\tif !found {\n\t\treturn nil, errors.Errorf(\"missing Spec.Template on %v %q\", in.Template.GroupVersionKind(), in.Template.GetName())\n\t} else if err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to retrieve Spec.Template map on %v %q\", in.Template.GroupVersionKind(), in.Template.GetName())\n\t}\n\n\t// Create the unstructured object from the template.\n\tto := &unstructured.Unstructured{Object: template}\n\tto.SetResourceVersion(\"\")\n\tto.SetFinalizers(nil)\n\tto.SetUID(\"\")\n\tto.SetSelfLink(\"\")\n\tto.SetName(names.SimpleNameGenerator.GenerateName(in.Template.GetName() + \"-\"))\n\tto.SetNamespace(in.Namespace)\n\n\t// Set annotations.\n\tannotations := to.GetAnnotations()\n\tif annotations == nil {\n\t\tannotations = map[string]string{}\n\t}\n\tfor key, value := range in.Annotations {\n\t\tannotations[key] = value\n\t}\n\tannotations[clusterv1.TemplateClonedFromNameAnnotation] = in.TemplateRef.Name\n\tannotations[clusterv1.TemplateClonedFromGroupKindAnnotation] = in.TemplateRef.GroupVersionKind().GroupKind().String()\n\tto.SetAnnotations(annotations)\n\n\t// Set labels.\n\tlabels := to.GetLabels()\n\tif labels == nil {\n\t\tlabels = map[string]string{}\n\t}\n\tfor key, value := range in.Labels {\n\t\tlabels[key] = value\n\t}\n\tlabels[clusterv1.ClusterNameLabel] = in.ClusterName\n\tto.SetLabels(labels)\n\n\t// Set the owner reference.\n\tif in.OwnerRef != nil {\n\t\tto.SetOwnerReferences([]metav1.OwnerReference{*in.OwnerRef})\n\t}\n\n\t// Set the object APIVersion.\n\tif to.GetAPIVersion() == \"\" {\n\t\tto.SetAPIVersion(in.Template.GetAPIVersion())\n\t}\n\n\t// Set the object Kind and strip the word \"Template\" if it's a suffix.\n\tif to.GetKind() == \"\" {\n\t\tto.SetKind(strings.TrimSuffix(in.Template.GetKind(), clusterv1.TemplateSuffix))\n\t}\n\treturn to, nil\n}", "func GetNewConfigJsonTemplate(cc CodeConfig) string {\n\treturn `{\n\t\"version\": \"0.1.0\",\n \"gson_api_url\": \"https://api.your-domain-goes-here.com/v1/\",\n\t\"port\": 4000,\n\t\"new_relic_key\": \"\",\n\t\"debug\": false,\n\t\"environment\": \"test\",\n\t\"test\": { {{if .IsMSSQL}}\n\t\t\"mssql\": {\n\t\t \"aws\": {\n\t\t\t\"server\": \"\",\n\t\t\t\"port\": 1433,\n\t\t\t\"dbname\": \"\",\n\t\t\t\"username\": \"\",\n\t\t\t\"password\": \"\",\n\t\t\t\"maxidleconnections\": 10,\n\t\t\t\"maxopenconnections\": 100,\n\t\t\t\"debug\": true\n\t\t }\n\t\t}\n {{else if .IsPostgresql}}\n \"postgresql\": {\n\t\t \"aws\": {\n\t\t\t\"server\": \"\",\n\t\t\t\"port\": 5432,\n\t\t\t\"dbname\": \"\",\n\t\t\t\"username\": \"\",\n\t\t\t\"password\": \"\",\n\t\t\t\"maxidleconnections\": 10,\n\t\t\t\"maxopenconnections\": 100,\n\t\t\t\"debug\": true\n\t\t }\n\t\t}\n {{else if .IsRethinkDB}}\n\t\t\"rethinkdb\": {\n\t\t \"aws\": {\n\t\t \"addresses\":\"\",\n\t\t \"dbname\": \"\",\n\t\t \"authkey\": \"\",\n\t\t \"discoverhosts\": false,\n\t\t \"maxidleconnections\": 10,\n\t\t \"maxopenconnections\": 100,\n\t\t \"debug\": true\n\t\t}\n\t}{{end}}\n }\n}`\n}", "func (m *GraphBaseServiceClient) ApplicationTemplates()(*i5310ba7d4cfddbf5de4c1be94a30f9ca8c747c30a87e76587ce88d1cbfff01b4.ApplicationTemplatesRequestBuilder) {\n return i5310ba7d4cfddbf5de4c1be94a30f9ca8c747c30a87e76587ce88d1cbfff01b4.NewApplicationTemplatesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) ApplicationTemplates()(*i5310ba7d4cfddbf5de4c1be94a30f9ca8c747c30a87e76587ce88d1cbfff01b4.ApplicationTemplatesRequestBuilder) {\n return i5310ba7d4cfddbf5de4c1be94a30f9ca8c747c30a87e76587ce88d1cbfff01b4.NewApplicationTemplatesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (h HomepageView) Template() string {\n\treturn homepageTemplate\n}", "func bootstrapTemplateNamePrefix(clusterName, machineDeploymentTopologyName string) string {\n\treturn fmt.Sprintf(\"%s-%s-\", clusterName, machineDeploymentTopologyName)\n}" ]
[ "0.66104203", "0.62430483", "0.6181528", "0.5889446", "0.5800052", "0.5718424", "0.57043046", "0.5691173", "0.5610317", "0.55718684", "0.55622894", "0.55551803", "0.5541451", "0.5521334", "0.552102", "0.55036914", "0.54525316", "0.5449506", "0.5407434", "0.53958434", "0.5381018", "0.53795797", "0.5367484", "0.53517246", "0.5337723", "0.53149647", "0.5312361", "0.5281451", "0.52747667", "0.52692574", "0.52322567", "0.52318746", "0.5229898", "0.5220442", "0.5202976", "0.5191993", "0.5168165", "0.51596093", "0.51593274", "0.51592934", "0.51581573", "0.5157146", "0.51528233", "0.5145683", "0.51416636", "0.5135514", "0.5133373", "0.5130337", "0.5129962", "0.5120466", "0.5110705", "0.510791", "0.510181", "0.5101209", "0.5090359", "0.5081451", "0.5077539", "0.5072091", "0.50674736", "0.5049485", "0.50455123", "0.5044974", "0.50220865", "0.5021001", "0.5020366", "0.5019332", "0.50158536", "0.5007487", "0.5002337", "0.4993123", "0.49876386", "0.49827975", "0.4980141", "0.49798107", "0.49765894", "0.49701163", "0.49690217", "0.4966978", "0.49615794", "0.49564326", "0.49537757", "0.49530286", "0.4951239", "0.49508792", "0.4947988", "0.49467796", "0.49408635", "0.4937677", "0.49302393", "0.49270433", "0.49262828", "0.49177355", "0.4911413", "0.49103093", "0.4902091", "0.49007088", "0.48960316", "0.48960316", "0.48897985", "0.48879963" ]
0.8097465
0
Parameters returns the list of CloudFormation parameters used by the template.
func (s *BackendService) Parameters() ([]*cloudformation.Parameter, error) { return append(s.svc.Parameters(), []*cloudformation.Parameter{ { ParameterKey: aws.String(BackendServiceContainerPortParamKey), ParameterValue: aws.String(strconv.FormatUint(uint64(aws.Uint16Value(s.manifest.BackendServiceConfig.Image.Port)), 10)), }, }...), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (e *ComponentStackConfig) Parameters() []*cloudformation.Parameter {\n\treturn []*cloudformation.Parameter{}\n}", "func Params(s CAPITemplateSpec) ([]string, error) {\n\tproc := processor.NewSimpleProcessor()\n\tvariables := map[string]bool{}\n\tfor _, v := range s.ResourceTemplates {\n\t\ttv, err := proc.GetVariables(v.RawExtension.Raw)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"processing template: %w\", err)\n\t\t}\n\t\tfor _, n := range tv {\n\t\t\tvariables[n] = true\n\t\t}\n\t}\n\tvar names []string\n\tfor k := range variables {\n\t\tnames = append(names, k)\n\t}\n\tsort.Strings(names)\n\treturn names, nil\n}", "func (tr *CapacityProvider) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (a *Amazon) Parameters() map[string]string {\n\tp := map[string]string{\n\t\t\"name\": a.Name(),\n\t\t\"cloud\": a.Cloud(),\n\t\t\"public_zone\": a.conf.Amazon.PublicZone,\n\t\t\"bucket_prefix\": a.conf.Amazon.BucketPrefix,\n\t}\n\tif a.conf.Amazon.VaultPath != \"\" {\n\t\tp[\"vault_path\"] = a.conf.Amazon.VaultPath\n\t}\n\tif a.conf.Amazon.Profile != \"\" {\n\t\tp[\"amazon_profile\"] = a.conf.Amazon.Profile\n\t}\n\treturn p\n}", "func (tr *Cluster) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (c *providerConstructor) ParameterList() parameterList {\n\treturn c.params\n}", "func (tr *Account) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *Service) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *SQLContainer) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *Table) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *TaskDefinition) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *CassandraTable) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (s *BackendService) SerializedParameters() (string, error) {\n\treturn s.svc.templateConfiguration(s)\n}", "func (tr *CassandraKeySpace) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *MongoCollection) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (o BuildSpecOutput) Parameters() BuildSpecParametersArrayOutput {\n\treturn o.ApplyT(func(v BuildSpec) []BuildSpecParameters { return v.Parameters }).(BuildSpecParametersArrayOutput)\n}", "func GetParameters(p []string) []*cloudformation.Parameter {\n\tvar parameters []*cloudformation.Parameter\n\tfor _, val := range p {\n\t\tif strings.Contains(val, \"=\") {\n\t\t\tstrKeyPair := strings.Split(val, \"=\")\n\t\t\tif strings.Compare(strKeyPair[1], \"\") == 0 || strings.Compare(strKeyPair[1], \"nil\") == 0 {\n\t\t\t\tlog.Warn(\"Skipping blank parameter [%v]\", strKeyPair[0])\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tparameters = append(parameters, &cloudformation.Parameter{\n\t\t\t\t\tParameterKey: &strKeyPair[0],\n\t\t\t\t\tParameterValue: &strKeyPair[1],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\treturn parameters\n}", "func (r *Document) Parameters() pulumi.ArrayOutput {\n\treturn (pulumi.ArrayOutput)(r.s.State[\"parameters\"])\n}", "func (tr *SQLTrigger) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func GetTemplateParams(w http.ResponseWriter, r *http.Request) {\n\tvar vars []string\n\tenv := envFromRequest(r)\n\n\tfilterBlacklist := func(s string) bool {\n\t\treturn !utils.StringInSlice(s, env.ParamsBlacklist)\n\t}\n\n\tscript := r.URL.Query().Get(\"script\")\n\tif script == \"\" {\n\t\thttp.Error(w, \"Required script parameter\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tenvName := r.URL.Query().Get(\"environment\")\n\tif envName == \"\" {\n\t\tenvName = \"default\"\n\t}\n\n\tvars = utils.Filter(env.Templates.ListVariables(script, envName), filterBlacklist)\n\n\tmarshaled, err := json.Marshal(vars)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(marshaled)\n}", "func (o ApplicationSpecSourceHelmOutput) Parameters() ApplicationSpecSourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationSpecSourceHelm) []ApplicationSpecSourceHelmParameters { return v.Parameters }).(ApplicationSpecSourceHelmParametersArrayOutput)\n}", "func (o EntitlementOutput) Parameters() GoogleCloudChannelV1ParameterResponseArrayOutput {\n\treturn o.ApplyT(func(v *Entitlement) GoogleCloudChannelV1ParameterResponseArrayOutput { return v.Parameters }).(GoogleCloudChannelV1ParameterResponseArrayOutput)\n}", "func (m *Immutable) Parameters() map[string]string {\n\treturn m.contained.Parameters()\n}", "func (t *Tables) Parameters(ctx context.Context, req *epb.ParametersRequest) (*epb.ParametersReply, error) {\n\treturn nil, nil\n}", "func (o InstanceFromTemplateOutput) Params() InstanceFromTemplateParamsOutput {\n\treturn o.ApplyT(func(v *InstanceFromTemplate) InstanceFromTemplateParamsOutput { return v.Params }).(InstanceFromTemplateParamsOutput)\n}", "func (o ApplicationSpecSourceKsonnetOutput) Parameters() ApplicationSpecSourceKsonnetParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationSpecSourceKsonnet) []ApplicationSpecSourceKsonnetParameters { return v.Parameters }).(ApplicationSpecSourceKsonnetParametersArrayOutput)\n}", "func (c *common) Parameters() sbcon.Parameters { return c.params }", "func mapParameters(parameters []types.Parameter) []*cloudformation.Parameter {\n\treturnParams := make([]*cloudformation.Parameter, 0)\n\tfor _, p := range parameters {\n\t\treturnParams = append(returnParams, &cloudformation.Parameter{\n\t\t\tParameterKey: aws.String(p.ParameterKey),\n\t\t\tParameterValue: aws.String(p.ParameterValue),\n\t\t})\n\t}\n\n\treturn returnParams\n}", "func (k *ksonnetApp) ListParams(environment string) ([]*v1alpha1.KsonnetParameter, error) {\n\targs := []string{\"param\", \"list\", \"--output\", \"json\"}\n\tif environment != \"\" {\n\t\targs = append(args, \"--env\", environment)\n\t}\n\tout, err := k.ksCmd(args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Auxiliary data to hold unmarshaled JSON output, which may use different field names\n\tvar ksParams struct {\n\t\tData []struct {\n\t\t\tComponent string `json:\"component\"`\n\t\t\tKey string `json:\"param\"`\n\t\t\tValue string `json:\"value\"`\n\t\t} `json:\"data\"`\n\t}\n\tif err := json.Unmarshal([]byte(out), &ksParams); err != nil {\n\t\treturn nil, err\n\t}\n\tvar params []*v1alpha1.KsonnetParameter\n\tfor _, ksParam := range ksParams.Data {\n\t\tvalue := strings.Trim(ksParam.Value, `'\"`)\n\t\tparams = append(params, &v1alpha1.KsonnetParameter{\n\t\t\tComponent: ksParam.Component,\n\t\t\tName: ksParam.Key,\n\t\t\tValue: value,\n\t\t})\n\t}\n\treturn params, nil\n}", "func (tr *SQLFunction) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (o BuildSpecPtrOutput) Parameters() BuildSpecParametersArrayOutput {\n\treturn o.ApplyT(func(v *BuildSpec) []BuildSpecParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(BuildSpecParametersArrayOutput)\n}", "func (tr *NotebookWorkspace) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (in *RecordSetGroup) GetParameters() map[string]string {\n\tparams := map[string]string{}\n\tcfnencoder.MarshalTypes(params, in.Spec, \"Parameter\")\n\treturn params\n}", "func (tr *MongoDatabase) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (o LookupEntitlementResultOutput) Parameters() GoogleCloudChannelV1ParameterResponseArrayOutput {\n\treturn o.ApplyT(func(v LookupEntitlementResult) []GoogleCloudChannelV1ParameterResponse { return v.Parameters }).(GoogleCloudChannelV1ParameterResponseArrayOutput)\n}", "func (o ApplicationSpecSourceHelmPtrOutput) Parameters() ApplicationSpecSourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationSpecSourceHelm) []ApplicationSpecSourceHelmParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(ApplicationSpecSourceHelmParametersArrayOutput)\n}", "func (c *Constructor) Parameters() []reflect.Type {\n\tif c == nil {\n\t\treturn nil\n\t}\n\ttypes := make([]reflect.Type, len(c.inTypes))\n\tcopy(types, c.inTypes)\n\treturn types\n}", "func (s *System) Parameters() []float32 {\n\treturn s.parametersVector\n}", "func (tr *SQLDatabase) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (f *PushFilter) Parameters() url.Values {\n\n\tif f.Params == nil {\n\t\treturn nil\n\t}\n\n\tout := url.Values{}\n\tfor k, v := range f.Params {\n\t\tout[k] = v\n\t}\n\n\treturn out\n}", "func (w *Where) Parameters() []interface{} {\n\treturn w.params\n}", "func (a *Affine) Parameters() []*anydiff.Var {\n\treturn []*anydiff.Var{a.Scalers, a.Biases}\n}", "func (o ApplicationSpecSourceKsonnetPtrOutput) Parameters() ApplicationSpecSourceKsonnetParametersArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationSpecSourceKsonnet) []ApplicationSpecSourceKsonnetParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(ApplicationSpecSourceKsonnetParametersArrayOutput)\n}", "func (tr *GremlinDatabase) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (temp *Template) ListRequest() (ListCommand, error) {\n\treq := &ListTemplates{\n\t\tName: temp.Name,\n\t\tAccount: temp.Account,\n\t\tDomainID: temp.DomainID,\n\t\tID: temp.ID,\n\t\tProjectID: temp.ProjectID,\n\t\tZoneID: temp.ZoneID,\n\t\tHypervisor: temp.Hypervisor,\n\t\t//TODO Tags\n\t}\n\tif temp.IsFeatured {\n\t\treq.TemplateFilter = \"featured\"\n\t}\n\tif temp.Removed != \"\" {\n\t\t*req.ShowRemoved = true\n\t}\n\n\treturn req, nil\n}", "func (p *OnuTcontProfile) ListEssentialParams() map[string]interface{} {\r\n\tvar EssentialOnuTcontProfile = map[string]interface{}{\r\n\t\tOnuTcontProfileHeaders[0]: p.GetName(),\r\n\t\tOnuTcontProfileHeaders[1]: p.GenerateTcontName(),\r\n\t\tOnuTcontProfileHeaders[2]: p.TcontType,\r\n\t\tOnuTcontProfileHeaders[3]: p.TcontID,\r\n\t\tOnuTcontProfileHeaders[4]: formatKbits(p.FixedDataRate),\r\n\t\tOnuTcontProfileHeaders[5]: formatKbits(p.AssuredDataRate),\r\n\t\tOnuTcontProfileHeaders[6]: formatKbits(p.MaxDataRate),\r\n\t}\r\n\r\n\treturn EssentialOnuTcontProfile\r\n}", "func (o *ParameterContextDTO) GetParameters() []ParameterEntity {\n\tif o == nil || o.Parameters == nil {\n\t\tvar ret []ParameterEntity\n\t\treturn ret\n\t}\n\treturn *o.Parameters\n}", "func (o SettingsSectionDescriptionOutput) Parameters() SettingsParameterDescriptionArrayOutput {\n\treturn o.ApplyT(func(v SettingsSectionDescription) []SettingsParameterDescription { return v.Parameters }).(SettingsParameterDescriptionArrayOutput)\n}", "func (r *resolver) templateParams(s *scope, l ast.TemplateParams) ([]sem.TemplateParam, error) {\n\tout := []sem.TemplateParam{}\n\tfor _, ast := range l {\n\t\tparam, err := r.templateParam(ast)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ts.declare(param, ast.Source)\n\t\tout = append(out, param)\n\t}\n\treturn out, nil\n}", "func (l *Layer) Parameters() []*autofunc.Variable {\n\treturn []*autofunc.Variable{l.Biases, l.Scales}\n}", "func (o DatasetAzureBlobOutput) Parameters() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *DatasetAzureBlob) pulumi.StringMapOutput { return v.Parameters }).(pulumi.StringMapOutput)\n}", "func (o LinkedServiceAzureTableStorageOutput) Parameters() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *LinkedServiceAzureTableStorage) pulumi.StringMapOutput { return v.Parameters }).(pulumi.StringMapOutput)\n}", "func getParameters(c *cli.Context) error {\n\tif !isSystemRunning() {\n\t\treturn nil\n\t}\n\t_, _, _, controllers := getIPAddresses()\n\n\tparams := sendCommandToControllers(controllers, \"GetParams\", \"\")\n\tfmt.Println(params)\n\n\treturn nil\n}", "func (o ApplicationStatusSyncComparedToSourceHelmOutput) Parameters() ApplicationStatusSyncComparedToSourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusSyncComparedToSourceHelm) []ApplicationStatusSyncComparedToSourceHelmParameters {\n\t\treturn v.Parameters\n\t}).(ApplicationStatusSyncComparedToSourceHelmParametersArrayOutput)\n}", "func (o ApplicationOperationSyncSourceHelmOutput) Parameters() ApplicationOperationSyncSourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationOperationSyncSourceHelm) []ApplicationOperationSyncSourceHelmParameters {\n\t\treturn v.Parameters\n\t}).(ApplicationOperationSyncSourceHelmParametersArrayOutput)\n}", "func (o ApplicationStatusSyncComparedToSourceHelmPtrOutput) Parameters() ApplicationStatusSyncComparedToSourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationStatusSyncComparedToSourceHelm) []ApplicationStatusSyncComparedToSourceHelmParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(ApplicationStatusSyncComparedToSourceHelmParametersArrayOutput)\n}", "func (o ApiOperationTemplateParameterOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ApiOperationTemplateParameter) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "func (o ApplicationOperationSyncSourceHelmPtrOutput) Parameters() ApplicationOperationSyncSourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationOperationSyncSourceHelm) []ApplicationOperationSyncSourceHelmParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(ApplicationOperationSyncSourceHelmParametersArrayOutput)\n}", "func (tr *SQLStoredProcedure) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *GremlinGraph) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (c *compileCtx) compileParameters(parameters map[string]*openapi.Parameter) error {\n\tc.phase = phaseCompileDefinitions\n\tfor ref, param := range parameters {\n\t\t_, s, err := c.compileParameterToSchema(param)\n\t\tm, err := c.compileSchema(camelCase(ref), s)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, `failed to compile #/parameters/%s`, ref)\n\t\t}\n\n\t\tpname := m.Name()\n\t\trepeated := false\n\n\t\t// Now this is really really annoying, but sometimes the values in\n\t\t// #/parameters/* contains a \"name\" field, which is the name used\n\t\t// for parameters...\n\t\tif v := param.Name; v != \"\" {\n\t\t\tpname = v\n\t\t}\n\n\t\t// Now this REALLY REALLY sucks, but we need to detect if the parameter\n\t\t// should be \"repeated\" by detecting if the enclosing type is an array.\n\t\tif param.Items != nil {\n\t\t\trepeated = true\n\t\t}\n\n\t\tm = &Parameter{\n\t\t\tType: m,\n\t\t\tparameterName: pname,\n\t\t\trepeated: repeated,\n\t\t}\n\t\tc.addDefinition(\"#/parameters/\"+ref, m)\n\t}\n\treturn nil\n}", "func (o AssociationOutput) Parameters() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *Association) pulumi.StringMapOutput { return v.Parameters }).(pulumi.StringMapOutput)\n}", "func (s *service) List(ctx context.Context) ([]*model.FormationConstraint, error) {\n\tformationConstraints, err := s.repo.ListAll(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"while listing all Formation Constraints\")\n\t}\n\treturn formationConstraints, nil\n}", "func (o ApplicationStatusOperationStateOperationSyncSourceHelmOutput) Parameters() ApplicationStatusOperationStateOperationSyncSourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusOperationStateOperationSyncSourceHelm) []ApplicationStatusOperationStateOperationSyncSourceHelmParameters {\n\t\treturn v.Parameters\n\t}).(ApplicationStatusOperationStateOperationSyncSourceHelmParametersArrayOutput)\n}", "func (p *Porter) ListParameters(ctx context.Context, opts ListOptions) ([]DisplayParameterSet, error) {\n\tlistOpts := storage.ListOptions{\n\t\tNamespace: opts.GetNamespace(),\n\t\tName: opts.Name,\n\t\tLabels: opts.ParseLabels(),\n\t\tSkip: opts.Skip,\n\t\tLimit: opts.Limit,\n\t}\n\tresults, err := p.Parameters.ListParameterSets(ctx, listOpts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdisplayResults := make([]DisplayParameterSet, len(results))\n\tfor i, ps := range results {\n\t\tdisplayResults[i] = NewDisplayParameterSet(ps)\n\t}\n\n\treturn displayResults, nil\n}", "func (o SystemParameterRuleOutput) Parameters() SystemParameterArrayOutput {\n\treturn o.ApplyT(func(v SystemParameterRule) []SystemParameter { return v.Parameters }).(SystemParameterArrayOutput)\n}", "func (o ApiOperationRequestRepresentationOutput) FormParameters() ApiOperationRequestRepresentationFormParameterArrayOutput {\n\treturn o.ApplyT(func(v ApiOperationRequestRepresentation) []ApiOperationRequestRepresentationFormParameter {\n\t\treturn v.FormParameters\n\t}).(ApiOperationRequestRepresentationFormParameterArrayOutput)\n}", "func (o ApplicationOperationSyncSourceKsonnetOutput) Parameters() ApplicationOperationSyncSourceKsonnetParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationOperationSyncSourceKsonnet) []ApplicationOperationSyncSourceKsonnetParameters {\n\t\treturn v.Parameters\n\t}).(ApplicationOperationSyncSourceKsonnetParametersArrayOutput)\n}", "func (o ApplicationStatusSyncComparedToSourceKsonnetOutput) Parameters() ApplicationStatusSyncComparedToSourceKsonnetParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusSyncComparedToSourceKsonnet) []ApplicationStatusSyncComparedToSourceKsonnetParameters {\n\t\treturn v.Parameters\n\t}).(ApplicationStatusSyncComparedToSourceKsonnetParametersArrayOutput)\n}", "func validateTriggerTemplateParameters(trigger *v1alpha1.Trigger) error {\n\tif trigger.Parameters != nil {\n\t\tfor i, parameter := range trigger.Parameters {\n\t\t\tif err := validateTriggerParameter(&parameter); err != nil {\n\t\t\t\treturn errors.Errorf(\"template parameter index: %d. err: %+v\", i, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (o ApplicationStatusOperationStateOperationSyncSourceHelmPtrOutput) Parameters() ApplicationStatusOperationStateOperationSyncSourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationStatusOperationStateOperationSyncSourceHelm) []ApplicationStatusOperationStateOperationSyncSourceHelmParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(ApplicationStatusOperationStateOperationSyncSourceHelmParametersArrayOutput)\n}", "func (n *Norm) Parameters() []*autofunc.Variable {\n\tres := make([]*autofunc.Variable, len(n.Weights)+len(n.Mags))\n\tcopy(res, n.Weights)\n\tcopy(res[len(n.Weights):], n.Mags)\n\n\tnormRes, rv := n.newNormRResult(autofunc.RVector{})\n\tnet := n.Creator.Create(normRes.NormPool)\n\tparams := net.Parameters()\n\tfor _, param := range params {\n\t\tif _, ok := rv[param]; !ok {\n\t\t\tres = append(res, param)\n\t\t}\n\t}\n\n\treturn res\n}", "func (o SettingsSectionDescriptionResponseOutput) Parameters() SettingsParameterDescriptionResponseArrayOutput {\n\treturn o.ApplyT(func(v SettingsSectionDescriptionResponse) []SettingsParameterDescriptionResponse { return v.Parameters }).(SettingsParameterDescriptionResponseArrayOutput)\n}", "func (r *BlockSeqFunc) Parameters() []*autofunc.Variable {\n\tif l, ok := r.Block.(sgd.Learner); ok {\n\t\treturn l.Parameters()\n\t} else {\n\t\treturn nil\n\t}\n}", "func (a *AddMixer) Parameters() []*anydiff.Var {\n\tvar res []*anydiff.Var\n\tfor _, v := range []Layer{a.In1, a.In2, a.Out} {\n\t\tif p, ok := v.(Parameterizer); ok {\n\t\t\tres = append(res, p.Parameters()...)\n\t\t}\n\t}\n\treturn res\n}", "func (o ApplicationStatusOperationStateSyncResultSourceHelmOutput) Parameters() ApplicationStatusOperationStateSyncResultSourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusOperationStateSyncResultSourceHelm) []ApplicationStatusOperationStateSyncResultSourceHelmParameters {\n\t\treturn v.Parameters\n\t}).(ApplicationStatusOperationStateSyncResultSourceHelmParametersArrayOutput)\n}", "func (o ApplicationOperationSyncSourceKsonnetPtrOutput) Parameters() ApplicationOperationSyncSourceKsonnetParametersArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationOperationSyncSourceKsonnet) []ApplicationOperationSyncSourceKsonnetParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(ApplicationOperationSyncSourceKsonnetParametersArrayOutput)\n}", "func (r *AWSRedshiftClusterParameterGroup_Parameter) AWSCloudFormationType() string {\n\treturn \"AWS::Redshift::ClusterParameterGroup.Parameter\"\n}", "func ParamsList() string {\n\treturn `brokers=comma,delimited,host:ports\ntls.enabled=boolean\ntls.ca=/path/to/ca.pem\ntls.cert=/path/to/cert.pem\ntls.key=/path/to/key.pem\nsasl.mechanism=SCRAM-SHA-256 or SCRAM-SHA-512\nuser=username\npass=password\nadmin.hosts=comma,delimited,host:ports\nadmin.tls.enabled=boolean\nadmin.tls.ca=/path/to/ca.pem\nadmin.tls.cert=/path/to/cert.pem\nadmin.tls.key=/path/to/key.pem\nregistry.hosts=comma,delimited,host:ports\nregistry.tls.enabled=boolean\nregistry.tls.ca=/path/to/ca.pem\nregistry.tls.cert=/path/to/cert.pem\nregistry.tls.key=/path/to/key.pem\ncloud.client_id=somestring\ncloud.client_secret=somelongerstring\nglobals.prompt=\"%n\"\nglobals.no_default_cluster=boolean\nglobals.dial_timeout=duration(3s,1m,2h)\nglobals.request_timeout_overhead=duration(10s,1m,2h)\nglobals.retry_timeout=duration(30s,1m,2h)\nglobals.fetch_max_wait=duration(5s,1m,2h)\nglobals.kafka_protocol_request_client_id=rpk\n`\n}", "func (o ApplicationStatusSyncComparedToSourceKsonnetPtrOutput) Parameters() ApplicationStatusSyncComparedToSourceKsonnetParametersArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationStatusSyncComparedToSourceKsonnet) []ApplicationStatusSyncComparedToSourceKsonnetParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(ApplicationStatusSyncComparedToSourceKsonnetParametersArrayOutput)\n}", "func addParameters(p *[]*cloudformation.Parameter, key string, values []string) {\n\n\tfor _, values := range values {\n\t\t*p = append(*p, &cloudformation.Parameter{\n\t\t\tParameterKey: &key,\n\t\t\tParameterValue: &values,\n\t\t\tResolvedValue: nil,\n\t\t\tUsePreviousValue: nil,\n\t\t})\n\t}\n}", "func (parser *Parser) parameters() ([]*Declaration, error) {\n\tparser.trace(\"PARAMETERS\")\n\tdefer parser.untrace()\n\tparam, err := parser.parameter()\n\t// empty, not an error\n\tif err == ErrNoMatch {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmoreParams, err := parser.moreParams()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparams := []*Declaration{param}\n\tif moreParams != nil {\n\t\tparams = append(params, moreParams...)\n\t}\n\treturn params, nil\n}", "func (f Function) Params() []Parameter {\n\tnew := make([]Parameter, len(f.spec.Params))\n\tcopy(new, f.spec.Params)\n\treturn new\n}", "func (o BuildRunStatusBuildSpecOutput) Parameters() BuildRunStatusBuildSpecParametersArrayOutput {\n\treturn o.ApplyT(func(v BuildRunStatusBuildSpec) []BuildRunStatusBuildSpecParameters { return v.Parameters }).(BuildRunStatusBuildSpecParametersArrayOutput)\n}", "func (o ApplicationStatusOperationStateSyncResultSourceHelmPtrOutput) Parameters() ApplicationStatusOperationStateSyncResultSourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationStatusOperationStateSyncResultSourceHelm) []ApplicationStatusOperationStateSyncResultSourceHelmParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(ApplicationStatusOperationStateSyncResultSourceHelmParametersArrayOutput)\n}", "func (m KafkaPlugin) Parameters() plugin.Parameters {\n\tparams := plugin.NewParameters()\n\n\tparams.Add(\"message\", plugin.TextParameter, \"Kafka Message\", `{\n \"project\" : \"{{.cds.project}}\",\n \"application\" : \"{{.cds.application}}\",\n \"pipeline\" : \"{{.cds.pipeline}}\",\n \"version\" : \"{{.cds.version}}\"\n}`)\n\tparams.Add(\"kafkaUser\", plugin.StringParameter, \"Kafka User\", \"{{.cds.proj.kafkaUser}}\")\n\tparams.Add(\"kafkaPassword\", plugin.StringParameter, \"Kafka Password\", \"{{.cds.proj.kafkaPassword}}\")\n\tparams.Add(\"kafkaGroup\", plugin.StringParameter, \"Kafka Consumer Group (used for acknowledgment)\", \"{{.cds.proj.kafkaGroup}}\")\n\tparams.Add(\"kafkaAddresses\", plugin.StringParameter, \"Kafka Addresses\", \"{{.cds.proj.kafkaAddresses}}\")\n\tparams.Add(\"topic\", plugin.StringParameter, \"Kafka Topic\", \"{{.cds.env.kafkaTopic}}\")\n\tparams.Add(\"artifacts\", plugin.StringParameter, \"Artifacts list (comma separated)\", \"\")\n\tparams.Add(\"publicKey\", plugin.StringParameter, \"GPG Public Key (ASCII armored format)\", \"{{.cds.proj.gpgPubAsc}}\")\n\tparams.Add(\"key\", plugin.StringParameter, \"Key used by AES Encryption. It have to be the same value as --key on plugin binary\", \"\")\n\tparams.Add(\"waitForAck\", plugin.BooleanParameter, `Wait for Ack`, \"true\")\n\tparams.Add(\"waitForAckTopic\", plugin.StringParameter, `Kafka Topic. Used only if \"waitForAck\" is true.`, \"{{.cds.env.kafkaAckTopic}}\")\n\tparams.Add(\"waitForAckTimeout\", plugin.NumberParameter, `Ack timeout (seconds). Used only if \"waitForAck\" is true.`, \"120\")\n\n\treturn params\n}", "func (o ApplicationStatusOperationStateOperationSyncSourceKsonnetOutput) Parameters() ApplicationStatusOperationStateOperationSyncSourceKsonnetParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusOperationStateOperationSyncSourceKsonnet) []ApplicationStatusOperationStateOperationSyncSourceKsonnetParameters {\n\t\treturn v.Parameters\n\t}).(ApplicationStatusOperationStateOperationSyncSourceKsonnetParametersArrayOutput)\n}", "func (params *QueueParams) CreateParams() []*cloudformation.Parameter {\n\tstackParams := []*cloudformation.Parameter{}\n\tif params.DelaySeconds != nil {\n\t\tstackParams = append(stackParams, mkParameter(ParamDelaySeconds, *params.DelaySeconds))\n\t}\n\tif params.MaximumMessageSize != nil {\n\t\tstackParams = append(stackParams, mkParameter(ParamMaximumMessageSize, *params.MaximumMessageSize))\n\t}\n\tif params.MessageRetentionPeriod != nil {\n\t\tstackParams = append(stackParams, mkParameter(ParamMessageRetentionPeriod, *params.MessageRetentionPeriod))\n\t}\n\tif params.ReceiveMessageWaitTimeSeconds != nil {\n\t\tstackParams = append(stackParams, mkParameter(ParamReceiveMessageWaitTimeSeconds, *params.ReceiveMessageWaitTimeSeconds))\n\t}\n\tif params.RedriveMaxReceiveCount != nil {\n\t\tstackParams = append(stackParams, mkParameter(ParamRedriveMaxReceiveCount, *params.RedriveMaxReceiveCount))\n\t}\n\tif params.VisibilityTimeout != nil {\n\t\tstackParams = append(stackParams, mkParameter(ParamVisibilityTimeout, *params.VisibilityTimeout))\n\t}\n\treturn stackParams\n}", "func (r *Client) validateTemplateParams(t *Template, params []*Parameter) error {\n\tmissing := map[string]interface{}{}\n\t// copy all wanted params into missing\n\tfor k, v := range t.Parameters {\n\t\tmissing[k] = v\n\t}\n\t// remove items from missing list as found\n\tfor wantedKey := range t.Parameters {\n\t\tfor _, param := range params {\n\t\t\tif param.ParameterKey == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// phew found it\n\t\t\tif *param.ParameterKey == wantedKey {\n\t\t\t\tdelete(missing, wantedKey)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\t// if any left, then we have an issue\n\tif len(missing) > 0 {\n\t\tkeys := []string{}\n\t\tfor k := range missing {\n\t\t\tkeys = append(keys, k)\n\t\t}\n\t\tkeysCSV := strings.Join(keys, \",\")\n\t\treturn fmt.Errorf(\"missing required input parameters: [%s]\", keysCSV)\n\t}\n\treturn nil\n}", "func (r *AWSDataPipelinePipeline_ParameterAttribute) AWSCloudFormationType() string {\n\treturn \"AWS::DataPipeline::Pipeline.ParameterAttribute\"\n}", "func (i *Interest) ApplicationParameters() []tlv.Block {\n\tparams := make([]tlv.Block, 0, len(i.parameters))\n\tfor _, param := range i.parameters {\n\t\tparams = append(params, *param)\n\t}\n\treturn params\n}", "func (o ApplicationStatusHistorySourceKsonnetOutput) Parameters() ApplicationStatusHistorySourceKsonnetParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusHistorySourceKsonnet) []ApplicationStatusHistorySourceKsonnetParameters {\n\t\treturn v.Parameters\n\t}).(ApplicationStatusHistorySourceKsonnetParametersArrayOutput)\n}", "func (o ApplicationStatusHistorySourceHelmOutput) Parameters() ApplicationStatusHistorySourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusHistorySourceHelm) []ApplicationStatusHistorySourceHelmParameters {\n\t\treturn v.Parameters\n\t}).(ApplicationStatusHistorySourceHelmParametersArrayOutput)\n}", "func (o *CreateInstance) GetParameters() CreateInstanceParameters {\n\tif o == nil || IsNil(o.Parameters) {\n\t\tvar ret CreateInstanceParameters\n\t\treturn ret\n\t}\n\treturn *o.Parameters\n}", "func (o ApiOperationResponseRepresentationOutput) FormParameters() ApiOperationResponseRepresentationFormParameterArrayOutput {\n\treturn o.ApplyT(func(v ApiOperationResponseRepresentation) []ApiOperationResponseRepresentationFormParameter {\n\t\treturn v.FormParameters\n\t}).(ApiOperationResponseRepresentationFormParameterArrayOutput)\n}", "func (m *StepData) GetContextParameterFilters() StepFilters {\n\tvar filters StepFilters\n\tcontextFilters := []string{}\n\tfor _, secret := range m.Spec.Inputs.Secrets {\n\t\tcontextFilters = append(contextFilters, secret.Name)\n\t}\n\n\tif len(m.Spec.Inputs.Resources) > 0 {\n\t\tfor _, res := range m.Spec.Inputs.Resources {\n\t\t\tif res.Type == \"stash\" {\n\t\t\t\tcontextFilters = append(contextFilters, \"stashContent\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif len(m.Spec.Containers) > 0 {\n\t\tparameterKeys := []string{\"containerCommand\", \"containerShell\", \"dockerEnvVars\", \"dockerImage\", \"dockerName\", \"dockerOptions\", \"dockerPullImage\", \"dockerVolumeBind\", \"dockerWorkspace\", \"dockerRegistryUrl\", \"dockerRegistryCredentialsId\"}\n\t\tfor _, container := range m.Spec.Containers {\n\t\t\tfor _, condition := range container.Conditions {\n\t\t\t\tfor _, dependentParam := range condition.Params {\n\t\t\t\t\tparameterKeys = append(parameterKeys, dependentParam.Value)\n\t\t\t\t\tparameterKeys = append(parameterKeys, dependentParam.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// ToDo: append dependentParam.Value & dependentParam.Name only according to correct parameter scope and not generally\n\t\tcontextFilters = append(contextFilters, parameterKeys...)\n\t}\n\tif len(m.Spec.Sidecars) > 0 {\n\t\t//ToDo: support fallback for \"dockerName\" configuration property -> via aliasing?\n\t\tcontextFilters = append(contextFilters, []string{\"containerName\", \"containerPortMappings\", \"dockerName\", \"sidecarEnvVars\", \"sidecarImage\", \"sidecarName\", \"sidecarOptions\", \"sidecarPullImage\", \"sidecarReadyCommand\", \"sidecarVolumeBind\", \"sidecarWorkspace\"}...)\n\t\t//ToDo: add condition param.Value and param.Name to filter as for Containers\n\t}\n\n\tcontextFilters = addVaultContextParametersFilter(m, contextFilters)\n\n\tif len(contextFilters) > 0 {\n\t\tfilters.All = append(filters.All, contextFilters...)\n\t\tfilters.General = append(filters.General, contextFilters...)\n\t\tfilters.Steps = append(filters.Steps, contextFilters...)\n\t\tfilters.Stages = append(filters.Stages, contextFilters...)\n\t\tfilters.Parameters = append(filters.Parameters, contextFilters...)\n\t\tfilters.Env = append(filters.Env, contextFilters...)\n\n\t}\n\treturn filters\n}", "func (o ApplicationStatusHistorySourceHelmPtrOutput) Parameters() ApplicationStatusHistorySourceHelmParametersArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationStatusHistorySourceHelm) []ApplicationStatusHistorySourceHelmParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(ApplicationStatusHistorySourceHelmParametersArrayOutput)\n}", "func (m *StepData) GetResourceParameters(path, name string) map[string]interface{} {\n\tresourceParams := map[string]interface{}{}\n\n\tfor _, param := range m.Spec.Inputs.Parameters {\n\t\tfor _, res := range param.ResourceRef {\n\t\t\tif res.Name == name {\n\t\t\t\tif val := getParameterValue(path, res, param); val != nil {\n\t\t\t\t\tresourceParams[param.Name] = val\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resourceParams\n}", "func createDNSInputParameters(input *handler.DNSInput) *map[string]string {\n\t//we need to convert this (albeit awkwardly for the time being) to Cloudformation Parameters\n\t//we do as such first by converting everything to a key value map\n\t//key being the CF Param name, value is the value to provide to the cloudformation template\n\tparameterMap := make(map[string]string, 0)\n\t//todo-refactor this bloody hardcoded mess\n\tparameterMap[domainNameParam] = input.HostedZone\n\tparameterMap[environmentParam] = input.Environment\n\tparameterMap[hostedZoneExistsParam] = input.HostedZoneExists\n\tparameterMap[fullDomainName] = input.FullDomainName\n\tparameterMap[clientSiteName] = input.ClientSiteName\n\n\treturn &parameterMap\n\n}", "func (StudentsT) NumParameters() int {\n\treturn 3\n}" ]
[ "0.7125019", "0.65790087", "0.6148231", "0.6108887", "0.6071374", "0.6043559", "0.60375744", "0.59913456", "0.5950139", "0.5897704", "0.5883349", "0.5874525", "0.5860929", "0.5825025", "0.5786588", "0.5748372", "0.57414997", "0.5733369", "0.56321555", "0.5625743", "0.5623877", "0.5622007", "0.56003565", "0.55961466", "0.5591121", "0.55910325", "0.55894184", "0.55850387", "0.5573473", "0.5569926", "0.5569586", "0.55558586", "0.54997873", "0.5497689", "0.5488057", "0.5468146", "0.5460404", "0.54493797", "0.544737", "0.5422998", "0.5422124", "0.54098576", "0.5394356", "0.5379277", "0.5321505", "0.52996004", "0.52917403", "0.52702093", "0.5254588", "0.52423435", "0.52409744", "0.5239031", "0.52387124", "0.523042", "0.5229295", "0.51969725", "0.51930726", "0.5183107", "0.51720244", "0.5169924", "0.51646864", "0.514323", "0.513746", "0.51230615", "0.511219", "0.5108541", "0.50946045", "0.5060578", "0.5058541", "0.50518006", "0.5030842", "0.5020512", "0.5018467", "0.5014709", "0.49883395", "0.49847043", "0.49823913", "0.4975361", "0.49700886", "0.49670112", "0.49555725", "0.4954002", "0.49499837", "0.49274954", "0.49194735", "0.49193615", "0.4912429", "0.49124184", "0.49092543", "0.49041277", "0.48709413", "0.48641294", "0.48629028", "0.4858063", "0.48555276", "0.48549104", "0.48477033", "0.4833686", "0.48333934", "0.4830202" ]
0.62849337
2
SerializedParameters returns the CloudFormation stack's parameters serialized to a YAML document annotated with comments for readability to users.
func (s *BackendService) SerializedParameters() (string, error) { return s.svc.templateConfiguration(s) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s ParameterMetadata) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (e *ComponentStackConfig) Parameters() []*cloudformation.Parameter {\n\treturn []*cloudformation.Parameter{}\n}", "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "func (m *TemplateParameter) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n {\n err := writer.WriteStringValue(\"description\", m.GetDescription())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"displayName\", m.GetDisplayName())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"jsonAllowedValues\", m.GetJsonAllowedValues())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"jsonDefaultValue\", m.GetJsonDefaultValue())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"@odata.type\", m.GetOdataType())\n if err != nil {\n return err\n }\n }\n if m.GetValueType() != nil {\n cast := (*m.GetValueType()).String()\n err := writer.WriteStringValue(\"valueType\", &cast)\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteAdditionalData(m.GetAdditionalData())\n if err != nil {\n return err\n }\n }\n return nil\n}", "func (s ParameterConstraints) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ParameterConstraints) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ConfigParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s MaintenanceWindowLambdaParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (def *ScannedDef) ParamsString() string {\n\tif def.BuildIsFunc {\n\t\tparams := make([]string, len(def.Params))\n\n\t\tfor i := 0; i < len(def.Params); i++ {\n\t\t\tparams[i] = \"p\" + strconv.Itoa(i)\n\t\t}\n\n\t\treturn strings.Join(params, \", \")\n\t}\n\n\tparams := \"\"\n\n\tfor _, param := range def.Params {\n\t\tparams += `\n\t\t\t\t\t` + param.Name + `: p` + param.Index + `,\n`\n\t}\n\n\treturn params\n}", "func (s WorkflowParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p Params) MarshalYAML() (interface{}, error) {\n\treturn p.String(), nil\n}", "func (*Parameters) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_parameters_proto_rawDescGZIP(), []int{0}\n}", "func (s MaintenanceWindowStepFunctionsParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s VideoParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *Parameter) MarshalYAML() (interface{}, error) {\n\tnb := high.NewNodeBuilder(p, p.low)\n\treturn nb.Render(), nil\n}", "func (tr *SQLContainer) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (s DescribeParametersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DescribeParametersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s SSMValidationParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s EnvironmentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DescribeParametersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DescribeParametersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (m *Immutable) Parameters() map[string]string {\n\treturn m.contained.Parameters()\n}", "func (v *PublicParamsManager) SerializePublicParameters() ([]byte, error) {\n\treturn v.PublicParams().Serialize()\n}", "func (in *RecordSetGroup) GetParameters() map[string]string {\n\tparams := map[string]string{}\n\tcfnencoder.MarshalTypes(params, in.Spec, \"Parameter\")\n\treturn params\n}", "func (p *Parameters) MarshalBinary() (data []byte, err error) {\n\tdata = []byte{}\n\ttmp := []byte{}\n\n\tif tmp, err = p.SlotsToCoeffsParameters.MarshalBinary(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata = append(data, uint8(len(tmp)))\n\tdata = append(data, tmp...)\n\n\tif tmp, err = p.EvalModParameters.MarshalBinary(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata = append(data, uint8(len(tmp)))\n\tdata = append(data, tmp...)\n\n\tif tmp, err = p.CoeffsToSlotsParameters.MarshalBinary(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata = append(data, uint8(len(tmp)))\n\tdata = append(data, tmp...)\n\n\ttmp = make([]byte, 4)\n\ttmp[0] = uint8(p.H >> 24)\n\ttmp[1] = uint8(p.H >> 16)\n\ttmp[2] = uint8(p.H >> 8)\n\ttmp[3] = uint8(p.H >> 0)\n\tdata = append(data, tmp...)\n\treturn\n}", "func (o DatasetAzureBlobOutput) Parameters() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *DatasetAzureBlob) pulumi.StringMapOutput { return v.Parameters }).(pulumi.StringMapOutput)\n}", "func (s ListPipelineParametersForExecutionInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (tr *Cluster) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (p *Parameters) MarshalBinary() ([]byte, error) {\n\tif p.N == 0 { // if N is 0, then p is the zero value\n\t\treturn []byte{}, nil\n\t}\n\tb := utils.NewBuffer(make([]byte, 0, 3+((2+len(p.Qi)+len(p.Pi))<<3)))\n\tb.WriteUint8(uint8(bits.Len64(p.N) - 1))\n\tb.WriteUint8(uint8(len(p.Qi)))\n\tb.WriteUint8(uint8(len(p.Pi)))\n\tb.WriteUint64(p.T)\n\tb.WriteUint64(uint64(p.Sigma * (1 << 32)))\n\tb.WriteUint64Slice(p.Qi)\n\tb.WriteUint64Slice(p.Pi)\n\treturn b.Bytes(), nil\n}", "func (s ParameterHistory) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"ACLKey: %v\\n\", p.ACL))\n\tsb.WriteString(fmt.Sprintf(\"DAOOwnerKey: %s\\n\", p.DAOOwner))\n\tsb.WriteString(fmt.Sprintf(\"UpgradeKey: %v\\n\", p.Upgrade))\n\treturn sb.String()\n}", "func (tr *NotebookWorkspace) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (s LinuxParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s GetParametersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s InterpolationParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (coup CreateOrUpdateParameters) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif coup.Location != nil {\n\t\tobjectMap[\"location\"] = coup.Location\n\t}\n\tif coup.Type != nil {\n\t\tobjectMap[\"type\"] = coup.Type\n\t}\n\tif coup.Name != nil {\n\t\tobjectMap[\"name\"] = coup.Name\n\t}\n\tif coup.Properties != nil {\n\t\tobjectMap[\"properties\"] = coup.Properties\n\t}\n\treturn json.Marshal(objectMap)\n}", "func (s ParametersFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (tr *TaskDefinition) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (s SigningProfileParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *Parameters) String() string {\n\tif p == nil {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"%s%s%s\", p.URL.String(), p.Headers.String(), p.TLSClient.String())\n}", "func (p *Parameter) Render() ([]byte, error) {\n\treturn yaml.Marshal(p)\n}", "func (s MaintenanceWindowRunCommandParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s SecretSetParameters) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"contentType\", s.ContentType)\n\tpopulate(objectMap, \"attributes\", s.SecretAttributes)\n\tpopulate(objectMap, \"tags\", s.Tags)\n\tpopulate(objectMap, \"value\", s.Value)\n\treturn json.Marshal(objectMap)\n}", "func (tr *GremlinGraph) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (*Parameters_Parameter) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_parameters_proto_rawDescGZIP(), []int{0, 0}\n}", "func (a *Amazon) Parameters() map[string]string {\n\tp := map[string]string{\n\t\t\"name\": a.Name(),\n\t\t\"cloud\": a.Cloud(),\n\t\t\"public_zone\": a.conf.Amazon.PublicZone,\n\t\t\"bucket_prefix\": a.conf.Amazon.BucketPrefix,\n\t}\n\tif a.conf.Amazon.VaultPath != \"\" {\n\t\tp[\"vault_path\"] = a.conf.Amazon.VaultPath\n\t}\n\tif a.conf.Amazon.Profile != \"\" {\n\t\tp[\"amazon_profile\"] = a.conf.Amazon.Profile\n\t}\n\treturn p\n}", "func (p *Parms) String() string {\n\tout, _ := json.MarshalIndent(p, \"\", \"\\t\")\n\treturn string(out)\n}", "func (tr *MongoCollection) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (r *Document) Parameters() pulumi.ArrayOutput {\n\treturn (pulumi.ArrayOutput)(r.s.State[\"parameters\"])\n}", "func (s SsmParameterStoreParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s UserDataValidationParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (tb *TaskBuilder) ShowParameters() string {\n\treturn fmt.Sprintf(`SHOW PARAMETERS IN TASK %v`, tb.QualifiedName())\n}", "func (tr *Service) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (ss StdSignature) MarshalYAML() (interface{}, error) {\n\tpk := \"\"\n\tif ss.PubKey != nil {\n\t\tpk = ss.PubKey.String()\n\t}\n\n\tbz, err := yaml.Marshal(struct {\n\t\tPubKey string `json:\"pub_key\"`\n\t\tSignature string `json:\"signature\"`\n\t}{\n\t\tpk,\n\t\tfmt.Sprintf(\"%X\", ss.Signature),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn string(bz), err\n}", "func (s AudioParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ListPipelineParametersForExecutionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (tr *SQLFunction) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *SQLTrigger) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *SQLStoredProcedure) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *SQLDatabase) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (r *PatchRequest) Serialize() map[string]interface{} {\n\tvalues := r.Values\n\tif values == nil {\n\t\tvalues = map[string]interface{}{}\n\t}\n\tm := map[string]interface{}{\n\t\t\"Script\": r.Script,\n\t\t\"Values\": values,\n\t}\n\treturn m\n}", "func (o BuildSpecOutput) Parameters() BuildSpecParametersArrayOutput {\n\treturn o.ApplyT(func(v BuildSpec) []BuildSpecParameters { return v.Parameters }).(BuildSpecParametersArrayOutput)\n}", "func (s MaintenanceWindowAutomationParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s GetParametersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p Params) String() string {\n\treturn fmt.Sprintf(\n\t\t\"TokenCourse: %d\\n\"+\n\t\t\t\"SubscriptionPrice: %d\\n\"+\n\t\t\t\"VPNGBPrice: %d\\n\"+\n\t\t\t\"StorageGBPrice: %d\\n\"+\n\t\t\t\"BaseVPNGb: %d\\n\"+\n\t\t\t\"BaseStorageGb: %d\\n\"+\n\t\t\t\"CouseChangeSigners: %v\\n\",\n\t\tp.TokenCourse,\n\t\tp.SubscriptionPrice,\n\t\tp.VPNGBPrice,\n\t\tp.StorageGBPrice,\n\t\tp.BaseVPNGb,\n\t\tp.BaseStorageGb,\n\t\tp.CourseChangeSigners,\n\t)\n}", "func (s SsmExternalParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (tr *Account) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (i Instance) MarshalYAML() (interface{}, error) {\n\treturn i.Vars, nil\n}", "func (ep Endpoint) MarshalYAML() (interface{}, error) {\n\ts, err := ep.toString()\n\treturn s, err\n}", "func (o AssociationOutput) Parameters() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *Association) pulumi.StringMapOutput { return v.Parameters }).(pulumi.StringMapOutput)\n}", "func (*ExecutionTemplate_DataprocParameters) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_execution_proto_rawDescGZIP(), []int{0, 1}\n}", "func (s DescribeDBClusterParameterGroupsInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o BuildSpecPtrOutput) Parameters() BuildSpecParametersArrayOutput {\n\treturn o.ApplyT(func(v *BuildSpec) []BuildSpecParameters {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parameters\n\t}).(BuildSpecParametersArrayOutput)\n}", "func (tr *MongoDatabase) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (tr *CapacityProvider) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (o SettingsSectionDescriptionOutput) Parameters() SettingsParameterDescriptionArrayOutput {\n\treturn o.ApplyT(func(v SettingsSectionDescription) []SettingsParameterDescription { return v.Parameters }).(SettingsParameterDescriptionArrayOutput)\n}", "func (m KafkaPlugin) Parameters() plugin.Parameters {\n\tparams := plugin.NewParameters()\n\n\tparams.Add(\"message\", plugin.TextParameter, \"Kafka Message\", `{\n \"project\" : \"{{.cds.project}}\",\n \"application\" : \"{{.cds.application}}\",\n \"pipeline\" : \"{{.cds.pipeline}}\",\n \"version\" : \"{{.cds.version}}\"\n}`)\n\tparams.Add(\"kafkaUser\", plugin.StringParameter, \"Kafka User\", \"{{.cds.proj.kafkaUser}}\")\n\tparams.Add(\"kafkaPassword\", plugin.StringParameter, \"Kafka Password\", \"{{.cds.proj.kafkaPassword}}\")\n\tparams.Add(\"kafkaGroup\", plugin.StringParameter, \"Kafka Consumer Group (used for acknowledgment)\", \"{{.cds.proj.kafkaGroup}}\")\n\tparams.Add(\"kafkaAddresses\", plugin.StringParameter, \"Kafka Addresses\", \"{{.cds.proj.kafkaAddresses}}\")\n\tparams.Add(\"topic\", plugin.StringParameter, \"Kafka Topic\", \"{{.cds.env.kafkaTopic}}\")\n\tparams.Add(\"artifacts\", plugin.StringParameter, \"Artifacts list (comma separated)\", \"\")\n\tparams.Add(\"publicKey\", plugin.StringParameter, \"GPG Public Key (ASCII armored format)\", \"{{.cds.proj.gpgPubAsc}}\")\n\tparams.Add(\"key\", plugin.StringParameter, \"Key used by AES Encryption. It have to be the same value as --key on plugin binary\", \"\")\n\tparams.Add(\"waitForAck\", plugin.BooleanParameter, `Wait for Ack`, \"true\")\n\tparams.Add(\"waitForAckTopic\", plugin.StringParameter, `Kafka Topic. Used only if \"waitForAck\" is true.`, \"{{.cds.env.kafkaAckTopic}}\")\n\tparams.Add(\"waitForAckTimeout\", plugin.NumberParameter, `Ack timeout (seconds). Used only if \"waitForAck\" is true.`, \"120\")\n\n\treturn params\n}", "func (tr *GremlinDatabase) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (s DBClusterParameterGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ParameterRanges) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s StartSigningJobParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (tr *Table) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (k *ksonnetApp) ListParams(environment string) ([]*v1alpha1.KsonnetParameter, error) {\n\targs := []string{\"param\", \"list\", \"--output\", \"json\"}\n\tif environment != \"\" {\n\t\targs = append(args, \"--env\", environment)\n\t}\n\tout, err := k.ksCmd(args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Auxiliary data to hold unmarshaled JSON output, which may use different field names\n\tvar ksParams struct {\n\t\tData []struct {\n\t\t\tComponent string `json:\"component\"`\n\t\t\tKey string `json:\"param\"`\n\t\t\tValue string `json:\"value\"`\n\t\t} `json:\"data\"`\n\t}\n\tif err := json.Unmarshal([]byte(out), &ksParams); err != nil {\n\t\treturn nil, err\n\t}\n\tvar params []*v1alpha1.KsonnetParameter\n\tfor _, ksParam := range ksParams.Data {\n\t\tvalue := strings.Trim(ksParam.Value, `'\"`)\n\t\tparams = append(params, &v1alpha1.KsonnetParameter{\n\t\t\tComponent: ksParam.Component,\n\t\t\tName: ksParam.Key,\n\t\t\tValue: value,\n\t\t})\n\t}\n\treturn params, nil\n}", "func (parameter *Parameter) ToJSON() string {\n\tb, err := json.Marshal(parameter)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(b)\n}", "func (s *Siegfried) YAML() string {\n\tversion := config.Version()\n\tstr := fmt.Sprintf(\n\t\t\"---\\nsiegfried : %d.%d.%d\\nscandate : %v\\nsignature : %s\\ncreated : %v\\nidentifiers : \\n\",\n\t\tversion[0], version[1], version[2],\n\t\ttime.Now().Format(time.RFC3339),\n\t\tconfig.SignatureBase(),\n\t\ts.C.Format(time.RFC3339))\n\tfor _, id := range s.ids {\n\t\td := id.Describe()\n\t\tstr += fmt.Sprintf(\" - name : '%v'\\n details : '%v'\\n\", d[0], d[1])\n\t}\n\treturn str\n}", "func (tr *CassandraKeySpace) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (s EnvironmentParameterRanges) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (m *ResponseCacheParameters) ToJSON() (string, error) {\n\treturn codec.ToJSON(m)\n}", "func MustSerializeParams(o ...interface{}) []byte {\n\treturn MustSerialize(o)\n}", "func (s OutputParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DBParameterGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s Secret) MarshalYAML() (interface{}, error) {\n\tif s != \"\" {\n\t\treturn \"<secret>\", nil\n\t}\n\treturn nil, nil\n}" ]
[ "0.58774626", "0.56483716", "0.56483716", "0.5647293", "0.56191176", "0.55894685", "0.55894685", "0.55894685", "0.55894685", "0.55815846", "0.5466514", "0.5466514", "0.5414707", "0.53601635", "0.5359349", "0.53564376", "0.53168863", "0.5295162", "0.52824515", "0.52822816", "0.52698004", "0.5263395", "0.52103746", "0.5201843", "0.5201843", "0.52017576", "0.5178758", "0.51618415", "0.51618415", "0.51177174", "0.5113964", "0.506796", "0.5055132", "0.49731958", "0.4960688", "0.49538472", "0.49269265", "0.49231517", "0.49205333", "0.49195832", "0.4917344", "0.4912593", "0.48970544", "0.48766798", "0.48747057", "0.48681727", "0.48533562", "0.48506442", "0.48408428", "0.48322594", "0.48241058", "0.48135284", "0.48076394", "0.48025796", "0.47921652", "0.47900927", "0.47886172", "0.47755954", "0.47728384", "0.47615546", "0.47595242", "0.47566152", "0.47561935", "0.4752422", "0.47469872", "0.47425362", "0.47393203", "0.473834", "0.47322175", "0.47255334", "0.47177446", "0.4709977", "0.46956035", "0.4682454", "0.46774065", "0.46739313", "0.46704876", "0.4670082", "0.46584225", "0.4649416", "0.46427295", "0.46383342", "0.46207544", "0.46139696", "0.46133015", "0.45971018", "0.45869067", "0.4579867", "0.45796546", "0.45787564", "0.45740986", "0.45717552", "0.45672432", "0.45671046", "0.45623133", "0.4547859", "0.4541072", "0.45394298", "0.4536359", "0.4532321" ]
0.6744447
0
Test that the iterator meets the required interface
func TestFilterIterator_Interface(t *testing.T) { var _ ResultIterator = &FilterIterator{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func testItrWithoutClose(t *testing.T, itr ledger.QueryResultsIterator, expectedKeys []string) {\n\tfor _, expectedKey := range expectedKeys {\n\t\tqueryResult, err := itr.Next()\n\t\trequire.NoError(t, err, \"An unexpected error was thrown during iterator Next()\")\n\t\tvkv := queryResult.(*queryresult.KV)\n\t\tkey := vkv.Key\n\t\trequire.Equal(t, expectedKey, key)\n\t}\n\tqueryResult, err := itr.Next()\n\trequire.NoError(t, err, \"An unexpected error was thrown during iterator Next()\")\n\trequire.Nil(t, queryResult)\n}", "func TestRequiresIterator(t *testing.T) {\r\n\tT := New(Of(Int), WithBacking([]int{1, 2, 3, 4}))\r\n\tsliced, _ := T.Slice(makeRS(1, 3))\r\n\tif sliced.RequiresIterator() {\r\n\t\tt.Errorf(\"Slicing on rows should not require Iterator\")\r\n\t}\r\n}", "func (m *MockMutableList) Iterator() Iterator {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Iterator\")\n\tret0, _ := ret[0].(Iterator)\n\treturn ret0\n}", "func mockIter(rowID RowID, val Persistent) Iterator {\n\tb, err := val.Marshal()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn NewSingleValueIterator(rowID, b)\n}", "func (_m *MockReaderIteratorPool) Put(iter ReaderIterator) {\n\t_m.ctrl.Call(_m, \"Put\", iter)\n}", "func (m *MockList) Iterator() Iterator {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Iterator\")\n\tret0, _ := ret[0].(Iterator)\n\treturn ret0\n}", "func (_m *MockSeriesIteratorPool) Put(iter SeriesIterator) {\n\t_m.ctrl.Call(_m, \"Put\", iter)\n}", "func TestIteratorNext(t *testing.T) {\n\tconst n = 100\n\tl := NewSkiplist(NewArena(arenaSize))\n\n\tvar it Iterator\n\tit.Init(l)\n\n\trequire.False(t, it.Valid())\n\n\tit.SeekToFirst()\n\trequire.False(t, it.Valid())\n\n\tfor i := n - 1; i >= 0; i-- {\n\t\tit.Add([]byte(fmt.Sprintf(\"%05d\", i)), newValue(i), 0)\n\t}\n\n\tit.SeekToFirst()\n\tfor i := 0; i < n; i++ {\n\t\trequire.True(t, it.Valid())\n\t\trequire.EqualValues(t, newValue(i), it.Value())\n\t\tit.Next()\n\t}\n\trequire.False(t, it.Valid())\n}", "func TestSeriesIDIterator(t *testing.T) {\n\telems := []tsdb.SeriesIDElem{\n\t\t{SeriesID: 1},\n\t\t{SeriesID: 2},\n\t}\n\n\titr := SeriesIDIterator{Elems: elems}\n\tif e := itr.Next(); !reflect.DeepEqual(elems[0], e) {\n\t\tt.Fatalf(\"unexpected elem(0): %#v\", e)\n\t} else if e := itr.Next(); !reflect.DeepEqual(elems[1], e) {\n\t\tt.Fatalf(\"unexpected elem(1): %#v\", e)\n\t} else if e := itr.Next(); e.SeriesID != 0 {\n\t\tt.Fatalf(\"expected nil elem: %#v\", e)\n\t}\n}", "func TestBasic(t *testing.T) {\n\tl := NewSkiplist(NewArena(arenaSize))\n\n\tvar it Iterator\n\tit.Init(l)\n\n\tval1 := newValue(42)\n\tval2 := newValue(52)\n\tval3 := newValue(62)\n\tval4 := newValue(72)\n\n\t// Try adding values.\n\tit.Add([]byte(\"key1\"), val1, 0)\n\tit.Add([]byte(\"key3\"), val3, 0xffff)\n\tit.Add([]byte(\"key2\"), val2, 100)\n\n\trequire.False(t, it.Seek([]byte(\"key\")))\n\n\trequire.True(t, it.Seek([]byte(\"key1\")))\n\trequire.EqualValues(t, \"00042\", it.Value())\n\trequire.EqualValues(t, 0, it.Meta())\n\n\trequire.True(t, it.Seek([]byte(\"key2\")))\n\trequire.EqualValues(t, \"00052\", it.Value())\n\trequire.EqualValues(t, 100, it.Meta())\n\n\trequire.True(t, it.Seek([]byte(\"key3\")))\n\trequire.EqualValues(t, \"00062\", it.Value())\n\trequire.EqualValues(t, 0xffff, it.Meta())\n\n\trequire.True(t, it.Seek([]byte(\"key2\")))\n\trequire.Nil(t, it.Set(val4, 101))\n\trequire.EqualValues(t, \"00072\", it.Value())\n\trequire.EqualValues(t, 101, it.Meta())\n\n\trequire.True(t, it.Seek([]byte(\"key3\")))\n\trequire.Nil(t, it.Delete())\n\trequire.True(t, !it.Valid())\n}", "func (_m *MockMultiReaderIteratorPool) Put(iter MultiReaderIterator) {\n\t_m.ctrl.Call(_m, \"Put\", iter)\n}", "func TestMeasurementIterator(t *testing.T) {\n\telems := []MeasurementElem{\n\t\tMeasurementElem{name: []byte(\"cpu\"), deleted: true},\n\t\tMeasurementElem{name: []byte(\"mem\")},\n\t}\n\n\titr := MeasurementIterator{Elems: elems}\n\tif e := itr.Next(); !reflect.DeepEqual(&elems[0], e) {\n\t\tt.Fatalf(\"unexpected elem(0): %#v\", e)\n\t} else if e := itr.Next(); !reflect.DeepEqual(&elems[1], e) {\n\t\tt.Fatalf(\"unexpected elem(1): %#v\", e)\n\t} else if e := itr.Next(); e != nil {\n\t\tt.Fatalf(\"expected nil elem: %#v\", e)\n\t}\n}", "func (it *MockIndexTree) Iterator(start, end []byte) Iterator {\n\titer := &ForwardIter{start: start, end: end}\n\tif bytes.Compare(start, end) >= 0 {\n\t\titer.err = io.EOF\n\t\treturn iter\n\t}\n\titer.enumerator, _ = it.bt.Seek(start)\n\titer.Next() //fill key, value, err\n\treturn iter\n}", "func validateNewIterator(iterator ItemIterator) (err error) {\n\tif !iterator.Next() && iterator.Err() != nil {\n\t\terr = iterator.Err()\n\t\titerator.Reset()\n\t\treturn err\n\t}\n\terr = iterator.Reset()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (iter *Iterator) Next() bool { return iter.impl.Next() }", "func (m *MockStore) Iterator(arg0, arg1 string) storage.StoreIterator {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Iterator\", arg0, arg1)\n\tret0, _ := ret[0].(storage.StoreIterator)\n\treturn ret0\n}", "func TestTableIterate(t *testing.T) {\n\tt.Run(\"Should not fail with no documents\", func(t *testing.T) {\n\t\ttb, cleanup := newTestTable(t)\n\t\tdefer cleanup()\n\n\t\ti := 0\n\t\terr := tb.Iterate(func(d types.Document) error {\n\t\t\ti++\n\t\t\treturn nil\n\t\t})\n\t\tassert.NoError(t, err)\n\t\trequire.Zero(t, i)\n\t})\n\n\tt.Run(\"Should iterate over all documents\", func(t *testing.T) {\n\t\ttb, cleanup := newTestTable(t)\n\t\tdefer cleanup()\n\n\t\tfor i := 0; i < 10; i++ {\n\t\t\t_, err := tb.Insert(newDocument())\n\t\t\tassert.NoError(t, err)\n\t\t}\n\n\t\tm := make(map[string]int)\n\t\terr := tb.Iterate(func(d types.Document) error {\n\t\t\tm[string(d.(document.Keyer).RawKey())]++\n\t\t\treturn nil\n\t\t})\n\t\tassert.NoError(t, err)\n\t\trequire.Len(t, m, 10)\n\t\tfor _, c := range m {\n\t\t\trequire.Equal(t, 1, c)\n\t\t}\n\t})\n\n\tt.Run(\"Should stop if fn returns error\", func(t *testing.T) {\n\t\ttb, cleanup := newTestTable(t)\n\t\tdefer cleanup()\n\n\t\tfor i := 0; i < 10; i++ {\n\t\t\t_, err := tb.Insert(newDocument())\n\t\t\tassert.NoError(t, err)\n\t\t}\n\n\t\ti := 0\n\t\terr := tb.Iterate(func(_ types.Document) error {\n\t\t\ti++\n\t\t\tif i >= 5 {\n\t\t\t\treturn errors.New(\"some error\")\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\trequire.EqualError(t, err, \"some error\")\n\t\trequire.Equal(t, 5, i)\n\t})\n}", "func (_m *MockSeriesIteratorPool) Get() SeriesIterator {\n\tret := _m.ctrl.Call(_m, \"Get\")\n\tret0, _ := ret[0].(SeriesIterator)\n\treturn ret0\n}", "func (_m *MockMultiReaderIterator) Next() bool {\n\tret := _m.ctrl.Call(_m, \"Next\")\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "func (_m *MockReaderIteratorPool) Get() ReaderIterator {\n\tret := _m.ctrl.Call(_m, \"Get\")\n\tret0, _ := ret[0].(ReaderIterator)\n\treturn ret0\n}", "func (_m *MockReaderIterator) Next() bool {\n\tret := _m.ctrl.Call(_m, \"Next\")\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "func TestTagKeyIterator(t *testing.T) {\n\telems := []TagKeyElem{\n\t\t{key: []byte(\"aaa\"), deleted: true},\n\t\t{key: []byte(\"bbb\")},\n\t}\n\n\titr := TagKeyIterator{Elems: elems}\n\tif e := itr.Next(); !reflect.DeepEqual(&elems[0], e) {\n\t\tt.Fatalf(\"unexpected elem(0): %#v\", e)\n\t} else if e := itr.Next(); !reflect.DeepEqual(&elems[1], e) {\n\t\tt.Fatalf(\"unexpected elem(1): %#v\", e)\n\t} else if e := itr.Next(); e != nil {\n\t\tt.Fatalf(\"expected nil elem: %#v\", e)\n\t}\n}", "func (_m *MockIteratorArrayPool) Put(iters []Iterator) {\n\t_m.ctrl.Call(_m, \"Put\", iters)\n}", "func (_m *MockSeriesIterators) Iters() []SeriesIterator {\n\tret := _m.ctrl.Call(_m, \"Iters\")\n\tret0, _ := ret[0].([]SeriesIterator)\n\treturn ret0\n}", "func (it *Iterator) Valid() bool { return it.item != nil }", "func (cur *sequenceCursor) iter(cb cursorIterCallback) {\n\tfor cur.valid() && !cb(cur.getItem(cur.idx)) {\n\t\tcur.advance()\n\t}\n}", "func Assert(ctx context.Context, t *testing.T, iterable Iterable, assertions ...RxAssert) {\n\tass := parseAssertions(assertions...)\n\n\tgot := make([]interface{}, 0)\n\terrs := make([]error, 0)\n\n\tobserve := iterable.Observe()\nloop:\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tbreak loop\n\t\tcase item, ok := <-observe:\n\t\t\tif !ok {\n\t\t\t\tbreak loop\n\t\t\t}\n\t\t\tif item.Error() {\n\t\t\t\terrs = append(errs, item.E)\n\t\t\t} else {\n\t\t\t\tgot = append(got, item.V)\n\t\t\t}\n\t\t}\n\t}\n\n\tif checked, predicates := ass.customPredicatesToBeChecked(); checked {\n\t\tfor _, predicate := range predicates {\n\t\t\terr := predicate(got)\n\t\t\tif err != nil {\n\t\t\t\tassert.Fail(t, err.Error())\n\t\t\t}\n\t\t}\n\t}\n\tif checkHasItems, expectedItems := ass.itemsToBeChecked(); checkHasItems {\n\t\tassert.Equal(t, expectedItems, got)\n\t}\n\tif checkHasItemsNoOrder, itemsNoOrder := ass.itemsNoOrderedToBeChecked(); checkHasItemsNoOrder {\n\t\tm := make(map[interface{}]interface{})\n\t\tfor _, v := range itemsNoOrder {\n\t\t\tm[v] = nil\n\t\t}\n\n\t\tfor _, v := range got {\n\t\t\tdelete(m, v)\n\t\t}\n\t\tif len(m) != 0 {\n\t\t\tassert.Fail(t, \"missing elements\", \"%v\", got)\n\t\t}\n\t}\n\tif checkHasItem, value := ass.itemToBeChecked(); checkHasItem {\n\t\tlength := len(got)\n\t\tif length != 1 {\n\t\t\tassert.FailNow(t, \"wrong number of items\", \"expected 1, got %d\", length)\n\t\t}\n\t\tassert.Equal(t, value, got[0])\n\t}\n\tif ass.noItemsToBeChecked() {\n\t\tassert.Equal(t, 0, len(got))\n\t}\n\tif ass.someItemsToBeChecked() {\n\t\tassert.NotEqual(t, 0, len(got))\n\t}\n\tif checkHasRaisedError, expectedError := ass.raisedErrorToBeChecked(); checkHasRaisedError {\n\t\tif expectedError == nil {\n\t\t\tassert.Equal(t, 0, len(errs))\n\t\t} else {\n\t\t\tif len(errs) == 0 {\n\t\t\t\tassert.FailNow(t, \"no error raised\", \"expected %v\", expectedError)\n\t\t\t}\n\t\t\tassert.Equal(t, expectedError, errs[0])\n\t\t}\n\t}\n\tif checkHasRaisedErrors, expectedErrors := ass.raisedErrorsToBeChecked(); checkHasRaisedErrors {\n\t\tassert.Equal(t, expectedErrors, errs)\n\t}\n\tif checkHasRaisedAnError, expectedError := ass.raisedAnErrorToBeChecked(); checkHasRaisedAnError {\n\t\tassert.Nil(t, expectedError)\n\t}\n\tif ass.notRaisedErrorToBeChecked() {\n\t\tassert.Equal(t, 0, len(errs))\n\t}\n}", "func TestCreateAndIter(t *testing.T) {\n\ttype insert struct {\n\t\tindex int\n\t\tvalue ElemType\n\t}\n\ttype tst struct {\n\t\tinserts []insert\n\t\tresult []ElemType\n\t}\n\n\ttsts := []tst{\n\t\t{[]insert{{0, distToElem(0)}, {1, distToElem(1)}, {2, distToElem(2)}, {3, distToElem(3)}, {4, distToElem(4)}, {5, distToElem(5)}, {6, distToElem(6)}, {7, distToElem(7)}, {8, distToElem(8)}, {9, distToElem(9)}, {10, distToElem(10)}},\n\t\t\t[]ElemType{distToElem(0), distToElem(1), distToElem(2), distToElem(3), distToElem(4), distToElem(5), distToElem(6), distToElem(7), distToElem(8), distToElem(9), distToElem(10)},\n\t\t},\n\t\t{[]insert{{0, distToElem(10)}, {0, distToElem(9)}, {0, distToElem(8)}, {0, distToElem(7)}, {0, distToElem(6)}, {0, distToElem(5)}, {0, distToElem(4)}, {0, distToElem(3)}, {0, distToElem(2)}, {0, distToElem(1)}, {0, distToElem(0)}},\n\t\t\t[]ElemType{distToElem(0), distToElem(1), distToElem(2), distToElem(3), distToElem(4), distToElem(5), distToElem(6), distToElem(7), distToElem(8), distToElem(9), distToElem(10)},\n\t\t},\n\t}\n\n\tfor _, ts := range tsts {\n\t\tvar sl ISkipList\n\t\tsl.Seed(randSeed1, randSeed2)\n\n\t\tfor _, ins := range ts.inserts {\n\t\t\tt.Logf(\"Inserting %v at %v\\n\", ins.value, ins.index)\n\t\t\tsl.Insert(ins.index, ins.value)\n\t\t}\n\n\t\tif sl.Length() != len(ts.result) {\n\t\t\tt.Errorf(\"Error mismatch: ISKipList has length %v; expected result has length %v\\n\", sl.Length(), len(ts.result))\n\t\t}\n\n\t\t// Test iterating through the list using At()\n\t\tfor i, v := range ts.result {\n\t\t\tt.Logf(\"At %v\\n\", i)\n\t\t\tslv := sl.At(i)\n\t\t\tif slv != v {\n\t\t\t\tt.Errorf(\"ISkipList[%v] = %v, expectedResult[%v] = %v\\n\", i, slv, i, v)\n\t\t\t}\n\t\t}\n\n\t\t// Test iterating through the by copying it to a slice.\n\t\tcpy := make([]ElemType, len(ts.result))\n\t\tsl.CopyToSlice(cpy)\n\t\tfor i, v := range cpy {\n\t\t\tif v != ts.result[i] {\n\t\t\t\tt.Errorf(\"sliceCopy[%v] = %v, expectedResult[%v] = %v\\n\", i, v, i, ts.result[i])\n\t\t\t}\n\t\t}\n\n\t\t// Test iterating through part of the list by copying it to a slice.\n\t\tmiddle := make([]ElemType, len(ts.result)-4)\n\t\tsl.CopyRangeToSlice(2, sl.Length()-2, middle)\n\t\tfor i, v := range middle {\n\t\t\tif v != ts.result[i+2] {\n\t\t\t\tt.Errorf(\"middle[%v] = %v, expectedResult[%v] = %v\\n\", i, v, i+2, ts.result[i+2])\n\t\t\t}\n\t\t}\n\n\t\t// Test iterating through the list using Iterate()\n\t\ti := 0\n\t\tsl.Iterate(func(e *ElemType) bool {\n\t\t\tif *e != ts.result[i] {\n\t\t\t\tt.Errorf(\"Expected value %v in iteration, got %v at index %v\\n\", ts.result[i], *e, i)\n\t\t\t}\n\t\t\ti++\n\t\t\treturn true\n\t\t})\n\t\ti = 0\n\t\tsl.IterateI(func(j int, e *ElemType) bool {\n\t\t\tif *e != ts.result[i] {\n\t\t\t\tt.Errorf(\"Expected value %v in iteration, got %v at index %v\\n\", ts.result[i], *e, i)\n\t\t\t}\n\t\t\tif i != j {\n\t\t\t\tt.Errorf(\"Unexpected index in iteration: %v vs. %v\\n\", i, j)\n\t\t\t}\n\t\t\ti++\n\t\t\treturn true\n\t\t})\n\t}\n}", "func (_m *MockIteratorArrayPool) Get(size int) []Iterator {\n\tret := _m.ctrl.Call(_m, \"Get\", size)\n\tret0, _ := ret[0].([]Iterator)\n\treturn ret0\n}", "func Next(it Iterator) bool {\n\treturn neogointernal.Syscall1(\"System.Iterator.Next\", it).(bool)\n}", "func assertIterateDomain(t *testing.T, st types.KVStore, expectedN int) {\n\tt.Helper()\n\titr := st.Iterator(nil, nil)\n\ti := 0\n\tfor ; itr.Valid(); itr.Next() {\n\t\tk, v := itr.Key(), itr.Value()\n\t\trequire.Equal(t, keyFmt(i), k)\n\t\trequire.Equal(t, valFmt(i), v)\n\t\ti++\n\t}\n\trequire.Equal(t, expectedN, i)\n\trequire.NoError(t, itr.Close())\n}", "func (_m *MockMutableSeriesIterators) Iters() []SeriesIterator {\n\tret := _m.ctrl.Call(_m, \"Iters\")\n\tret0, _ := ret[0].([]SeriesIterator)\n\treturn ret0\n}", "func Test_Cover_Iterators(T *testing.T) {\n\tdg := graph.NewDGraph(ut.Node(\"A\"), ut.Node(\"B\"))\n\tdg.DFS(\"A\", iterator.PreOrder)\n\tdg.BFS(\"A\")\n\tdg.RDFS(\"A\", iterator.PreOrder)\n\tdg.RBFS(\"A\")\n\n\tug := graph.NewUGraph(ut.Node(\"A\"), ut.Node(\"B\"))\n\tug.DFS(\"A\", iterator.PreOrder)\n\tug.BFS(\"A\")\n\tug.RDFS(\"A\", iterator.PreOrder)\n\tug.RBFS(\"A\")\n}", "func check(iterations int, ordered chan Ordered, t *testing.T) {\n\tcount := int64(1)\n\n\tfor o := range ordered {\n\t\tif o.Order() != count {\n\t\t\tt.Errorf(\"Expected item #%v to equal %v\", count, o.Order())\n\t\t}\n\t\tcount++\n\t}\n\n\tif count != int64(iterations+1) {\n\t\tt.Error(\"Expected only 1 iteration\")\n\t}\n}", "func (_m *MockIterator) Next() bool {\n\tret := _m.ctrl.Call(_m, \"Next\")\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "func IsIteratorValidForGoThrough(it *levigo.Iterator, keyEnd string) bool {\n\tif keyEnd != \"\" {\n\t\treturn it.Valid() && string(it.Key()) <= keyEnd\n\t}\n\treturn it.Valid()\n}", "func TestTagValueIterator(t *testing.T) {\n\telems := []TagValueElem{\n\t\t{value: []byte(\"aaa\"), deleted: true},\n\t\t{value: []byte(\"bbb\")},\n\t}\n\n\titr := &TagValueIterator{Elems: elems}\n\tif e := itr.Next(); !reflect.DeepEqual(&elems[0], e) {\n\t\tt.Fatalf(\"unexpected elem(0): %#v\", e)\n\t} else if e := itr.Next(); !reflect.DeepEqual(&elems[1], e) {\n\t\tt.Fatalf(\"unexpected elem(1): %#v\", e)\n\t} else if e := itr.Next(); e != nil {\n\t\tt.Fatalf(\"expected nil elem: %#v\", e)\n\t}\n}", "func (_m *MockSeriesIterator) Next() bool {\n\tret := _m.ctrl.Call(_m, \"Next\")\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "func (_m *MockMultiReaderIteratorPool) Get() MultiReaderIterator {\n\tret := _m.ctrl.Call(_m, \"Get\")\n\tret0, _ := ret[0].(MultiReaderIterator)\n\treturn ret0\n}", "func (_m *MockENotifyingList) Iterator() EIterator {\n\tret := _m.Called()\n\n\tvar r0 EIterator\n\tif rf, ok := ret.Get(0).(func() EIterator); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(EIterator)\n\t\t}\n\t}\n\n\treturn r0\n}", "func TestRandomOpSequences(t *testing.T) {\n\tconst nops = 1000\n\tconst niters = 20\n\n\tvar sl ISkipList\n\tsl.Seed(randSeed1, randSeed2)\n\tfor i := 0; i < niters; i++ {\n\t\tt.Logf(\"----- Generating random sequence of %v operations -----\\n\", nops)\n\t\tops := sliceutils.GenOps(nops, 0)\n\t\tsl.Clear()\n\t\ta := make([]ElemType, 0)\n\t\tfor _, o := range ops {\n\t\t\tt.Logf(\"%s\\n\", sliceutils.PrintOp(&o))\n\t\t\tsliceutils.ApplyOpToSlice(&o, &a)\n\t\t\tapplyOpToISkipList(&o, &sl)\n\t\t\tt.Logf(\"%v\\n\", DebugPrintISkipList(&sl, 3))\n\t\t\tt.Logf(\"%+v\\n\", a)\n\n\t\t\tt.Logf(\"Reported lengths: %v %v\\n\", sl.Length(), len(a))\n\n\t\t\tif len(a) != sl.Length() {\n\t\t\t\tt.Errorf(\"ISkipList has wrong length (%v instead of %v)\\n\", sl.Length(), len(a))\n\t\t\t}\n\n\t\t\t// Equality check by looping over indices.\n\t\t\tt.Logf(\"Testing result via index loop...\\n\")\n\t\t\tfor i, v := range a {\n\t\t\t\te := sl.At(i)\n\t\t\t\tt.Logf(\"Checking %v\\n\", i)\n\t\t\t\tif v != e {\n\t\t\t\t\tt.Errorf(\"Expected value %v at index %v, got %v instead (index loop).\\n\", v, i, e)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Equality check using ForAllI\n\t\tt.Logf(\"Testing result via ForAllI()...\")\n\t\tsl.ForAllI(func(i int, v *ElemType) {\n\t\t\tt.Logf(\"Checking %v\\n\", i)\n\t\t\tif *v != a[i] {\n\t\t\t\tt.Errorf(\"Expected value %v at index %v, got %v instead (ForAllI).\\n\", a[i], i, *v)\n\t\t\t}\n\t\t})\n\n\t\t// Copy and then check copy has expected elements using ForAllI.\n\t\tcp := sl.Copy()\n\t\tcp.ForAllI(func(i int, v *ElemType) {\n\t\t\tt.Logf(\"Checking %v\\n\", i)\n\t\t\tif *v != a[i] {\n\t\t\t\tt.Errorf(\"Expected value %v at index %v, got %v instead (ForAllI).\\n\", a[i], i, *v)\n\t\t\t}\n\t\t})\n\t}\n}", "func (it *iterator) Next() (ok bool) {\n\tit.next <- struct{}{}\n\tselect {\n\tcase it.err = <-it.errCh:\n\t\treturn false\n\tcase it.current, ok = <-it.items:\n\t}\n\treturn\n}", "func (it *emptyIterator) Err() error { return nil }", "func (_m *MockMutableSeriesIteratorsPool) Put(iters MutableSeriesIterators) {\n\t_m.ctrl.Call(_m, \"Put\", iters)\n}", "func (m *MockMutableList) AddIterator(iter Iterator) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AddIterator\", iter)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (m *MockStore) Query(arg0 string, arg1 ...storage.QueryOption) (storage.Iterator, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0}\n\tfor _, a := range arg1 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Query\", varargs...)\n\tret0, _ := ret[0].(storage.Iterator)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (Int32SliceIterator) Err() error { return nil }", "func PrintResultsIterator(queryIterator shim.StateQueryIteratorInterface, stub shim.ChaincodeStubInterface) error {\n\t// USE DEFER BECAUSE it will close also in case of error throwing (premature return)\n\tdefer queryIterator.Close()\n\tfor i := 0; queryIterator.HasNext(); i++ {\n\t\tresponseRange, err := queryIterator.Next()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tobjectType, compositeKeyParts, err := stub.SplitCompositeKey(responseRange.Key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ti := 0\n\t\tfor _, keyPart := range compositeKeyParts {\n\t\t\tfmt.Printf(\"Found a Relation OBJECT_TYPE:%s KEYPART %s: %s\", objectType, i, keyPart)\n\t\t\ti++\n\t\t}\n\t}\n\treturn nil\n}", "func (feed *feed) iterator() {\n\tfor feed.Scan() {\n\t\tvar item Item\n\t\terr := xml.Unmarshal(feed.Bytes(), &item)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tfeed.next <- &item\n\t}\n\tclose(feed.next)\n}", "func (m *MockDHTKeeper) IterateAnnounceList(it func([]byte, *core.AnnounceListEntry)) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"IterateAnnounceList\", it)\n}", "func (s *Set) Iterator() Iterator {\n\treturn s.skiplist.Iterator()\n}", "func (suite *TestGormSuite) TestIterateRows(c *C) {\n\tormdb := buildGormDb(c)\n\tdefer ormdb.Close()\n\n\tormdb.Exec(\"CREATE TABLE test_iter_rows(sr_id INT, sr_name VARCHAR(32))\")\n\tormdb.Exec(\"INSERT INTO test_iter_rows VALUES(?, ?)\", 21, \"Bob\")\n\tormdb.Exec(\"INSERT INTO test_iter_rows VALUES(?, ?)\", 22, \"Joe\")\n\n\tdbQuery := ormdb.Raw(\"SELECT * FROM test_iter_rows\")\n\tdbExt := ToDefaultGormDbExt(dbQuery)\n\n\tvar numberOfRows int = 0\n\tdbExt.IterateRows(db.RowsCallbackFunc(func(rows *sql.Rows) db.IterateControl {\n\t\tnumberOfRows++\n\t\treturn db.IterateContinue\n\t}))\n\n\tc.Assert(numberOfRows, Equals, 2)\n}", "func (suite *TestGormSuite) TestIterateRows(c *C) {\n\tormdb := buildGormDb(c)\n\tdefer ormdb.Close()\n\n\tormdb.Exec(\"CREATE TABLE test_iter_rows(sr_id INT, sr_name VARCHAR(32))\")\n\tormdb.Exec(\"INSERT INTO test_iter_rows VALUES(?, ?)\", 21, \"Bob\")\n\tormdb.Exec(\"INSERT INTO test_iter_rows VALUES(?, ?)\", 22, \"Joe\")\n\n\tdbQuery := ormdb.Raw(\"SELECT * FROM test_iter_rows\")\n\tdbExt := ToGormDbExt(dbQuery)\n\n\tvar numberOfRows int = 0\n\tdbExt.IterateRows(db.RowsCallbackFunc(func (rows *sql.Rows) db.IterateControl {\n\t\tnumberOfRows++\n\t\treturn db.IterateContinue\n\t}))\n\n\tc.Assert(numberOfRows, Equals, 2)\n}", "func TestMergeMeasurementIterators(t *testing.T) {\n\titr := tsi1.MergeMeasurementIterators(\n\t\t&MeasurementIterator{Elems: []MeasurementElem{\n\t\t\t{name: []byte(\"aaa\")},\n\t\t\t{name: []byte(\"bbb\"), deleted: true},\n\t\t\t{name: []byte(\"ccc\")},\n\t\t}},\n\t\t&MeasurementIterator{},\n\t\t&MeasurementIterator{Elems: []MeasurementElem{\n\t\t\t{name: []byte(\"bbb\")},\n\t\t\t{name: []byte(\"ccc\"), deleted: true},\n\t\t\t{name: []byte(\"ddd\")},\n\t\t}},\n\t)\n\n\tif e := itr.Next(); !bytes.Equal(e.Name(), []byte(\"aaa\")) || e.Deleted() {\n\t\tt.Fatalf(\"unexpected elem(0): %s/%v\", e.Name(), e.Deleted())\n\t} else if e := itr.Next(); !bytes.Equal(e.Name(), []byte(\"bbb\")) || !e.Deleted() {\n\t\tt.Fatalf(\"unexpected elem(1): %s/%v\", e.Name(), e.Deleted())\n\t} else if e := itr.Next(); !bytes.Equal(e.Name(), []byte(\"ccc\")) || e.Deleted() {\n\t\tt.Fatalf(\"unexpected elem(2): %s/%v\", e.Name(), e.Deleted())\n\t} else if e := itr.Next(); !bytes.Equal(e.Name(), []byte(\"ddd\")) || e.Deleted() {\n\t\tt.Fatalf(\"unexpected elem(3): %s/%v\", e.Name(), e.Deleted())\n\t} else if e := itr.Next(); e != nil {\n\t\tt.Fatalf(\"expected nil elem: %#v\", e)\n\t}\n}", "func (i Iterator) Inspect(in Inspection) {\n\tin.Properties[\"index\"] = i.Index + 1\n\tin.Properties[\"length\"] = len(i.Target)\n}", "func (v Uvarint) Iterator() func() (n uint64, ok bool) {\n\tpos := 0\n\treturn func() (uint64, bool) {\n\t\tif pos >= len(v.data) {\n\t\t\treturn 0, false\n\t\t}\n\t\tx := uint64(0)\n\t\tfor i, b := range v.data[pos:] {\n\t\t\tx |= uint64(b&0x7f) << uint(i*7)\n\t\t\tif b&0x80 == 0 {\n\t\t\t\tpos += i + 1\n\t\t\t\treturn x, true\n\t\t\t}\n\t\t}\n\t\tpanic(\"incomplete array\")\n\t}\n}", "func assertSubset(t *testing.T, expected, actual *Object) {\nOuter:\n\tfor _, pair := range expected.Pairs {\n\t\tfor _, value := range actual.GetAll(pair.Key) {\n\t\t\tif pair.Value == value {\n\t\t\t\tcontinue Outer\n\t\t\t}\n\t\t}\n\t\tt.Fatalf(\n\t\t\t\"Did not find expected pair %q = %q in\\n%+v\",\n\t\t\tpair.Key,\n\t\t\tpair.Value,\n\t\t\tactual)\n\t}\n}", "func (s *Iterator) Iterator() engine.Iterator {\n\treturn s.i\n}", "func TestFetchInterface(t *testing.T) {\n\tt.Parallel()\n\n\tassert.Implements(t, (*resource.Task)(nil), new(fetch.Fetch))\n}", "func (s *BasecluListener) EnterIterator(ctx *IteratorContext) {}", "func ToIter(f AssertFunc) IterFunc {\n\treturn func(err error) (ok bool) {\n\t\tf(err, &ok)\n\t\t// assertion succeeded (no more iterations needed)\n\t\treturn !ok\n\t}\n}", "func TestIteratorConcurrency(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"skipping test in short mode.\")\n\t}\n\ttree := setupMutableTree(t, true)\n\t_, err := tree.LoadVersion(0)\n\trequire.NoError(t, err)\n\t// So much slower\n\twg := new(sync.WaitGroup)\n\tfor i := 0; i < 100; i++ {\n\t\tfor j := 0; j < maxIterator; j++ {\n\t\t\twg.Add(1)\n\t\t\tgo func(i, j int) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\t_, err := tree.Set([]byte(fmt.Sprintf(\"%d%d\", i, j)), iavlrand.RandBytes(1))\n\t\t\t\trequire.NoError(t, err)\n\t\t\t}(i, j)\n\t\t}\n\t\titr, _ := tree.Iterator(nil, nil, true)\n\t\tfor ; itr.Valid(); itr.Next() {\n\t\t}\n\t}\n\twg.Wait()\n}", "func (i *Iterator) Next() {\n\ti.iterator.Next()\n}", "func TestIterate(t *testing.T) {\n\tbuffer := bytes.NewBufferString(s19TestFile)\n\treader := Open(buffer)\n\tif reader != nil {\n\t\tdata := make([]byte, 0)\n\t\texpectedAddress := uint32(0x400)\n\t\tfor it := range reader.Records() {\n\t\t\trec := it.Record\n\t\t\terr := it.Error\n\t\t\tif err == io.EOF {\n\t\t\t\tt.Fatal(\"EOF not handled properly\")\n\t\t\t}\n\t\t\tif rec.Address() != expectedAddress {\n\t\t\t\tt.Fatalf(\"Address mismatch expected: %v got: %v\", expectedAddress, rec.Address())\n\t\t\t}\n\t\t\texpectedAddress += uint32(len(rec.Data()))\n\t\t\tdata = append(data, rec.Data()...)\n\t\t}\n\t\tif bytes.Compare(data, binaryTestFile[:]) != 0 {\n\t\t\tt.Error(\"Data read did not match reference values\")\n\t\t}\n\t} else {\n\t\tt.Fatal(\"Open call failed\")\n\t}\n}", "func (s *SkipList) Iterator() Iterator {\n\treturn &iter{\n\t\tcurrent: s.header,\n\t\tlist: s,\n\t}\n}", "func (s *SkipList) Iterator() Iterator {\n\treturn &iter{\n\t\tcurrent: s.header,\n\t\tlist: s,\n\t}\n}", "func TestMemoryDBIterator(t *testing.T) {\n\ttests := []struct {\n\t\tcontent map[string]string\n\t\tprefix string\n\t\torder []string\n\t}{\n\t\t// Empty databases should be iterable\n\t\t{map[string]string{}, \"\", nil},\n\t\t{map[string]string{}, \"non-existent-prefix\", nil},\n\n\t\t// Single-item databases should be iterable\n\t\t{map[string]string{\"key\": \"val\"}, \"\", []string{\"key\"}},\n\t\t{map[string]string{\"key\": \"val\"}, \"k\", []string{\"key\"}},\n\t\t{map[string]string{\"key\": \"val\"}, \"l\", nil},\n\n\t\t// Multi-item databases should be fully iterable\n\t\t{\n\t\t\tmap[string]string{\"k1\": \"v1\", \"k5\": \"v5\", \"k2\": \"v2\", \"k4\": \"v4\", \"k3\": \"v3\"},\n\t\t\t\"\",\n\t\t\t[]string{\"k1\", \"k2\", \"k3\", \"k4\", \"k5\"},\n\t\t},\n\t\t{\n\t\t\tmap[string]string{\"k1\": \"v1\", \"k5\": \"v5\", \"k2\": \"v2\", \"k4\": \"v4\", \"k3\": \"v3\"},\n\t\t\t\"k\",\n\t\t\t[]string{\"k1\", \"k2\", \"k3\", \"k4\", \"k5\"},\n\t\t},\n\t\t{\n\t\t\tmap[string]string{\"k1\": \"v1\", \"k5\": \"v5\", \"k2\": \"v2\", \"k4\": \"v4\", \"k3\": \"v3\"},\n\t\t\t\"l\",\n\t\t\tnil,\n\t\t},\n\t\t// Multi-item databases should be prefix-iterable\n\t\t{\n\t\t\tmap[string]string{\n\t\t\t\t\"ka1\": \"va1\", \"ka5\": \"va5\", \"ka2\": \"va2\", \"ka4\": \"va4\", \"ka3\": \"va3\",\n\t\t\t\t\"kb1\": \"vb1\", \"kb5\": \"vb5\", \"kb2\": \"vb2\", \"kb4\": \"vb4\", \"kb3\": \"vb3\",\n\t\t\t},\n\t\t\t\"ka\",\n\t\t\t[]string{\"ka1\", \"ka2\", \"ka3\", \"ka4\", \"ka5\"},\n\t\t},\n\t\t{\n\t\t\tmap[string]string{\n\t\t\t\t\"ka1\": \"va1\", \"ka5\": \"va5\", \"ka2\": \"va2\", \"ka4\": \"va4\", \"ka3\": \"va3\",\n\t\t\t\t\"kb1\": \"vb1\", \"kb5\": \"vb5\", \"kb2\": \"vb2\", \"kb4\": \"vb4\", \"kb3\": \"vb3\",\n\t\t\t},\n\t\t\t\"kc\",\n\t\t\tnil,\n\t\t},\n\t}\n\tfor i, tt := range tests {\n\t\t// Create the key-value data store\n\t\tdb := New()\n\t\tfor key, val := range tt.content {\n\t\t\tif err := db.Put([]byte(key), []byte(val)); err != nil {\n\t\t\t\tt.Fatalf(\"test %d: failed to insert item %s:%s into database: %v\", i, key, val, err)\n\t\t\t}\n\t\t}\n\t\t// Iterate over the database with the given configs and verify the results\n\t\tit, idx := db.NewIterator([]byte(tt.prefix), nil), 0\n\t\tfor it.Next() {\n\t\t\tif !bytes.Equal(it.Key(), []byte(tt.order[idx])) {\n\t\t\t\tt.Errorf(\"test %d: item %d: key mismatch: have %s, want %s\", i, idx, string(it.Key()), tt.order[idx])\n\t\t\t}\n\t\t\tif !bytes.Equal(it.Value(), []byte(tt.content[tt.order[idx]])) {\n\t\t\t\tt.Errorf(\"test %d: item %d: value mismatch: have %s, want %s\", i, idx, string(it.Value()), tt.content[tt.order[idx]])\n\t\t\t}\n\t\t\tidx++\n\t\t}\n\t\tif err := it.Error(); err != nil {\n\t\t\tt.Errorf(\"test %d: iteration failed: %v\", i, err)\n\t\t}\n\t\tif idx != len(tt.order) {\n\t\t\tt.Errorf(\"test %d: iteration terminated prematurely: have %d, want %d\", i, idx, len(tt.order))\n\t\t}\n\t}\n}", "func (InvertingInt32SliceIterator) Err() error { return nil }", "func (db *TriasDB) Iterator(start, end []byte) Iterator {\n\treturn db.MakeIterator(start, end, false)\n}", "func testMultiSourceImplementsSource(t *testing.T) {\n\tassert.Implements(t, (*Source)(nil), new(multiSource))\n}", "func (q *memQueue) Iter(fn func(int, []byte) bool) error {\n\tq.mu.Lock()\n\tdefer q.mu.Unlock()\n\n\tfor i, item := range q.q {\n\t\tif fn(i, item) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}", "func TestSkipList() {\n\ts := NewIntMap()\n\ts.Set(7, \"seven\")\n\ts.Set(1, \"one\")\n\ts.Set(0, \"zero\")\n\ts.Set(5, \"five\")\n\ts.Set(9, \"nine\")\n\ts.Set(10, \"ten\")\n\ts.Set(3, \"three\")\n\n\ts.printRepr()\n\tfmt.Println()\n\n\tif firstValue, ok := s.Get(0); ok {\n\t\tfmt.Println(firstValue)\n\t}\n\tfmt.Println()\n\t// prints:\n\t// zero\n\n\ts.Delete(7)\n\tif secondValue, ok := s.Get(7); ok {\n\t\tfmt.Println(secondValue)\n\t} else {\n\t\tfmt.Println(\"key=7 not found!\")\n\t}\n\tfmt.Println()\n\t// prints: not found!\n\n\ts.Set(9, \"niner\")\n\t// Iterate through all the elements, in order.\n\tunboundIterator := s.Iterator()\n\tfor unboundIterator.Next() {\n\t\tfmt.Printf(\"%d: %s\\n\", unboundIterator.Key(), unboundIterator.Value())\n\t}\n\tfmt.Println()\n\t// prints:\n\t// 0: zero\n\t// 1: one\n\t// 3: three\n\t// 5: five\n\t// 9: niner\n\t// 10: ten\n\n\tfor unboundIterator.Previous() {\n\t\tfmt.Printf(\"%d: %s\\n\", unboundIterator.Key(), unboundIterator.Value())\n\t}\n\tfmt.Println()\n\t// 9: niner\n\t// 5: five\n\t// 3: three\n\t// 1: one\n\t// 0: zero\n\n\tboundIterator := s.Range(3, 10)\n\t// Iterate only through elements in some range.\n\tfor boundIterator.Next() {\n\t\tfmt.Printf(\"%d: %s\\n\", boundIterator.Key(), boundIterator.Value())\n\t}\n\tfmt.Println()\n\t// prints:\n\t// 3: three\n\t// 5: five\n\t// 9: niner\n\n\tfor boundIterator.Previous() {\n\t\tfmt.Printf(\"%d: %s\\n\", boundIterator.Key(), boundIterator.Value())\n\t}\n\tfmt.Println()\n\t// prints:\n\t// 5: five\n\t// 3: three\n\n\tvar iterator Iterator\n\n\titerator = s.Seek(3)\n\tfmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n\t// prints:\n\t// 3: three\n\n\titerator = s.Seek(2)\n\tfmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n\t// prints:\n\t// 3: three\n\n\titerator = s.SeekToFirst()\n\tfmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n\t// prints:\n\t// 0: zero\n\n\titerator = s.SeekToLast()\n\tfmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n\tfmt.Println()\n\t// prints:\n\t// 10: ten\n\n\t// SkipList can also reduce subsequent forward seeking costs by reusing the same iterator:\n\titerator = s.Seek(3)\n\tfmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n\t// prints:\n\t// 3: three\n\n\titerator.Seek(5)\n\tfmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n\tfmt.Println()\n\t// prints:\n\t// 5: five\n\n\tfmt.Println(\"SkipList struct demo done.\")\n}", "func (p *Node) iter(next iterFunc) *collectionIterator {\n\treturn &collectionIterator{\n\t\tnext: next,\n\t\tnode: p,\n\t}\n}", "func TestRangeIterator(t *testing.T) {\n\ttree := NewSplayTree()\n\titems := []Item{Int(2), Int(4), Int(6), Int(1), Int(5), Int(3), Int(0)}\n\ttree.InsertAll(items)\n\tfor lkup := range items {\n\t\ttree.Lookup(Int(lkup))\n\t\tlower := Int(2)\n\t\tupper := Int(4)\n\t\titer := tree.RangeIterator(lower, upper)\n\t\tfor item := iter(); item != nil; item = iter() {\n\t\t\tif item.Less(lower) || upper.Less(item) {\n\t\t\t\tt.Errorf(\"RangeIterator item %v ![%v, %v]\", item, lower, upper)\n\t\t\t}\n\t\t}\n\t\tlower = Int(-10)\n\t\tupper = Int(-1)\n\t\titer = tree.RangeIterator(lower, upper)\n\t\tfor item := iter(); item != nil; item = iter() {\n\t\t\tif item.Less(lower) || upper.Less(item) {\n\t\t\t\tt.Errorf(\"RangeIterator item %v ![%v, %v]\", item, lower, upper)\n\t\t\t}\n\t\t}\n\t\tlower = Int(-1)\n\t\tupper = Int(3)\n\t\titer = tree.RangeIterator(lower, upper)\n\t\tfor item := iter(); item != nil; item = iter() {\n\t\t\tif item.Less(lower) || upper.Less(item) {\n\t\t\t\tt.Errorf(\"RangeIterator item %v ![%v, %v]\", item, lower, upper)\n\t\t\t}\n\t\t}\n\t\tlower = Int(3)\n\t\tupper = Int(9)\n\t\titer = tree.RangeIterator(lower, upper)\n\t\tfor item := iter(); item != nil; item = iter() {\n\t\t\tif item.Less(lower) || upper.Less(item) {\n\t\t\t\tt.Errorf(\"RangeIterator item %v ![%v, %v]\", item, lower, upper)\n\t\t\t}\n\t\t}\n\t\tlower = Int(9)\n\t\tupper = Int(29)\n\t\titer = tree.RangeIterator(lower, upper)\n\t\tfor item := iter(); item != nil; item = iter() {\n\t\t\tif item.Less(lower) || upper.Less(item) {\n\t\t\t\tt.Errorf(\"RangeIterator item %v ![%v, %v]\", item, lower, upper)\n\t\t\t}\n\t\t}\n\t}\n}", "func Iterator(scope *Scope, shared_name string, container string, output_types []tf.DataType, output_shapes []tf.Shape) (handle tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{\"shared_name\": shared_name, \"container\": container, \"output_types\": output_types, \"output_shapes\": output_shapes}\n\topspec := tf.OpSpec{\n\t\tType: \"Iterator\",\n\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (v Varint) Iterator() func() (n int64, ok bool) {\n\tnext := v.Uvarint.Iterator()\n\treturn func() (int64, bool) {\n\t\tu, ok := next()\n\t\treturn int64(u), ok\n\t}\n}", "func (kv *KV) Iterator(f func([]byte, []byte) bool) error {\n\trows, err := kv.db.Query(\n\t\tfmt.Sprintf(\"SELECT k, v FROM %s\", string(kv.table)),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\tvar k, v []byte\n\tfor rows.Next() {\n\t\tif err = rows.Scan(&k, &v); err == nil {\n\t\t\tif !f(k, v) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "func (db *RocksDB) Iterator(start, end []byte) (Iterator, error) {\n\titr := db.db.NewIterator(db.ro)\n\treturn newRocksDBIterator(itr, start, end, false), nil\n}", "func (m MakeInt32Iter) MakeIter() Int32Iterator { return m() }", "func TestInterface(t *testing.T) {\n\ttype Sample struct {\n\t\tDummy int64\n\t\tStr string\n\t}\n\n\ttype Test struct {\n\t\tvalue interface{}\n\t}\n\ttests := []Test{\n\t\t{[]int{1, 2, 3}},\n\t\t{Sample{10, \"MyString\"}},\n\t}\n\n\tInterfaceMap[\"[]int\"] = reflect.TypeOf([]int{})\n\tInterfaceMap[\"sexpr.Sample\"] = reflect.TypeOf(Sample{0, \"\"})\n\n\tfor _, test := range tests {\n\t\ttype Struct struct {\n\t\t\tI interface{}\n\t\t}\n\t\ts := Struct{test.value}\n\t\t// Encode it\n\t\tdata, err := Marshal(s)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Marshal failed: %v\", err)\n\t\t}\n\t\t// Decode it\n\t\tvar value Struct\n\t\terr = Unmarshal(data, &value)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Unmarshal failed: %v\", err)\n\t\t}\n\t\t// Check equality.\n\t\tif !reflect.DeepEqual(value, s) {\n\t\t\tt.Fatalf(\"not equal: %v/%v\", value, s)\n\t\t}\n\t\tt.Logf(\"Unmarshal() = %+v\\n\", value)\n\t}\n}", "func TarIterator(reader io.Reader, visitor TarVisitor) error {\n\ttarReader := tar.NewReader(reader)\n\n\tfor {\n\t\thdr, err := tarReader.Next()\n\t\tif errors.Is(err, io.EOF) {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := visitor(hdr, tarReader); err != nil {\n\t\t\tif errors.Is(err, ErrTarStopIteration) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"failed to visit tar entry=%q : %w\", hdr.Name, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (tfb *TempFileBlock) Iterator() (*BlockIterator, error) {\n reader, err := tfb.Reader()\n if err != nil {\n return &BlockIterator{}, errors.Wrap(err, \"Error creating iterator\")\n }\n\n it := &BlockIterator{\n Reader: reader,\n BigEndian: tfb.UseBigEndian(),\n }\n\n return it, nil\n}", "func (e Account) Iterator(s ent.Storage) ent.EntIterator { return s.IterateEnts(&e) }", "func (e Account) Iterator(s ent.Storage) ent.EntIterator { return s.IterateEnts(&e) }", "func TestSanity(t *testing.T) {\n\ts := newIntMap()\n\tfor i := 0; i < 10000; i++ {\n\t\tinsert := rand.Int()\n\t\ts.Set(insert, insert)\n\t}\n\tvar last int = 0\n\n\ti := s.Iterator()\n\tdefer i.Close()\n\n\tfor i.Next() {\n\t\tif last != 0 && i.Key().(int) <= last {\n\t\t\tt.Errorf(\"Not in order!\")\n\t\t}\n\t\tlast = i.Key().(int)\n\t}\n\n\tfor i.Previous() {\n\t\tif last != 0 && i.Key().(int) > last {\n\t\t\tt.Errorf(\"Not in order!\")\n\t\t}\n\t\tlast = i.Key().(int)\n\t}\n}", "func (_m *MockReaderIterator) Err() error {\n\tret := _m.ctrl.Call(_m, \"Err\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func SrtingsIterator(strs ...string) Iterator {\n\tvar bbw Writer\n\tfor _, s := range strs {\n\t\tbs := []byte(s)\n\t\tbf, err := bbw.Allocate(len(bs), true)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tcopy(bf, bs)\n\t}\n\n\tres, err := bbw.Close()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\trdr := new(Reader)\n\trdr.Reset(res, false)\n\treturn rdr\n}", "func (_m *MockIterator) Close() {\n\t_m.ctrl.Call(_m, \"Close\")\n}", "func (db *DB) doWithIterator(query string, arguments []interface{}) (Iterator, error) {\n\trows, columns, err := db.executeQuery(query, arguments, true, true)\n\tif err != nil {\n\t\tif rows != nil {\n\t\t\trows.Close()\n\t\t}\n\t\treturn nil, err\n\t}\n\n\titerator := iteratorInternals{\n\t\trows: rows,\n\t\tcolumns: columns,\n\t}\n\n\treturn &iterator, nil\n}", "func Test_List(t *testing.T) {\n\n\tl := list.New()\n\tfor i := 0; i < 10; i++ {\n\t\tl.PushBack(fmt.Sprintf(\"data_%d\", i))\n\t}\n\n\tfor e := l.Front(); e != nil; e = e.Next() {\n\t\tt.Log(\"::::>>>>\", e)\n\t}\n\n\tfor e := l.Front(); e != nil; e = e.Next() {\n\t\tt.Log(\"---->>>>\", e)\n\t}\n\n}", "func (m *memory) Iterator() (Iterator, error) {\n\tm.RLock()\n\tdefer m.RUnlock()\n\tkeys := make([]string, len(m.keys))\n\tcopy(keys, m.keys)\n\tstorage := make(map[string][]byte, len(m.storage))\n\tfor k, v := range m.storage {\n\t\tstorage[k] = v\n\t}\n\treturn &memiter{-1, keys, storage}, nil\n}", "func (i *Iter) Scan(dest ...interface{}) bool {\n\treturn i.iter.Scan(dest...)\n}", "func (_m *MockReaderIteratorPool) Init(alloc ReaderIteratorAllocate) {\n\t_m.ctrl.Call(_m, \"Init\", alloc)\n}", "func (m *MockGCS) GetObjectIterator(arg0 string) iterator.Pageable {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetObjectIterator\", arg0)\n\tret0, _ := ret[0].(iterator.Pageable)\n\treturn ret0\n}", "func (_m *MockMultiReaderIteratorPool) Init(alloc ReaderIteratorAllocate) {\n\t_m.ctrl.Call(_m, \"Init\", alloc)\n}", "func assertItemType(c <-chan item, typ itemType, t *testing.T) {\n i := <-c\n if i.typ != typ {\n fmt.Println(\"Wrong item type\")\n t.Fail()\n }\n}", "func TestIteratorPrev(t *testing.T) {\n\tconst n = 100\n\tl := NewSkiplist(NewArena(arenaSize))\n\n\tvar it Iterator\n\tit.Init(l)\n\n\trequire.False(t, it.Valid())\n\n\tit.SeekToLast()\n\trequire.False(t, it.Valid())\n\n\tfor i := 0; i < n; i++ {\n\t\tit.Add([]byte(fmt.Sprintf(\"%05d\", i)), newValue(i), 0)\n\t}\n\n\tit.SeekToLast()\n\tfor i := n - 1; i >= 0; i-- {\n\t\trequire.True(t, it.Valid())\n\t\trequire.EqualValues(t, newValue(i), it.Value())\n\t\tit.Prev()\n\t}\n\trequire.False(t, it.Valid())\n}", "func (UintSliceIterator) Err() error { return nil }", "func (_m *MockMutableSeriesIteratorsPool) Get(size int) MutableSeriesIterators {\n\tret := _m.ctrl.Call(_m, \"Get\", size)\n\tret0, _ := ret[0].(MutableSeriesIterators)\n\treturn ret0\n}", "func (_m *MockMultiReaderIterator) Err() error {\n\tret := _m.ctrl.Call(_m, \"Err\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}" ]
[ "0.65963125", "0.65729076", "0.63306326", "0.6292579", "0.6115231", "0.60881704", "0.60851395", "0.60494417", "0.59806186", "0.59703356", "0.59606194", "0.592851", "0.59058845", "0.5902405", "0.58828515", "0.5868109", "0.57136816", "0.5703445", "0.56945217", "0.5673303", "0.5615967", "0.5594087", "0.5591798", "0.55798656", "0.5570273", "0.55684483", "0.55623686", "0.5556755", "0.5553624", "0.5504543", "0.5503401", "0.5498374", "0.54940164", "0.5472884", "0.5464655", "0.5449785", "0.5443043", "0.5418406", "0.5417551", "0.5393652", "0.5386988", "0.5382588", "0.5376446", "0.5356935", "0.53526944", "0.5348924", "0.53461295", "0.5337126", "0.53365296", "0.5328565", "0.53067815", "0.5300684", "0.52856785", "0.52827597", "0.5264794", "0.52626914", "0.5250343", "0.52430695", "0.52410567", "0.52082413", "0.5201102", "0.5183162", "0.51817375", "0.5169486", "0.51645356", "0.51645356", "0.5163272", "0.5161555", "0.51599556", "0.5158689", "0.5157315", "0.51564056", "0.51425505", "0.51398784", "0.51315415", "0.51218075", "0.5110481", "0.5107558", "0.51067895", "0.5098923", "0.5098342", "0.50974953", "0.5092557", "0.5092557", "0.5090852", "0.5084828", "0.50758857", "0.5074615", "0.50665927", "0.50623107", "0.50585496", "0.505216", "0.5049819", "0.5045743", "0.5043591", "0.5043406", "0.5039917", "0.50357974", "0.50200796", "0.50185794" ]
0.70005614
0
tell the server to shut itself down. please do not change this function.
func (kv *KVPaxos) kill() { kv.dead = true kv.l.Close() kv.px.Kill() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Controller) Down(wg *sync.WaitGroup, timeout time.Duration) {\n\tdefer wg.Done()\n\n\tcs := c.wrapper.CurrentState()\n\n\tif cs == ServerOffline {\n\t\tlogrus.Info(\"Minecraft Server already stopped\")\n\t\treturn\n\t}\n\n\tif cs == ServerStarting || cs == ServerOnline {\n\t\tif err := c.wrapper.Stop(); err != nil {\n\t\t\tlogrus.Errorf(\"Server Shutdown Failed:%+v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif err := c.wrapper.WaitUntilOffline(timeout); err != nil {\n\t\tlogrus.Errorf(\"Server Shutdown Failed:%+v\", err)\n\t\treturn\n\t}\n\n\tlogrus.Info(\"Minecraft Server Exited Properly\")\n}", "func shutDown(ctx context.Context, logger *log.Logger, srv *http.Server) {\n\tquit := make(chan os.Signal, 1)\n\tsignal.Notify(quit, os.Interrupt)\n\t<-quit\n\n\tlogger.Info(\"msg\", \"Shutting down HTTP/REST gateway server...\")\n\n\tctx, cancel := context.WithTimeout(ctx, 5*time.Second)\n\tdefer cancel()\n\n\tif err := srv.Shutdown(ctx); err != nil {\n\t\tlogger.Error(\"err\", fmt.Sprintf(\"Shutdown HTTP/REST gateway server: %s\", err.Error()))\n\t}\n\n\tlogger.Info(\"msg\", \"Shutdown done HTTP/REST gateway server\")\n}", "func (s *Server) Shutdown() {\n\tclose(stop)\n}", "func (d *DynamicSelect) shutDown() {\n\tif r := recover(); r != nil {\n\t\tlog.Printf(\"Recovered from panic in main DynamicSelect: %v\\n\", r)\n\t\tlog.Println(\"Attempting normal shutdown.\")\n\t}\n\n\t// just making sure.\n\td.killHeard = true\n\td.alive = false\n\td.running = false\n\tclose(d.done)\n\n\t// Tell the outside world we're done.\n\td.onKillAction()\n\n\t// Handle outstanding requests / a flood of closed messages.\n\tgo d.drainChannels()\n\n\t// Wait for internal listeners to halt.\n\td.listenerWG.Wait()\n\n\t// Make it painfully clear to the GC.\n\tclose(d.aggregator)\n\tclose(d.priorityAggregator)\n\tclose(d.onClose)\n}", "func (s *SWIM) ShutDown() {\n\tatomic.CompareAndSwapInt32(&s.stopFlag, AVAILABLE, DIE)\n\ts.messageEndpoint.Shutdown()\n\ts.quitFD <- struct{}{}\n}", "func (s *server) shutdown(ctx context.Context) error {\n\treturn s.server.Shutdown(ctx)\n}", "func (s *Server) ShutDown(ctx context.Context) error {\n\treturn s.HTTPServer.Shutdown(ctx)\n}", "func (this *ReceiverHolder) Shutdown() error {\n\tfmt.Println(\"Shutting down Server...please wait.\")\n\tfmt.Println(\"######################################\")\n\tthis.receiver.Stop()\n\tfmt.Println(\"######################################\")\n\treturn nil\n}", "func (hd *Downloader) shutdown() {\n\textendDeadline(hd.conn, modules.NegotiateSettingsTime)\n\t// don't care about these errors\n\t_, _ = verifySettings(hd.conn, hd.host)\n\t_ = modules.WriteNegotiationStop(hd.conn)\n\tclose(hd.closeChan)\n}", "func (s *server) shutdown() {\n\tif s.isShutdown {\n\t\treturn\n\t}\n\ts.mu.Lock()\n\tfmt.Printf(\"Shutting down server...\\n\")\n\ts.isShutdown = true\n\tif s.listener != nil {\n\t\ts.listener.Close()\n\t}\n\ts.mu.Unlock()\n}", "func (s *Server) Shutdown(ctx context.Context) error {\n\t// logInfo(\"%v %v Shutdown...\", s.Handler.LogTag(), s.Listener.Addr())\n\tdefer logInfo(\"%v %v Shutdown\", s.Handler.LogTag(), s.Listener.Addr())\n\ts.running = false\n\ts.Listener.Close()\n\tselect {\n\tcase <-s.chStop:\n\tcase <-ctx.Done():\n\t\treturn ErrTimeout\n\t}\n\treturn nil\n}", "func shutdownServer() {\n\tshutdownDelay := time.NewTimer(SHUTDOWN_DELAY)\n\t<-shutdownDelay.C\n\tsrv.Shutdown(context.Background())\n}", "func (s *testDoQServer) Shutdown() {\n\t_ = s.listener.Close()\n}", "func Stop() {\n\t// /bin/dbus-send --system --dest=org.ganesha.nfsd --type=method_call /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.shutdown\n}", "func (srv *Server) Stop() {\n Warn(fmt.Sprintf(\"stopping server %s\", srv.addrURL.String()))\n srv.mu.Lock()\n if srv.httpServer == nil {\n srv.mu.Unlock()\n return\n }\n graceTimeOut := time.Duration(50)\n ctx, cancel := context.WithTimeout(context.Background(), graceTimeOut)\n defer cancel()\n if err := srv.httpServer.Shutdown(ctx); err != nil {\n Debug(\"Wait is over due to error\")\n if err := srv.httpServer.Close(); err != nil {\n Debug(err.Error())\n }\n Debug(err.Error())\n }\n close(srv.stopc)\n <-srv.donec\n srv.mu.Unlock()\n Warn(fmt.Sprintf(\"stopped server %s\", srv.addrURL.String()))\n}", "func (s *server) Stop() error {\n\t// Make sure this only happens once.\n\tif atomic.AddInt32(&s.shutdown, 1) != 1 {\n\t\tlogging.CPrint(logging.INFO, \"server is already in the process of shutting down\", logging.LogFormat{})\n\t\treturn nil\n\t}\n\n\ts.syncManager.Stop()\n\n\t// Signal the remaining goroutines to quit.\n\tclose(s.quit)\n\n\ts.wg.Done()\n\n\treturn nil\n}", "func (s *Server) Stop() {\n\tclose(s.channelQuit)\n}", "func (p *grpcPort) shutdown(ctx context.Context) {\n\tp.m.Lock()\n\tserver := p.server\n\tif p.healthSrv != nil {\n\t\tp.healthSrv.Shutdown() // announce we are going away\n\t}\n\tp.m.Unlock()\n\tif server != nil {\n\t\tserver.GracefulStop()\n\t}\n}", "func (sc *ServerConn) Shutdown() {\n\tsc.cancel()\n}", "func (s *Server) Stop() {\n\ts.logger.Notice(\"Shutting down %v server...\", s.name)\n\ts.killChan <- true\n\ts.logger.Notice(\"Server %v shutdown complete.\", s.name)\n}", "func (s *server) Stop() {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\ts.httpServer.SetKeepAlivesEnabled(false)\n\terr := s.httpServer.Shutdown(ctx)\n\tif err != nil {\n\t\ts.logger.Fatalf(\"could not gracefully shutdown the server: %v\\n\", err)\n\t}\n\n\t<-s.done\n}", "func (m *Manager) shutdownServer() {\n\t// returns an error but ignoring for now\n\tm.srv.Shutdown(context.Background())\n}", "func ShutDown() {\n\tC.shout_shutdown()\n}", "func Teardown() {\n\tinitController()\n\tc.tm.Teardown()\n\tlog.Println(\"Server stopped.\")\n}", "func (s *Server) Stop() error {\n\tif err := s.conn.Close(); err != nil {\n\t\treturn fmt.Errorf(\"Could not close connection. Err: %s\", err)\n\t}\n\n\terr := s.agonesSDK.Shutdown()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not shutdown Agones. Err: %s\", err)\n\t}\n\n\treturn nil\n}", "func (s *Server) Shutdown() error {\n\ts.ctxCancel()\n\treturn nil\n}", "func (h *healthcheckManager) shutdown() {\n\th.quit <- true\n\t<-h.stopped\n}", "func (s *Server) Shutdown() {\n\ts.log.Info(\"shutting down server\", zap.Int(\"peers\", s.PeerCount()))\n\ts.transport.Close()\n\ts.discovery.Close()\n\ts.consensus.Shutdown()\n\tfor _, p := range s.getPeers(nil) {\n\t\tp.Disconnect(errServerShutdown)\n\t}\n\ts.bQueue.discard()\n\ts.bSyncQueue.discard()\n\tif s.StateRootCfg.Enabled {\n\t\ts.stateRoot.Shutdown()\n\t}\n\tif s.oracle != nil {\n\t\ts.oracle.Shutdown()\n\t}\n\tif s.notaryModule != nil {\n\t\ts.notaryModule.Stop()\n\t}\n\tif s.chain.P2PSigExtensionsEnabled() {\n\t\ts.notaryRequestPool.StopSubscriptions()\n\t}\n\tclose(s.quit)\n}", "func (srv *Server) Stop() error {\n\tif err := srv.app.Shutdown(); err != nil {\n\t\treturn err\n\t}\n\tif err := srv.config.StorageDriver.Disconnect(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (n *Network) ShutDown() {\n\tdefer n.CancelFunc()\n\terr := n.H.Close()\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tpanic(err)\n\t}\n}", "func (s *SrvSession) Shutdown(ctx context.Context) {\n\tif s.srv != nil {\n\t\tif err := s.srv.Shutdown(ctx); err != nil && err != http.ErrServerClosed {\n\t\t\tlog.Warningf(\"Shutdown for [%v] %v\", s.listenAddr, err)\n\t\t}\n\t}\n}", "func (s *PingServer) Shutdown() {\n\ts.srv.GracefulStop()\n}", "func (s *server) Stop() error {\n\t// Bail if we're already shutting down.\n\tif atomic.AddInt32(&s.shutdown, 1) != 1 {\n\t\treturn nil\n\t}\n\n\t// Shutdown the wallet, funding manager, and the rpc server.\n\ts.chainNotifier.Stop()\n\ts.rpcServer.Stop()\n\ts.fundingMgr.Stop()\n\ts.chanRouter.Stop()\n\ts.htlcSwitch.Stop()\n\ts.utxoNursery.Stop()\n\ts.breachArbiter.Stop()\n\ts.discoverSrv.Stop()\n\ts.lnwallet.Shutdown()\n\n\t// Signal all the lingering goroutines to quit.\n\tclose(s.quit)\n\ts.wg.Wait()\n\n\treturn nil\n}", "func (server *Server) Stop() {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tif cancel != nil {\n\t\tserver.srv.Shutdown(ctx)\n\t\tserver.srv = nil\n\t}\n\tif server.hub != nil {\n\t\tserver.hub.stop()\n\t}\n}", "func (sw *SimpleWebServer) Shutdown(ctx context.Context) error {\n\tif !sw.running {\n\t\treturn fmt.Errorf(\"not started\")\n\t}\n\tsw.running = false\n\treturn sw.Server.Shutdown(ctx)\n}", "func (s *Server) Shutdown(ctx context.Context) error {\n\twg := &sync.WaitGroup{}\n\tc := make(chan struct{})\n\n\tgo func() {\n\t\tdefer close(c)\n\t\ts.GracefulStop()\n\t\twg.Wait()\n\t}()\n\n\tselect {\n\tcase <-c:\n\t\treturn nil\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n}", "func (s *Server) Shutdown() error {\n\treturn s.Provider().Stop()\n}", "func (s *Server) Stop() error {\n\ts.logger.Log(\"msg\", \"stopping\")\n\tctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancelFn()\n\n\terr := s.encoder.(system.Stoppable).Stop()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.mqtt.(system.Stoppable).Stop()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.db.Stop()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.srv.Shutdown(ctx)\n}", "func (a *App) Stop() {\n\t// Create a context to attempt a graceful 5 second shutdown.\n\tconst timeout = 5 * time.Second\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\n\t// Attempt the graceful shutdown by closing the listener and\n\t// completing all inflight requests.\n\tif err := a.server.Shutdown(ctx); err != nil {\n\t\ta.logger.Printf(\"Could not stop server gracefully: %v\", err)\n\t\ta.logger.Printf(\"Initiating hard shutdown\")\n\t\tif err := a.server.Close(); err != nil {\n\t\t\ta.logger.Printf(\"Could not stop http server: %v\", err)\n\t\t}\n\t}\n}", "func (sr *sapmReceiver) Shutdown(context.Context) error {\n\tif sr.server == nil {\n\t\treturn nil\n\t}\n\terr := sr.server.Close()\n\tsr.shutdownWG.Wait()\n\treturn err\n}", "func (s *Server) Shutdown() error {\n\ts.api.ServerShutdown()\n\treturn nil\n}", "func (g *Group) Shutdown(ctx context.Context) error {\n\tif g.transition(started, stopping) {\n\t\tdefer g.transition(stopping, stopped)\n\t\treturn g.execute(func(s Server) error {\n\t\t\treturn s.Shutdown(ctx)\n\t\t}, nil)\n\t}\n\n\treturn errors.New(\"server is already stopped or shutting down\")\n}", "func (s *Server) Stop() {\n\ts.server.Stop()\n}", "func (ms *MarvinServer) Stop() {\n\n}", "func (s *Server) Shutdown() (err error) {\n\tlog.Info().Msg(\"gracefully shutting down\")\n\ts.srv.GracefulStop()\n\tif err = s.trisa.Shutdown(); err != nil {\n\t\tlog.Error().Err(err).Msg(\"could not shutdown trisa server\")\n\t\treturn err\n\t}\n\tlog.Debug().Msg(\"successful shutdown\")\n\treturn nil\n}", "func (s *tcpServerBase) Shutdown() {\n\tlog.WithField(\"name\", s.name).Debug(\"shutting down\")\n\tclose(s.quit)\n\t_ = s.listener.Close()\n}", "func (s *Server) shutdown() error {\n\ts.shutdownLock.Lock()\n\tdefer s.shutdownLock.Unlock()\n\n\ts.unregister(s.initialEntry)\n\n\tif s.shouldShutdown {\n\t\treturn nil\n\t}\n\ts.shouldShutdown = true\n\n\ts.shutdownChan <- true\n\t//s.shutdownChanProbe <- true\n\n\tif s.ipv4conn != nil {\n\t\ts.ipv4conn.Close()\n\t}\n\tif s.ipv6conn != nil {\n\t\ts.ipv6conn.Close()\n\t}\n\n\tlog.Println(\"Waiting for goroutines to finish\")\n\ts.waitGroup.Wait()\n\n\treturn nil\n}", "func (s *SimpleServer) Stop() {\n\tif s != nil {\n\t\ts.shutdownReq <- true\n\t}\n}", "func (s *Server) Stop() error {\n\t// Check if the server is running\n\tif !s.IsRunning() {\n\t\treturn errors.New(\"Attempted to stop a non-running server\")\n\t}\n\n\t// Shut down server gracefully, but wait no longer than a configured amount of seconds before halting\n\tctx, _ := context.WithTimeout(context.Background(), time.Duration(config.GetInstance().Server.Timeouts.ShutDown)*time.Second)\n\tif err := s.instance.Shutdown(ctx); err != nil {\n\t\treturn err\n\t}\n\n\ts.running = false\n\n\treturn nil\n}", "func (s *Server) Shutdown() error {\n\ts.server.GracefulStop()\n\treturn nil\n}", "func (s *Server) Shutdown(graceful bool) {\n\ts.yorkieServiceCancel()\n\n\tif graceful {\n\t\ts.grpcServer.GracefulStop()\n\t} else {\n\t\ts.grpcServer.Stop()\n\t}\n}", "func (s *Server) Stop() {\n\ts.stopAPIServer()\n\ts.stopFUSEServer()\n\ts.shutdown()\n}", "func (s *Server) Stop() {\n\ts.quit <- true\n\t<-s.quit\n}", "func (s *Server) Stop(ctx context.Context) {\n\ts.shutdownFuncsM.Lock()\n\tdefer s.shutdownFuncsM.Unlock()\n\ts.shutdownOnce.Do(func() {\n\t\tclose(s.shuttingDown)\n\t\t// Shut down the HTTP server in parallel to calling any custom shutdown functions\n\t\twg := sync.WaitGroup{}\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tif err := s.srv.Shutdown(ctx); err != nil {\n\t\t\t\tslog.Debug(ctx, \"Graceful shutdown failed; forcibly closing connections 👢\")\n\t\t\t\tif err := s.srv.Close(); err != nil {\n\t\t\t\t\tslog.Critical(ctx, \"Forceful shutdown failed, exiting 😱: %v\", err)\n\t\t\t\t\tpanic(err) // Something is super hosed here\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tfor _, f := range s.shutdownFuncs {\n\t\t\tf := f // capture range variable\n\t\t\twg.Add(1)\n\t\t\tgo func() {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tf(ctx)\n\t\t\t}()\n\t\t}\n\t\twg.Wait()\n\t})\n}", "func (ts *Server) Stop() error {\n\tif ts.Server == nil {\n\t\treturn nil\n\t}\n\tif err := ts.Server.Shutdown(context.Background()); err != nil {\n\t\treturn err\n\t}\n\tts.Server = nil\n\treturn nil\n}", "func (srv *Server) Shutdown() {\n\tsrv.opsLock.Lock()\n\tsrv.shutdown = true\n\t// Don't block if there's no currently processed operations\n\tif srv.currentOps < 1 {\n\t\treturn\n\t}\n\tsrv.opsLock.Unlock()\n\t<-srv.shutdownRdy\n}", "func (m *Server) Shutdown() error {\n\tm.Listener.Close()\n\treturn nil\n}", "func (r *server) Stop() {\n\t// TODO: pass context in as a parameter.\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tif err := r.stopHTTPServers(ctx); err != nil {\n\t\tlog.WithError(err).Error(\"Some HTTP servers failed to shutdown.\")\n\t}\n\n\tr.Server.Stop()\n}", "func (s *Server) Shutdown() {\n\ts.candidate.endCampaign()\n\n\t// Shutdown the RPC listener.\n\tif s.rpcListener != nil {\n\t\tlogging.Info(\"core/server: shutting down RPC server at %v\", s.rpcListener.Addr())\n\t\ts.rpcListener.Close()\n\t}\n\n\tclose(s.shutdownChan)\n}", "func (p *Proxy) Shutdown() {\n\tlog.Info(\"Shutting down server gracefully\")\n\tclose(p.shutdown)\n\tgraceful.Shutdown()\n\tp.gRPCStop()\n}", "func (o *OmahaServer) Shutdown(ctx context.Context) {\n\to.server.Shutdown(ctx)\n\tclose(o.shuttingDown)\n}", "func (p *PrivNegAPI) Stop() {\n\tif err := p.server.Shutdown(nil); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (ui *GUI) Shutdown() {\n\tctx, cl := context.WithTimeout(ui.cfg.Ctx, time.Second*5)\n\tdefer cl()\n\tif err := ui.server.Shutdown(ctx); err != nil {\n\t\tlog.Error(err)\n\t}\n}", "func (s *Server) Stop() {\n\t// TODO write to `s.stop` channel\n}", "func stopServer(w http.ResponseWriter, r *http.Request) {\n\tgo localServer.Shutdown(context.Background())\n}", "func (s *Server) Shutdown() {\n\tlog.Printf(\"server Shutdown 1\")\n\n\tif s.cancel != nil {\n\t\ts.cancel()\n\t}\n\n\t// Wait until interfaces shut down\n\ts.grpcStopped.Wait()\n\ts.restStopped.Wait()\n}", "func (s *Server) Shutdown() {\n\ts.serverLock.Lock()\n\tdefer s.serverLock.Unlock()\n\ts.server.Stop()\n\ts.cancel()\n}", "func (w *Webserver) Stop() error {\n\tw.logger.Infof(\"gracefully shutting down http server at %d...\", w.config.Port)\n\n\terr := w.Server.Shutdown(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclose(w.jobs)\n\treturn nil\n}", "func (ser *Server) Stop() {\n\tmanners.Close()\n}", "func (s *Server) Stop() {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\tdefer cancel()\n\n\ts.logger.Info(\"Shutting down\")\n\tif err := s.server.Shutdown(ctx); err != nil {\n\t\ts.logger.Errorw(\"HTTP server shutdown\",\n\t\t\t\"error\", err,\n\t\t)\n\t}\n}", "func (srv *Server) Shutdown(ctx context.Context, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\treturn srv.Server.Shutdown(ctx)\n}", "func (s *Server) Stop() error {\n\treturn nil\n}", "func (ws *WebServer) Shutdown() error {\n\terr := ws.server.Shutdown(context.Background())\n\tws.server = nil\n\treturn err\n}", "func (t *TcpServer) Stop() {\n\tt.isRunning = false\n}", "func serverShutdown(finalConn net.Conn) {\n\tvar shutdown string\n\t// If all clients have left... (Note this is never called when the server is started because no client has disconnected even though there are no clients)\n\tif len(connMap) == 0 {\n\t\tif err := finalConn.Close(); err == nil {\n\t\t\tfmt.Println(\"Closing final connection...\") // Close the connection of the last client\n\t\t\tfinalConn.Close()\n\t\t}\n\t\tfmt.Println(\"All users have left the chat\")\n\t\tfmt.Print(\"Do you wish to shut down the server ? yes/no : \")\n\t\tfmt.Scanln(&shutdown) // Put the message typed into shutdown\n\t\tif shutdown == \"yes\" {\n\t\t\tfmt.Print(\"Shutting down server...\")\n\t\t\tos.Exit(0) // Server shutdown with no error\n\t\t}\n\t}\n}", "func (he *Editor) shutdown() {\n\textendDeadline(he.conn, modules.NegotiateSettingsTime)\n\t// don't care about these errors\n\t_, _ = verifySettings(he.conn, he.host)\n\t_ = modules.WriteNegotiationStop(he.conn)\n\tclose(he.closeChan)\n}", "func (s *Server) Shutdown() {\n\ts.Registry.Deregister(s.uuid)\n}", "func (s *Server) Shutdown() {\n\ts.Registry.Deregister(s.uuid)\n}", "func (s *Server) Shutdown() {\n\tlog.Println(\"Shutting down\")\n\ts.shutdown()\n}", "func WorkerShutDown(workerID int){\n\tworkerMsg := WorkerMessage{}\n\tworkerMsg.ID = workerID\n\n\tcall(\"Master.WorkerShutDown\", &workerMsg, &workerMsg)\n}", "func (sc *serverConfig) Shutdown() {\n\tlog.Println(\"shutting down http server...\")\n\tsc.Shutdown()\n}", "func (htmlServer *HTMLServer) Stop() error {\n\n\tconst timeout = 5 * time.Second\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\n\tlog.Println(Detail(\"SERVER : Service stopping.\"))\n\n\tif e := htmlServer.server.Shutdown(ctx); e != nil {\n\n\t\tif e := htmlServer.server.Close(); e != nil {\n\t\t\tlog.Printf(Warn(\"SERVER : Service stopping : Error=%s\"), e)\n\t\t\treturn e\n\t\t}\n\t}\n\n\thtmlServer.wg.Wait()\n\tlog.Println(Detail(\"SERVER : Stopped\"))\n\treturn nil\n}", "func (gate *Gate) Shutdown() {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tif err := gate.srv.Shutdown(ctx); err != nil {\n\t\tpanic(\"Server Shutdown Error : \" + err.Error())\n\t}\n\tfmt.Println(\"Server Exit\")\n}", "func (s *DefaultServer) Shutdown() error {\n\terr := s.cmd.Wait()\n\tif err != nil {\n\t\treturn s.cmd.Process.Kill()\n\t}\n\n\treturn err\n}", "func (as *AdminServer) Shutdown() error {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\tdefer cancel()\n\treturn as.server.Shutdown(ctx)\n}", "func (s *Server) Stop() {\n\ts.g.Stop()\n}", "func (e *Engine) Shutdown() error {\n\treturn e.server.Shutdown(context.TODO())\n}", "func (d *Driver) Shutdown(ctx context.Context) error {\n\treturn d.Server.Shutdown(ctx)\n}", "func (o *Object) StopHttpServer() {\n\t_ = o.server.Shutdown(context.Background())\n}", "func (s *Server) OnStop() {}", "func (s Server) Shutdown() {\n\ts.logger.Error(s.server.Shutdown(context.Background()))\n}", "func (s *Server) Shutdown(ctx context.Context) error {\n\treturn s.service.Stop(ctx)\n}", "func (c *Client) Shutdown() error {\n\tif _, err := c.httpPost(\"system/shutdown\", \"\"); err != nil {\n\t\treturn maskAny(err)\n\t}\n\treturn nil\n}", "func (dd *DefaultDriver) Shutdown(ctx context.Context) error {\n\treturn dd.Server.Shutdown(ctx)\n}", "func (s *WiringServer) Shutdown() {\n\ts.cacheServer.hs.Close()\n}", "func (g GrpcServer) Stop() {\n\tg.server.GracefulStop()\n}", "func (s *callbackServer) Shutdown() {\n\tif err := s.server.Shutdown(context.Background()); err != nil {\n\t\tlog.Printf(\"HTTP server Shutdown error: %v\", err)\n\t}\n}", "func (c *client) Shutdown(ctx context.Context, goodbye bool) error {\n\tq := url.Values{}\n\tif goodbye {\n\t\tq.Set(\"mode\", \"goodbye\")\n\t}\n\turl := c.createURL(\"/shutdown\", q)\n\n\treq, err := http.NewRequest(\"POST\", url, nil)\n\tif err != nil {\n\t\treturn maskAny(err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn maskAny(err)\n\t}\n\tif err := c.handleResponse(resp, \"POST\", url, nil); err != nil {\n\t\treturn maskAny(err)\n\t}\n\n\treturn nil\n}", "func (k *KeKahu) Shutdown() (err error) {\n\tinfo(\"shutting down the kekahu service\")\n\n\t// Shutdown the server\n\tif err = k.server.Shutdown(); err != nil {\n\t\tk.echan <- err\n\t}\n\n\t// Notify the run method we're done\n\t// NOTE: do this last or the cleanup proceedure won't be done.\n\tk.done <- true\n\treturn nil\n}", "func (s *Server) Stop() {\n\ts.changeState(Stopping)\n\ts.shutdown()\n\ts.changeState(Stopped)\n}", "func (srv *Server) Shutdown(ctx context.Context) error {\n\tif srv.Config.Stats != nil {\n\t\tif err := srv.Config.Stats.Shutdown(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := srv.ssh.Shutdown(ctx); err != nil {\n\t\treturn err\n\t}\n\treturn srv.http.Shutdown(ctx)\n}" ]
[ "0.73573047", "0.702127", "0.69189304", "0.68929464", "0.6844762", "0.6828401", "0.6828394", "0.67957246", "0.67955023", "0.67780477", "0.67758715", "0.67660624", "0.67436534", "0.67431206", "0.6720775", "0.6672549", "0.6657689", "0.66560906", "0.6643462", "0.66421086", "0.6595025", "0.65827125", "0.6577871", "0.65542483", "0.6549815", "0.6544401", "0.65419793", "0.6537877", "0.65334606", "0.65098244", "0.65096635", "0.6507186", "0.64991", "0.64910334", "0.64889055", "0.64660436", "0.64658976", "0.6440322", "0.64372474", "0.64321697", "0.6424569", "0.6423272", "0.642268", "0.6418252", "0.6408398", "0.64048934", "0.6401881", "0.6395621", "0.63884073", "0.6386587", "0.638538", "0.63840926", "0.6383518", "0.6380913", "0.6378542", "0.6376641", "0.63753057", "0.63744503", "0.6372672", "0.6368088", "0.63604325", "0.63600594", "0.6354882", "0.6349454", "0.63484216", "0.6346317", "0.634595", "0.6344434", "0.63321483", "0.6330204", "0.63283217", "0.6327137", "0.6323347", "0.63213015", "0.63196707", "0.63120455", "0.6308513", "0.6308513", "0.63059294", "0.6304412", "0.6304216", "0.6302796", "0.6295255", "0.6293943", "0.62858915", "0.62835443", "0.6282027", "0.62818164", "0.6273169", "0.6267347", "0.6258357", "0.62564665", "0.62526554", "0.624961", "0.6248061", "0.62389255", "0.6232694", "0.62317395", "0.62310743", "0.62286353", "0.62280005" ]
0.0
-1
servers[] contains the ports of the set of servers that will cooperate via Paxos to form the faulttolerant key/value service. me is the index of the current server in servers[].
func StartServer(servers []string, me int) *KVPaxos { // this call is all that's needed to persuade // Go's RPC library to marshall/unmarshall // struct Op. gob.Register(Op{}) kv := new(KVPaxos) kv.me = me // Start Salman Addition kv.data = make(map[string]string) kv.pastClientRequestResponses = make(map[string]Response) // Start Salman Addition rpcs := rpc.NewServer() rpcs.Register(kv) kv.px = paxos.Make(servers, me, rpcs) os.Remove(servers[me]) l, e := net.Listen("unix", servers[me]); if e != nil { log.Fatal("listen error: ", e); } kv.l = l // please do not change any of the following code, // or do anything to subvert it. go func() { for kv.dead == false { conn, err := kv.l.Accept() if err == nil && kv.dead == false { if kv.unreliable && (rand.Int63() % 1000) < 100 { // discard the request. conn.Close() } else if kv.unreliable && (rand.Int63() % 1000) < 200 { // process the request but force discard of reply. c1 := conn.(*net.UnixConn) f, _ := c1.File() err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR) if err != nil { fmt.Printf("shutdown: %v\n", err) } go rpcs.ServeConn(conn) } else { go rpcs.ServeConn(conn) } } else if err == nil { conn.Close() } if err != nil && kv.dead == false { fmt.Printf("KVPaxos(%v) accept: %v\n", me, err.Error()) kv.kill() } } }() return kv }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SetServers(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"INFO\\tSet Servers\")\n\tfmt.Println(\"INFO\\tSet Servers\")\n\t/*\n\t \tvars := mux.Vars(r)\n\t \tip := vars[\"ip\"]\n\t \tips := strings.Split(ip, DELIM)\n\n\t fmt.Println(ip)\n\t \tfor i := range ips {\n\t \t\tdata.servers[ips[i]] = true\n\t \t}\n\n\t \tfmt.Println(\" servers \", data.processType)\n\t \tif data.processType == 3 {\n\t \t\tvar clients map[string]bool = data.servers\n\t \t\tserverListStr := create_server_list_string()\n\t \t\tj := 0\n\t \t\tfor ipaddr := range clients {\n\t \t\t\tsend_command_to_process(ipaddr, \"SetServers\", serverListStr)\n\t \t\t\tname := \"server_\" + fmt.Sprintf(\"%d\", j)\n\t \t\t\tfmt.Println(name, ipaddr)\n\t \t\t\tsend_command_to_process(ipaddr, \"SetName\", name)\n\t \t\t\tj = j + 1\n\t \t\t}\n\t \t}\n\t*/\n}", "func ReturnServers(env, tipo string) (IP []string) {\n\tvar SIP string\n\n\tdb, err := sql.Open(\"mysql\", UserDB+\":\"+PassDB+\"@tcp(\"+HostDB+\":\"+PortDB+\")/\"+DatabaseDB+\"?charset=utf8\")\n\tcheckErr(err)\n\n\tdefer db.Close()\n\n\trows, err := db.Query(\"SELECT IP FROM servidores WHERE env='\" + env + \"' AND type_server='\" + tipo + \"' AND ativo=1\")\n\tcheckErr(err)\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&SIP)\n\t\tcheckErr(err)\n\n\t\tIP = append(IP, SIP)\n\t}\n\n\treturn IP\n}", "func ConnectToServers(i int,Servers []ServerConfig) {\n\t// Check for connection unless the ith server accepts the rpc connection\n\tvar client *rpc.Client = nil\n\tvar err error = nil\n\t// Polls until the connection is made\n\n\tServers[i] = ServerConfig{\n\t\t\tId: i,\n\t\t\tHostname: \"Server\"+strconv.Itoa(i),\n\t\t\tClientPort: 9000+2*i,\n\t\t\tLogPort: 9001+2*i,\n\t\t\tClient: client,\n\t}\n\tfor {\n\t\tclient, err = rpc.Dial(\"tcp\", \"localhost:\" + strconv.Itoa(9001+2*i))\n\t\tif err == nil {\n\t\t\t//log.Print(\"Connected to \", strconv.Itoa(9001+2*i))\n\t\t\tbreak\n\t\t\t}\n\t}\t\t\t\t\n}", "func (computeService Service) Servers() ([]Server, error) {\n\tresult := []Server{}\n\tmarker := \"\"\n\n\tmore := true\n\n\tvar err error\n\tfor more {\n\t\tcontainer := serversContainer{}\n\t\treqURL, err := computeService.buildServersDetailQueryURL(ServerDetailQueryParameters{\n\t\t\tLimit: int64(defaultLimit),\n\t\t\tMarker: marker,\n\t\t}, \"/servers\")\n\t\tif err != nil {\n\t\t\treturn container.Servers, err\n\t\t}\n\n\t\terr = misc.GetJSON(reqURL.String(), computeService.authenticator, &container)\n\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\n\t\tif len(container.Servers) < defaultLimit {\n\t\t\tmore = false\n\t\t}\n\n\t\tfor _, server := range container.Servers {\n\t\t\tresult = append(result, server)\n\t\t\tmarker = server.ID\n\t\t}\n\t}\n\n\treturn result, err\n}", "func StartServer(servers []string, me int) *KVPaxos {\n\t// call gob.Register on structures you want\n\t// Go's RPC library to marshall/unmarshall.\n\tgob.Register(Op{})\n\n\tkv := new(KVPaxos)\n\tkv.me = me\n\n\t// Your initialization code here.\n\tkv.seq = 0\n\tkv.keyValue = make(map[string]string)\n\tkv.records = make(map[int64]*Record)\n\n\trpcs := rpc.NewServer()\n\trpcs.Register(kv)\n\n\tkv.px = paxos.Make(servers, me, rpcs)\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tkv.l = l\n\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tconn, err := kv.l.Accept()\n\t\t\tif err == nil && kv.isdead() == false {\n\t\t\t\tif kv.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if kv.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && kv.isdead() == false {\n\t\t\t\tfmt.Printf(\"KVPaxos(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tkv.kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn kv\n}", "func (r *HashRing) Servers() []string {\n\tr.RLock()\n\tservers := r.copyServersNoLock()\n\tr.RUnlock()\n\treturn servers\n}", "func (m *VpnConfiguration) SetServers(value []VpnServerable)() {\n err := m.GetBackingStore().Set(\"servers\", value)\n if err != nil {\n panic(err)\n }\n}", "func StartServer(servers []string, me int) *KVPaxos {\n\t// call gob.Register on structures you want\n\t// Go's RPC library to marshall/unmarshall.\n\tgob.Register(Op{})\n\n\tkv := new(KVPaxos)\n\tkv.me = me\n\n\t// Your initialization code here.\n\tkv.keyVal = make(map[string]string)\n\tkv.requests = make(map[int64]string)\n\tkv.seqCount = 0\n\n\trpcs := rpc.NewServer()\n\trpcs.Register(kv)\n\n\tkv.px = paxos.Make(servers, me, rpcs)\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tkv.l = l\n\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tconn, err := kv.l.Accept()\n\t\t\tif err == nil && kv.isdead() == false {\n\t\t\t\tif kv.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if kv.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && kv.isdead() == false {\n\t\t\t\tfmt.Printf(\"KVPaxos(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tkv.kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn kv\n}", "func (m *VpnConfiguration) GetServers()([]VpnServerable) {\n val, err := m.GetBackingStore().Get(\"servers\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]VpnServerable)\n }\n return nil\n}", "func (p *Proxy) ServerNames() ([]string, error) {\n ns := []string{\"Error-Getting-Server-Names\"}\n rcon, err := p.GetRcon()\n if err != nil { return ns, err }\n\n command := fmt.Sprintf(\"bconf getServers().getKeys()\")\n reply, err := rcon.Send(command)\n if err != nil { return ns, err }\n\n reply = strings.Trim(reply, \"[] \\n\")\n names := strings.Split(reply, \",\")\n for i, n := range names {\n names[i] = strings.Trim(n, \" \")\n }\n return names, nil\n}", "func StartServer(servers []string, me int) *KVPaxos {\n\t// call gob.Register on structures you want\n\t// Go's RPC library to marshall/unmarshall.\n\tgob.Register(Op{})\n\n\tkv := new(KVPaxos)\n\tkv.me = me\n\n\t// Your initialization code here.\n\n\tkv.client_info = make(map[int64]*ClientStatus)\n\tkv.state = make(map[string]string)\n\tkv.noop_channel = make(chan int)\n\n\tgo kv.handleOps()\n\n\n\trpcs := rpc.NewServer()\n\trpcs.Register(kv)\n\n\tkv.px = paxos.Make(servers, me, rpcs)\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tkv.l = l\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tconn, err := kv.l.Accept()\n\t\t\tif err == nil && kv.isdead() == false {\n\t\t\t\tif kv.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if kv.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && kv.isdead() == false {\n\t\t\t\tfmt.Printf(\"KVPaxos(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tkv.kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn kv\n}", "func StartServer(servers []string, me int) *KVPaxos {\n\t// this call is all that's needed to persuade\n\t// Go's RPC library to marshall/unmarshall\n\t// struct Op.\n\tgob.Register(Op{})\n\n\tkv := new(KVPaxos)\n\tkv.me = me\n\n\t// Your initialization code here.\n\tkv.seq = 0\n\tkv.kvs = make(map[string]string)\n\tkv.ids = make(map[string]int64)\n\tkv.replies = make(map[string]string)\n\n\trpcs := rpc.NewServer()\n\trpcs.Register(kv)\n\n\tkv.px = paxos.Make(servers, me, rpcs)\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tkv.l = l\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor kv.dead == false {\n\t\t\tconn, err := kv.l.Accept()\n\t\t\tif err == nil && kv.dead == false {\n\t\t\t\tif kv.unreliable && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if kv.unreliable && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && kv.dead == false {\n\t\t\t\tfmt.Printf(\"KVPaxos(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tkv.kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn kv\n}", "func initServers(servers map[string]reportConfig) []Server {\n\tvar serverList []Server\n\tfor url, params := range servers {\n\t\ts, err := createServer(url, params.get())\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tserverList = append(serverList, s)\n\t}\n\n\treturn serverList\n}", "func GetAllServers(nodeuuid string)(data map[string]map[string]string, err error){\n err = ndb.GetTokenByUuid(nodeuuid); if err!=nil{logs.Error(\"Error loading node token: %s\",err); return nil,err}\n ipuuid,portuuid,err := ndb.ObtainPortIp(nodeuuid)\n if err != nil {\n logs.Error(\"GetAllServers ERROR Obtaining Port and IP for Add a new server into STAP: \"+err.Error())\n return nil,err\n }\n data, err = nodeclient.GetAllServers(ipuuid,portuuid)\n if err != nil {\n logs.Error(\"node/GetAllServers ERROR http data request: \"+err.Error())\n return nil, err\n }\n return data,nil\n}", "func (a *albClient) Servers() Servers {\n\treturn a.servers\n}", "func getServers(ctx context.Context, tc *client.TeleportClient) ([]types.Server, error) {\n\tclt, err := tc.ConnectToCluster(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tdefer clt.Close()\n\n\tresources, err := apiclient.GetAllResources[types.Server](ctx, clt.AuthClient, tc.ResourceFilter(types.KindNode))\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tif len(resources) == 0 {\n\t\treturn nil, trace.BadParameter(\"no target hosts available\")\n\t}\n\n\treturn resources, nil\n}", "func (i *Inspector) Servers() ([]*ServerInfo, error) {\n\tservers, err := i.rdb.ListServers()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tworkers, err := i.rdb.ListWorkers()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm := make(map[string]*ServerInfo) // ServerInfo keyed by serverID\n\tfor _, s := range servers {\n\t\tm[s.ServerID] = &ServerInfo{\n\t\t\tID: s.ServerID,\n\t\t\tHost: s.Host,\n\t\t\tPID: s.PID,\n\t\t\tConcurrency: s.Concurrency,\n\t\t\tQueues: s.Queues,\n\t\t\tStrictPriority: s.StrictPriority,\n\t\t\tStarted: s.Started,\n\t\t\tStatus: s.Status,\n\t\t\tActiveWorkers: make([]*WorkerInfo, 0),\n\t\t}\n\t}\n\tfor _, w := range workers {\n\t\tsrvInfo, ok := m[w.ServerID]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\twrkInfo := &WorkerInfo{\n\t\t\tStarted: w.Started,\n\t\t\tDeadline: w.Deadline,\n\t\t\tTask: &ActiveTask{\n\t\t\t\tTask: asynq.NewTask(w.Type, w.Payload),\n\t\t\t\tID: w.ID,\n\t\t\t\tQueue: w.Queue,\n\t\t\t},\n\t\t}\n\t\tsrvInfo.ActiveWorkers = append(srvInfo.ActiveWorkers, wrkInfo)\n\t}\n\tvar out []*ServerInfo\n\tfor _, srvInfo := range m {\n\t\tout = append(out, srvInfo)\n\t}\n\treturn out, nil\n}", "func (this *StandardServerSelector) SetServers(servers ...string) error {\n\tif len(servers) == 0 {\n\t\treturn ErrNoServers\n\t}\n\n\tnaddr := make([]net.Addr, len(servers))\n\tfor i, server := range servers {\n\t\tif strings.Contains(server, \"/\") {\n\t\t\taddr, err := net.ResolveUnixAddr(\"unix\", server)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tnaddr[i] = addr\n\t\t} else {\n\t\t\ttcpaddr, err := net.ResolveTCPAddr(\"tcp\", server)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tnaddr[i] = tcpaddr\n\t\t}\n\t}\n\n\tthis.lk.Lock()\n\tdefer this.lk.Unlock()\n\tthis.addrs = naddr\n\treturn nil\n}", "func (rs RoomState) Servers() []ServerUserCount {\n\treturn rs.serverList\n}", "func (ss *RoundRobinServerList) SetServers(servers ...string) error {\n\tnaddr := make([]net.Addr, len(servers))\n\tfor i, server := range servers {\n\t\tif strings.Contains(server, \"/\") {\n\t\t\taddr, err := net.ResolveUnixAddr(\"unix\", server)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tnaddr[i] = newStaticAddr(addr)\n\t\t} else {\n\t\t\ttcpaddr, err := net.ResolveTCPAddr(\"tcp\", server)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tnaddr[i] = newStaticAddr(tcpaddr)\n\t\t}\n\t}\n\n\tss.mu.Lock()\n\tdefer ss.mu.Unlock()\n\tss.addrs = naddr\n\treturn nil\n}", "func (sp *jsonServerPage) asClientServers() (servers []*ClientServer) {\n\tfor _, d := range sp.Data {\n\t\tservers = append(servers, d.Server.asClientServer())\n\t}\n\n\treturn servers\n}", "func CyberghostServers() []models.CyberghostServer {\n\treturn []models.CyberghostServer{\n\t\t{Region: \"Albania\", Group: \"Premium TCP Europe\", Hostname: \"97-1-al.cg-dialup.net\", IPs: []net.IP{{31, 171, 155, 3}, {31, 171, 155, 4}, {31, 171, 155, 7}, {31, 171, 155, 8}, {31, 171, 155, 9}, {31, 171, 155, 10}, {31, 171, 155, 11}, {31, 171, 155, 12}, {31, 171, 155, 13}, {31, 171, 155, 14}}},\n\t\t{Region: \"Albania\", Group: \"Premium UDP Europe\", Hostname: \"87-1-al.cg-dialup.net\", IPs: []net.IP{{31, 171, 155, 4}, {31, 171, 155, 5}, {31, 171, 155, 6}, {31, 171, 155, 7}, {31, 171, 155, 8}, {31, 171, 155, 9}, {31, 171, 155, 10}, {31, 171, 155, 11}, {31, 171, 155, 13}, {31, 171, 155, 14}}},\n\t\t{Region: \"Algeria\", Group: \"Premium TCP Europe\", Hostname: \"97-1-dz.cg-dialup.net\", IPs: []net.IP{{176, 125, 228, 132}, {176, 125, 228, 134}, {176, 125, 228, 135}, {176, 125, 228, 136}, {176, 125, 228, 137}, {176, 125, 228, 138}, {176, 125, 228, 139}, {176, 125, 228, 140}, {176, 125, 228, 141}, {176, 125, 228, 142}}},\n\t\t{Region: \"Algeria\", Group: \"Premium UDP Europe\", Hostname: \"87-1-dz.cg-dialup.net\", IPs: []net.IP{{176, 125, 228, 131}, {176, 125, 228, 133}, {176, 125, 228, 134}, {176, 125, 228, 136}, {176, 125, 228, 137}, {176, 125, 228, 139}, {176, 125, 228, 140}, {176, 125, 228, 141}, {176, 125, 228, 142}, {176, 125, 228, 143}}},\n\t\t{Region: \"Andorra\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ad.cg-dialup.net\", IPs: []net.IP{{188, 241, 82, 137}, {188, 241, 82, 138}, {188, 241, 82, 140}, {188, 241, 82, 142}, {188, 241, 82, 147}, {188, 241, 82, 155}, {188, 241, 82, 159}, {188, 241, 82, 160}, {188, 241, 82, 161}, {188, 241, 82, 166}}},\n\t\t{Region: \"Andorra\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ad.cg-dialup.net\", IPs: []net.IP{{188, 241, 82, 133}, {188, 241, 82, 134}, {188, 241, 82, 136}, {188, 241, 82, 137}, {188, 241, 82, 146}, {188, 241, 82, 153}, {188, 241, 82, 155}, {188, 241, 82, 160}, {188, 241, 82, 164}, {188, 241, 82, 168}}},\n\t\t{Region: \"Argentina\", Group: \"Premium TCP USA\", Hostname: \"93-1-ar.cg-dialup.net\", IPs: []net.IP{{146, 70, 39, 4}, {146, 70, 39, 9}, {146, 70, 39, 15}, {146, 70, 39, 19}, {146, 70, 39, 135}, {146, 70, 39, 136}, {146, 70, 39, 139}, {146, 70, 39, 142}, {146, 70, 39, 143}, {146, 70, 39, 145}}},\n\t\t{Region: \"Argentina\", Group: \"Premium UDP USA\", Hostname: \"94-1-ar.cg-dialup.net\", IPs: []net.IP{{146, 70, 39, 3}, {146, 70, 39, 5}, {146, 70, 39, 6}, {146, 70, 39, 8}, {146, 70, 39, 11}, {146, 70, 39, 12}, {146, 70, 39, 131}, {146, 70, 39, 134}, {146, 70, 39, 142}, {146, 70, 39, 143}}},\n\t\t{Region: \"Armenia\", Group: \"Premium TCP Europe\", Hostname: \"97-1-am.cg-dialup.net\", IPs: []net.IP{{185, 253, 160, 131}, {185, 253, 160, 134}, {185, 253, 160, 136}, {185, 253, 160, 137}, {185, 253, 160, 138}, {185, 253, 160, 139}, {185, 253, 160, 140}, {185, 253, 160, 141}, {185, 253, 160, 142}, {185, 253, 160, 143}}},\n\t\t{Region: \"Armenia\", Group: \"Premium UDP Europe\", Hostname: \"87-1-am.cg-dialup.net\", IPs: []net.IP{{185, 253, 160, 131}, {185, 253, 160, 132}, {185, 253, 160, 133}, {185, 253, 160, 134}, {185, 253, 160, 135}, {185, 253, 160, 136}, {185, 253, 160, 137}, {185, 253, 160, 141}, {185, 253, 160, 142}, {185, 253, 160, 144}}},\n\t\t{Region: \"Australia\", Group: \"Premium TCP Asia\", Hostname: \"96-1-au.cg-dialup.net\", IPs: []net.IP{{154, 16, 81, 22}, {181, 214, 215, 7}, {181, 214, 215, 15}, {181, 214, 215, 18}, {191, 101, 210, 15}, {191, 101, 210, 50}, {191, 101, 210, 60}, {202, 60, 80, 78}, {202, 60, 80, 82}, {202, 60, 80, 102}}},\n\t\t{Region: \"Australia\", Group: \"Premium UDP Asia\", Hostname: \"95-1-au.cg-dialup.net\", IPs: []net.IP{{181, 214, 215, 4}, {181, 214, 215, 16}, {191, 101, 210, 18}, {191, 101, 210, 21}, {191, 101, 210, 36}, {191, 101, 210, 58}, {191, 101, 210, 60}, {202, 60, 80, 74}, {202, 60, 80, 106}, {202, 60, 80, 124}}},\n\t\t{Region: \"Austria\", Group: \"Premium TCP Europe\", Hostname: \"97-1-at.cg-dialup.net\", IPs: []net.IP{{37, 19, 223, 9}, {37, 19, 223, 16}, {37, 19, 223, 113}, {37, 19, 223, 205}, {37, 19, 223, 211}, {37, 19, 223, 218}, {37, 19, 223, 223}, {37, 19, 223, 245}, {37, 120, 155, 104}, {89, 187, 168, 174}}},\n\t\t{Region: \"Austria\", Group: \"Premium UDP Europe\", Hostname: \"87-1-at.cg-dialup.net\", IPs: []net.IP{{37, 19, 223, 202}, {37, 19, 223, 205}, {37, 19, 223, 229}, {37, 19, 223, 239}, {37, 19, 223, 241}, {37, 19, 223, 243}, {37, 120, 155, 103}, {89, 187, 168, 160}, {89, 187, 168, 174}, {89, 187, 168, 181}}},\n\t\t{Region: \"Bahamas\", Group: \"Premium TCP USA\", Hostname: \"93-1-bs.cg-dialup.net\", IPs: []net.IP{{95, 181, 238, 131}, {95, 181, 238, 136}, {95, 181, 238, 142}, {95, 181, 238, 144}, {95, 181, 238, 146}, {95, 181, 238, 147}, {95, 181, 238, 148}, {95, 181, 238, 152}, {95, 181, 238, 153}, {95, 181, 238, 155}}},\n\t\t{Region: \"Bahamas\", Group: \"Premium UDP USA\", Hostname: \"94-1-bs.cg-dialup.net\", IPs: []net.IP{{95, 181, 238, 131}, {95, 181, 238, 138}, {95, 181, 238, 140}, {95, 181, 238, 141}, {95, 181, 238, 146}, {95, 181, 238, 147}, {95, 181, 238, 148}, {95, 181, 238, 151}, {95, 181, 238, 153}, {95, 181, 238, 155}}},\n\t\t{Region: \"Bangladesh\", Group: \"Premium TCP Asia\", Hostname: \"96-1-bd.cg-dialup.net\", IPs: []net.IP{{84, 252, 93, 132}, {84, 252, 93, 133}, {84, 252, 93, 135}, {84, 252, 93, 138}, {84, 252, 93, 139}, {84, 252, 93, 141}, {84, 252, 93, 142}, {84, 252, 93, 143}, {84, 252, 93, 144}, {84, 252, 93, 145}}},\n\t\t{Region: \"Bangladesh\", Group: \"Premium UDP Asia\", Hostname: \"95-1-bd.cg-dialup.net\", IPs: []net.IP{{84, 252, 93, 131}, {84, 252, 93, 133}, {84, 252, 93, 134}, {84, 252, 93, 135}, {84, 252, 93, 136}, {84, 252, 93, 139}, {84, 252, 93, 140}, {84, 252, 93, 141}, {84, 252, 93, 143}, {84, 252, 93, 145}}},\n\t\t{Region: \"Belarus\", Group: \"Premium TCP Europe\", Hostname: \"97-1-by.cg-dialup.net\", IPs: []net.IP{{45, 132, 194, 5}, {45, 132, 194, 6}, {45, 132, 194, 23}, {45, 132, 194, 24}, {45, 132, 194, 25}, {45, 132, 194, 27}, {45, 132, 194, 30}, {45, 132, 194, 35}, {45, 132, 194, 44}, {45, 132, 194, 49}}},\n\t\t{Region: \"Belarus\", Group: \"Premium UDP Europe\", Hostname: \"87-1-by.cg-dialup.net\", IPs: []net.IP{{45, 132, 194, 6}, {45, 132, 194, 8}, {45, 132, 194, 9}, {45, 132, 194, 11}, {45, 132, 194, 15}, {45, 132, 194, 19}, {45, 132, 194, 20}, {45, 132, 194, 23}, {45, 132, 194, 24}, {45, 132, 194, 26}}},\n\t\t{Region: \"Belgium\", Group: \"Premium TCP Europe\", Hostname: \"97-1-be.cg-dialup.net\", IPs: []net.IP{{37, 120, 143, 165}, {37, 120, 143, 166}, {185, 210, 217, 10}, {185, 210, 217, 248}, {193, 9, 114, 211}, {193, 9, 114, 220}, {194, 110, 115, 195}, {194, 110, 115, 199}, {194, 110, 115, 205}, {194, 110, 115, 238}}},\n\t\t{Region: \"Belgium\", Group: \"Premium UDP Europe\", Hostname: \"87-1-be.cg-dialup.net\", IPs: []net.IP{{37, 120, 143, 163}, {37, 120, 143, 167}, {185, 210, 217, 9}, {185, 210, 217, 13}, {185, 210, 217, 55}, {185, 210, 217, 251}, {185, 232, 21, 120}, {194, 110, 115, 214}, {194, 110, 115, 218}, {194, 110, 115, 236}}},\n\t\t{Region: \"Bosnia and Herzegovina\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ba.cg-dialup.net\", IPs: []net.IP{{185, 99, 3, 57}, {185, 99, 3, 58}, {185, 99, 3, 72}, {185, 99, 3, 73}, {185, 99, 3, 74}, {185, 99, 3, 130}, {185, 99, 3, 131}, {185, 99, 3, 134}, {185, 99, 3, 135}, {185, 99, 3, 136}}},\n\t\t{Region: \"Bosnia and Herzegovina\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ba.cg-dialup.net\", IPs: []net.IP{{185, 99, 3, 57}, {185, 99, 3, 58}, {185, 99, 3, 72}, {185, 99, 3, 73}, {185, 99, 3, 74}, {185, 99, 3, 130}, {185, 99, 3, 131}, {185, 99, 3, 134}, {185, 99, 3, 135}, {185, 99, 3, 136}}},\n\t\t{Region: \"Brazil\", Group: \"Premium TCP USA\", Hostname: \"93-1-br.cg-dialup.net\", IPs: []net.IP{{188, 241, 177, 5}, {188, 241, 177, 11}, {188, 241, 177, 38}, {188, 241, 177, 45}, {188, 241, 177, 132}, {188, 241, 177, 135}, {188, 241, 177, 136}, {188, 241, 177, 152}, {188, 241, 177, 153}, {188, 241, 177, 156}}},\n\t\t{Region: \"Brazil\", Group: \"Premium UDP USA\", Hostname: \"94-1-br.cg-dialup.net\", IPs: []net.IP{{188, 241, 177, 8}, {188, 241, 177, 37}, {188, 241, 177, 40}, {188, 241, 177, 42}, {188, 241, 177, 45}, {188, 241, 177, 135}, {188, 241, 177, 139}, {188, 241, 177, 149}, {188, 241, 177, 152}, {188, 241, 177, 154}}},\n\t\t{Region: \"Bulgaria\", Group: \"Premium TCP Europe\", Hostname: \"97-1-bg.cg-dialup.net\", IPs: []net.IP{{37, 120, 152, 99}, {37, 120, 152, 101}, {37, 120, 152, 103}, {37, 120, 152, 104}, {37, 120, 152, 105}, {37, 120, 152, 106}, {37, 120, 152, 107}, {37, 120, 152, 108}, {37, 120, 152, 109}, {37, 120, 152, 110}}},\n\t\t{Region: \"Bulgaria\", Group: \"Premium UDP Europe\", Hostname: \"87-1-bg.cg-dialup.net\", IPs: []net.IP{{37, 120, 152, 99}, {37, 120, 152, 100}, {37, 120, 152, 101}, {37, 120, 152, 102}, {37, 120, 152, 103}, {37, 120, 152, 105}, {37, 120, 152, 106}, {37, 120, 152, 107}, {37, 120, 152, 108}, {37, 120, 152, 109}}},\n\t\t{Region: \"Cambodia\", Group: \"Premium TCP Asia\", Hostname: \"96-1-kh.cg-dialup.net\", IPs: []net.IP{{188, 215, 235, 35}, {188, 215, 235, 36}, {188, 215, 235, 38}, {188, 215, 235, 39}, {188, 215, 235, 45}, {188, 215, 235, 49}, {188, 215, 235, 51}, {188, 215, 235, 53}, {188, 215, 235, 54}, {188, 215, 235, 57}}},\n\t\t{Region: \"Cambodia\", Group: \"Premium UDP Asia\", Hostname: \"95-1-kh.cg-dialup.net\", IPs: []net.IP{{188, 215, 235, 36}, {188, 215, 235, 40}, {188, 215, 235, 42}, {188, 215, 235, 44}, {188, 215, 235, 46}, {188, 215, 235, 47}, {188, 215, 235, 48}, {188, 215, 235, 50}, {188, 215, 235, 55}, {188, 215, 235, 57}}},\n\t\t{Region: \"Canada\", Group: \"Premium TCP USA\", Hostname: \"93-1-ca.cg-dialup.net\", IPs: []net.IP{{66, 115, 142, 136}, {66, 115, 142, 139}, {66, 115, 142, 156}, {66, 115, 142, 162}, {66, 115, 142, 172}, {104, 200, 151, 99}, {104, 200, 151, 111}, {104, 200, 151, 153}, {104, 200, 151, 164}, {172, 98, 89, 137}}},\n\t\t{Region: \"Canada\", Group: \"Premium UDP USA\", Hostname: \"94-1-ca.cg-dialup.net\", IPs: []net.IP{{66, 115, 142, 135}, {66, 115, 142, 154}, {66, 115, 142, 165}, {104, 200, 151, 32}, {104, 200, 151, 57}, {104, 200, 151, 85}, {104, 200, 151, 86}, {104, 200, 151, 147}, {172, 98, 89, 144}, {172, 98, 89, 173}}},\n\t\t{Region: \"Chile\", Group: \"Premium TCP USA\", Hostname: \"93-1-cl.cg-dialup.net\", IPs: []net.IP{{146, 70, 11, 3}, {146, 70, 11, 6}, {146, 70, 11, 7}, {146, 70, 11, 8}, {146, 70, 11, 9}, {146, 70, 11, 10}, {146, 70, 11, 11}, {146, 70, 11, 12}, {146, 70, 11, 13}, {146, 70, 11, 14}}},\n\t\t{Region: \"Chile\", Group: \"Premium UDP USA\", Hostname: \"94-1-cl.cg-dialup.net\", IPs: []net.IP{{146, 70, 11, 3}, {146, 70, 11, 4}, {146, 70, 11, 6}, {146, 70, 11, 7}, {146, 70, 11, 8}, {146, 70, 11, 9}, {146, 70, 11, 10}, {146, 70, 11, 11}, {146, 70, 11, 13}, {146, 70, 11, 14}}},\n\t\t{Region: \"China\", Group: \"Premium TCP Asia\", Hostname: \"96-1-cn.cg-dialup.net\", IPs: []net.IP{{188, 241, 80, 131}, {188, 241, 80, 132}, {188, 241, 80, 133}, {188, 241, 80, 134}, {188, 241, 80, 135}, {188, 241, 80, 137}, {188, 241, 80, 139}, {188, 241, 80, 140}, {188, 241, 80, 141}, {188, 241, 80, 142}}},\n\t\t{Region: \"China\", Group: \"Premium UDP Asia\", Hostname: \"95-1-cn.cg-dialup.net\", IPs: []net.IP{{188, 241, 80, 131}, {188, 241, 80, 132}, {188, 241, 80, 133}, {188, 241, 80, 134}, {188, 241, 80, 135}, {188, 241, 80, 136}, {188, 241, 80, 137}, {188, 241, 80, 138}, {188, 241, 80, 139}, {188, 241, 80, 142}}},\n\t\t{Region: \"Colombia\", Group: \"Premium TCP USA\", Hostname: \"93-1-co.cg-dialup.net\", IPs: []net.IP{{146, 70, 9, 3}, {146, 70, 9, 4}, {146, 70, 9, 5}, {146, 70, 9, 7}, {146, 70, 9, 9}, {146, 70, 9, 10}, {146, 70, 9, 11}, {146, 70, 9, 12}, {146, 70, 9, 13}, {146, 70, 9, 14}}},\n\t\t{Region: \"Colombia\", Group: \"Premium UDP USA\", Hostname: \"94-1-co.cg-dialup.net\", IPs: []net.IP{{146, 70, 9, 3}, {146, 70, 9, 4}, {146, 70, 9, 5}, {146, 70, 9, 6}, {146, 70, 9, 7}, {146, 70, 9, 8}, {146, 70, 9, 9}, {146, 70, 9, 10}, {146, 70, 9, 11}, {146, 70, 9, 12}}},\n\t\t{Region: \"Costa Rica\", Group: \"Premium TCP USA\", Hostname: \"93-1-cr.cg-dialup.net\", IPs: []net.IP{{146, 70, 10, 3}, {146, 70, 10, 4}, {146, 70, 10, 5}, {146, 70, 10, 6}, {146, 70, 10, 7}, {146, 70, 10, 8}, {146, 70, 10, 10}, {146, 70, 10, 11}, {146, 70, 10, 12}, {146, 70, 10, 13}}},\n\t\t{Region: \"Costa Rica\", Group: \"Premium UDP USA\", Hostname: \"94-1-cr.cg-dialup.net\", IPs: []net.IP{{146, 70, 10, 3}, {146, 70, 10, 4}, {146, 70, 10, 5}, {146, 70, 10, 6}, {146, 70, 10, 7}, {146, 70, 10, 8}, {146, 70, 10, 9}, {146, 70, 10, 11}, {146, 70, 10, 12}, {146, 70, 10, 14}}},\n\t\t{Region: \"Croatia\", Group: \"Premium TCP Europe\", Hostname: \"97-1-hr.cg-dialup.net\", IPs: []net.IP{{146, 70, 8, 5}, {146, 70, 8, 8}, {146, 70, 8, 9}, {146, 70, 8, 10}, {146, 70, 8, 11}, {146, 70, 8, 12}, {146, 70, 8, 13}, {146, 70, 8, 14}, {146, 70, 8, 15}, {146, 70, 8, 16}}},\n\t\t{Region: \"Croatia\", Group: \"Premium UDP Europe\", Hostname: \"87-1-hr.cg-dialup.net\", IPs: []net.IP{{146, 70, 8, 3}, {146, 70, 8, 4}, {146, 70, 8, 5}, {146, 70, 8, 6}, {146, 70, 8, 7}, {146, 70, 8, 9}, {146, 70, 8, 11}, {146, 70, 8, 13}, {146, 70, 8, 14}, {146, 70, 8, 16}}},\n\t\t{Region: \"Cyprus\", Group: \"Premium TCP Europe\", Hostname: \"97-1-cy.cg-dialup.net\", IPs: []net.IP{{185, 253, 162, 131}, {185, 253, 162, 133}, {185, 253, 162, 135}, {185, 253, 162, 136}, {185, 253, 162, 137}, {185, 253, 162, 139}, {185, 253, 162, 140}, {185, 253, 162, 142}, {185, 253, 162, 143}, {185, 253, 162, 144}}},\n\t\t{Region: \"Cyprus\", Group: \"Premium UDP Europe\", Hostname: \"87-1-cy.cg-dialup.net\", IPs: []net.IP{{185, 253, 162, 131}, {185, 253, 162, 132}, {185, 253, 162, 134}, {185, 253, 162, 135}, {185, 253, 162, 137}, {185, 253, 162, 138}, {185, 253, 162, 140}, {185, 253, 162, 142}, {185, 253, 162, 143}, {185, 253, 162, 144}}},\n\t\t{Region: \"Czech Republic\", Group: \"Premium TCP Europe\", Hostname: \"97-1-cz.cg-dialup.net\", IPs: []net.IP{{138, 199, 56, 235}, {138, 199, 56, 236}, {138, 199, 56, 237}, {138, 199, 56, 245}, {138, 199, 56, 246}, {138, 199, 56, 249}, {195, 181, 161, 12}, {195, 181, 161, 16}, {195, 181, 161, 20}, {195, 181, 161, 23}}},\n\t\t{Region: \"Czech Republic\", Group: \"Premium UDP Europe\", Hostname: \"87-1-cz.cg-dialup.net\", IPs: []net.IP{{138, 199, 56, 227}, {138, 199, 56, 229}, {138, 199, 56, 231}, {138, 199, 56, 235}, {138, 199, 56, 241}, {138, 199, 56, 247}, {195, 181, 161, 10}, {195, 181, 161, 16}, {195, 181, 161, 18}, {195, 181, 161, 22}}},\n\t\t{Region: \"Denmark\", Group: \"Premium TCP Europe\", Hostname: \"97-1-dk.cg-dialup.net\", IPs: []net.IP{{37, 120, 145, 83}, {37, 120, 145, 88}, {37, 120, 145, 93}, {37, 120, 194, 36}, {37, 120, 194, 56}, {37, 120, 194, 57}, {95, 174, 65, 163}, {95, 174, 65, 174}, {185, 206, 224, 238}, {185, 206, 224, 243}}},\n\t\t{Region: \"Denmark\", Group: \"Premium UDP Europe\", Hostname: \"87-1-dk.cg-dialup.net\", IPs: []net.IP{{37, 120, 194, 39}, {95, 174, 65, 167}, {95, 174, 65, 170}, {185, 206, 224, 227}, {185, 206, 224, 230}, {185, 206, 224, 236}, {185, 206, 224, 238}, {185, 206, 224, 245}, {185, 206, 224, 250}, {185, 206, 224, 254}}},\n\t\t{Region: \"Egypt\", Group: \"Premium TCP Europe\", Hostname: \"97-1-eg.cg-dialup.net\", IPs: []net.IP{{188, 214, 122, 40}, {188, 214, 122, 42}, {188, 214, 122, 43}, {188, 214, 122, 45}, {188, 214, 122, 48}, {188, 214, 122, 50}, {188, 214, 122, 52}, {188, 214, 122, 60}, {188, 214, 122, 70}, {188, 214, 122, 73}}},\n\t\t{Region: \"Egypt\", Group: \"Premium UDP Europe\", Hostname: \"87-1-eg.cg-dialup.net\", IPs: []net.IP{{188, 214, 122, 37}, {188, 214, 122, 38}, {188, 214, 122, 44}, {188, 214, 122, 54}, {188, 214, 122, 57}, {188, 214, 122, 59}, {188, 214, 122, 60}, {188, 214, 122, 61}, {188, 214, 122, 67}, {188, 214, 122, 69}}},\n\t\t{Region: \"Estonia\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ee.cg-dialup.net\", IPs: []net.IP{{95, 153, 32, 83}, {95, 153, 32, 84}, {95, 153, 32, 86}, {95, 153, 32, 88}, {95, 153, 32, 89}, {95, 153, 32, 90}, {95, 153, 32, 91}, {95, 153, 32, 92}, {95, 153, 32, 93}, {95, 153, 32, 94}}},\n\t\t{Region: \"Estonia\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ee.cg-dialup.net\", IPs: []net.IP{{95, 153, 32, 83}, {95, 153, 32, 84}, {95, 153, 32, 85}, {95, 153, 32, 87}, {95, 153, 32, 88}, {95, 153, 32, 89}, {95, 153, 32, 90}, {95, 153, 32, 91}, {95, 153, 32, 92}, {95, 153, 32, 94}}},\n\t\t{Region: \"Finland\", Group: \"Premium TCP Europe\", Hostname: \"97-1-fi.cg-dialup.net\", IPs: []net.IP{{188, 126, 89, 99}, {188, 126, 89, 102}, {188, 126, 89, 105}, {188, 126, 89, 107}, {188, 126, 89, 108}, {188, 126, 89, 110}, {188, 126, 89, 112}, {188, 126, 89, 115}, {188, 126, 89, 116}, {188, 126, 89, 119}}},\n\t\t{Region: \"Finland\", Group: \"Premium UDP Europe\", Hostname: \"87-1-fi.cg-dialup.net\", IPs: []net.IP{{188, 126, 89, 101}, {188, 126, 89, 104}, {188, 126, 89, 109}, {188, 126, 89, 110}, {188, 126, 89, 111}, {188, 126, 89, 113}, {188, 126, 89, 114}, {188, 126, 89, 115}, {188, 126, 89, 122}, {188, 126, 89, 124}}},\n\t\t{Region: \"France\", Group: \"Premium TCP Europe\", Hostname: \"97-1-fr.cg-dialup.net\", IPs: []net.IP{{84, 17, 43, 167}, {84, 17, 60, 147}, {84, 17, 60, 155}, {151, 106, 8, 108}, {191, 101, 31, 202}, {191, 101, 31, 254}, {191, 101, 217, 45}, {191, 101, 217, 159}, {191, 101, 217, 211}, {191, 101, 217, 240}}},\n\t\t{Region: \"France\", Group: \"Premium UDP Europe\", Hostname: \"87-1-fr.cg-dialup.net\", IPs: []net.IP{{84, 17, 60, 59}, {84, 17, 60, 121}, {191, 101, 31, 81}, {191, 101, 31, 84}, {191, 101, 31, 126}, {191, 101, 31, 127}, {191, 101, 217, 140}, {191, 101, 217, 201}, {191, 101, 217, 206}, {191, 101, 217, 211}}},\n\t\t{Region: \"Georgia\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ge.cg-dialup.net\", IPs: []net.IP{{95, 181, 236, 131}, {95, 181, 236, 132}, {95, 181, 236, 133}, {95, 181, 236, 134}, {95, 181, 236, 135}, {95, 181, 236, 136}, {95, 181, 236, 138}, {95, 181, 236, 139}, {95, 181, 236, 142}, {95, 181, 236, 144}}},\n\t\t{Region: \"Georgia\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ge.cg-dialup.net\", IPs: []net.IP{{95, 181, 236, 132}, {95, 181, 236, 133}, {95, 181, 236, 134}, {95, 181, 236, 136}, {95, 181, 236, 137}, {95, 181, 236, 139}, {95, 181, 236, 141}, {95, 181, 236, 142}, {95, 181, 236, 143}, {95, 181, 236, 144}}},\n\t\t{Region: \"Germany\", Group: \"Premium TCP Europe\", Hostname: \"97-1-de.cg-dialup.net\", IPs: []net.IP{{84, 17, 48, 39}, {84, 17, 48, 234}, {84, 17, 49, 106}, {84, 17, 49, 112}, {84, 17, 49, 218}, {154, 28, 188, 35}, {154, 28, 188, 66}, {154, 28, 188, 133}, {154, 28, 188, 144}, {154, 28, 188, 145}}},\n\t\t{Region: \"Germany\", Group: \"Premium UDP Europe\", Hostname: \"87-1-de.cg-dialup.net\", IPs: []net.IP{{84, 17, 48, 41}, {84, 17, 48, 224}, {84, 17, 49, 95}, {84, 17, 49, 236}, {84, 17, 49, 241}, {138, 199, 36, 151}, {154, 13, 1, 177}, {154, 28, 188, 73}, {154, 28, 188, 76}, {154, 28, 188, 93}}},\n\t\t{Region: \"Greece\", Group: \"Premium TCP Europe\", Hostname: \"97-1-gr.cg-dialup.net\", IPs: []net.IP{{185, 51, 134, 163}, {185, 51, 134, 165}, {185, 51, 134, 171}, {185, 51, 134, 172}, {185, 51, 134, 245}, {185, 51, 134, 246}, {185, 51, 134, 247}, {185, 51, 134, 249}, {185, 51, 134, 251}, {185, 51, 134, 254}}},\n\t\t{Region: \"Greece\", Group: \"Premium UDP Europe\", Hostname: \"87-1-gr.cg-dialup.net\", IPs: []net.IP{{185, 51, 134, 163}, {185, 51, 134, 166}, {185, 51, 134, 173}, {185, 51, 134, 174}, {185, 51, 134, 244}, {185, 51, 134, 246}, {185, 51, 134, 247}, {185, 51, 134, 251}, {185, 51, 134, 252}, {185, 51, 134, 253}}},\n\t\t{Region: \"Greenland\", Group: \"Premium TCP Europe\", Hostname: \"97-1-gl.cg-dialup.net\", IPs: []net.IP{{91, 90, 120, 3}, {91, 90, 120, 4}, {91, 90, 120, 5}, {91, 90, 120, 7}, {91, 90, 120, 8}, {91, 90, 120, 10}, {91, 90, 120, 12}, {91, 90, 120, 13}, {91, 90, 120, 14}, {91, 90, 120, 17}}},\n\t\t{Region: \"Greenland\", Group: \"Premium UDP Europe\", Hostname: \"87-1-gl.cg-dialup.net\", IPs: []net.IP{{91, 90, 120, 3}, {91, 90, 120, 4}, {91, 90, 120, 5}, {91, 90, 120, 7}, {91, 90, 120, 9}, {91, 90, 120, 10}, {91, 90, 120, 12}, {91, 90, 120, 14}, {91, 90, 120, 15}, {91, 90, 120, 16}}},\n\t\t{Region: \"Hong Kong\", Group: \"Premium TCP Asia\", Hostname: \"96-1-hk.cg-dialup.net\", IPs: []net.IP{{84, 17, 56, 144}, {84, 17, 56, 148}, {84, 17, 56, 153}, {84, 17, 56, 162}, {84, 17, 56, 163}, {84, 17, 56, 169}, {84, 17, 56, 170}, {84, 17, 56, 179}, {84, 17, 56, 180}, {84, 17, 56, 181}}},\n\t\t{Region: \"Hong Kong\", Group: \"Premium UDP Asia\", Hostname: \"95-1-hk.cg-dialup.net\", IPs: []net.IP{{84, 17, 56, 143}, {84, 17, 56, 147}, {84, 17, 56, 150}, {84, 17, 56, 152}, {84, 17, 56, 161}, {84, 17, 56, 164}, {84, 17, 56, 168}, {84, 17, 56, 179}, {84, 17, 56, 180}, {84, 17, 56, 183}}},\n\t\t{Region: \"Hungary\", Group: \"Premium TCP Europe\", Hostname: \"97-1-hu.cg-dialup.net\", IPs: []net.IP{{86, 106, 74, 247}, {86, 106, 74, 251}, {86, 106, 74, 253}, {185, 189, 114, 117}, {185, 189, 114, 118}, {185, 189, 114, 119}, {185, 189, 114, 121}, {185, 189, 114, 123}, {185, 189, 114, 125}, {185, 189, 114, 126}}},\n\t\t{Region: \"Hungary\", Group: \"Premium UDP Europe\", Hostname: \"87-1-hu.cg-dialup.net\", IPs: []net.IP{{86, 106, 74, 245}, {86, 106, 74, 247}, {86, 106, 74, 248}, {86, 106, 74, 249}, {86, 106, 74, 250}, {86, 106, 74, 252}, {86, 106, 74, 253}, {185, 189, 114, 120}, {185, 189, 114, 121}, {185, 189, 114, 122}}},\n\t\t{Region: \"Iceland\", Group: \"Premium TCP Europe\", Hostname: \"97-1-is.cg-dialup.net\", IPs: []net.IP{{45, 133, 193, 3}, {45, 133, 193, 4}, {45, 133, 193, 6}, {45, 133, 193, 7}, {45, 133, 193, 8}, {45, 133, 193, 10}, {45, 133, 193, 11}, {45, 133, 193, 12}, {45, 133, 193, 13}, {45, 133, 193, 14}}},\n\t\t{Region: \"Iceland\", Group: \"Premium UDP Europe\", Hostname: \"87-1-is.cg-dialup.net\", IPs: []net.IP{{45, 133, 193, 3}, {45, 133, 193, 5}, {45, 133, 193, 6}, {45, 133, 193, 7}, {45, 133, 193, 8}, {45, 133, 193, 9}, {45, 133, 193, 10}, {45, 133, 193, 11}, {45, 133, 193, 13}, {45, 133, 193, 14}}},\n\t\t{Region: \"India\", Group: \"Premium TCP Europe\", Hostname: \"97-1-in.cg-dialup.net\", IPs: []net.IP{{103, 13, 112, 68}, {103, 13, 112, 70}, {103, 13, 112, 72}, {103, 13, 112, 74}, {103, 13, 112, 75}, {103, 13, 113, 74}, {103, 13, 113, 79}, {103, 13, 113, 82}, {103, 13, 113, 83}, {103, 13, 113, 84}}},\n\t\t{Region: \"India\", Group: \"Premium UDP Europe\", Hostname: \"87-1-in.cg-dialup.net\", IPs: []net.IP{{103, 13, 112, 67}, {103, 13, 112, 70}, {103, 13, 112, 71}, {103, 13, 112, 77}, {103, 13, 112, 80}, {103, 13, 113, 72}, {103, 13, 113, 74}, {103, 13, 113, 75}, {103, 13, 113, 77}, {103, 13, 113, 85}}},\n\t\t{Region: \"Indonesia\", Group: \"Premium TCP Asia\", Hostname: \"96-1-id.cg-dialup.net\", IPs: []net.IP{{146, 70, 14, 3}, {146, 70, 14, 4}, {146, 70, 14, 5}, {146, 70, 14, 6}, {146, 70, 14, 7}, {146, 70, 14, 10}, {146, 70, 14, 12}, {146, 70, 14, 13}, {146, 70, 14, 15}, {146, 70, 14, 16}}},\n\t\t{Region: \"Indonesia\", Group: \"Premium UDP Asia\", Hostname: \"95-1-id.cg-dialup.net\", IPs: []net.IP{{146, 70, 14, 3}, {146, 70, 14, 5}, {146, 70, 14, 8}, {146, 70, 14, 9}, {146, 70, 14, 10}, {146, 70, 14, 12}, {146, 70, 14, 13}, {146, 70, 14, 14}, {146, 70, 14, 15}, {146, 70, 14, 16}}},\n\t\t{Region: \"Iran\", Group: \"Premium TCP Asia\", Hostname: \"96-1-ir.cg-dialup.net\", IPs: []net.IP{{62, 133, 46, 3}, {62, 133, 46, 4}, {62, 133, 46, 5}, {62, 133, 46, 6}, {62, 133, 46, 7}, {62, 133, 46, 8}, {62, 133, 46, 9}, {62, 133, 46, 10}, {62, 133, 46, 14}, {62, 133, 46, 15}}},\n\t\t{Region: \"Iran\", Group: \"Premium UDP Asia\", Hostname: \"95-1-ir.cg-dialup.net\", IPs: []net.IP{{62, 133, 46, 3}, {62, 133, 46, 4}, {62, 133, 46, 7}, {62, 133, 46, 8}, {62, 133, 46, 11}, {62, 133, 46, 12}, {62, 133, 46, 13}, {62, 133, 46, 14}, {62, 133, 46, 15}, {62, 133, 46, 16}}},\n\t\t{Region: \"Ireland\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ie.cg-dialup.net\", IPs: []net.IP{{37, 120, 235, 154}, {37, 120, 235, 166}, {37, 120, 235, 174}, {77, 81, 139, 35}, {84, 247, 48, 6}, {84, 247, 48, 19}, {84, 247, 48, 22}, {84, 247, 48, 23}, {84, 247, 48, 25}, {84, 247, 48, 26}}},\n\t\t{Region: \"Ireland\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ie.cg-dialup.net\", IPs: []net.IP{{37, 120, 235, 147}, {37, 120, 235, 148}, {37, 120, 235, 153}, {37, 120, 235, 158}, {37, 120, 235, 169}, {37, 120, 235, 174}, {84, 247, 48, 8}, {84, 247, 48, 11}, {84, 247, 48, 20}, {84, 247, 48, 23}}},\n\t\t{Region: \"Isle of Man\", Group: \"Premium TCP Europe\", Hostname: \"97-1-im.cg-dialup.net\", IPs: []net.IP{{91, 90, 124, 147}, {91, 90, 124, 149}, {91, 90, 124, 150}, {91, 90, 124, 151}, {91, 90, 124, 152}, {91, 90, 124, 153}, {91, 90, 124, 154}, {91, 90, 124, 156}, {91, 90, 124, 157}, {91, 90, 124, 158}}},\n\t\t{Region: \"Isle of Man\", Group: \"Premium UDP Europe\", Hostname: \"87-1-im.cg-dialup.net\", IPs: []net.IP{{91, 90, 124, 147}, {91, 90, 124, 149}, {91, 90, 124, 150}, {91, 90, 124, 151}, {91, 90, 124, 152}, {91, 90, 124, 153}, {91, 90, 124, 154}, {91, 90, 124, 155}, {91, 90, 124, 156}, {91, 90, 124, 157}}},\n\t\t{Region: \"Israel\", Group: \"Premium TCP Europe\", Hostname: \"97-1-il.cg-dialup.net\", IPs: []net.IP{{160, 116, 0, 174}, {185, 77, 248, 103}, {185, 77, 248, 111}, {185, 77, 248, 113}, {185, 77, 248, 114}, {185, 77, 248, 124}, {185, 77, 248, 125}, {185, 77, 248, 127}, {185, 77, 248, 128}, {185, 77, 248, 129}}},\n\t\t{Region: \"Israel\", Group: \"Premium UDP Europe\", Hostname: \"87-1-il.cg-dialup.net\", IPs: []net.IP{{160, 116, 0, 163}, {160, 116, 0, 165}, {160, 116, 0, 172}, {185, 77, 248, 103}, {185, 77, 248, 106}, {185, 77, 248, 114}, {185, 77, 248, 117}, {185, 77, 248, 118}, {185, 77, 248, 126}, {185, 77, 248, 129}}},\n\t\t{Region: \"Italy\", Group: \"Premium TCP Europe\", Hostname: \"97-1-it.cg-dialup.net\", IPs: []net.IP{{84, 17, 58, 21}, {84, 17, 58, 100}, {84, 17, 58, 106}, {84, 17, 58, 111}, {84, 17, 58, 117}, {87, 101, 94, 122}, {212, 102, 55, 100}, {212, 102, 55, 106}, {212, 102, 55, 110}, {212, 102, 55, 122}}},\n\t\t{Region: \"Italy\", Group: \"Premium UDP Europe\", Hostname: \"87-1-it.cg-dialup.net\", IPs: []net.IP{{84, 17, 58, 19}, {84, 17, 58, 95}, {84, 17, 58, 105}, {84, 17, 58, 119}, {84, 17, 58, 120}, {87, 101, 94, 116}, {185, 217, 71, 137}, {185, 217, 71, 138}, {185, 217, 71, 153}, {212, 102, 55, 108}}},\n\t\t{Region: \"Japan\", Group: \"Premium TCP Asia\", Hostname: \"96-1-jp.cg-dialup.net\", IPs: []net.IP{{156, 146, 35, 6}, {156, 146, 35, 10}, {156, 146, 35, 15}, {156, 146, 35, 22}, {156, 146, 35, 37}, {156, 146, 35, 39}, {156, 146, 35, 40}, {156, 146, 35, 41}, {156, 146, 35, 44}, {156, 146, 35, 50}}},\n\t\t{Region: \"Japan\", Group: \"Premium UDP Asia\", Hostname: \"95-1-jp.cg-dialup.net\", IPs: []net.IP{{156, 146, 35, 4}, {156, 146, 35, 14}, {156, 146, 35, 15}, {156, 146, 35, 18}, {156, 146, 35, 25}, {156, 146, 35, 34}, {156, 146, 35, 36}, {156, 146, 35, 46}, {156, 146, 35, 49}, {156, 146, 35, 50}}},\n\t\t{Region: \"Kazakhstan\", Group: \"Premium TCP Europe\", Hostname: \"97-1-kz.cg-dialup.net\", IPs: []net.IP{{62, 133, 47, 131}, {62, 133, 47, 132}, {62, 133, 47, 134}, {62, 133, 47, 136}, {62, 133, 47, 138}, {62, 133, 47, 139}, {62, 133, 47, 140}, {62, 133, 47, 142}, {62, 133, 47, 143}, {62, 133, 47, 144}}},\n\t\t{Region: \"Kazakhstan\", Group: \"Premium UDP Europe\", Hostname: \"87-1-kz.cg-dialup.net\", IPs: []net.IP{{62, 133, 47, 131}, {62, 133, 47, 132}, {62, 133, 47, 133}, {62, 133, 47, 134}, {62, 133, 47, 135}, {62, 133, 47, 138}, {62, 133, 47, 139}, {62, 133, 47, 140}, {62, 133, 47, 142}, {62, 133, 47, 143}}},\n\t\t{Region: \"Kenya\", Group: \"Premium TCP Asia\", Hostname: \"96-1-ke.cg-dialup.net\", IPs: []net.IP{{62, 12, 118, 195}, {62, 12, 118, 196}, {62, 12, 118, 197}, {62, 12, 118, 198}, {62, 12, 118, 199}, {62, 12, 118, 200}, {62, 12, 118, 201}, {62, 12, 118, 202}, {62, 12, 118, 203}, {62, 12, 118, 204}}},\n\t\t{Region: \"Kenya\", Group: \"Premium UDP Asia\", Hostname: \"95-1-ke.cg-dialup.net\", IPs: []net.IP{{62, 12, 118, 195}, {62, 12, 118, 196}, {62, 12, 118, 197}, {62, 12, 118, 198}, {62, 12, 118, 199}, {62, 12, 118, 200}, {62, 12, 118, 201}, {62, 12, 118, 202}, {62, 12, 118, 203}, {62, 12, 118, 204}}},\n\t\t{Region: \"Korea\", Group: \"Premium TCP Asia\", Hostname: \"96-1-kr.cg-dialup.net\", IPs: []net.IP{{79, 110, 55, 131}, {79, 110, 55, 134}, {79, 110, 55, 141}, {79, 110, 55, 147}, {79, 110, 55, 148}, {79, 110, 55, 151}, {79, 110, 55, 152}, {79, 110, 55, 153}, {79, 110, 55, 155}, {79, 110, 55, 157}}},\n\t\t{Region: \"Korea\", Group: \"Premium UDP Asia\", Hostname: \"95-1-kr.cg-dialup.net\", IPs: []net.IP{{79, 110, 55, 131}, {79, 110, 55, 133}, {79, 110, 55, 134}, {79, 110, 55, 136}, {79, 110, 55, 138}, {79, 110, 55, 140}, {79, 110, 55, 149}, {79, 110, 55, 151}, {79, 110, 55, 152}, {79, 110, 55, 157}}},\n\t\t{Region: \"Latvia\", Group: \"Premium TCP Europe\", Hostname: \"97-1-lv.cg-dialup.net\", IPs: []net.IP{{109, 248, 148, 244}, {109, 248, 148, 245}, {109, 248, 148, 246}, {109, 248, 148, 247}, {109, 248, 148, 249}, {109, 248, 148, 250}, {109, 248, 148, 253}, {109, 248, 149, 22}, {109, 248, 149, 24}, {109, 248, 149, 25}}},\n\t\t{Region: \"Latvia\", Group: \"Premium UDP Europe\", Hostname: \"87-1-lv.cg-dialup.net\", IPs: []net.IP{{109, 248, 148, 248}, {109, 248, 148, 250}, {109, 248, 148, 254}, {109, 248, 149, 19}, {109, 248, 149, 20}, {109, 248, 149, 22}, {109, 248, 149, 24}, {109, 248, 149, 26}, {109, 248, 149, 28}, {109, 248, 149, 30}}},\n\t\t{Region: \"Liechtenstein\", Group: \"Premium UDP Europe\", Hostname: \"87-1-li.cg-dialup.net\", IPs: []net.IP{{91, 90, 122, 131}, {91, 90, 122, 134}, {91, 90, 122, 137}, {91, 90, 122, 138}, {91, 90, 122, 139}, {91, 90, 122, 140}, {91, 90, 122, 141}, {91, 90, 122, 142}, {91, 90, 122, 144}, {91, 90, 122, 145}}},\n\t\t{Region: \"Lithuania\", Group: \"Premium TCP Europe\", Hostname: \"97-1-lt.cg-dialup.net\", IPs: []net.IP{{85, 206, 162, 212}, {85, 206, 162, 215}, {85, 206, 162, 219}, {85, 206, 162, 222}, {85, 206, 165, 17}, {85, 206, 165, 23}, {85, 206, 165, 25}, {85, 206, 165, 26}, {85, 206, 165, 30}, {85, 206, 165, 31}}},\n\t\t{Region: \"Lithuania\", Group: \"Premium UDP Europe\", Hostname: \"87-1-lt.cg-dialup.net\", IPs: []net.IP{{85, 206, 162, 209}, {85, 206, 162, 210}, {85, 206, 162, 211}, {85, 206, 162, 213}, {85, 206, 162, 214}, {85, 206, 162, 217}, {85, 206, 162, 218}, {85, 206, 162, 220}, {85, 206, 165, 26}, {85, 206, 165, 30}}},\n\t\t{Region: \"Luxembourg\", Group: \"Premium UDP Europe\", Hostname: \"87-1-lu.cg-dialup.net\", IPs: []net.IP{{5, 253, 204, 7}, {5, 253, 204, 10}, {5, 253, 204, 12}, {5, 253, 204, 23}, {5, 253, 204, 26}, {5, 253, 204, 30}, {5, 253, 204, 37}, {5, 253, 204, 39}, {5, 253, 204, 44}, {5, 253, 204, 45}}},\n\t\t{Region: \"Macao\", Group: \"Premium TCP Asia\", Hostname: \"96-1-mo.cg-dialup.net\", IPs: []net.IP{{84, 252, 92, 131}, {84, 252, 92, 133}, {84, 252, 92, 135}, {84, 252, 92, 137}, {84, 252, 92, 138}, {84, 252, 92, 139}, {84, 252, 92, 141}, {84, 252, 92, 142}, {84, 252, 92, 144}, {84, 252, 92, 145}}},\n\t\t{Region: \"Macao\", Group: \"Premium UDP Asia\", Hostname: \"95-1-mo.cg-dialup.net\", IPs: []net.IP{{84, 252, 92, 132}, {84, 252, 92, 134}, {84, 252, 92, 135}, {84, 252, 92, 136}, {84, 252, 92, 137}, {84, 252, 92, 139}, {84, 252, 92, 141}, {84, 252, 92, 143}, {84, 252, 92, 144}, {84, 252, 92, 145}}},\n\t\t{Region: \"Macedonia\", Group: \"Premium TCP Europe\", Hostname: \"97-1-mk.cg-dialup.net\", IPs: []net.IP{{185, 225, 28, 3}, {185, 225, 28, 4}, {185, 225, 28, 5}, {185, 225, 28, 6}, {185, 225, 28, 7}, {185, 225, 28, 8}, {185, 225, 28, 9}, {185, 225, 28, 10}, {185, 225, 28, 11}, {185, 225, 28, 12}}},\n\t\t{Region: \"Macedonia\", Group: \"Premium UDP Europe\", Hostname: \"87-1-mk.cg-dialup.net\", IPs: []net.IP{{185, 225, 28, 3}, {185, 225, 28, 4}, {185, 225, 28, 5}, {185, 225, 28, 6}, {185, 225, 28, 7}, {185, 225, 28, 8}, {185, 225, 28, 9}, {185, 225, 28, 10}, {185, 225, 28, 11}, {185, 225, 28, 12}}},\n\t\t{Region: \"Malaysia\", Group: \"Premium TCP Asia\", Hostname: \"96-1-my.cg-dialup.net\", IPs: []net.IP{{146, 70, 15, 4}, {146, 70, 15, 6}, {146, 70, 15, 8}, {146, 70, 15, 9}, {146, 70, 15, 10}, {146, 70, 15, 11}, {146, 70, 15, 12}, {146, 70, 15, 13}, {146, 70, 15, 15}, {146, 70, 15, 16}}},\n\t\t{Region: \"Malaysia\", Group: \"Premium UDP Asia\", Hostname: \"95-1-my.cg-dialup.net\", IPs: []net.IP{{146, 70, 15, 3}, {146, 70, 15, 4}, {146, 70, 15, 5}, {146, 70, 15, 6}, {146, 70, 15, 7}, {146, 70, 15, 8}, {146, 70, 15, 10}, {146, 70, 15, 12}, {146, 70, 15, 15}, {146, 70, 15, 16}}},\n\t\t{Region: \"Malta\", Group: \"Premium TCP Europe\", Hostname: \"97-1-mt.cg-dialup.net\", IPs: []net.IP{{176, 125, 230, 133}, {176, 125, 230, 135}, {176, 125, 230, 136}, {176, 125, 230, 137}, {176, 125, 230, 138}, {176, 125, 230, 140}, {176, 125, 230, 142}, {176, 125, 230, 143}, {176, 125, 230, 144}, {176, 125, 230, 145}}},\n\t\t{Region: \"Malta\", Group: \"Premium UDP Europe\", Hostname: \"87-1-mt.cg-dialup.net\", IPs: []net.IP{{176, 125, 230, 131}, {176, 125, 230, 133}, {176, 125, 230, 134}, {176, 125, 230, 136}, {176, 125, 230, 137}, {176, 125, 230, 138}, {176, 125, 230, 139}, {176, 125, 230, 140}, {176, 125, 230, 144}, {176, 125, 230, 145}}},\n\t\t{Region: \"Mexico\", Group: \"Premium TCP USA\", Hostname: \"93-1-mx.cg-dialup.net\", IPs: []net.IP{{77, 81, 142, 132}, {77, 81, 142, 134}, {77, 81, 142, 136}, {77, 81, 142, 139}, {77, 81, 142, 142}, {77, 81, 142, 154}, {77, 81, 142, 155}, {77, 81, 142, 157}, {77, 81, 142, 158}, {77, 81, 142, 159}}},\n\t\t{Region: \"Mexico\", Group: \"Premium UDP USA\", Hostname: \"94-1-mx.cg-dialup.net\", IPs: []net.IP{{77, 81, 142, 130}, {77, 81, 142, 131}, {77, 81, 142, 132}, {77, 81, 142, 139}, {77, 81, 142, 141}, {77, 81, 142, 142}, {77, 81, 142, 146}, {77, 81, 142, 147}, {77, 81, 142, 154}, {77, 81, 142, 159}}},\n\t\t{Region: \"Moldova\", Group: \"Premium TCP Europe\", Hostname: \"97-1-md.cg-dialup.net\", IPs: []net.IP{{178, 175, 130, 243}, {178, 175, 130, 244}, {178, 175, 130, 245}, {178, 175, 130, 246}, {178, 175, 130, 251}, {178, 175, 130, 254}, {178, 175, 142, 131}, {178, 175, 142, 132}, {178, 175, 142, 133}, {178, 175, 142, 134}}},\n\t\t{Region: \"Moldova\", Group: \"Premium UDP Europe\", Hostname: \"87-1-md.cg-dialup.net\", IPs: []net.IP{{178, 175, 130, 243}, {178, 175, 130, 244}, {178, 175, 130, 246}, {178, 175, 130, 250}, {178, 175, 130, 251}, {178, 175, 130, 253}, {178, 175, 130, 254}, {178, 175, 142, 132}, {178, 175, 142, 133}, {178, 175, 142, 134}}},\n\t\t{Region: \"Monaco\", Group: \"Premium TCP Europe\", Hostname: \"97-1-mc.cg-dialup.net\", IPs: []net.IP{{95, 181, 233, 131}, {95, 181, 233, 132}, {95, 181, 233, 133}, {95, 181, 233, 137}, {95, 181, 233, 138}, {95, 181, 233, 139}, {95, 181, 233, 140}, {95, 181, 233, 141}, {95, 181, 233, 143}, {95, 181, 233, 144}}},\n\t\t{Region: \"Monaco\", Group: \"Premium UDP Europe\", Hostname: \"87-1-mc.cg-dialup.net\", IPs: []net.IP{{95, 181, 233, 132}, {95, 181, 233, 135}, {95, 181, 233, 136}, {95, 181, 233, 137}, {95, 181, 233, 138}, {95, 181, 233, 139}, {95, 181, 233, 141}, {95, 181, 233, 142}, {95, 181, 233, 143}, {95, 181, 233, 144}}},\n\t\t{Region: \"Mongolia\", Group: \"Premium TCP Asia\", Hostname: \"96-1-mn.cg-dialup.net\", IPs: []net.IP{{185, 253, 163, 132}, {185, 253, 163, 133}, {185, 253, 163, 135}, {185, 253, 163, 136}, {185, 253, 163, 139}, {185, 253, 163, 140}, {185, 253, 163, 141}, {185, 253, 163, 142}, {185, 253, 163, 143}, {185, 253, 163, 144}}},\n\t\t{Region: \"Mongolia\", Group: \"Premium UDP Asia\", Hostname: \"95-1-mn.cg-dialup.net\", IPs: []net.IP{{185, 253, 163, 131}, {185, 253, 163, 133}, {185, 253, 163, 134}, {185, 253, 163, 137}, {185, 253, 163, 138}, {185, 253, 163, 139}, {185, 253, 163, 140}, {185, 253, 163, 141}, {185, 253, 163, 142}, {185, 253, 163, 144}}},\n\t\t{Region: \"Montenegro\", Group: \"Premium TCP Europe\", Hostname: \"97-1-me.cg-dialup.net\", IPs: []net.IP{{176, 125, 229, 131}, {176, 125, 229, 135}, {176, 125, 229, 137}, {176, 125, 229, 138}, {176, 125, 229, 140}, {176, 125, 229, 141}, {176, 125, 229, 142}, {176, 125, 229, 143}, {176, 125, 229, 144}, {176, 125, 229, 145}}},\n\t\t{Region: \"Montenegro\", Group: \"Premium UDP Europe\", Hostname: \"87-1-me.cg-dialup.net\", IPs: []net.IP{{176, 125, 229, 131}, {176, 125, 229, 134}, {176, 125, 229, 136}, {176, 125, 229, 137}, {176, 125, 229, 138}, {176, 125, 229, 139}, {176, 125, 229, 140}, {176, 125, 229, 141}, {176, 125, 229, 143}, {176, 125, 229, 144}}},\n\t\t{Region: \"Morocco\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ma.cg-dialup.net\", IPs: []net.IP{{95, 181, 232, 132}, {95, 181, 232, 133}, {95, 181, 232, 134}, {95, 181, 232, 136}, {95, 181, 232, 137}, {95, 181, 232, 138}, {95, 181, 232, 139}, {95, 181, 232, 140}, {95, 181, 232, 141}, {95, 181, 232, 144}}},\n\t\t{Region: \"Morocco\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ma.cg-dialup.net\", IPs: []net.IP{{95, 181, 232, 131}, {95, 181, 232, 132}, {95, 181, 232, 133}, {95, 181, 232, 135}, {95, 181, 232, 137}, {95, 181, 232, 139}, {95, 181, 232, 140}, {95, 181, 232, 141}, {95, 181, 232, 142}, {95, 181, 232, 143}}},\n\t\t{Region: \"Netherlands\", Group: \"Premium TCP Europe\", Hostname: \"97-1-nl.cg-dialup.net\", IPs: []net.IP{{84, 17, 47, 98}, {181, 214, 206, 22}, {181, 214, 206, 27}, {181, 214, 206, 36}, {195, 78, 54, 10}, {195, 78, 54, 20}, {195, 78, 54, 43}, {195, 78, 54, 50}, {195, 78, 54, 119}, {195, 181, 172, 78}}},\n\t\t{Region: \"Netherlands\", Group: \"Premium UDP Europe\", Hostname: \"87-1-nl.cg-dialup.net\", IPs: []net.IP{{84, 17, 47, 110}, {181, 214, 206, 29}, {181, 214, 206, 42}, {195, 78, 54, 8}, {195, 78, 54, 19}, {195, 78, 54, 47}, {195, 78, 54, 110}, {195, 78, 54, 141}, {195, 78, 54, 143}, {195, 78, 54, 157}}},\n\t\t{Region: \"New Zealand\", Group: \"Premium TCP Asia\", Hostname: \"96-1-nz.cg-dialup.net\", IPs: []net.IP{{43, 250, 207, 98}, {43, 250, 207, 99}, {43, 250, 207, 100}, {43, 250, 207, 101}, {43, 250, 207, 102}, {43, 250, 207, 103}, {43, 250, 207, 105}, {43, 250, 207, 106}, {43, 250, 207, 108}, {43, 250, 207, 109}}},\n\t\t{Region: \"New Zealand\", Group: \"Premium UDP Asia\", Hostname: \"95-1-nz.cg-dialup.net\", IPs: []net.IP{{43, 250, 207, 98}, {43, 250, 207, 99}, {43, 250, 207, 102}, {43, 250, 207, 104}, {43, 250, 207, 105}, {43, 250, 207, 106}, {43, 250, 207, 107}, {43, 250, 207, 108}, {43, 250, 207, 109}, {43, 250, 207, 110}}},\n\t\t{Region: \"Nigeria\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ng.cg-dialup.net\", IPs: []net.IP{{102, 165, 25, 68}, {102, 165, 25, 69}, {102, 165, 25, 70}, {102, 165, 25, 71}, {102, 165, 25, 72}, {102, 165, 25, 73}, {102, 165, 25, 75}, {102, 165, 25, 76}, {102, 165, 25, 77}, {102, 165, 25, 78}}},\n\t\t{Region: \"Nigeria\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ng.cg-dialup.net\", IPs: []net.IP{{102, 165, 25, 68}, {102, 165, 25, 69}, {102, 165, 25, 70}, {102, 165, 25, 71}, {102, 165, 25, 72}, {102, 165, 25, 74}, {102, 165, 25, 75}, {102, 165, 25, 76}, {102, 165, 25, 77}, {102, 165, 25, 78}}},\n\t\t{Region: \"Norway\", Group: \"Premium TCP Europe\", Hostname: \"97-1-no.cg-dialup.net\", IPs: []net.IP{{45, 12, 223, 137}, {45, 12, 223, 140}, {185, 206, 225, 29}, {185, 206, 225, 231}, {185, 253, 97, 234}, {185, 253, 97, 236}, {185, 253, 97, 238}, {185, 253, 97, 244}, {185, 253, 97, 250}, {185, 253, 97, 254}}},\n\t\t{Region: \"Norway\", Group: \"Premium UDP Europe\", Hostname: \"87-1-no.cg-dialup.net\", IPs: []net.IP{{45, 12, 223, 133}, {45, 12, 223, 134}, {45, 12, 223, 142}, {185, 206, 225, 227}, {185, 206, 225, 228}, {185, 206, 225, 231}, {185, 206, 225, 235}, {185, 253, 97, 237}, {185, 253, 97, 246}, {185, 253, 97, 254}}},\n\t\t{Region: \"Pakistan\", Group: \"Premium TCP Asia\", Hostname: \"96-1-pk.cg-dialup.net\", IPs: []net.IP{{146, 70, 12, 3}, {146, 70, 12, 4}, {146, 70, 12, 6}, {146, 70, 12, 8}, {146, 70, 12, 9}, {146, 70, 12, 10}, {146, 70, 12, 11}, {146, 70, 12, 12}, {146, 70, 12, 13}, {146, 70, 12, 14}}},\n\t\t{Region: \"Pakistan\", Group: \"Premium UDP Asia\", Hostname: \"95-1-pk.cg-dialup.net\", IPs: []net.IP{{146, 70, 12, 4}, {146, 70, 12, 5}, {146, 70, 12, 6}, {146, 70, 12, 7}, {146, 70, 12, 8}, {146, 70, 12, 10}, {146, 70, 12, 11}, {146, 70, 12, 12}, {146, 70, 12, 13}, {146, 70, 12, 14}}},\n\t\t{Region: \"Panama\", Group: \"Premium TCP Europe\", Hostname: \"97-1-pa.cg-dialup.net\", IPs: []net.IP{{91, 90, 126, 131}, {91, 90, 126, 132}, {91, 90, 126, 133}, {91, 90, 126, 134}, {91, 90, 126, 136}, {91, 90, 126, 138}, {91, 90, 126, 139}, {91, 90, 126, 141}, {91, 90, 126, 142}, {91, 90, 126, 145}}},\n\t\t{Region: \"Panama\", Group: \"Premium UDP Europe\", Hostname: \"87-1-pa.cg-dialup.net\", IPs: []net.IP{{91, 90, 126, 131}, {91, 90, 126, 133}, {91, 90, 126, 134}, {91, 90, 126, 135}, {91, 90, 126, 136}, {91, 90, 126, 138}, {91, 90, 126, 140}, {91, 90, 126, 141}, {91, 90, 126, 142}, {91, 90, 126, 145}}},\n\t\t{Region: \"Philippines\", Group: \"Premium TCP Asia\", Hostname: \"96-1-ph.cg-dialup.net\", IPs: []net.IP{{188, 214, 125, 37}, {188, 214, 125, 38}, {188, 214, 125, 40}, {188, 214, 125, 43}, {188, 214, 125, 44}, {188, 214, 125, 45}, {188, 214, 125, 52}, {188, 214, 125, 55}, {188, 214, 125, 61}, {188, 214, 125, 62}}},\n\t\t{Region: \"Philippines\", Group: \"Premium UDP Asia\", Hostname: \"95-1-ph.cg-dialup.net\", IPs: []net.IP{{188, 214, 125, 37}, {188, 214, 125, 40}, {188, 214, 125, 46}, {188, 214, 125, 49}, {188, 214, 125, 52}, {188, 214, 125, 54}, {188, 214, 125, 57}, {188, 214, 125, 58}, {188, 214, 125, 61}, {188, 214, 125, 62}}},\n\t\t{Region: \"Poland\", Group: \"Premium TCP Europe\", Hostname: \"97-1-pl.cg-dialup.net\", IPs: []net.IP{{138, 199, 59, 132}, {138, 199, 59, 136}, {138, 199, 59, 137}, {138, 199, 59, 143}, {138, 199, 59, 144}, {138, 199, 59, 152}, {138, 199, 59, 153}, {138, 199, 59, 166}, {138, 199, 59, 174}, {138, 199, 59, 175}}},\n\t\t{Region: \"Poland\", Group: \"Premium UDP Europe\", Hostname: \"87-1-pl.cg-dialup.net\", IPs: []net.IP{{138, 199, 59, 130}, {138, 199, 59, 136}, {138, 199, 59, 148}, {138, 199, 59, 149}, {138, 199, 59, 153}, {138, 199, 59, 156}, {138, 199, 59, 157}, {138, 199, 59, 164}, {138, 199, 59, 171}, {138, 199, 59, 173}}},\n\t\t{Region: \"Portugal\", Group: \"Premium TCP Europe\", Hostname: \"97-1-pt.cg-dialup.net\", IPs: []net.IP{{89, 26, 243, 112}, {89, 26, 243, 115}, {89, 26, 243, 195}, {89, 26, 243, 216}, {89, 26, 243, 218}, {89, 26, 243, 220}, {89, 26, 243, 222}, {89, 26, 243, 223}, {89, 26, 243, 225}, {89, 26, 243, 228}}},\n\t\t{Region: \"Portugal\", Group: \"Premium UDP Europe\", Hostname: \"87-1-pt.cg-dialup.net\", IPs: []net.IP{{89, 26, 243, 99}, {89, 26, 243, 113}, {89, 26, 243, 115}, {89, 26, 243, 195}, {89, 26, 243, 199}, {89, 26, 243, 216}, {89, 26, 243, 219}, {89, 26, 243, 225}, {89, 26, 243, 226}, {89, 26, 243, 227}}},\n\t\t{Region: \"Qatar\", Group: \"Premium TCP Europe\", Hostname: \"97-1-qa.cg-dialup.net\", IPs: []net.IP{{95, 181, 234, 133}, {95, 181, 234, 135}, {95, 181, 234, 136}, {95, 181, 234, 137}, {95, 181, 234, 138}, {95, 181, 234, 139}, {95, 181, 234, 140}, {95, 181, 234, 141}, {95, 181, 234, 142}, {95, 181, 234, 143}}},\n\t\t{Region: \"Qatar\", Group: \"Premium UDP Europe\", Hostname: \"87-1-qa.cg-dialup.net\", IPs: []net.IP{{95, 181, 234, 131}, {95, 181, 234, 132}, {95, 181, 234, 133}, {95, 181, 234, 134}, {95, 181, 234, 135}, {95, 181, 234, 137}, {95, 181, 234, 138}, {95, 181, 234, 139}, {95, 181, 234, 142}, {95, 181, 234, 143}}},\n\t\t{Region: \"Russian Federation\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ru.cg-dialup.net\", IPs: []net.IP{{5, 8, 16, 72}, {5, 8, 16, 74}, {5, 8, 16, 84}, {5, 8, 16, 85}, {5, 8, 16, 123}, {5, 8, 16, 124}, {5, 8, 16, 132}, {146, 70, 52, 35}, {146, 70, 52, 44}, {146, 70, 52, 54}}},\n\t\t{Region: \"Russian Federation\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ru.cg-dialup.net\", IPs: []net.IP{{5, 8, 16, 75}, {5, 8, 16, 87}, {5, 8, 16, 99}, {5, 8, 16, 110}, {5, 8, 16, 138}, {146, 70, 52, 29}, {146, 70, 52, 52}, {146, 70, 52, 58}, {146, 70, 52, 59}, {146, 70, 52, 67}}},\n\t\t{Region: \"Saudi Arabia\", Group: \"Premium TCP Europe\", Hostname: \"97-1-sa.cg-dialup.net\", IPs: []net.IP{{95, 181, 235, 131}, {95, 181, 235, 133}, {95, 181, 235, 134}, {95, 181, 235, 135}, {95, 181, 235, 137}, {95, 181, 235, 138}, {95, 181, 235, 139}, {95, 181, 235, 140}, {95, 181, 235, 141}, {95, 181, 235, 142}}},\n\t\t{Region: \"Saudi Arabia\", Group: \"Premium UDP Europe\", Hostname: \"87-1-sa.cg-dialup.net\", IPs: []net.IP{{95, 181, 235, 131}, {95, 181, 235, 132}, {95, 181, 235, 134}, {95, 181, 235, 135}, {95, 181, 235, 136}, {95, 181, 235, 137}, {95, 181, 235, 138}, {95, 181, 235, 139}, {95, 181, 235, 141}, {95, 181, 235, 144}}},\n\t\t{Region: \"Serbia\", Group: \"Premium TCP Europe\", Hostname: \"97-1-rs.cg-dialup.net\", IPs: []net.IP{{37, 120, 193, 179}, {37, 120, 193, 186}, {37, 120, 193, 188}, {37, 120, 193, 190}, {141, 98, 103, 36}, {141, 98, 103, 38}, {141, 98, 103, 39}, {141, 98, 103, 43}, {141, 98, 103, 44}, {141, 98, 103, 46}}},\n\t\t{Region: \"Serbia\", Group: \"Premium UDP Europe\", Hostname: \"87-1-rs.cg-dialup.net\", IPs: []net.IP{{37, 120, 193, 180}, {37, 120, 193, 186}, {37, 120, 193, 187}, {37, 120, 193, 188}, {37, 120, 193, 189}, {37, 120, 193, 190}, {141, 98, 103, 35}, {141, 98, 103, 36}, {141, 98, 103, 39}, {141, 98, 103, 41}}},\n\t\t{Region: \"Singapore\", Group: \"Premium TCP Asia\", Hostname: \"96-1-sg.cg-dialup.net\", IPs: []net.IP{{84, 17, 39, 162}, {84, 17, 39, 165}, {84, 17, 39, 168}, {84, 17, 39, 171}, {84, 17, 39, 175}, {84, 17, 39, 177}, {84, 17, 39, 178}, {84, 17, 39, 181}, {84, 17, 39, 183}, {84, 17, 39, 185}}},\n\t\t{Region: \"Singapore\", Group: \"Premium UDP Asia\", Hostname: \"95-1-sg.cg-dialup.net\", IPs: []net.IP{{84, 17, 39, 162}, {84, 17, 39, 165}, {84, 17, 39, 166}, {84, 17, 39, 167}, {84, 17, 39, 171}, {84, 17, 39, 174}, {84, 17, 39, 175}, {84, 17, 39, 178}, {84, 17, 39, 180}, {84, 17, 39, 185}}},\n\t\t{Region: \"Slovakia\", Group: \"Premium TCP Europe\", Hostname: \"97-1-sk.cg-dialup.net\", IPs: []net.IP{{185, 245, 85, 227}, {185, 245, 85, 228}, {185, 245, 85, 229}, {185, 245, 85, 230}, {185, 245, 85, 231}, {185, 245, 85, 232}, {185, 245, 85, 233}, {185, 245, 85, 234}, {185, 245, 85, 235}, {185, 245, 85, 236}}},\n\t\t{Region: \"Slovakia\", Group: \"Premium UDP Europe\", Hostname: \"87-1-sk.cg-dialup.net\", IPs: []net.IP{{185, 245, 85, 227}, {185, 245, 85, 228}, {185, 245, 85, 229}, {185, 245, 85, 230}, {185, 245, 85, 231}, {185, 245, 85, 232}, {185, 245, 85, 233}, {185, 245, 85, 234}, {185, 245, 85, 235}, {185, 245, 85, 236}}},\n\t\t{Region: \"Slovenia\", Group: \"Premium TCP Europe\", Hostname: \"97-1-si.cg-dialup.net\", IPs: []net.IP{{195, 80, 150, 211}, {195, 80, 150, 212}, {195, 80, 150, 214}, {195, 80, 150, 215}, {195, 80, 150, 216}, {195, 80, 150, 217}, {195, 80, 150, 218}, {195, 80, 150, 219}, {195, 80, 150, 221}, {195, 80, 150, 222}}},\n\t\t{Region: \"Slovenia\", Group: \"Premium UDP Europe\", Hostname: \"87-1-si.cg-dialup.net\", IPs: []net.IP{{195, 80, 150, 211}, {195, 80, 150, 212}, {195, 80, 150, 214}, {195, 80, 150, 215}, {195, 80, 150, 216}, {195, 80, 150, 217}, {195, 80, 150, 219}, {195, 80, 150, 220}, {195, 80, 150, 221}, {195, 80, 150, 222}}},\n\t\t{Region: \"South Africa\", Group: \"Premium TCP Asia\", Hostname: \"96-1-za.cg-dialup.net\", IPs: []net.IP{{154, 127, 50, 212}, {154, 127, 50, 215}, {154, 127, 50, 217}, {154, 127, 50, 219}, {154, 127, 50, 220}, {154, 127, 50, 222}, {154, 127, 60, 196}, {154, 127, 60, 198}, {154, 127, 60, 199}, {154, 127, 60, 200}}},\n\t\t{Region: \"South Africa\", Group: \"Premium TCP Europe\", Hostname: \"97-1-za.cg-dialup.net\", IPs: []net.IP{{197, 85, 7, 26}, {197, 85, 7, 27}, {197, 85, 7, 28}, {197, 85, 7, 29}, {197, 85, 7, 30}, {197, 85, 7, 31}, {197, 85, 7, 131}, {197, 85, 7, 132}, {197, 85, 7, 133}, {197, 85, 7, 134}}},\n\t\t{Region: \"South Africa\", Group: \"Premium UDP Asia\", Hostname: \"95-1-za.cg-dialup.net\", IPs: []net.IP{{154, 127, 50, 210}, {154, 127, 50, 214}, {154, 127, 50, 218}, {154, 127, 50, 219}, {154, 127, 50, 220}, {154, 127, 50, 221}, {154, 127, 50, 222}, {154, 127, 60, 195}, {154, 127, 60, 199}, {154, 127, 60, 206}}},\n\t\t{Region: \"South Africa\", Group: \"Premium UDP Europe\", Hostname: \"87-1-za.cg-dialup.net\", IPs: []net.IP{{197, 85, 7, 26}, {197, 85, 7, 27}, {197, 85, 7, 28}, {197, 85, 7, 29}, {197, 85, 7, 30}, {197, 85, 7, 31}, {197, 85, 7, 131}, {197, 85, 7, 132}, {197, 85, 7, 133}, {197, 85, 7, 134}}},\n\t\t{Region: \"Spain\", Group: \"Premium TCP Europe\", Hostname: \"97-1-es.cg-dialup.net\", IPs: []net.IP{{37, 120, 142, 41}, {37, 120, 142, 52}, {37, 120, 142, 55}, {37, 120, 142, 61}, {37, 120, 142, 173}, {84, 17, 62, 131}, {84, 17, 62, 142}, {84, 17, 62, 144}, {185, 93, 3, 108}, {185, 93, 3, 114}}},\n\t\t{Region: \"Sri Lanka\", Group: \"Premium TCP Europe\", Hostname: \"97-1-lk.cg-dialup.net\", IPs: []net.IP{{95, 181, 239, 131}, {95, 181, 239, 132}, {95, 181, 239, 133}, {95, 181, 239, 134}, {95, 181, 239, 135}, {95, 181, 239, 136}, {95, 181, 239, 137}, {95, 181, 239, 138}, {95, 181, 239, 140}, {95, 181, 239, 144}}},\n\t\t{Region: \"Sri Lanka\", Group: \"Premium UDP Europe\", Hostname: \"87-1-lk.cg-dialup.net\", IPs: []net.IP{{95, 181, 239, 131}, {95, 181, 239, 132}, {95, 181, 239, 133}, {95, 181, 239, 134}, {95, 181, 239, 135}, {95, 181, 239, 136}, {95, 181, 239, 140}, {95, 181, 239, 141}, {95, 181, 239, 142}, {95, 181, 239, 144}}},\n\t\t{Region: \"Sweden\", Group: \"Premium TCP Europe\", Hostname: \"97-1-se.cg-dialup.net\", IPs: []net.IP{{188, 126, 73, 207}, {188, 126, 73, 209}, {188, 126, 73, 214}, {188, 126, 73, 219}, {188, 126, 79, 6}, {188, 126, 79, 11}, {188, 126, 79, 19}, {188, 126, 79, 25}, {195, 246, 120, 148}, {195, 246, 120, 161}}},\n\t\t{Region: \"Sweden\", Group: \"Premium UDP Europe\", Hostname: \"87-1-se.cg-dialup.net\", IPs: []net.IP{{188, 126, 73, 201}, {188, 126, 73, 211}, {188, 126, 73, 213}, {188, 126, 73, 218}, {188, 126, 79, 6}, {188, 126, 79, 8}, {188, 126, 79, 19}, {195, 246, 120, 142}, {195, 246, 120, 144}, {195, 246, 120, 168}}},\n\t\t{Region: \"Switzerland\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ch.cg-dialup.net\", IPs: []net.IP{{84, 17, 52, 4}, {84, 17, 52, 20}, {84, 17, 52, 44}, {84, 17, 52, 65}, {84, 17, 52, 72}, {84, 17, 52, 80}, {84, 17, 52, 83}, {84, 17, 52, 85}, {185, 32, 222, 112}, {185, 189, 150, 73}}},\n\t\t{Region: \"Switzerland\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ch.cg-dialup.net\", IPs: []net.IP{{84, 17, 52, 5}, {84, 17, 52, 14}, {84, 17, 52, 24}, {84, 17, 52, 64}, {84, 17, 52, 73}, {84, 17, 52, 85}, {185, 32, 222, 114}, {185, 189, 150, 52}, {185, 189, 150, 57}, {195, 225, 118, 43}}},\n\t\t{Region: \"Taiwan\", Group: \"Premium TCP Asia\", Hostname: \"96-1-tw.cg-dialup.net\", IPs: []net.IP{{45, 133, 181, 100}, {45, 133, 181, 102}, {45, 133, 181, 103}, {45, 133, 181, 106}, {45, 133, 181, 109}, {45, 133, 181, 113}, {45, 133, 181, 115}, {45, 133, 181, 116}, {45, 133, 181, 123}, {45, 133, 181, 125}}},\n\t\t{Region: \"Taiwan\", Group: \"Premium UDP Asia\", Hostname: \"95-1-tw.cg-dialup.net\", IPs: []net.IP{{45, 133, 181, 99}, {45, 133, 181, 102}, {45, 133, 181, 107}, {45, 133, 181, 108}, {45, 133, 181, 109}, {45, 133, 181, 114}, {45, 133, 181, 116}, {45, 133, 181, 117}, {45, 133, 181, 123}, {45, 133, 181, 124}}},\n\t\t{Region: \"Thailand\", Group: \"Premium TCP Asia\", Hostname: \"96-1-th.cg-dialup.net\", IPs: []net.IP{{146, 70, 13, 3}, {146, 70, 13, 4}, {146, 70, 13, 6}, {146, 70, 13, 7}, {146, 70, 13, 8}, {146, 70, 13, 9}, {146, 70, 13, 11}, {146, 70, 13, 13}, {146, 70, 13, 15}, {146, 70, 13, 16}}},\n\t\t{Region: \"Thailand\", Group: \"Premium UDP Asia\", Hostname: \"95-1-th.cg-dialup.net\", IPs: []net.IP{{146, 70, 13, 3}, {146, 70, 13, 4}, {146, 70, 13, 8}, {146, 70, 13, 9}, {146, 70, 13, 10}, {146, 70, 13, 11}, {146, 70, 13, 12}, {146, 70, 13, 13}, {146, 70, 13, 15}, {146, 70, 13, 16}}},\n\t\t{Region: \"Turkey\", Group: \"Premium TCP Europe\", Hostname: \"97-1-tr.cg-dialup.net\", IPs: []net.IP{{188, 213, 34, 9}, {188, 213, 34, 11}, {188, 213, 34, 15}, {188, 213, 34, 16}, {188, 213, 34, 23}, {188, 213, 34, 25}, {188, 213, 34, 28}, {188, 213, 34, 41}, {188, 213, 34, 108}, {188, 213, 34, 110}}},\n\t\t{Region: \"Turkey\", Group: \"Premium UDP Europe\", Hostname: \"87-1-tr.cg-dialup.net\", IPs: []net.IP{{188, 213, 34, 8}, {188, 213, 34, 11}, {188, 213, 34, 14}, {188, 213, 34, 28}, {188, 213, 34, 35}, {188, 213, 34, 42}, {188, 213, 34, 43}, {188, 213, 34, 100}, {188, 213, 34, 103}, {188, 213, 34, 107}}},\n\t\t{Region: \"Ukraine\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ua.cg-dialup.net\", IPs: []net.IP{{31, 28, 161, 18}, {31, 28, 161, 20}, {31, 28, 161, 27}, {31, 28, 163, 34}, {31, 28, 163, 37}, {31, 28, 163, 44}, {62, 149, 7, 167}, {62, 149, 7, 172}, {62, 149, 29, 45}, {62, 149, 29, 57}}},\n\t\t{Region: \"Ukraine\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ua.cg-dialup.net\", IPs: []net.IP{{31, 28, 161, 27}, {31, 28, 163, 38}, {31, 28, 163, 42}, {31, 28, 163, 54}, {31, 28, 163, 61}, {62, 149, 7, 162}, {62, 149, 7, 163}, {62, 149, 29, 35}, {62, 149, 29, 38}, {62, 149, 29, 41}}},\n\t\t{Region: \"United Arab Emirates\", Group: \"Premium TCP Europe\", Hostname: \"97-1-ae.cg-dialup.net\", IPs: []net.IP{{217, 138, 193, 179}, {217, 138, 193, 180}, {217, 138, 193, 181}, {217, 138, 193, 182}, {217, 138, 193, 183}, {217, 138, 193, 184}, {217, 138, 193, 185}, {217, 138, 193, 186}, {217, 138, 193, 188}, {217, 138, 193, 190}}},\n\t\t{Region: \"United Arab Emirates\", Group: \"Premium UDP Europe\", Hostname: \"87-1-ae.cg-dialup.net\", IPs: []net.IP{{217, 138, 193, 179}, {217, 138, 193, 180}, {217, 138, 193, 181}, {217, 138, 193, 182}, {217, 138, 193, 183}, {217, 138, 193, 186}, {217, 138, 193, 187}, {217, 138, 193, 188}, {217, 138, 193, 189}, {217, 138, 193, 190}}},\n\t\t{Region: \"United Kingdom\", Group: \"Premium TCP Europe\", Hostname: \"97-1-gb.cg-dialup.net\", IPs: []net.IP{{45, 133, 173, 49}, {45, 133, 173, 56}, {45, 133, 173, 82}, {45, 133, 173, 86}, {95, 154, 200, 153}, {95, 154, 200, 156}, {181, 215, 176, 103}, {181, 215, 176, 246}, {181, 215, 176, 251}, {194, 110, 13, 141}}},\n\t\t{Region: \"United Kingdom\", Group: \"Premium UDP Europe\", Hostname: \"87-1-gb.cg-dialup.net\", IPs: []net.IP{{45, 133, 172, 100}, {45, 133, 172, 126}, {45, 133, 173, 84}, {95, 154, 200, 174}, {181, 215, 176, 110}, {181, 215, 176, 151}, {181, 215, 176, 158}, {191, 101, 209, 142}, {194, 110, 13, 107}, {194, 110, 13, 128}}},\n\t\t{Region: \"United States\", Group: \"Premium TCP USA\", Hostname: \"93-1-us.cg-dialup.net\", IPs: []net.IP{{102, 129, 145, 15}, {102, 129, 152, 195}, {102, 129, 152, 248}, {154, 21, 208, 159}, {185, 242, 5, 117}, {185, 242, 5, 123}, {185, 242, 5, 229}, {191, 96, 227, 173}, {191, 96, 227, 196}, {199, 115, 119, 248}}},\n\t\t{Region: \"United States\", Group: \"Premium UDP USA\", Hostname: \"94-1-us.cg-dialup.net\", IPs: []net.IP{{23, 82, 14, 113}, {23, 105, 177, 122}, {45, 89, 173, 222}, {84, 17, 35, 4}, {89, 187, 171, 132}, {156, 146, 37, 45}, {156, 146, 59, 86}, {184, 170, 240, 231}, {191, 96, 150, 248}, {199, 115, 119, 248}}},\n\t\t{Region: \"Venezuela\", Group: \"Premium TCP USA\", Hostname: \"93-1-ve.cg-dialup.net\", IPs: []net.IP{{95, 181, 237, 132}, {95, 181, 237, 133}, {95, 181, 237, 134}, {95, 181, 237, 135}, {95, 181, 237, 136}, {95, 181, 237, 138}, {95, 181, 237, 139}, {95, 181, 237, 140}, {95, 181, 237, 141}, {95, 181, 237, 143}}},\n\t\t{Region: \"Venezuela\", Group: \"Premium UDP USA\", Hostname: \"94-1-ve.cg-dialup.net\", IPs: []net.IP{{95, 181, 237, 131}, {95, 181, 237, 132}, {95, 181, 237, 134}, {95, 181, 237, 135}, {95, 181, 237, 136}, {95, 181, 237, 140}, {95, 181, 237, 141}, {95, 181, 237, 142}, {95, 181, 237, 143}, {95, 181, 237, 144}}},\n\t\t{Region: \"Vietnam\", Group: \"Premium TCP Asia\", Hostname: \"96-1-vn.cg-dialup.net\", IPs: []net.IP{{188, 214, 152, 99}, {188, 214, 152, 101}, {188, 214, 152, 103}, {188, 214, 152, 104}, {188, 214, 152, 105}, {188, 214, 152, 106}, {188, 214, 152, 107}, {188, 214, 152, 108}, {188, 214, 152, 109}, {188, 214, 152, 110}}},\n\t\t{Region: \"Vietnam\", Group: \"Premium UDP Asia\", Hostname: \"95-1-vn.cg-dialup.net\", IPs: []net.IP{{188, 214, 152, 99}, {188, 214, 152, 100}, {188, 214, 152, 101}, {188, 214, 152, 102}, {188, 214, 152, 103}, {188, 214, 152, 104}, {188, 214, 152, 105}, {188, 214, 152, 106}, {188, 214, 152, 107}, {188, 214, 152, 109}}},\n\t}\n}", "func Servers(session *discordgo.Session, message *discordgo.MessageCreate, env *botenv.BotEnv) {\n\tenv.AuditLock.RLock()\n\tdefer env.AuditLock.RUnlock()\n\tvar b strings.Builder\n\n\ti := 0\n\tfor k := range env.Audit.Map {\n\t\tfmt.Fprintf(&b, \"%s\\n\", k)\n\t\ti++\n\t}\n\tembed := discordgo.MessageEmbed{Title: \"Servers\", Description: b.String()}\n\tsession.ChannelMessageSendEmbed(message.ChannelID, &embed)\n}", "func (c *Client) QueryServers() {\n\t// create the message. Only header, no payload when querying server\n\tvar message Message\n\n\tmessage.Objname = c.params.Objname\n\tmessage.Opnum = c.Opnum\n\tmessage.Phase = c.Phase\n\tmessage.Objparams = c.params\n\tmessage.TagValue_var = TagValue{Tag_var: Tag{Client_id: \"\", Version_num: 0}, Value: make([]byte, 0)}\n\tmessage.Sender = c.client_name\n\n\tmessage_to_send := CreateGobFromMessage(message)\n\n\tfor _, server := range c.params.Servers_names {\n\t\tc.connection[server].SendBytes(message_to_send.Bytes(), NON_BLOCKING)\n\t\t//serverMessageCountUp(server)\n\t}\n\n}", "func (page ServerListResultPage) Values() []Server {\n if page.slr.IsEmpty() {\n return nil\n }\n return *page.slr.Value\n }", "func (st *State) Servers() []*Server {\n\tst.mu.Lock()\n\tdefer st.mu.Unlock()\n\tservers := make([]*Server, len(st.servers))\n\tcopy(servers, st.servers)\n\treturn servers\n}", "func AllServers(w http.ResponseWriter, r *http.Request) {\n\n\tvar response Items\n\tvar allInfo []ServerInfo\n\n\trows, err := db.Query(\n\t\t\"SELECT id, domain, servers_changed, ssl_grade, previous_ssl_grade, logo, title, is_down, created_at, updated_at FROM serverInfo\")\n\tcatch(err)\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\n\t\tvar responseInfo Info\n\t\tvar serverInfo ServerInfo\n\n\t\t// Print out the returned values.\n\t\tvar id uuid.UUID\n\t\tvar domain, sslGradeDB string\n\t\tvar serversChangedDB sql.NullBool\n\t\tvar previousSslGradeDB, logo, title sql.NullString\n\t\tvar isDown bool\n\t\tvar createdAtDB time.Time\n\t\tvar updatedAtDB pq.NullTime\n\n\t\tif err := rows.Scan(&id, &domain, &serversChangedDB, &sslGradeDB, &previousSslGradeDB, &logo, &title, &isDown, &createdAtDB, &updatedAtDB); err != nil {\n\t\t\tlog.Print(err)\n\t\t} else {\n\n\t\t\tserverInfo.Domain = domain\n\n\t\t\tresponseInfo.SSLGrade = sslGradeDB\n\t\t\tif previousSslGradeDB.Valid {\n\t\t\t\tresponseInfo.PreviousSSLGrade = previousSslGradeDB.String\n\t\t\t}\n\t\t\tif logo.Valid {\n\t\t\t\tresponseInfo.Logo = logo.String\n\t\t\t}\n\t\t\tif title.Valid {\n\t\t\t\tresponseInfo.Title = title.String\n\t\t\t}\n\t\t\tresponseInfo.IsDown = isDown\n\t\t\tresponseInfo.Created = createdAtDB\n\t\t\tif updatedAtDB.Valid {\n\t\t\t\tresponseInfo.Updated = updatedAtDB.Time\n\t\t\t}\n\n\t\t\tservers, _ := lookUpServersDB(id)\n\t\t\tresponseInfo.Servers = servers\n\t\t\tserverInfo.Info = responseInfo\n\n\t\t}\n\t\tallInfo = append(allInfo, serverInfo)\n\t}\n\n\tresponse.Items = allInfo\n\n\tjson.NewEncoder(w).Encode(response)\n}", "func (b *Backend) GetServers(clusterName string) (map[string]*model.Server, error) {\n\tservices, err := b.agent.Services()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttargetServices := make(map[string]*api.AgentService)\n\tfor _, service := range services {\n\t\tif service.Service == clusterName {\n\t\t\ttargetServices[service.ID] = service\n\t\t}\n\t}\n\n\tservers := make(map[string]*model.Server)\n\tfor _, service := range targetServices {\n\t\ts := &model.Server{\n\t\t\tSchema: \"http\",\n\t\t\tAddr: fmt.Sprintf(\"%s:%d\", service.Address, service.Port),\n\n\t\t\tExternal: true,\n\t\t}\n\n\t\tif service.Tags != nil {\n\t\t\tfor _, tag := range service.Tags {\n\t\t\t\tkv := strings.SplitN(tag, \"=\", 2)\n\n\t\t\t\tswitch kv[0] {\n\t\t\t\tcase MaxQPSTag:\n\t\t\t\t\tv, err := strconv.Atoi(kv[1])\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\ts.MaxQPS = v\n\t\t\t\t\t}\n\t\t\t\tcase HalfToOpenTag:\n\t\t\t\t\tv, err := strconv.Atoi(kv[1])\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\ts.HalfToOpen = v\n\t\t\t\t\t}\n\t\t\t\tcase HalfTrafficRateTag:\n\t\t\t\t\tv, err := strconv.Atoi(kv[1])\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\ts.HalfTrafficRate = v\n\t\t\t\t\t}\n\t\t\t\tcase CloseCountTag:\n\t\t\t\t\tv, err := strconv.Atoi(kv[1])\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\ts.CloseCount = v\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tservers[s.Addr] = s\n\t}\n\n\treturn servers, nil\n}", "func (lb *LoadBalancer) setServers(serverAddresses []string) bool {\n\tserverAddresses, hasOriginalServer := sortServers(serverAddresses, lb.originalServerAddress)\n\tif len(serverAddresses) == 0 {\n\t\treturn false\n\t}\n\n\tlb.mutex.Lock()\n\tdefer lb.mutex.Unlock()\n\n\tif reflect.DeepEqual(serverAddresses, lb.ServerAddresses) {\n\t\treturn false\n\t}\n\n\tlb.ServerAddresses = serverAddresses\n\tlb.randomServers = append([]string{}, lb.ServerAddresses...)\n\trand.Shuffle(len(lb.randomServers), func(i, j int) {\n\t\tlb.randomServers[i], lb.randomServers[j] = lb.randomServers[j], lb.randomServers[i]\n\t})\n\tif !hasOriginalServer {\n\t\tlb.randomServers = append(lb.randomServers, lb.originalServerAddress)\n\t}\n\tlb.currentServerAddress = lb.randomServers[0]\n\tlb.nextServerIndex = 1\n\n\treturn true\n}", "func (o BackendServiceFabricClusterPtrOutput) ServerX509Names() BackendServiceFabricClusterServerX509NameArrayOutput {\n\treturn o.ApplyT(func(v *BackendServiceFabricCluster) []BackendServiceFabricClusterServerX509Name {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ServerX509Names\n\t}).(BackendServiceFabricClusterServerX509NameArrayOutput)\n}", "func addrStructure(redisPort []string, redisHosts []string) []string {\n\thosts := []string{}\n\tif len(redisPort) != len(redisHosts) {\n\t\tport := \"6379\"\n\t\tif len(redisPort) == 0 {\n\t\t\tlogrus.Warnf(\"REDIS_PORT not exist, Use default port:%s\", port)\n\t\t} else {\n\t\t\tport = redisPort[0]\n\t\t\tlogrus.Warnf(\"REDIS_PORT len not equal REDIS_HOST len, Use first port:%s\", port)\n\t\t}\n\t\tfor _, host := range redisHosts {\n\t\t\thost := host + \":\" + port\n\t\t\thosts = append(hosts, host)\n\t\t}\n\t} else {\n\t\tfor index, host := range redisHosts {\n\t\t\thost := host + \":\" + redisPort[index]\n\t\t\thosts = append(hosts, host)\n\t\t}\n\t}\n\tif len(hosts) == 0 {\n\t\tlogrus.Warnf(\"REDIS_PORT hosts is empty\")\n\t}\n\treturn hosts\n}", "func (c *clbClient) Servers() Servers {\n\treturn c.servers\n}", "func Services() []string {\n\tret := make([]string, 0, len(servers))\n\tfor name := range servers {\n\t\tret = append(ret, name)\n\t}\n\tsort.Strings(ret)\n\treturn ret\n}", "func StartServer(servers []string, me int) *KVPaxos {\n // this call is all that's needed to persuade\n // Go's RPC library to marshall/unmarshall\n // struct Op.\n gob.Register(Op{})\n\n kv := new(KVPaxos)\n kv.me = me\n\n // Your initialization code here.\n kv.data = make(map[string]string)\n kv.pendingRead = make(map[int64]*PendingRead)\n kv.applied = -1\n\n rpcs := rpc.NewServer()\n rpcs.Register(kv)\n\n kv.px = paxos.Make(servers, me, rpcs)\n\n // start worker\n kv.StartBackgroundWorker()\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n kv.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for kv.dead == false {\n conn, err := kv.l.Accept()\n if err == nil && kv.dead == false {\n if kv.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if kv.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && kv.dead == false {\n fmt.Printf(\"KVPaxos(%v) accept: %v\\n\", me, err.Error())\n kv.kill()\n }\n }\n }()\n\n return kv\n}", "func (o BackendServiceFabricClusterOutput) ServerX509Names() BackendServiceFabricClusterServerX509NameArrayOutput {\n\treturn o.ApplyT(func(v BackendServiceFabricCluster) []BackendServiceFabricClusterServerX509Name {\n\t\treturn v.ServerX509Names\n\t}).(BackendServiceFabricClusterServerX509NameArrayOutput)\n}", "func (r *ReconcileRethinkDBCluster) listServers(cr *rethinkdbv1alpha1.RethinkDBCluster) ([]corev1.Pod, error) {\n\tfound := &corev1.PodList{}\n\tlabelSelector := labels.SelectorFromSet(labelsForCluster(cr))\n\tlistOps := &client.ListOptions{Namespace: cr.Namespace, LabelSelector: labelSelector}\n\terr := r.client.List(context.TODO(), listOps, found)\n\tif err != nil {\n\t\tlog.Error(err, \"failed to list server pods\")\n\t\treturn nil, err\n\t}\n\treturn found.Items, nil\n}", "func startMultipleServers(n int) ([]*url.URL, []*httptest.Server, error) {\n\n\tvar srvs []*httptest.Server\n\tvar urls []*url.URL\n\n\tfor i := 0; i < n; i++ {\n\t\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tfmt.Fprint(w, \"Hello from backend \", r.URL.Path[1:])\n\t\t}))\n\t\tsrvs = append(srvs, ts)\n\n\t\turl, err := url.Parse(ts.URL)\n\t\tif err != nil {\n\t\t\treturn nil, srvs, err\n\t\t}\n\t\turls = append(urls, url)\n\t}\n\n\treturn urls, srvs, nil\n}", "func StartServer(gid int64, shardmasters []string,\n servers []string, me int) *ShardKV {\n gob.Register(Op{})\n gob.Register(ServerState{})\n\n kv := new(ShardKV)\n kv.me = me\n kv.gid = gid\n kv.sm = shardmaster.MakeClerk(shardmasters)\n\n // Your initialization code here.\n // Don't call Join().\n kv.localLog = make(map[int]Op)\n kv.Counter = 1\n kv.horizon = 0\n kv.configNum = -1\n kv.max = 0\n // setup cell storage\n id := int(rand.Int31n(1000000)) // TODO: change to be recoverable?\n kv.storage = MakeStorage(id, 1000000000, \"127.0.0.1:27017\")\n kv.storage.Clear()\n\n\n kv.current = ServerState{make(map[int]map[string]string), make(map[string]ClientReply)}\n kv.results = make(map[string]ClientReply)\n kv.configs = make(map[int]shardmaster.Config)\n kv.configs[-1] = shardmaster.Config{}\n\n rpcs := rpc.NewServer()\n rpcs.Register(kv)\n\n kv.px = paxos.Make(servers, me, rpcs)\n kv.uid = strconv.FormatInt(nrand(), 10)\n\n // Logging\n kv.logFilename = fmt.Sprintf(\"logs/paxos_log_%d_%d.log\", kv.me, kv.gid)\n var err error\n kv.logFile, err = os.OpenFile(kv.logFilename, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)\n if err != nil {\n log.Fatal(err)\n }\n kv.enc = gob.NewEncoder(kv.logFile)\n\n// go kv.logBackground()\n\n os.Remove(servers[me])\n l, e := net.Listen(Network, servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n kv.l = l\n\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for kv.dead == false {\n conn, err := kv.l.Accept()\n if err == nil && kv.dead == false {\n if kv.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if kv.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n DPrintf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && kv.dead == false {\n DPrintf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n kv.Kill()\n }\n }\n }()\n\n go func() {\n for kv.dead == false {\n kv.tick()\n time.Sleep(250 * time.Millisecond)\n }\n }()\n\n return kv\n}", "func (c *NetConv) Server(address string, ln net.Listener) []attribute.KeyValue {\n\tif ln == nil {\n\t\treturn c.Host(address)\n\t}\n\n\tlAddr := ln.Addr()\n\tif lAddr == nil {\n\t\treturn c.Host(address)\n\t}\n\n\thostName, hostPort := splitHostPort(address)\n\tsockHostAddr, sockHostPort := splitHostPort(lAddr.String())\n\tnetwork := lAddr.Network()\n\tsockFamily := family(network, sockHostAddr)\n\n\tn := nonZeroStr(hostName, network, sockHostAddr, sockFamily)\n\tn += positiveInt(hostPort, sockHostPort)\n\tattr := make([]attribute.KeyValue, 0, n)\n\tif hostName != \"\" {\n\t\tattr = append(attr, c.HostName(hostName))\n\t\tif hostPort > 0 {\n\t\t\t// Only if net.host.name is set should net.host.port be.\n\t\t\tattr = append(attr, c.HostPort(hostPort))\n\t\t}\n\t}\n\tif network != \"\" {\n\t\tattr = append(attr, c.Transport(network))\n\t}\n\tif sockFamily != \"\" {\n\t\tattr = append(attr, c.NetSockFamilyKey.String(sockFamily))\n\t}\n\tif sockHostAddr != \"\" {\n\t\tattr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr))\n\t\tif sockHostPort > 0 {\n\t\t\t// Only if net.sock.host.addr is set should net.sock.host.port be.\n\t\t\tattr = append(attr, c.NetSockHostPortKey.Int(sockHostPort))\n\t\t}\n\t}\n\treturn attr\n}", "func (d *InfoOutput) MiddlewareServers() []any {\n\tval := d.reply[\"middleware_servers\"]\n\n\treturn val.([]any)\n\n}", "func (sp *jsonServerPage) asApplicationServers() (servers []*ApplicationServer) {\n\tfor _, d := range sp.Data {\n\t\tservers = append(servers, d.Server.asApplicationServer())\n\t}\n\n\treturn servers\n}", "func (c *directClient) AllServers(ctx context.Context) (entries []*disc.Entry, err error) {\n\tc.mx.RLock()\n\tdefer c.mx.RUnlock()\n\tfor _, entry := range c.entries {\n\t\tif entry.Server != nil {\n\t\t\tentries = append(entries, entry)\n\t\t}\n\t}\n\treturn entries, nil\n}", "func createServersOfDomain(domainA DomainAPI, domain *model.Domain) {\n\n\tfor _, servers := range domainA.Endpoints {\n\t\taddress := servers.IPAddress\n\t\towner, country := domainA.WhoisServerAttributes(address)\n\t\tsslGrade := servers.Grade\n\t\ttemServer := model.Server{address, sslGrade, country, owner}\n\t\tdomain.Servers = append(domain.Servers, temServer)\n\t}\n}", "func startServer(socket string, port string, dbPath string, superUser []string) (error) {\n log.Println(\"conn type\", socket)\n log.Println(\"conn port\", port)\n log.Println(\"dbPath\", dbPath)\n\n for _,v := range superUser {\n log.Println(\"superUser: \", v)\n }\n\n listener, err := net.Listen(socket, port)\n if err != nil {\n log.Fatal(\"Listen error: \", err)\n }\n\n db, err := OpenDatabase(dbPath)\n if err != nil {\n log.Fatal(\"Db error:\", err)\n }\n\n defer db.Close()\n\n // Handle http verification requests\n http.HandleFunc(\"/\", HttpDatabaseHandler(db))\n\n rpcService := new(RpcService)\n rpcService.Db = db\n\n // Handle RPC users manage requests\n s := rpc.NewServer()\n s.RegisterCodec(gJson.NewCodec(), \"application/json\")\n s.RegisterService(rpcService, \"Users\")\n http.Handle(\"/rpc\", s)\n\n http.Serve(listener, nil)\n\n return nil\n}", "func (*IbaServer) T() *__tbl_iba_servers {\n\treturn &_tbl_iba_servers\n}", "func RegisterServiceEntryEachInterfaceIP(entry *ServiceEntry, ifaces []string, notIfaces []string) (servers []*Server, err error) {\n\t// entry := NewServiceEntry(instance, service, domain)\n\t// entry.Port = port\n\t// entry.Text = text\n\t// entry.HostName = host\n\n\tif entry.Instance == \"\" {\n\t\treturn nil, fmt.Errorf(\"Missing service instance name\")\n\t}\n\tif entry.Service == \"\" {\n\t\treturn nil, fmt.Errorf(\"Missing service name\")\n\t}\n\t// if entry.HostName == \"\" {\n\t// \treturn nil, fmt.Errorf(\"Missing host name\")\n\t// }\n\t// fmt.Printf(\"mdns Domain:[%s] %d\\n\", entry.Domain, len(entry.Domain))\n\tif entry.Domain == \"\" {\n\t\tentry.Domain = \"local\"\n\t}\n\tlogDebug(\"Domain:[%s] %d\\n\", entry.Domain, len(entry.Domain))\n\tif entry.Port == 0 {\n\t\treturn nil, fmt.Errorf(\"Missing port\")\n\t}\n\n\tif entry.HostName == \"\" {\n\t\tentry.HostName, err = os.Hostname()\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"Could not determine host\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tif !strings.HasSuffix(trimDot(entry.HostName), entry.Domain) {\n\t\tentry.HostName = fmt.Sprintf(\"%s.%s.\", trimDot(entry.HostName), trimDot(entry.Domain))\n\t}\n\n\t// for _, ip := range ips {\n\t// \tipAddr := net.ParseIP(ip)\n\t// \tif ipAddr == nil {\n\t// \t\treturn nil, fmt.Errorf(\"Failed to parse given IP: %v\", ip)\n\t// \t} else if ipv4 := ipAddr.To4(); ipv4 != nil {\n\t// \t\tentry.AddrIPv4 = append(entry.AddrIPv4, ipAddr)\n\t// \t} else if ipv6 := ipAddr.To16(); ipv6 != nil {\n\t// \t\tentry.AddrIPv6 = append(entry.AddrIPv6, ipAddr)\n\t// \t} else {\n\t// \t\treturn nil, fmt.Errorf(\"The IP is neither IPv4 nor IPv6: %#v\", ipAddr)\n\t// \t}\n\t// }\n\n\tvar _ifaces []net.Interface\n\n\tif len(ifaces) == 0 {\n\t\t_ifaces = listMulticastInterfaces()\n\t\tlogDebug(\"found multicast Interfaces \", _ifaces)\n\t} else {\n\t\tfor _, name := range ifaces {\n\t\t\tvar iface net.Interface\n\t\t\tactualiface, err2 := net.InterfaceByName(name)\n\t\t\tif err2 == nil {\n\t\t\t\tiface = *actualiface\n\t\t\t} else {\n\t\t\t\terr = fmt.Errorf(\"interface not found %s\", name)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t_ifaces = append(_ifaces, iface)\n\t\t}\n\t}\n\n\tfor _, name := range notIfaces {\n\tinnerIfLoop:\n\t\tfor i, ifs := range _ifaces {\n\t\t\tif ifs.Name == name {\n\t\t\t\t// this removes interface 'i' from the list\n\t\t\t\t// (bump the last interface off the list, and replace slot 'i'\n\t\t\t\t// then resize the slice, not have the - now duplicated - last slot)\n\t\t\t\t_ifaces[i] = _ifaces[len(_ifaces)-1]\n\t\t\t\t_ifaces[len(_ifaces)-1] = net.Interface{} // make sure GC cleanups all fields in Interface\n\t\t\t\t_ifaces = _ifaces[:len(_ifaces)-1]\n\t\t\t\tbreak innerIfLoop\n\t\t\t}\n\t\t}\n\t}\n\n\t//\tlogDebug(\"mdns orgin:%+v\\n\", entry)\n\t// loop through and publish each inteface / IP combination\n\tfor _, interf := range _ifaces {\n\t\t// get address(es) for each interface\n\t\taddrs, err2 := interf.Addrs()\n\t\tif err2 != nil {\n\t\t\terr = err2\n\t\t\treturn\n\t\t}\n\t\t// create a unique entry for each interface\n\t\tnewentry := dupServiceEntryNoIps(entry)\n\t\t//\t\tlogDebug(\"mdns duped entry: %+v\\n\", newentry)\n\t\tfor _, addr := range addrs {\n\t\t\tswitch ip := addr.(type) {\n\t\t\tcase *net.IPNet:\n\t\t\t\tif ip.IP.DefaultMask() != nil {\n\t\t\t\t\tif ipv4 := ip.IP.To4(); ipv4 != nil {\n\t\t\t\t\t\tnewentry.AddrIPv4 = append(newentry.AddrIPv4, ip.IP)\n\t\t\t\t\t} else if ipv6 := ip.IP.To16(); ipv6 != nil {\n\t\t\t\t\t\tnewentry.AddrIPv6 = append(newentry.AddrIPv6, ip.IP)\n\t\t\t\t\t}\n\t\t\t\t\t// else {\n\t\t\t\t\t// \treturn nil, fmt.Errorf(\"The IP is neither IPv4 nor IPv6: %#v\", ip.IP)\n\t\t\t\t\t// }\n\t\t\t\t\t//\t\t\t\t\tnewentry.AddrIPv4\n\t\t\t\t\t//\t\t\t\t\treturn nil, (ip.IP)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlogDebug(\"Serving out interface \", interf.Name)\n\t\tserver, err2 := newServer([]net.Interface{interf})\n\t\tif err2 == nil {\n\t\t\tservers = append(servers, server)\n\t\t} else {\n\t\t\terr = err2\n\t\t\treturn\n\t\t}\n\t}\n\n\tfor _, server := range servers {\n\t\tserver.service = entry\n\t\tgo server.mainloop()\n\t\tgo server.probe()\n\t}\n\n\t// s, err := newServer(_ifaces)\n\t// if err != nil {\n\t// \treturn nil, err\n\t// }\n\n\t// s.service = entry\n\t// go s.mainloop()\n\t// go s.probe()\n\n\treturn\n\n}", "func Server(srv ...transport.Server) Option {\n\treturn func(o *options) { o.servers = srv }\n}", "func Server(srv ...transport.Server) Option {\n\treturn func(o *options) { o.servers = srv }\n}", "func getNameservers(resolvConf []byte) []string {\n\tnameservers := []string{}\n\tfor _, line := range getLines(resolvConf) {\n\t\tns := nsRegexp.FindSubmatch(line)\n\t\tif len(ns) > 0 {\n\t\t\tnameservers = append(nameservers, string(ns[1]))\n\t\t}\n\t}\n\treturn nameservers\n}", "func (w *WSUS) order(servers []string) {\n\n\ts := make(map[int]string, len(servers))\n\tfor _, n := range servers {\n\t\tt := responseTime(n)\n\t\tif t == 0 {\n\t\t\twlog.Warning(2, fmt.Sprintf(\"Skipping WSUS server %s as it appears to be unreachable\", n))\n\t\t\tcontinue\n\t\t}\n\t\ts[int(t)] = n\n\t}\n\tk := sortedKeys(s)\n\n\tfor _, key := range k {\n\t\tw.Servers = append(w.Servers, s[key])\n\t}\n}", "func (service *ServerService) EqualServers(s1, s2 models.ServerModel) bool {\n\treturn s1.SslGrade == s2.SslGrade && s1.Owner == s2.Owner && s1.Country == s2.Country && s1.IPAddress == s2.IPAddress\n}", "func (h *Handler) serveServers(w http.ResponseWriter, r *http.Request) {}", "func Server(address string, ln net.Listener) []attribute.KeyValue {\n\treturn nc.Server(address, ln)\n}", "func (o RegisteredDomainOutput) NameServers() RegisteredDomainNameServerArrayOutput {\n\treturn o.ApplyT(func(v *RegisteredDomain) RegisteredDomainNameServerArrayOutput { return v.NameServers }).(RegisteredDomainNameServerArrayOutput)\n}", "func StartServer(gid int64, shardmasters []string,\n\tservers []string, me int) *ShardKV {\n\tgob.Register(Op{})\n\n\tkv := new(ShardKV)\n\tkv.me = me\n\tkv.gid = gid\n\tkv.sm = shardmaster.MakeClerk(shardmasters)\n\n\t// Your initialization code here.\n\t// Don't call Join().\n\tkv.config = kv.sm.Query(-1)\n\tkv.keyValue = make(map[string]string)\n\tkv.seq = 0\n\tkv.name = servers[me]\n\tkv.records = make(map[int64]*Record)\n\n\tDPrintf(\"%s come up, config=%v\",kv.name,kv.config)\n\n\trpcs := rpc.NewServer()\n\trpcs.Register(kv)\n\n\tkv.px = paxos.Make(servers, me, rpcs)\n\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tkv.l = l\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tconn, err := kv.l.Accept()\n\t\t\tif err == nil && kv.isdead() == false {\n\t\t\t\tif kv.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if kv.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && kv.isdead() == false {\n\t\t\t\tfmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tkv.kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tkv.tick()\n\t\t\ttime.Sleep(250 * time.Millisecond)\n\t\t}\n\t}()\n\n\treturn kv\n}", "func StartServer(gid int64, shardmasters []string,\n servers []string, me int) *ShardKV {\n gob.Register(Op{})\n\tgob.Register(CachedReply{})\n\tgob.Register(ShardData{})\n\n kv := new(ShardKV)\n kv.me = me\n kv.gid = gid\n kv.sm = shardmaster.MakeClerk(shardmasters)\n\n // Your initialization code here.\n // Don't call Join().\n\tkv.log = make(map[int]Op)\n\tkv.highestDone = -1\n\n\tkv.currentConfig = shardmaster.Config{}\n\tkv.currentConfig.Groups = map[int64][]string{}\n\tkv.currentConfig.Num = -1\n\tkv.changing = false\n\n\tkv.shardData = make(map[int]*ShardData)\n\tfor i := 0; i < shardmaster.NShards; i++ {\n\t\tnewShardData := &ShardData{}\n\t\tnewShardData.Data = make(map[string]string)\n\t\tnewShardData.CachedReplies = make(map[string]map[string]CachedReply)\n\t\tnewShardData.StoredReplies = make(map[string]map[uint64]CachedReply)\n\t\tnewShardData.HighestReqIdLogged = make(map[string]uint64)\n\t\tkv.shardData[i] = newShardData\n\t}\n\n\n rpcs := rpc.NewServer()\n rpcs.Register(kv)\n\n kv.px = paxos.Make(servers, me, rpcs)\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n kv.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for kv.dead == false {\n conn, err := kv.l.Accept()\n if err == nil && kv.dead == false {\n if kv.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if kv.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && kv.dead == false {\n fmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n kv.kill()\n }\n }\n }()\n\n go func() {\n for kv.dead == false {\n kv.tick()\n time.Sleep(250 * time.Millisecond)\n }\n }()\n\n return kv\n}", "func StartServer(gid int64, shardmasters []string,\n servers []string, me int) *ShardKV {\n gob.Register(Op{})\n gob.Register(PutReply{})\n gob.Register(GetReply{})\n\n kv := new(ShardKV)\n kv.me = me\n kv.gid = gid\n kv.sm = shardmaster.MakeClerk(shardmasters)\n\n // Your initialization code here.\n // Don't call Join().\n for k := 0; k < shardmaster.NShards; k++ {\n\t\tkv.database[k] = make(map[string]string)\n\t\tkv.handled_replies[k] = make(map[string]interface{})\n kv.serve[k] = false\n\t}\n kv.cur_config = shardmaster.Config{}\n kv.next_config = shardmaster.Config{}\n kv.receive_replies = make(map[string]ReceiveReply)\n kv.config_started = make(map[int]bool)\n kv.top = 0\n\n\n rpcs := rpc.NewServer()\n rpcs.Register(kv)\n\n kv.px = paxos.Make(servers, me, rpcs)\n\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n kv.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for kv.dead == false {\n conn, err := kv.l.Accept()\n if err == nil && kv.dead == false {\n if kv.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if kv.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && kv.dead == false {\n fmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n kv.kill()\n }\n }\n }()\n\n go func() {\n for kv.dead == false {\n kv.tick()\n time.Sleep(250 * time.Millisecond)\n }\n }()\n\n return kv\n}", "func (p *Proxy) SortServers() {\n\tsort.Slice(p.Servers, func(i, j int) bool {\n\t\treturn p.Servers[i].SortKey() < p.Servers[j].SortKey()\n\t})\n}", "func (s *ServerT) Hosts() ([]string, error) {\n\tvar hosts = []string{s.Config.HTTPHost}\n\n\tif s.Config.HTTPHost != \"localhost\" {\n\t\thosts = append(hosts, \"localhost\")\n\t}\n\n\taddresses, _ := net.InterfaceAddrs()\n\tfor _, address := range addresses {\n\t\tif ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\n\t\t\thost := ipnet.IP.To4()\n\t\t\tif host != nil {\n\t\t\t\thosts = append(hosts, host.String())\n\t\t\t}\n\t\t}\n\t}\n\n\treturn hosts, nil\n}", "func startServers(t *testing.T) [N]*os.Process {\n\tkvsd, err := exec.LookPath(\"kvsd\")\n\tfmt.Println(\"kvsd:\" + kvsd)\n\tif err != nil {\n\t\tt.Fatal(\"kvsd not in $PATH; kvsd needs to be installed before running this test\")\n\t}\n\targv := []string{\n\t\t\"-id\",\n\t\t\"1\",\n\t\t\"-v=3\",\n\t\t\"-log_dir=\" + KVS + \"kvsd/log/\",\n\t\t\"-all-cores\",\n\t\t\"-config-file\",\n\t\tcfg,\n\t}\n\tvar proc [N]*os.Process\n\n\t// start N servers\n\tfor i := 0; i < N; i++ {\n\t\targv[1] = strconv.Itoa(i)\n\t\tcmd := exec.Command(kvsd, argv...)\n\t\t//cmd.Dir = os.Getenv(\"GOPATH\") + \"src\\\\github.com\\\\relab\\\\goxos\\\\kvs\\\\kvsd\"\n\t\terr := cmd.Start()\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Failed to start kvsd:\", err)\n\t\t}\n\t\tproc[i] = cmd.Process\n\t}\n\treturn proc\n}", "func GetNameservers(resolvConf []byte, kind int) []string {\n\tvar nameservers []string\n\tfor _, line := range getLines(resolvConf, []byte(\"#\")) {\n\t\tvar ns [][]byte\n\t\tif kind == IP {\n\t\t\tns = nsRegexp.FindSubmatch(line)\n\t\t} else if kind == IPv4 {\n\t\t\tns = nsIPv4Regexpmatch.FindSubmatch(line)\n\t\t} else if kind == IPv6 {\n\t\t\tns = nsIPv6Regexpmatch.FindSubmatch(line)\n\t\t}\n\t\tif len(ns) > 0 {\n\t\t\tnameservers = append(nameservers, string(ns[1]))\n\t\t}\n\t}\n\treturn nameservers\n}", "func (c *Client) CheckMetaServers() error {\n\tresp, err := c.get(\"\")\n\tbuf, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t}\n\tres := make([]string, 0)\n\tif err := json.Unmarshal(buf, res); err != nil {\n\t\treturn err\n\t}\n\n\tfor i, meta := range c.MetaServers() {\n\t\tif res[i] == meta {\n\t\t\treturn ErrService\n\t\t}\n\t}\n\n\treturn nil\n}", "func ExampleServers() {\n\ttr := make(TempServers, 2)\n\tfmt.Println(\"Created\", len(tr), \"temp redis servers\")\n\tfmt.Println(\"TempServers are nil?\", tr[0] == nil)\n\ttr.Start()\n\tfmt.Println(\"Started servers\")\n\tfmt.Println(\"TempServers are nil?\", tr[0] == nil)\n\n\tpools := tr.Pools(2)\n\tfmt.Println(\"Created a slice of\", len(pools), \"[]*redis.Pool, each to a different server\")\n\ttr.Stop()\n\tfmt.Println(\"TempServers terminated\")\n\t// Output:\n\t// Created 2 temp redis servers\n\t// TempServers are nil? true\n\t// Started servers\n\t// TempServers are nil? false\n\t// Created a slice of 2 []*redis.Pool, each to a different server\n\t// TempServers terminated\n}", "func (a *Agent) SetServers(urls [][]URL) {\n\ta.Servers = urls\n}", "func (o GroupDnsConfigOutput) Nameservers() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GroupDnsConfig) []string { return v.Nameservers }).(pulumi.StringArrayOutput)\n}", "func (sd *steamDirectory) SetServers(servers []string) {\n\tsd.Lock()\n\tdefer sd.Unlock()\n\n\tsd.servers = servers\n}", "func (c *Client) MetaServers() []string {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\treturn c.metaServers\n}", "func (ts TempServers) Start() {\n\tfor i := 0; i < len(ts); i++ {\n\t\tserver, err := tempredis.Start(tempredis.Config{})\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tts[i] = server\n\t}\n}", "func GetServers() ServersResponse {\n\tvar servers ServersResponse\n\tresponse := network.Get(\"admin/servers\")\n\tjson.Unmarshal(response, &servers)\n\n\treturn servers\n}", "func (s *LifecyclerRPCServer) Ports(opts HostOpts, resp *[]string) (err error) {\n\t*resp, err = s.Plugin.Ports(opts.Version, opts.FlagValues)\n\treturn err\n}", "func SrvEntries(addrs *pb.EndPoints, namedPort string) (srvs []*net.SRV, err error) {\n\tsrvs = make([]*net.SRV, 0, len(addrs.Entries))\n\tvar srvErr error\n\tfor _, entry := range addrs.Entries {\n\t\thost := entry.Host\n\t\tport := 0\n\t\tif namedPort == \"\" {\n\t\t\tnamedPort = DefaultPortName\n\t\t}\n\t\tport = int(entry.PortMap[namedPort])\n\t\tif port == 0 {\n\t\t\tlog.Warningf(\"vtns: bad port %v %v\", namedPort, entry)\n\t\t\tcontinue\n\t\t}\n\t\tsrvs = append(srvs, &net.SRV{Target: host, Port: uint16(port)})\n\t}\n\tnetutil.SortRfc2782(srvs)\n\tif srvErr != nil && len(srvs) == 0 {\n\t\treturn nil, fmt.Errorf(\"SrvEntries failed: no valid endpoints found\")\n\t}\n\treturn\n}", "func (h *JBoss4) getServersOnHost(\n\tacc Accumulator,\n\tserverURL string,\n\thosts []string,\n) error {\n\tvar wg sync.WaitGroup\n\n\terrorChannel := make(chan error, len(hosts))\n\n\tfor _, host := range hosts {\n\t\twg.Add(1)\n\t\tgo func(host string) {\n\t\t\tdefer wg.Done()\n\t\t\tlog.Printf(\"I! Get Servers from host: %s\\n\", host)\n\n\t\t\tservers := HostResponse{Outcome: \"\", Result: []string{\"standalone\"}}\n\n\t\t\tfor _, server := range servers.Result {\n\t\t\t\tlog.Printf(\"I! JBoss4 Plugin Processing Servers from host:[ %s ] : Server [ %s ]\\n\", host, server)\n\t\t\t\tfor _, v := range h.Metrics {\n\t\t\t\t\tswitch v {\n\t\t\t\t\tcase \"jvm\":\n\t\t\t\t\t\th.getJVMStatistics(acc, serverURL, host, server)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tlog.Printf(\"E! Jboss doesn't exist the metric set %s\\n\", v)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}(host)\n\t}\n\n\twg.Wait()\n\tclose(errorChannel)\n\n\t// Get all errors and return them as one giant error\n\terrorStrings := []string{}\n\tfor err := range errorChannel {\n\t\terrorStrings = append(errorStrings, err.Error())\n\t}\n\n\tif len(errorStrings) == 0 {\n\t\treturn nil\n\t}\n\treturn errors.New(strings.Join(errorStrings, \"\\n\"))\n}", "func (manager *Manager) ServerData(c net.Conn, buf []byte) {\n\tfor _, connectionManager := range manager.ConnectionManagers {\n\t\tconnectionManager.ServerData(c, buf)\n\t}\n}", "func (dsmap DomainWhoisServerMap) GetWhoisServer(ps string) []WhoisServer {\n\tvar wss []WhoisServer\n\tlvl := strings.Split(ps, \".\")\n\tfor i := 1; i <= len(lvl); i++ {\n\t\ttlds := strings.SplitN(ps, \".\", i)\n\t\tif ws, ok := dsmap[tlds[len(tlds)-1]]; ok {\n\t\t\treturn ws\n\t\t}\n\t}\n\treturn wss\n}", "func (api Solarwinds) ListServers(siteid int) ([]Server, error) {\n\tbody := struct {\n\t\tItems []Server `xml:\"items>server\"`\n\t}{}\n\n\terr := api.get(url.Values{\n\t\t\"service\": []string{\"list_servers\"},\n\t\t\"siteid\": []string{strconv.Itoa(siteid)},\n\t}, &body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn body.Items, nil\n}", "func parseSlaveInfo(s map[string]string, pwd string) ([]*NodeInfo, error) {\n\t/*\n\t\tmap[string]string{\"slave0\":\"10.1.1.228:7004\"}\n\t*/\n\tres := make([]*NodeInfo, 0)\n\tfor _, v := range s {\n\t\tallInfoMap, err := probeNode(v, pwd)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselectionServerMap, exist := allInfoMap[Server]\n\t\tif !exist {\n\t\t\treturn nil, errors.New(\"probe info error\")\n\t\t}\n\t\tversion, exist := selectionServerMap[\"redis_version\"]\n\t\tif !exist {\n\t\t\treturn nil, errors.New(\"selection Server.redis_version not exist\")\n\t\t}\n\n\t\trunid, exist := selectionServerMap[\"run_id\"]\n\t\tif !exist {\n\t\t\treturn nil, errors.New(\"selection Server.run_id not exist\")\n\t\t}\n\n\t\tres = append(res, &NodeInfo{\n\t\t\tVer: version, Id: runid, Addr: v,\n\t\t})\n\t}\n\treturn res, nil\n}", "func (service *ServerService) EqualSetOfServers(set1, set2 []models.ServerModel) bool {\n\tif len(set1) != len(set2) {\n\t\treturn false\n\t}\n\tminnorServer := func(s1, s2 models.ServerModel) bool {\n\t\treturn s1.IPAddress < s2.IPAddress\n\t}\n\tsort.Slice(set1, func(i, j int) bool { return minnorServer(set1[i], set1[j]) })\n\tsort.Slice(set2, func(i, j int) bool { return minnorServer(set2[i], set2[j]) })\n\tfor i := 0; i < len(set1); i++ {\n\t\tif !service.EqualServers(set1[i], set2[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (c *ApplicationCredentials) GetServers() (svs []*ApplicationServer, err error) {\n\tbytes, err := c.query(\"servers?include=allocations\", \"GET\", nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Get the initial page\n\tvar page jsonServerPage\n\terr = json.Unmarshal(bytes, &page)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Search for the remaining pages if present\n\tpages, err := page.getAll(c.Token)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, page := range pages {\n\t\tsvs = append(svs, page.asApplicationServers()...)\n\t}\n\n\treturn\n}", "func StartServer(gid int64, shardmasters []string,\n\tservers []string, me int) *ShardKV {\n\tgob.Register(Op{})\n\n\tkv := new(ShardKV)\n\tkv.me = me\n\tkv.gid = gid\n\tkv.sm = shardmaster.MakeClerk(shardmasters)\n\n\t// Your initialization code here.\n\t// Don't call Join().\n\tkv.keyValue = make(map[string]string)\n\tkv.seqHistory = make(map[string]int)\n\tkv.replyHistory = make(map[string]CommonReply)\n\n\trpcs := rpc.NewServer()\n\trpcs.Register(kv)\n\n\tkv.px = paxos.Make(servers, me, rpcs)\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tkv.l = l\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tconn, err := kv.l.Accept()\n\t\t\tif err == nil && kv.isdead() == false {\n\t\t\t\tif kv.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if kv.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && kv.isdead() == false {\n\t\t\t\tfmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tkv.kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tkv.tick()\n\t\t\ttime.Sleep(250 * time.Millisecond)\n\t\t}\n\t}()\n\n\treturn kv\n}", "func StartServer(gid int64, shardmasters []string,\n\tservers []string, me int) *ShardKV {\n\tgob.Register(Op{})\n\tkv := new(ShardKV)\n\tkv.me = me\n\tkv.gid = gid\n\tkv.sm = shardmaster.MakeClerk(shardmasters)\n\n\t// Your initialization code here.\n\t// Don't call Join().\n\tkv.config = shardmaster.Config{Num: -1}\n\tkv.datastore = make(map[string]string)\n\tkv.logs = make(map[string]string)\n\tkv.seq = 0\n\n\trpcs := rpc.NewServer()\n\trpcs.Register(kv)\n\n\tkv.px = paxos.Make(servers, me, rpcs)\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tkv.l = l\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tconn, err := kv.l.Accept()\n\t\t\tif err == nil && kv.isdead() == false {\n\t\t\t\tif kv.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if kv.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && kv.isdead() == false {\n\t\t\t\tfmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tkv.kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tkv.tick()\n\t\t\ttime.Sleep(250 * time.Millisecond)\n\t\t}\n\t}()\n\n\treturn kv\n}", "func (c *directClient) AvailableServers(ctx context.Context) (entries []*disc.Entry, err error) {\n\tc.mx.RLock()\n\tdefer c.mx.RUnlock()\n\tfor _, entry := range c.entries {\n\t\tif entry.Server != nil {\n\t\t\tentries = append(entries, entry)\n\t\t}\n\t}\n\treturn entries, nil\n}", "func (srv *Server) setServicesHealth() {\n\n\tfor service := range srv.gRPC.GetServiceInfo() {\n\t\tsrv.health.SetServingStatus(service, healthpb.HealthCheckResponse_SERVING)\n\t\t// TODO: use debug log\n\t\t//log.Printf(\"Service health info %s is serving\\n\", service)\n\t}\n\n\tsrv.startHealthMonitor()\n\tlog.Printf(\"%s server health monitor started\", srv.name)\n}", "func Checkserver(request *restful.Request, response *restful.Response) {\n\tportstring := request.PathParameter(\"port-id\")\n\tglog.Info(\"get the port number\", portstring)\n\tportint, err := strconv.Atoi(portstring)\n\tif err != nil {\n\t\tresponse.WriteError(500, err)\n\t\treturn\n\t}\n\tstatmap := make(map[string]string)\n\tstatmap[\"ifserver\"] = \"false\"\n\tstatmap[\"psummary\"] = \"null\"\n\terr = lib.Getinfofromportbylsof(portint)\n\tif err != nil {\n\t\tglog.Info(err)\n\t\tjstr, _ := json.Marshal(statmap)\n\t\tresponse.Write(jstr)\n\t\treturn\n\t} else {\n\t\t//get the process info\n\t\tstatmap[\"ifserver\"] = \"true\"\n\t\tprocessinfo, _ := Getprocessinfo(portint)\n\t\tstatmap[\"psummary\"] = processinfo\n\t\tjstr, _ := json.Marshal(statmap)\n\t\tresponse.Write(jstr)\n\t\treturn\n\t}\n}", "func CheckServers(servers Servers) {\n\treadyChannel, notReadyChannel := make(ServerCh), make(ServerCh)\n\n\tdefer close(readyChannel)\n\tdefer close(notReadyChannel)\n\n\tstart := time.Now()\n\n\tfor _, server := range servers {\n\t\tgo check(server, readyChannel, notReadyChannel)\n\t}\n\n\tfor i := 0; i < len(servers); {\n\t\tselect {\n\t\tcase server := <-readyChannel:\n\t\t\tlog.Printf(\"%s server ready. It takes %.2f seconds to start\", server.Name, time.Until(start).Seconds())\n\t\t\ti++\n\t\tcase server := <-notReadyChannel:\n\t\t\tgo check(server, readyChannel, notReadyChannel)\n\t\t}\n\t}\n\n\tlog.Println(\"Server checks finished\")\n}", "func (p *Plex) GetServers() ([]pmsDevices, error) {\n\trequestInfo.headers.Token = p.token\n\n\tquery := plexURL + \"/pms/resources.xml?includeHttps=1\"\n\n\tresp, respErr := requestInfo.get(query)\n\n\tif respErr != nil {\n\t\treturn []pmsDevices{}, respErr\n\t}\n\n\tdefer resp.Body.Close()\n\n\tresult := new(resourcesResponse)\n\n\tif err := xml.NewDecoder(resp.Body).Decode(result); err != nil {\n\t\tfmt.Println(err.Error())\n\n\t\treturn []pmsDevices{}, err\n\t}\n\n\tvar servers []pmsDevices\n\n\tfor _, r := range result.Device {\n\t\tif r.Provides != \"server\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tservers = append(servers, r)\n\t}\n\n\treturn servers, nil\n}", "func Make(peers []string, me int, rpcs *rpc.Server) *Paxos {\n px := &Paxos{}\n px.peers = peers\n px.me = me\n px.Instances = make(map[int]Instance)\n px.done = make(map[int]int)\n px.maxSeq = -1\n \n // instantiate all done[i] at -1\n for i, _ := range px.peers {\n px.done[i] = -1\n }\n\n if rpcs != nil {\n // caller will create socket &c\n rpcs.Register(px)\n } else {\n rpcs = rpc.NewServer()\n rpcs.Register(px)\n\n // prepare to receive connections from clients.\n // change \"unix\" to \"tcp\" to use over a network.\n os.Remove(peers[me]) // only needed for \"unix\"\n l, e := net.Listen(\"unix\", peers[me])\n if e != nil {\n log.Fatal(\"listen error: \", e)\n }\n px.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n // create a thread to accept RPC connections\n go func() {\n for px.isdead() == false {\n conn, err := px.l.Accept()\n if err == nil && px.isdead() == false {\n if px.isunreliable() && (rand.Int63()%1000) < 100 {\n // discard the request.\n conn.Close()\n } else if px.isunreliable() && (rand.Int63()%1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n atomic.AddInt32(&px.rpcCount, 1)\n go rpcs.ServeConn(conn)\n } else {\n atomic.AddInt32(&px.rpcCount, 1)\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && px.isdead() == false {\n fmt.Printf(\"Paxos(%v) accept: %v\\n\", me, err.Error())\n }\n }\n }()\n }\n\n return px\n}", "func (t *Twemproxy) processServer(\n\tacc telegraf.Accumulator,\n\ttags map[string]string,\n\tdata map[string]interface{},\n) {\n\tfields := make(map[string]interface{})\n\tfor key, value := range data {\n\t\tif val, ok := value.(float64); ok {\n\t\t\tfields[key] = val\n\t\t}\n\t}\n\tacc.AddFields(\"twemproxy_pool_server\", fields, tags)\n}", "func StartServer(servers []string, me int) *ShardMaster {\n gob.Register(Op{})\n\n sm := new(ShardMaster)\n sm.me = me\n\n sm.configs = make([]Config, 1)\n\n for i := 0; i < NShards; i++ {\n\tsm.configs[0].Shards[i] = EMPTY_NUMBER \n }\n sm.configs[0].Groups = map[int64][]string{}\n\n rpcs := rpc.NewServer()\n rpcs.Register(sm)\n\n sm.px = paxos.Make(servers, me, rpcs)\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n sm.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for sm.dead == false {\n conn, err := sm.l.Accept()\n if err == nil && sm.dead == false {\n if sm.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if sm.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && sm.dead == false {\n fmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n sm.Kill()\n }\n }\n }()\n\n return sm\n}", "func Make(peers []string, me int, rpcs *rpc.Server) *Paxos {\n px := &Paxos{}\n px.peers = peers\n px.me = me\n\n // Your initialization code here.\n px.instances = make(map[int]*Instance)\n px.doneMap = make([]int, len(px.peers))\n for i := 0; i < len(px.doneMap); i++ {\n px.doneMap[i] = -1\n }\n px.maxSeq = -1\n\n if rpcs != nil {\n // caller will create socket &c\n rpcs.Register(px)\n } else {\n rpcs = rpc.NewServer()\n rpcs.Register(px)\n\n // prepare to receive connections from clients.\n // change \"unix\" to \"tcp\" to use over a network.\n os.Remove(peers[me]) // only needed for \"unix\"\n l, e := net.Listen(\"unix\", peers[me])\n if e != nil {\n log.Fatal(\"listen error: \", e)\n }\n px.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n // create a thread to accept RPC connections\n go func() {\n for px.dead == false {\n conn, err := px.l.Accept()\n if err == nil && px.dead == false {\n if px.unreliable && (rand.Int63()%1000) < 100 {\n // discard the request.\n conn.Close()\n } else if px.unreliable && (rand.Int63()%1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n px.rpcCount++\n go rpcs.ServeConn(conn)\n } else {\n px.rpcCount++\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && px.dead == false {\n fmt.Printf(\"Paxos(%v) accept: %v\\n\", me, err.Error())\n }\n }\n }()\n }\n\n return px\n}", "func showServers(client *clcv2.CLIClient, servnames []string) {\n\ttype asyncServerResult struct {\n\t\tserver clcv2.Server\n\t\tgroup clcv2.Group\n\t}\n\n\tvar (\n\t\twg sync.WaitGroup\n\t\tresChan = make(chan asyncServerResult)\n\t\tresults []asyncServerResult\n\t)\n\n\tfor _, servname := range servnames {\n\t\tservname := servname\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tserver, err := client.GetServer(servname)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"Failed to list details of server %q: %s\\n\", servname, err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tgrp, err := client.GetGroup(server.GroupId)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"Failed to resolve %s group UUID: %s\\n\", servname, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresChan <- asyncServerResult{\n\t\t\t\tserver: server,\n\t\t\t\tgroup: *grp,\n\t\t\t}\n\t\t}()\n\t}\n\t// Waiter needs to run in the background, to close generator\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(resChan)\n\t}()\n\n\tfor res := range resChan {\n\t\tresults = append(results, res)\n\t}\n\n\tif len(results) > 0 {\n\t\tvar table = tablewriter.NewWriter(os.Stdout)\n\t\t// Sort in ascending order of last-modified date.\n\n\t\tsort.Slice(results, func(i, j int) bool {\n\t\t\treturn results[i].server.ChangeInfo.ModifiedDate.Before(results[j].server.ChangeInfo.ModifiedDate)\n\t\t})\n\n\t\ttable.SetAutoFormatHeaders(false)\n\t\ttable.SetAlignment(tablewriter.ALIGN_LEFT)\n\t\ttable.SetAutoWrapText(true)\n\n\t\ttable.SetHeader([]string{\n\t\t\t\"Name\", \"Group\", \"Description\", \"OS\",\n\t\t\t\"IP\", \"CPU\", \"Mem\", \"Storage\",\n\t\t\t\"Status\", \"Last Change\",\n\t\t})\n\n\t\tfor _, res := range results {\n\t\t\tIPs := []string{}\n\t\t\tfor _, ip := range res.server.Details.IpAddresses {\n\t\t\t\tif ip.Public != \"\" {\n\t\t\t\t\tIPs = append(IPs, ip.Public)\n\t\t\t\t}\n\t\t\t\tif ip.Internal != \"\" {\n\t\t\t\t\tIPs = append(IPs, ip.Internal)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tstatus := res.server.Details.PowerState\n\t\t\tif res.server.Details.InMaintenanceMode {\n\t\t\t\tstatus = \"MAINTENANCE\"\n\t\t\t} else if res.server.Status != \"active\" {\n\t\t\t\tstatus = res.server.Status\n\t\t\t}\n\n\t\t\tdesc := res.server.Description\n\t\t\tif res.server.IsTemplate {\n\t\t\t\tdesc = \"TPL: \" + desc\n\t\t\t}\n\n\t\t\tmodifiedStr := humanize.Time(res.server.ChangeInfo.ModifiedDate)\n\t\t\t// The ModifiedBy field can be an email address, or an API Key (hex string) //\n\t\t\tif _, err := hex.DecodeString(res.server.ChangeInfo.ModifiedBy); err == nil {\n\t\t\t\tmodifiedStr += \" via API Key\"\n\t\t\t} else {\n\t\t\t\tmodifiedStr += \" by \" + truncate(res.server.ChangeInfo.ModifiedBy, 6)\n\t\t\t}\n\n\t\t\t// Append a tilde (~) to indicate it has snapshots\n\t\t\tserverName := res.server.Name\n\t\t\tif len(res.server.Details.Snapshots) > 0 {\n\t\t\t\tserverName += \" ~\"\n\t\t\t}\n\n\t\t\ttable.Append([]string{\n\t\t\t\tserverName, res.group.Name, truncate(desc, 30), truncate(res.server.OsType, 15),\n\t\t\t\tstrings.Join(IPs, \" \"),\n\t\t\t\tfmt.Sprint(res.server.Details.Cpu), fmt.Sprintf(\"%d G\", res.server.Details.MemoryMb/1024),\n\t\t\t\tfmt.Sprintf(\"%d G\", res.server.Details.StorageGb),\n\t\t\t\tstatus, modifiedStr,\n\t\t\t})\n\t\t}\n\n\t\ttable.Render()\n\t}\n}", "func (c *Controller) ServerPods(w http.ResponseWriter, r *http.Request) {\n\tServe(w, r, c.AdmitPods)\n}", "func parseNameServer() ([]net.IP, error) {\n\tfile, err := os.Open(\"/etc/resolv.conf\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error opening /etc/resolv.conf: %v\", err)\n\t}\n\tdefer file.Close()\n\n\tscan := bufio.NewScanner(file)\n\tscan.Split(bufio.ScanLines)\n\n\tip := make([]net.IP, 0)\n\n\tfor scan.Scan() {\n\t\tserverString := scan.Text()\n\t\tif strings.Contains(serverString, \"nameserver\") {\n\t\t\ttmpString := strings.Replace(serverString, \"nameserver\", \"\", 1)\n\t\t\tnameserver := strings.TrimSpace(tmpString)\n\t\t\tsip := net.ParseIP(nameserver)\n\t\t\tif sip != nil && !sip.Equal(config.Config.ListenIP) {\n\t\t\t\tip = append(ip, sip)\n\t\t\t}\n\t\t}\n\t}\n\tif len(ip) == 0 {\n\t\treturn nil, fmt.Errorf(\"there is no nameserver in /etc/resolv.conf\")\n\t}\n\treturn ip, nil\n}", "func CreateServers(ctx context.Context, n int) ([]int, error) {\n\tvar ports []int\n\n\tlocalCtx, cancel := context.WithCancel(ctx)\n\tfor i := 0; i < n; i++ {\n\t\tport, err := ListenHTTP(localCtx)\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t\treturn nil, err\n\t\t}\n\n\t\tports = append(ports, port)\n\t}\n\n\treturn ports, nil\n}", "func (c *Config) Server(name string) *Config {\n\tif len(name) != 0 {\n\t\tif _, ok := c.Servers[name]; !ok {\n\t\t\tc.context = &Server{parent: c, Name: name, Host: name}\n\t\t\tc.Servers[name] = c.context\n\t\t} else {\n\t\t\tc.addError(errMsgDuplicateServer)\n\t\t}\n\t} else {\n\t\tc.addError(fmtErrMissing, \"<NONE>\", errHost)\n\t}\n\treturn c\n}", "func getMemberClusterApiServerUrls(kubeconfig *clientcmdapi.Config, clusterNames []string) ([]string, error) {\n\tvar urls []string\n\tfor _, name := range clusterNames {\n\t\tif cluster := kubeconfig.Clusters[name]; cluster != nil {\n\t\t\turls = append(urls, cluster.Server)\n\t\t} else {\n\t\t\treturn nil, xerrors.Errorf(\"cluster '%s' not found in kubeconfig\", name)\n\t\t}\n\t}\n\treturn urls, nil\n}", "func ServersPush(src, dst string, cu *CommonUser, ipFile string, wt *sync.WaitGroup, ccons chan struct{}, crs chan machine.Result, timeout int) {\n\thosts, err := parseIpfile(ipFile, cu)\n\tif err != nil {\n\t\tlog.Error(\"Parse %s error, error=%s\", ipFile, err)\n\t\treturn\n\t}\n\n\tips := config.GetIps(hosts)\n\tlog.Info(\"[servers]=%v\", ips)\n\tfmt.Printf(\"[servers]=%v\\n\", ips)\n\n\tls := len(hosts)\n\tgo output.PrintResults2(crs, ls, wt, ccons, timeout)\n\n\tfor _, h := range hosts {\n\t\tccons <- struct{}{}\n\t\tserver := machine.NewScpServer(h.Ip, h.Port, h.User, h.Psw, \"scp\", src, dst, cu.force, timeout)\n\t\twt.Add(1)\n\t\tgo server.PRunScp(crs)\n\t}\n}", "func ServerSate(session *network.Session) *network.Writer {\n\t// request server list\n\tvar r = server.ListRes{}\n\tg_RPCHandler.Call(rpc.ServerList, server.ListReq{}, &r)\n\tvar s = r.List\n\n\tvar packet = network.NewWriter(SERVERSTATE)\n\tpacket.WriteByte(len(s))\n\n\tfor i := 0; i < len(s); i++ {\n\t\tpacket.WriteByte(s[i].Id)\n\t\tpacket.WriteByte(s[i].Hot) // 0x10 = HOT! Flag; or bit_set(5)\n\t\tpacket.WriteInt32(0x00)\n\t\tpacket.WriteByte(len(s[i].List))\n\n\t\tfor j := 0; j < len(s[i].List); j++ {\n\t\t\tvar c = s[i].List[j]\n\t\t\tpacket.WriteByte(c.Id)\n\t\t\tpacket.WriteUint16(c.CurrentUsers)\n\t\t\tpacket.WriteUint16(0x00)\n\t\t\tpacket.WriteUint16(0xFFFF)\n\t\t\tpacket.WriteUint16(0x00)\n\t\t\tpacket.WriteUint16(0x00)\n\t\t\tpacket.WriteUint32(0x00)\n\t\t\tpacket.WriteUint16(0x00)\n\t\t\tpacket.WriteUint16(0x00)\n\t\t\tpacket.WriteUint16(0x00)\n\t\t\tpacket.WriteByte(0x00)\n\t\t\tpacket.WriteByte(0x00)\n\t\t\tpacket.WriteByte(0x00)\n\t\t\tpacket.WriteByte(0xFF)\n\t\t\tpacket.WriteUint16(c.MaxUsers)\n\n\t\t\t// if session is local, provide local IPs...\n\t\t\t// this helps during development when you have local & remote clients\n\t\t\t// however, here we assume that locally all servers will run on the\n\t\t\t// same IP\n\t\t\tif session.IsLocal() {\n\t\t\t\tip := net.ParseIP(session.GetLocalEndPntIp())[12:16]\n\t\t\t\tpacket.WriteUint32(binary.LittleEndian.Uint32(ip))\n\t\t\t} else {\n\t\t\t\tpacket.WriteUint32(c.Ip)\n\t\t\t}\n\n\t\t\tpacket.WriteUint16(c.Port)\n\t\t\tpacket.WriteUint32(c.Type)\n\t\t}\n\t}\n\n\treturn packet\n}", "func (provider AWSProvider) GetServers(providerOptions map[string]string, logger *log.Logger) ([]string, error) {\n\n\t// Initialise Discover struct from go-discover\n\tdiscoverer := discover.Discover{\n\t\tProviders : map[string]discover.Provider{\n\t\t\t\"aws\": discover.Providers[\"aws\"],\n\t\t},\n\t}\n\n\t// Discard logs if loggger is not set\n\tif logger == nil {\n\t\tlogger = log.New(ioutil.Discard, \"\", log.LstdFlags)\n\t}\n\n\t// Create the constraint list for discovering AWS instances\n\tcfg := fmt.Sprintf(\"provider=aws region=%s access_key_id=%s secret_access_key=%s addr_type=%s tag_key=%s tag_value=%s\", providerOptions[\"region\"], providerOptions[\"accessKeyId\"], providerOptions[\"secretAccessKey\"], providerOptions[\"addrType\"], providerOptions[\"tagKey\"], providerOptions[\"tagValue\"])\n\tserverIps, err := discoverer.Addrs(cfg, logger)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn serverIps, nil\n}", "func sortServers(s []RegisteredServer) {\n\tsort.Slice(s, func(i, j int) bool {\n\t\treturn s[i].ServerInfo().Name() < s[j].ServerInfo().Name()\n\t})\n}", "func StartServer(gid int64, shardmasters []string, servers []string, me int) *ShardKV {\n gob.Register(Op{})\n gob.Register(GetArgs{})\n gob.Register(GetReply{})\n gob.Register(PutArgs{})\n gob.Register(PutReply{})\n\n kv := new(ShardKV)\n kv.me = me\n kv.gid = gid\n kv.sm = shardmaster.MakeClerk(shardmasters)\n\n // Your initialization code here.\n // Don't call Join().\n kv.id = strconv.Itoa(kv.me) + \"_\" + strconv.Itoa(int(kv.gid))\n kv.kvs = [shardmaster.NShards]map[string]string{}\n for idx, _ := range(kv.kvs) {\n kv.kvs[idx] = make(map[string]string)\n }\n kv.client_last_op = make(map[int64]*Op)\n kv.client_max_seq = make(map[int64]int64)\n kv.request_noop_channel = make(chan int)\n kv.curr_config = shardmaster.Config{Num:0}\n kv.handled_shards = [shardmaster.NShards]int64{}\n kv.max_config_in_log = 0\n \n\n go kv.applyOps()\n\n rpcs := rpc.NewServer()\n rpcs.Register(kv)\n\n kv.px = paxos.Make(servers, me, rpcs)\n\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n kv.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for kv.dead == false {\n conn, err := kv.l.Accept()\n if err == nil && kv.dead == false {\n if kv.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if kv.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && kv.dead == false {\n fmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n kv.kill()\n }\n }\n }()\n\n go func() {\n for kv.dead == false {\n kv.tick()\n time.Sleep(250 * time.Millisecond)\n }\n }()\n\n return kv\n}" ]
[ "0.6320043", "0.61423033", "0.60204196", "0.59289306", "0.5913171", "0.5910354", "0.58990043", "0.5859742", "0.58087176", "0.58075607", "0.57970375", "0.57787573", "0.5772199", "0.5684998", "0.56840986", "0.55818623", "0.5573835", "0.55359936", "0.55059063", "0.54844165", "0.5484378", "0.545974", "0.5428866", "0.5410363", "0.54054", "0.53902614", "0.53786963", "0.53514534", "0.5332319", "0.53130686", "0.5301302", "0.5293684", "0.52534837", "0.524992", "0.5233918", "0.52223516", "0.52173465", "0.52099085", "0.5199143", "0.51813805", "0.5178481", "0.51778305", "0.51747787", "0.5173652", "0.51639104", "0.5151062", "0.514899", "0.514899", "0.51479083", "0.51361287", "0.5123398", "0.51220274", "0.5121332", "0.5117808", "0.51069", "0.5076063", "0.50700986", "0.5065664", "0.5063186", "0.5057916", "0.5053559", "0.5045641", "0.5034688", "0.50170356", "0.49925557", "0.49893624", "0.4988768", "0.498135", "0.49732053", "0.4970587", "0.49688601", "0.4954668", "0.49536508", "0.49515322", "0.49414524", "0.4936897", "0.49279845", "0.49238607", "0.49206057", "0.4917361", "0.4913039", "0.49122515", "0.49044296", "0.4899629", "0.48988566", "0.48882392", "0.48820716", "0.4881374", "0.48790166", "0.48757374", "0.4864935", "0.48593742", "0.4852801", "0.4851845", "0.48485383", "0.4839123", "0.48379308", "0.48340788", "0.48331776", "0.483224" ]
0.5337773
28
NewClientOutboundOp creates a new naming schema for client outbound operations.
func NewClientOutboundOp(system string, opts ...Option) *Schema { cfg := &config{} for _, opt := range opts { opt(cfg) } return New(&clientOutboundOp{cfg: cfg, system: system}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewHTTPClientOp(opts ...Option) *Schema {\n\treturn NewClientOutboundOp(\"http\", opts...)\n}", "func NewServerInboundOp(system string, opts ...Option) *Schema {\n\tcfg := &config{}\n\tfor _, opt := range opts {\n\t\topt(cfg)\n\t}\n\treturn New(&serverInboundOp{cfg: cfg, system: system})\n}", "func NewDBOutboundOp(system string, opts ...Option) *Schema {\n\tcfg := &config{}\n\tfor _, opt := range opts {\n\t\topt(cfg)\n\t}\n\treturn New(&dbOutboundOp{cfg: cfg, system: system})\n}", "func NewGRPCClientOp(opts ...Option) *Schema {\n\treturn NewClientOutboundOp(\"grpc\", opts...)\n}", "func NewOutbound(opts ...OutboundHTTPOpt) (*OutboundHTTPClient, error) {\n\tclOpts := &outboundCommHTTPOpts{}\n\t// Apply options\n\tfor _, opt := range opts {\n\t\topt(clOpts)\n\t}\n\n\tif clOpts.client == nil {\n\t\treturn nil, errors.New(\"creation of outbound transport requires an HTTP client\")\n\t}\n\n\tcs := &OutboundHTTPClient{\n\t\tclient: clOpts.client,\n\t}\n\n\treturn cs, nil\n}", "func NewOutboundCommFromClient(client *http.Client) (*OutboundCommHTTP, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is empty, cannot create new HTTP transport\")\n\t}\n\n\tcm := &OutboundCommHTTP{\n\t\tclient: client,\n\t}\n\treturn cm, nil\n}", "func NewOutbound(prov provider) *OutboundDispatcher {\n\treturn &OutboundDispatcher{\n\t\toutboundTransports: prov.OutboundTransports(),\n\t\tpackager: prov.Packager(),\n\t\ttransportReturnRoute: prov.TransportReturnRoute(),\n\t\tvdRegistry: prov.VDRIRegistry(),\n\t\tkms: prov.LegacyKMS(),\n\t}\n}", "func (t *Transport) NewOutbound(chooser peer.Chooser) *Outbound {\n\treturn &Outbound{\n\t\tonce: lifecycle.NewOnce(),\n\t\ttransport: t,\n\t\tchooser: chooser,\n\t}\n}", "func NewOperationClient(c config) *OperationClient {\n\treturn &OperationClient{config: c}\n}", "func NewCassandraOutboundOp(opts ...Option) *Schema {\n\treturn NewDBOutboundOp(\"cassandra\", opts...)\n}", "func schemaCreateRequestToOps(req *scoop_protocol.Config) []scoop_protocol.Operation {\n\tops := make([]scoop_protocol.Operation, 0, len(req.Columns))\n\tfor _, col := range req.Columns {\n\t\tops = append(ops, scoop_protocol.NewAddOperation(col.OutboundName, col.InboundName, col.Transformer, col.ColumnCreationOptions))\n\t}\n\treturn ops\n}", "func (fgsc *FakeGKESDKClient) newOp() *container.Operation {\n\topName := strconv.Itoa(fgsc.opNumber)\n\top := &container.Operation{\n\t\tName: opName,\n\t\tStatus: \"DONE\",\n\t}\n\tif status, ok := fgsc.opStatus[opName]; ok {\n\t\top.Status = status\n\t}\n\tfgsc.opNumber++\n\tfgsc.ops[opName] = op\n\treturn op\n}", "func newOutboundConn(c net.Conn, s *Server, conf *config.FeedConfig) Conn {\n\n\tsname := s.Name()\n\n\tif len(sname) == 0 {\n\t\tsname = \"nntp.anon.tld\"\n\t}\n\tstorage := s.Storage\n\tif storage == nil {\n\t\tstorage = store.NewNullStorage()\n\t}\n\treturn &v1OBConn{\n\t\tconf: conf,\n\t\tC: v1Conn{\n\t\t\thooks: s,\n\t\t\tstate: ConnState{\n\t\t\t\tFeedName: conf.Name,\n\t\t\t\tHostName: conf.Addr,\n\t\t\t\tOpen: true,\n\t\t\t},\n\t\t\tserverName: sname,\n\t\t\tstorage: storage,\n\t\t\tC: textproto.NewConn(c),\n\t\t\tconn: c,\n\t\t\thdrio: message.NewHeaderIO(),\n\t\t},\n\t}\n}", "func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService2ProtocolTest {\n\tsvc := &InputService2ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice2protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func NewElasticsearchOutboundOp(opts ...Option) *Schema {\n\treturn NewDBOutboundOp(\"elasticsearch\", opts...)\n}", "func NewClientRequest(serviceName string, methodName string, args []interface{}) *ClientRequest {\n\treturn &ClientRequest{ServiceName: serviceName, MethodName: methodName, Arguments: args}\n}", "func (t *ChannelTransport) NewOutbound() *ChannelOutbound {\n\treturn &ChannelOutbound{\n\t\tonce: lifecycle.NewOnce(),\n\t\tchannel: t.ch,\n\t\ttransport: t,\n\t}\n}", "func NewMongoDBOutboundOp(opts ...Option) *Schema {\n\treturn NewDBOutboundOp(\"mongodb\", opts...)\n}", "func newInputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService12ProtocolTest {\n\tsvc := &InputService12ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice12protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func NewGRPCServerOp(opts ...Option) *Schema {\n\treturn NewServerInboundOp(\"grpc\", opts...)\n}", "func newTopoClient(cfg ServiceConfig) (topoapi.TopoClient, error) {\n\topts := []grpc.DialOption{\n\t\tgrpc.WithStreamInterceptor(southbound.RetryingStreamClientInterceptor(100 * time.Millisecond)),\n\t}\n\tif cfg.Insecure {\n\t\topts = append(opts, grpc.WithInsecure())\n\t}\n\n\tconn, err := getTopoConn(\"onos-topo\", opts...)\n\tif err != nil {\n\t\tstat, ok := status.FromError(err)\n\t\tif ok {\n\t\t\tlog.Error(\"Unable to connect to topology service\", err)\n\t\t\treturn nil, errors.FromStatus(stat)\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn topoapi.NewTopoClient(conn), nil\n}", "func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *InputService2ProtocolTest {\n\tsvc := &InputService2ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"InputService2ProtocolTest\",\n\t\t\t\tServiceID: \"InputService2ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t\tJSONVersion: \"1.1\",\n\t\t\t\tTargetPrefix: \"com.amazonaws.foo\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func newInputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService14ProtocolTest {\n\tsvc := &InputService14ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice14protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func newInputService20ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService20ProtocolTest {\n\tsvc := &InputService20ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice20protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func newInputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService11ProtocolTest {\n\tsvc := &InputService11ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice11protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func newInputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService13ProtocolTest {\n\tsvc := &InputService13ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice13protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService1ProtocolTest {\n\tsvc := &InputService1ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice1protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func NewClient(c *rpc.Client) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tvar (\n\t\t\terrs = make(chan error, 1)\n\t\t\tresponses = make(chan interface{}, 1)\n\t\t)\n\t\tgo func() {\n\t\t\tvar response reqrep.AddResponse\n\t\t\tif err := c.Call(\"addsvc.Add\", request, &response); err != nil {\n\t\t\t\terrs <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresponses <- response\n\t\t}()\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, context.DeadlineExceeded\n\t\tcase err := <-errs:\n\t\t\treturn nil, err\n\t\tcase response := <-responses:\n\t\t\treturn response, nil\n\t\t}\n\t}\n}", "func NewOpServer(db *database.DB, addr string) *rpc.Server {\n\treturn rpc.NewServer(\"OpRpcServer\", &OpRpcServer{db}, addr)\n}", "func newInputService22ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService22ProtocolTest {\n\tsvc := &InputService22ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice22protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func newInputService18ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService18ProtocolTest {\n\tsvc := &InputService18ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice18protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func NewOperationroomClient(c config) *OperationroomClient {\n\treturn &OperationroomClient{config: c}\n}", "func NewHTTPServerOp(opts ...Option) *Schema {\n\treturn NewServerInboundOp(\"http\", opts...)\n}", "func (*ClientConnectEvent) Op() ws.OpCode { return 12 }", "func (t *OpenconfigOfficeAp_Ssids_Ssid_Clients) NewClient(Mac string) (*OpenconfigOfficeAp_Ssids_Ssid_Clients_Client, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Client == nil {\n\t\tt.Client = make(map[string]*OpenconfigOfficeAp_Ssids_Ssid_Clients_Client)\n\t}\n\n\tkey := Mac\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Client[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Client\", key)\n\t}\n\n\tt.Client[key] = &OpenconfigOfficeAp_Ssids_Ssid_Clients_Client{\n\t\tMac: &Mac,\n\t}\n\n\treturn t.Client[key], nil\n}", "func NewOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient {\n\tcp := arm.ClientOptions{}\n\tif options != nil {\n\t\tcp = *options\n\t}\n\tif len(cp.Host) == 0 {\n\t\tcp.Host = arm.AzurePublicCloud\n\t}\n\treturn &OperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}\n}", "func (c *OutputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *OutputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *InputService1ProtocolTest {\n\tsvc := &InputService1ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"InputService1ProtocolTest\",\n\t\t\t\tServiceID: \"InputService1ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t\tJSONVersion: \"1.1\",\n\t\t\t\tTargetPrefix: \"com.amazonaws.foo\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func (c *OutputService12ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func newClient(opts *ClientOpts) (*Client, error) {\n\tbaseClient, err := newAPIClient(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tAPIClient: *baseClient,\n\t}\n\n\t// init base operator\n\tclient.Node = newNodeClient(client)\n\tclient.Namespace = newNameSpaceClient(client)\n\tclient.ConfigMap = newConfigMapClient(client)\n\tclient.Service = newServiceClient(client)\n\tclient.Pod = newPodClient(client)\n\tclient.ReplicationController = newReplicationControllerClient(client)\n\tclient.StatefulSet = newStatefulSetClient(client)\n\tclient.DaemonSet = newDaemonSetClient(client)\n\tclient.Deployment = newDeploymentClient(client)\n\tclient.ReplicaSet = newReplicaSetClient(client)\n\n\treturn client, nil\n}", "func NewClient(getLicense, updateDeviceLicense, updateDeviceLicenseWithValue goa.Endpoint) *Client {\n\treturn &Client{\n\t\tGetLicenseEndpoint: getLicense,\n\t\tUpdateDeviceLicenseEndpoint: updateDeviceLicense,\n\t\tUpdateDeviceLicenseWithValueEndpoint: updateDeviceLicenseWithValue,\n\t}\n}", "func NewClient(endpointURL, soapActionBase string, cl *http.Client) Caller {\n\tif cl == nil {\n\t\tcl = http.DefaultClient\n\t}\n\tif cl.Transport == nil {\n\t\tcl.Transport = http.DefaultTransport\n\t}\n\tcl.Transport = soaptrip.New(cl.Transport)\n\treturn &soapClient{\n\t\tClient: cl,\n\t\tURL: endpointURL,\n\t\tSOAPActionBase: soapActionBase,\n\t\tbufpool: bp.New(1024),\n\t}\n}", "func ToClient(client *scm.Client, botName string) *Client {\n\treturn &Client{client: client, botName: botName}\n}", "func (t *ChannelTransport) NewSingleOutbound(addr string) *ChannelOutbound {\n\treturn &ChannelOutbound{\n\t\tonce: lifecycle.NewOnce(),\n\t\tchannel: t.ch,\n\t\ttransport: t,\n\t\taddr: addr,\n\t}\n}", "func NewClient(hub *Hub, id, scope string, service *service.Service, conn *Connection) *Client {\n\tclient := &Client{\n\t\thub: hub,\n\t\tid: id,\n\t\tscope: scope,\n\t\tconnections: make(map[*Connection]bool),\n\t\tregister: make(chan *Connection),\n\t\tunregister: make(chan *Connection),\n\t\tinbox: make(chan *Message, 256),\n\t\toutbox: make(chan *Message, 256),\n\t\tserviceData: service,\n\t}\n\n\tclient.connections[conn] = true\n\n\treturn client\n}", "func (c *OutputService14ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewClient(conn *ws.Conn) Client {\n\tlog.Println(\"NewClient\")\n\ttx := make(chan ToClient, 3)\n\trx := make(chan ToServer, 3)\n\td := make(chan Dest)\n\tq := make(chan struct{})\n\tgo runClient(q, d, rx)\n\tif conn != nil {\n\t\tgo readFromConn(conn, rx)\n\t\tgo writeToConn(conn, tx)\n\t}\n\treturn Client{tx, rx, d, q}\n}", "func (c *OutputService13ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewMsgFilterClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *MsgFilterClient {\n return &MsgFilterClient{\n c: thrift.NewTStandardClient(iprot, oprot),\n }\n}", "func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService8ProtocolTest {\n\tsvc := &InputService8ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice8protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func New(o *Opt) *Client {\n\treturn &Client{\n\t\to: o,\n\t}\n}", "func NewOutboundMock(t minimock.Tester) *OutboundMock {\n\tm := &OutboundMock{t: t}\n\n\tif controller, ok := t.(minimock.MockController); ok {\n\t\tcontroller.RegisterMocker(m)\n\t}\n\n\tm.AsByteStringMock = mOutboundMockAsByteString{mock: m}\n\tm.CanAcceptMock = mOutboundMockCanAccept{mock: m}\n\tm.GetEndpointTypeMock = mOutboundMockGetEndpointType{mock: m}\n\tm.GetIPAddressMock = mOutboundMockGetIPAddress{mock: m}\n\tm.GetNameAddressMock = mOutboundMockGetNameAddress{mock: m}\n\tm.GetRelayIDMock = mOutboundMockGetRelayID{mock: m}\n\n\treturn m\n}", "func newClientMethod(r *raml.Resource, rd *cr.Resource, m *raml.Method,\n\tmethodName string) (cr.MethodInterface, error) {\n\treturn newMethod(nil, r, rd, m, methodName)\n}", "func (self *MessageStore) AddOutbound(client string, msg protobase.EDProtocol) bool {\n\tself.RLock()\n\tif ok := self.nomexist(client); !ok {\n\t\tself.RUnlock()\n\t\treturn false\n\t}\n\tvar cid string = uidstr(msg)\n\tself.out[client].Lock()\n\tif _, ok := self.out[client].messages[cid]; ok == true {\n\t\tself.out[client].Unlock()\n\t\tself.RUnlock()\n\n\t\treturn false\n\t}\n\tself.out[client].messages[cid] = msg\n\tself.out[client].order[cid] = self.out[client].GenSeqID()\n\tself.out[client].Unlock()\n\tself.RUnlock()\n\n\treturn true\n}", "func schemaUpdateRequestToOps(req *core.ClientUpdateSchemaRequest) []scoop_protocol.Operation {\n\tops := make([]scoop_protocol.Operation, 0, len(req.Additions)+len(req.Deletes)+len(req.Renames))\n\tfor _, colName := range req.Deletes {\n\t\tops = append(ops, scoop_protocol.NewDeleteOperation(colName))\n\t}\n\tfor _, col := range req.Additions {\n\t\tops = append(ops, scoop_protocol.NewAddOperation(col.OutboundName, col.InboundName, col.Transformer, col.Length))\n\t}\n\tfor oldName, newName := range req.Renames {\n\t\tops = append(ops, scoop_protocol.NewRenameOperation(oldName, newName))\n\t}\n\treturn ops\n}", "func (t *Transport) NewSingleOutbound(addr string) *Outbound {\n\tchooser := peerchooser.NewSingle(hostport.PeerIdentifier(addr), t)\n\treturn t.NewOutbound(chooser)\n}", "func NewOutboundRoundTripper(om OutboundMeasures, o *Outbounder) http.RoundTripper {\n\t// nolint:bodyclose\n\treturn promhttp.RoundTripperFunc(xhttp.RetryTransactor(\n\t\t// use the default should retry predicate ...\n\t\txhttp.RetryOptions{\n\t\t\tLogger: o.logger(),\n\t\t\tRetries: o.retries(),\n\t\t\tCounter: om.Retries,\n\t\t},\n\t\tInstrumentOutboundCounter(\n\t\t\tom.RequestCounter,\n\t\t\tInstrumentOutboundDuration(\n\t\t\t\tom.RequestDuration,\n\t\t\t\tpromhttp.InstrumentRoundTripperInFlight(om.InFlight, o.transport()),\n\t\t\t),\n\t\t),\n\t))\n}", "func CreateOperationHandler(mqCli gclient.MQClient) *OperationHandler {\n\treturn &OperationHandler{\n\t\tmqCli: mqCli,\n\t}\n}", "func newInputService17ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService17ProtocolTest {\n\tsvc := &InputService17ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice17protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func (t *transformer) generateClient(protoPackage, serviceName string, iface *ast.InterfaceType) ([]ast.Decl, error) {\n\t// This function used to construct an AST. It was a lot of code.\n\t// Now it generates code via a template and parses back to AST.\n\t// Slower, but saner and easier to make changes.\n\n\ttype Method struct {\n\t\tName string\n\t\tInputMessage string\n\t\tOutputMessage string\n\t}\n\tmethods := make([]Method, 0, len(iface.Methods.List))\n\n\tvar buf bytes.Buffer\n\ttoGoCode := func(n ast.Node) (string, error) {\n\t\tdefer buf.Reset()\n\t\terr := format.Node(&buf, t.fset, n)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn buf.String(), nil\n\t}\n\n\tfor _, m := range iface.Methods.List {\n\t\tsignature, ok := m.Type.(*ast.FuncType)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected embedded interface in %sClient\", serviceName)\n\t\t}\n\n\t\tinStructPtr := signature.Params.List[1].Type.(*ast.StarExpr)\n\t\tinStruct, err := toGoCode(inStructPtr.X)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\toutStructPtr := signature.Results.List[0].Type.(*ast.StarExpr)\n\t\toutStruct, err := toGoCode(outStructPtr.X)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmethods = append(methods, Method{\n\t\t\tName: m.Names[0].Name,\n\t\t\tInputMessage: inStruct,\n\t\t\tOutputMessage: outStruct,\n\t\t})\n\t}\n\n\tprpcSymbolPrefix := \"prpc.\"\n\tif t.inPRPCPackage {\n\t\tprpcSymbolPrefix = \"\"\n\t}\n\terr := clientCodeTemplate.Execute(&buf, map[string]any{\n\t\t\"Service\": serviceName,\n\t\t\"ProtoPkg\": protoPackage,\n\t\t\"StructName\": firstLower(serviceName) + \"PRPCClient\",\n\t\t\"Methods\": methods,\n\t\t\"PRPCSymbolPrefix\": prpcSymbolPrefix,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"client template execution: %s\", err)\n\t}\n\n\tf, err := parser.ParseFile(t.fset, \"\", buf.String(), 0)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"client template result parsing: %s. Code: %#v\", err, buf.String())\n\t}\n\treturn f.Decls, nil\n}", "func (c *OutputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *OutputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewClient(endpoints ...[]string) *Client {\n\tclient := &Client{\n\t\tevents: make(chan *models.Event),\n\t\tcancel: make(chan struct{}),\n\t}\n\tfor _, v := range endpoints {\n\t\tclient.endpoints = v\n\t}\n\tclient.address = client.GetServiceIP()\n\treturn client\n}", "func newInputService15ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService15ProtocolTest {\n\tsvc := &InputService15ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice15protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func NewClient( o *ClientOption) *Client {\n\treturn &Client{\n\t\toption: *o,\n\t\trcvASDU: make(chan []byte, o.config.RecvUnAckLimitW<<4),\n\t\tsendASDU: make(chan []byte, o.config.SendUnAckLimitK<<4),\n\t\tRcvRaw: make(chan []byte, o.config.RecvUnAckLimitW<<5),\n\t\tsendRaw: make(chan []byte, o.config.SendUnAckLimitK<<5), // may not block!\n\t\tClog: clog.NewLogger(\"iec61850 client => \"),\n\t\tonConnect: func(*Client) {},\n\t\tonConnectionLost: func(*Client) {},\n\t}\n}", "func newInputService16ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService16ProtocolTest {\n\tsvc := &InputService16ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice16protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func (c *OutputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *OutputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewOCSPClient(config OCSPClientConfig) *OCSPClient {\n\tif config.HTTPClient == nil {\n\t\tconfig.HTTPClient = http.DefaultClient\n\t}\n\tif config.RetryPolicy == nil {\n\t\tconfig.RetryPolicy = DefaultBackoff.Copy()\n\t}\n\tif config.NewFutureEventAt == nil {\n\t\tconfig.NewFutureEventAt = futureevent.DefaultFactory\n\t}\n\treturn &OCSPClient{config}\n}", "func CreateGetWsCustomizedChO2ORequest() (request *GetWsCustomizedChO2ORequest) {\n\trequest = &GetWsCustomizedChO2ORequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"alinlp\", \"2020-06-29\", \"GetWsCustomizedChO2O\", \"alinlp\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func newInputService21ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService21ProtocolTest {\n\tsvc := &InputService21ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice21protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func WithOutboundHTTPClient(client *http.Client) OutboundHTTPOpt {\n\treturn func(opts *outboundCommHTTPOpts) {\n\t\topts.client = client\n\t}\n}", "func newInputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService10ProtocolTest {\n\tsvc := &InputService10ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice10protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func Create() *ConnectedClient {\n client := ConnectedClient {}\n\n client.ClientSecret = generateClientSecret();\n client.ClientToken = generateClientIdentifier();\n client.ClientName = generateClientName();\n client.VoteHistory = make([]Vote, 0);\n client.QueueHistory = make([]QueueEntry, 0);\n client.ConnectionTime = time.Now();\n client.LastCommunicated = time.Now();\n\n currentClients[client.ClientToken] = &client\n\n return &client\n}", "func newClientRequest(cs ConnectionSettings) *clientRequest {\n\treturn &clientRequest{\n\t\tConnectionSettings: cs,\n\t\tresponse: make(chan clientResponse),\n\t}\n}", "func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *InputService8ProtocolTest {\n\tsvc := &InputService8ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"InputService8ProtocolTest\",\n\t\t\t\tServiceID: \"InputService8ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func newWSClientFilter(addresses []string, unspentOutPoints []wire.OutPoint, params *chaincfg.Params) *wsClientFilter {\n\tfilter := &wsClientFilter{\n\t\tpubKeyHashes: map[[ripemd160.Size]byte]struct{}{},\n\t\tscriptHashes: map[[ripemd160.Size]byte]struct{}{},\n\t\tcompressedPubKeys: map[[33]byte]struct{}{},\n\t\tuncompressedPubKeys: map[[65]byte]struct{}{},\n\t\totherAddresses: map[string]struct{}{},\n\t\tunspent: make(map[wire.OutPoint]struct{}, len(unspentOutPoints)),\n\t}\n\n\tfor _, s := range addresses {\n\t\tfilter.addAddressStr(s, params)\n\t}\n\tfor i := range unspentOutPoints {\n\t\tfilter.addUnspentOutPoint(&unspentOutPoints[i])\n\t}\n\n\treturn filter\n}", "func NewMockOnewayOutbound(ctrl *gomock.Controller) *MockOnewayOutbound {\n\tmock := &MockOnewayOutbound{ctrl: ctrl}\n\tmock.recorder = &MockOnewayOutboundMockRecorder{mock}\n\treturn mock\n}", "func (c *OutputService8ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService6ProtocolTest {\n\tsvc := &InputService6ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice6protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func createNewUnstructured(\n\tclientHubDynamic dynamic.Interface,\n\tgvr schema.GroupVersionResource,\n\tobj *unstructured.Unstructured,\n\tname, namespace string,\n) {\n\tklog.V(5).Infof(\"Creation Unstructured of %s %s/%s\", gvr, name, namespace)\n\tns := clientHubDynamic.Resource(gvr).Namespace(namespace)\n\tklog.V(5).Infof(\"ns client created for %s %s/%s created\", gvr, name, namespace)\n\tExpect(ns.Create(context.TODO(), obj, metav1.CreateOptions{})).NotTo(BeNil())\n\tklog.V(5).Infof(\"Check if Unstructured %s %s/%s created\", gvr, name, namespace)\n\tExpect(ns.Get(context.TODO(), name, metav1.GetOptions{})).NotTo(BeNil())\n\tklog.V(5).Infof(\"Unstructured %s %s/%s created\", gvr, name, namespace)\n}", "func NewCreateClientCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"create\",\n\t\tShort: \"create new localhost client\",\n\t\tLong: \"create new localhost (loopback) client\",\n\t\tExample: fmt.Sprintf(\"%s tx %s %s create --from node0 --home ../node0/<app>cli --chain-id $CID\", version.AppName, host.ModuleName, types.SubModuleName),\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, _ []string) error {\n\t\t\tclientCtx := client.GetClientContextFromCmd(cmd)\n\t\t\tclientCtx, err := client.ReadTxCommandFlags(clientCtx, cmd.Flags())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tmsg := types.NewMsgCreateClient(clientCtx.GetFromAddress())\n\t\t\tif err := msg.ValidateBasic(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)\n\t\t},\n\t}\n\n\tflags.AddTxFlagsToCmd(cmd)\n\n\treturn cmd\n}", "func NewMockUnaryOutbound(ctrl *gomock.Controller) *MockUnaryOutbound {\n\tmock := &MockUnaryOutbound{ctrl: ctrl}\n\tmock.recorder = &MockUnaryOutboundMockRecorder{mock}\n\treturn mock\n}", "func NewClient(modifiers ...RequestModifier) *Client {\n\treturn &Client{modifiers}\n}", "func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewClient(op Options, limit int) *Client {\n\treturn &Client{\n\t\tOptions: op,\n\t\tLimit: limit,\n\t\tlimitCh: make(chan struct{}, limit),\n\t}\n}", "func NewPrinterCreateOperation()(*PrinterCreateOperation) {\n m := &PrinterCreateOperation{\n PrintOperation: *NewPrintOperation(),\n }\n odataTypeValue := \"#microsoft.graph.printerCreateOperation\";\n m.SetOdataType(&odataTypeValue);\n return m\n}", "func NewClient(ctx context.Context, endpoint string, options ...option) (*Client, error) {\n\tc := &Client{\n\t\tendpoint: endpoint,\n\t\tconsumerID: 0,\n\t\tconsumers: make(map[uint64]consumer),\n\t\terrorHandler: func(error) {},\n\t}\n\tc.defines.reset()\n\topts := clientOptions{\n\t\tclient: c,\n\t\tnewWebSocket: ws.New,\n\t}\n\tfor _, opt := range options {\n\t\topt(&opts)\n\t}\n\topts.wsOptions = append(opts.wsOptions,\n\t\tws.OnConnect(c.onConnect),\n\t\tws.OnDisconnect(c.onDisconnect),\n\t\tws.OnFailure(c.onFailure),\n\t\tws.OnMessage(c.onMessage),\n\t\tws.ErrorHandler(c.errorHandler),\n\t)\n\tvar err error\n\tif c.ws, err = opts.newWebSocket(ctx, c.endpoint, opts.wsOptions...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "func (c *InputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewMsgCreateIndex(owner sdk.AccAddress, tableName string, field string) MsgCreateIndex {\n return MsgCreateIndex {\n Owner: owner,\n TableName: tableName,\n Field: field,\n }\n}", "func New(c grpc.UserClient) nethttp.Handler {\n\tfn := func(w nethttp.ResponseWriter, r *nethttp.Request) {\n\t\tvar e error\n\n\t\tif r.Body == nil {\n\t\t\tresponse.WithError(r.Context(), response.HTTPError{\n\t\t\t\tCode: nethttp.StatusBadRequest,\n\t\t\t\tError: ErrEmptyRequestBody,\n\t\t\t\tMessage: ErrEmptyRequestBody.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tparams, ok := gorouter.FromContext(r.Context())\n\t\tif !ok {\n\t\t\tresponse.WithError(r.Context(), response.HTTPError{\n\t\t\t\tCode: nethttp.StatusBadRequest,\n\t\t\t\tError: ErrInvalidURLParams,\n\t\t\t\tMessage: ErrInvalidURLParams.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tdefer r.Body.Close()\n\t\tbody, e := ioutil.ReadAll(r.Body)\n\t\tif e != nil {\n\t\t\tresponse.WithError(r.Context(), response.HTTPError{\n\t\t\t\tCode: nethttp.StatusBadRequest,\n\t\t\t\tError: e,\n\t\t\t\tMessage: \"Invalid request body\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\te = c.DispatchAndClose(r.Context(), params.Value(\"command\"), body)\n\t\tif e != nil {\n\t\t\tresponse.WithError(r.Context(), response.HTTPError{\n\t\t\t\tCode: nethttp.StatusBadRequest,\n\t\t\t\tError: e,\n\t\t\t\tMessage: \"Invalid request\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(nethttp.StatusCreated)\n\n\t\treturn\n\t}\n\n\treturn nethttp.HandlerFunc(fn)\n}", "func (c *OutputService15ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewSRTOutbound(options *SRTOutboundOptions) (*SRTOutbound, error) {\n\treturn &SRTOutbound{\n\t\toptions,\n\t\tmake(map[string]chan []byte),\n\t\tsync.Mutex{},\n\t\tlog.New().WithFields(log.Fields{\"module\": \"SRTOutbound\"}),\n\t}, nil\n}", "func (c *OutputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *OutputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewINV(i, o *Wire) *Gate {\n\tgate := &Gate{\n\t\tOp: circuit.INV,\n\t\tA: i,\n\t\tO: o,\n\t}\n\ti.AddOutput(gate)\n\to.SetInput(gate)\n\n\treturn gate\n}", "func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}" ]
[ "0.55754787", "0.5387539", "0.5369806", "0.5365895", "0.51960135", "0.51482224", "0.49851736", "0.49218264", "0.4861859", "0.48274773", "0.4802394", "0.47659954", "0.4725118", "0.47145423", "0.47105554", "0.46655613", "0.4616343", "0.4613883", "0.46041968", "0.45778775", "0.45653054", "0.45351085", "0.45216525", "0.4514271", "0.449292", "0.44896412", "0.44748855", "0.44690347", "0.44084328", "0.43811354", "0.4359405", "0.43495727", "0.434134", "0.43325973", "0.43294558", "0.43077803", "0.4302423", "0.4302423", "0.42738655", "0.42680535", "0.42668277", "0.426462", "0.42625663", "0.42524937", "0.42503986", "0.42341498", "0.42336786", "0.42295545", "0.42218438", "0.42062512", "0.42055535", "0.42022023", "0.42017812", "0.42006245", "0.42004237", "0.41929597", "0.4184837", "0.4180116", "0.41792077", "0.41771534", "0.41769376", "0.4173551", "0.4173551", "0.41674897", "0.41612953", "0.41508985", "0.41409308", "0.41405287", "0.41405287", "0.41339913", "0.413105", "0.41280067", "0.4122712", "0.41207567", "0.41050515", "0.4104816", "0.40979648", "0.40886375", "0.408717", "0.4083117", "0.4082917", "0.40797433", "0.40769768", "0.40767685", "0.4074938", "0.4067303", "0.4064686", "0.40639493", "0.40628248", "0.40516013", "0.40506807", "0.40466002", "0.40419325", "0.40312836", "0.40304148", "0.40302518", "0.40302518", "0.4023902", "0.40213272", "0.40213272" ]
0.8034903
0
NewServerInboundOp creates a new naming schema for server inbound operations.
func NewServerInboundOp(system string, opts ...Option) *Schema { cfg := &config{} for _, opt := range opts { opt(cfg) } return New(&serverInboundOp{cfg: cfg, system: system}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewHTTPServerOp(opts ...Option) *Schema {\n\treturn NewServerInboundOp(\"http\", opts...)\n}", "func NewGRPCServerOp(opts ...Option) *Schema {\n\treturn NewServerInboundOp(\"grpc\", opts...)\n}", "func IpInterface_NewServer(s IpInterface_Server, policy *server.Policy) *server.Server {\n\tc, _ := s.(server.Shutdowner)\n\treturn server.New(IpInterface_Methods(nil, s), s, c, policy)\n}", "func schemaCreateRequestToOps(req *scoop_protocol.Config) []scoop_protocol.Operation {\n\tops := make([]scoop_protocol.Operation, 0, len(req.Columns))\n\tfor _, col := range req.Columns {\n\t\tops = append(ops, scoop_protocol.NewAddOperation(col.OutboundName, col.InboundName, col.Transformer, col.ColumnCreationOptions))\n\t}\n\treturn ops\n}", "func NewOpServer(db *database.DB, addr string) *rpc.Server {\n\treturn rpc.NewServer(\"OpRpcServer\", &OpRpcServer{db}, addr)\n}", "func NewClientOutboundOp(system string, opts ...Option) *Schema {\n\tcfg := &config{}\n\tfor _, opt := range opts {\n\t\topt(cfg)\n\t}\n\treturn New(&clientOutboundOp{cfg: cfg, system: system})\n}", "func (sm *Manager) RegisterNewSchema(schema StateManager) {\n\tsm.handlers[schema.Name()] = schema\n}", "func (t *Transport) NewInbound(opts InboundOptions) *Inbound {\n\tif opts.PrefetchCount == 0 {\n\t\topts.PrefetchCount = defaultPrefetchCount\n\t}\n\treturn &Inbound{\n\t\tonce: sync.Once(),\n\t\ttransport: t,\n\t\topts: opts,\n\t\ttracer: t.tracer,\n\t\tclient: t.client,\n\t\tclientFactory: t.clientFactory,\n\t}\n}", "func NewIngressServer(superSpec *supervisor.Spec, super *supervisor.Supervisor, serviceName string, inf informer.Informer) *IngressServer {\n\tentity, exists := super.GetSystemController(trafficcontroller.Kind)\n\tif !exists {\n\t\tpanic(fmt.Errorf(\"BUG: traffic controller not found\"))\n\t}\n\n\ttc, ok := entity.Instance().(*trafficcontroller.TrafficController)\n\tif !ok {\n\t\tpanic(fmt.Errorf(\"BUG: want *TrafficController, got %T\", entity.Instance()))\n\t}\n\n\treturn &IngressServer{\n\t\tsuper: super,\n\n\t\ttc: tc,\n\t\tnamespace: fmt.Sprintf(\"%s/%s\", superSpec.Name(), \"ingress\"),\n\n\t\tpipelines: make(map[string]*supervisor.ObjectEntity),\n\t\thttpServer: nil,\n\t\tserviceName: serviceName,\n\t\tinf: inf,\n\t\tmutex: sync.RWMutex{},\n\t}\n}", "func PersistentIpInterface_NewServer(s PersistentIpInterface_Server, policy *server.Policy) *server.Server {\n\tc, _ := s.(server.Shutdowner)\n\treturn server.New(PersistentIpInterface_Methods(nil, s), s, c, policy)\n}", "func IpNetwork_NewServer(s IpNetwork_Server, policy *server.Policy) *server.Server {\n\tc, _ := s.(server.Shutdowner)\n\treturn server.New(IpNetwork_Methods(nil, s), s, c, policy)\n}", "func NewInboundPacket(id int) (encoding.Codable, error) {\n\ttypePtr, ok := inboundTypes[id]\n\tif !ok {\n\t\treturn new(UnknownPacket), nil\n\t}\n\ttyp := reflect.TypeOf(typePtr).Elem()\n\tvalue := reflect.New(typ)\n\treturn value.Interface().(encoding.Codable), nil\n}", "func NewSchema() Intercepter {\n\treturn IntercepterFunc(schema)\n}", "func newServerCmd(proxy *Proxy) brigodier.LiteralNodeBuilder {\n\treturn brigodier.Literal(\"server\").\n\t\tRequires(hasCmdPerm(proxy, serverCmdPermission)).\n\t\t// List registered server.\n\t\tExecutes(command.Command(func(c *command.Context) error {\n\t\t\treturn c.SendMessage(serversInfo(proxy, c.Source))\n\t\t})).\n\t\t// Switch server\n\t\tThen(brigodier.Argument(\"name\", brigodier.String).\n\t\t\tSuggests(serverSuggestionProvider(proxy)).\n\t\t\tExecutes(command.Command(func(c *command.Context) error {\n\t\t\t\tplayer, ok := c.Source.(Player)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn c.Source.SendMessage(&Text{S: Style{Color: Red},\n\t\t\t\t\t\tContent: \"Only players can connect to a server!\"})\n\t\t\t\t}\n\n\t\t\t\tname := c.String(\"name\")\n\t\t\t\trs := proxy.Server(name)\n\t\t\t\tif rs == nil {\n\t\t\t\t\treturn c.Source.SendMessage(&Text{S: Style{Color: Red},\n\t\t\t\t\t\tContent: fmt.Sprintf(\"Server %q doesn't exist.\", name)})\n\t\t\t\t}\n\n\t\t\t\tctx, cancel := context.WithTimeout(context.Background(),\n\t\t\t\t\ttime.Millisecond*time.Duration(proxy.config.ConnectionTimeout))\n\t\t\t\tdefer cancel()\n\t\t\t\tplayer.CreateConnectionRequest(rs).ConnectWithIndication(ctx)\n\t\t\t\treturn nil\n\t\t\t})),\n\t\t)\n}", "func NewAPICfgInfluxServer(m *macaron.Macaron) error {\n\tbind := binding.Bind\n\n\tm.Group(\"/api/cfg/influxservers\", func() {\n\t\tm.Get(\"/\", reqSignedIn, GetInfluxServer)\n\t\tm.Get(\"/:id\", reqSignedIn, GetInfluxServerByID)\n\t\tm.Post(\"/\", reqSignedIn, bind(config.InfluxCfg{}), AddInfluxServer)\n\t\tm.Put(\"/:id\", reqSignedIn, bind(config.InfluxCfg{}), UpdateInfluxServer)\n\t\tm.Delete(\"/:id\", reqSignedIn, DeleteInfluxServer)\n\t\tm.Get(\"/checkondel/:id\", reqSignedIn, GetInfluxAffectOnDel)\n\t\tm.Post(\"/ping/\", reqSignedIn, bind(config.InfluxCfg{}), PingInfluxServer)\n\t})\n\n\treturn nil\n}", "func NewSchema(m ...interface{}) *Schema {\n\tif len(m) > 0 {\n\t\tsche := &Schema{}\n\t\tstack := toMiddleware(m)\n\t\tfor _, s := range stack {\n\t\t\t*sche = append(*sche, s)\n\t\t}\n\t\treturn sche\n\t}\n\treturn nil\n}", "func (m *Manager) AddInbound(ctx context.Context, p *peer.Peer, group NeighborsGroup,\n\tconnectOpts ...server.ConnectPeerOption) error {\n\treturn m.addNeighbor(ctx, p, group, m.server.AcceptPeer, connectOpts)\n}", "func NewIpsecServer(ctx *pulumi.Context,\n\tname string, args *IpsecServerArgs, opts ...pulumi.ResourceOption) (*IpsecServer, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ClientIpPool == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ClientIpPool'\")\n\t}\n\tif args.LocalSubnet == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'LocalSubnet'\")\n\t}\n\tif args.VpnGatewayId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'VpnGatewayId'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource IpsecServer\n\terr := ctx.RegisterResource(\"alicloud:vpn/ipsecServer:IpsecServer\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewUnaryServerInterceptor(gcpProjectID string) grpc.UnaryServerInterceptor {\n\treturn func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {\n\t\tincomingMetadata, _ := metadata.FromIncomingContext(ctx)\n\t\tmetadataCopy := incomingMetadata.Copy()\n\t\t_, spanCtx := otelgrpc.Extract(ctx, &metadataCopy)\n\n\t\tif spanCtx.IsValid() {\n\t\t\tt := traceInfo{ProjectID: gcpProjectID, TraceID: spanCtx.TraceID().String(), SpanID: spanCtx.SpanID().String()}\n\t\t\tctx = ctxzap.ToContext(ctx, ctxzap.Extract(ctx).With(\n\t\t\t\tzapdriver.TraceContext(t.TraceID, t.SpanID, true, t.ProjectID)...,\n\t\t\t))\n\t\t}\n\n\t\treqJsonBytes, _ := json.Marshal(req)\n\t\tLogger(ctx).Info(\n\t\t\tinfo.FullMethod,\n\t\t\tzap.ByteString(\"params\", reqJsonBytes),\n\t\t)\n\n\t\treturn handler(ctx, req)\n\t}\n}", "func NewServer(registered Controllers) (Server, error) {\n\n\tspec, err := loads.Analyzed(rest.FlatSwaggerJSON, \"\")\n\tif err != nil {\n\t\treturn Server{}, err\n\t}\n\n\tapi := operation.NewRollpayAPI(spec)\n\tapi.JSONConsumer = runtime.JSONConsumer()\n\tapi.JSONProducer = runtime.JSONProducer()\n\tapi.ServerShutdown = func() {}\n\n\tfor _, r := range registered.Controllers {\n\t\tr.Register(api)\n\t}\n\n\treturn Server{api.Serve(nil)}, nil\n}", "func AddServer(w http.ResponseWriter, r *http.Request) {\n\tvar newServer Server\n\n\t// Read the body\n\tbody, err := ioutil.ReadAll(r.Body)\n\n\tif err != nil {\n\t\tlog.Print(err.Error())\n\t\t// Error while reading the body...\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif err := json.Unmarshal(body, &newServer); err == nil {\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tservers[newServer.Name] = newServer\n\n\t\tlog.Println(\"Registered \" + newServer.Name)\n\t} else {\n\t\t// If we can't unmarshal the json, we're assuming the client made a mistake\n\t\t// in formatting their request\n\t\tlog.Println(err.Error())\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t}\n\n}", "func NewServer() (*Server, error) {\n\tdb, err := sql.NewSQL()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpersonService, err := sql.NewPersonService(db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := gin.Default()\n\t{\n\t\troute := r.Group(\"/person\")\n\t\tctrl := controllers.NewPerson(personService)\n\n\t\troute.POST(\"\", ctrl.Post)\n\t\troute.PUT(\"/:id\", ctrl.Put)\n\t\troute.GET(\"/:id\", ctrl.Get)\n\t\troute.DELETE(\"/:id\", ctrl.Delete)\n\t}\n\n\treturn &Server{\n\t\tPersonService: personService,\n\t\tGin: r,\n\t}, nil\n}", "func (in *Inbound) DeepCopy() *Inbound {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Inbound)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewServerConfigImportAllOf(classId string, objectType string) *ServerConfigImportAllOf {\n\tthis := ServerConfigImportAllOf{}\n\tthis.ClassId = classId\n\tthis.ObjectType = objectType\n\treturn &this\n}", "func UnaryServerInterceptor(privilegeFunc PrivilegeFunc) grpc.UnaryServerInterceptor {\n\tinitPolicyModel()\n\treturn func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {\n\t\tnewCtx, err := privilegeFunc(ctx, req)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn handler(newCtx, req)\n\t}\n}", "func newServerCodec(conn io.ReadWriteCloser, srv interface{}) *serverCodec {\n\treturn &serverCodec{\n\t\tdec: json.NewDecoder(conn),\n\t\tenc: json.NewEncoder(conn),\n\t\tc: conn,\n\t\tsrv: srv,\n\t\tpending: make(map[uint64]*json.RawMessage),\n\t}\n}", "func NewServerSideReader(r io.Reader) *Reader {\n\treturn NewReader(r, ws.StateServerSide)\n}", "func (s *BasePlSqlParserListener) EnterNew_index_name(ctx *New_index_nameContext) {}", "func New(cfg tapr.Config, inv inv.Inventory) http.Handler {\n\ts := &server{\n\t\tconfig: cfg,\n\t\tinv: inv,\n\t}\n\n\treturn rpc.NewServer(cfg, rpc.Service{\n\t\tName: \"inv\",\n\t\tMethods: map[string]rpc.Method{\n\t\t\t\"volumes\": s.Volumes,\n\t\t},\n\t})\n}", "func (s *BasePlSqlParserListener) EnterNew_tablespace_name(ctx *New_tablespace_nameContext) {}", "func newServer(ctx context.Context, logger zerolog.Logger, dsn datastore.PGDatasourceName) (*server.Server, func(), error) {\n\t// This will be filled in by Wire with providers from the provider sets in\n\t// wire.Build.\n\twire.Build(\n\t\twire.InterfaceValue(new(trace.Exporter), trace.Exporter(nil)),\n\t\tgoCloudServerSet,\n\t\tapplicationSet,\n\t\tappHealthChecks,\n\t\twire.Struct(new(server.Options), \"HealthChecks\", \"TraceExporter\", \"DefaultSamplingPolicy\", \"Driver\"),\n\t\tdatastore.NewDB,\n\t\twire.Bind(new(datastore.Datastorer), new(*datastore.Datastore)),\n\t\tdatastore.NewDatastore)\n\treturn nil, nil, nil\n}", "func NewServer(kind, name, addr, namespace string) *types.ServerV2 {\n\treturn &types.ServerV2{\n\t\tKind: kind,\n\t\tVersion: types.V2,\n\t\tMetadata: types.Metadata{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSpec: types.ServerSpecV2{\n\t\t\tAddr: addr,\n\t\t},\n\t}\n}", "func NewServer(ops ServerOps) *Server {\n\treturn &Server{ops: ops}\n}", "func newServerMethod(apiDef *raml.APIDefinition, r *raml.Resource, rd *cr.Resource, m *raml.Method,\n\tmethodName string) cr.MethodInterface {\n\n\t// creates generic method\n\tmi, err := newMethod(apiDef, r, rd, m, methodName)\n\tif err != nil {\n\t\tlog.Fatalf(\"newServerMethod unexpected error:%v\", err)\n\t}\n\n\treturn mi\n}", "func NewInputServer(storage ProtectedStorage) InputServer {\n\treturn &inputServer{storage: storage}\n}", "func New(e *step.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tListH: NewListHandler(e.List, uh),\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t\tRemoveH: NewRemoveHandler(e.Remove, uh),\n\t\tUpdateH: NewUpdateHandler(e.Update, uh),\n\t}\n}", "func NewServer(tokens []string, handlers []Handler) *Server {\n\tt := make(map[string]bool)\n\tfor _, v := range tokens {\n\t\tt[v] = true\n\t}\n\treturn &Server{\n\t\ttokens: t,\n\t\thandlers: handlers,\n\t}\n}", "func New(e *calc.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t}\n}", "func NewServer(name string, ip interface{}, port int) *Server {\n\ts := new(Server)\n\ts.Name = name\n\tswitch ip := ip.(type) {\n\tcase net.IP:\n\t\ts.Ipaddr = ip\n\tcase string:\n\t\ts.Ipaddr = net.ParseIP(ip)\n\t}\n\ts.Port = port\n\treturn s\n}", "func createServer(w http.ResponseWriter, r *http.Request) {\n w.Header().Set(\"Content-Type\", \"application/json\")\n\n\tvar newServer server\n\treqBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t fmt.Println(err)\n\t\tfmt.Fprintf(w, \"Kindly enter data with the server's address, MSA and MTA network addresses only in order to create new server\")\n\t w.WriteHeader(http.StatusInternalServerError)\n\t return\n\t}\n\tnewServer.ID = strconv.Itoa(len(servers)+1)\n\n\tjson.Unmarshal(reqBody, &newServer)\n\tservers = append(servers, newServer)\n\tw.WriteHeader(http.StatusCreated)\n\n\tjson.NewEncoder(w).Encode(newServer)\n}", "func NewInboundRequest(\n baseRequest *http.Request,\n pathParams PathParams,\n) *InboundRequest {\n req := &InboundRequest{\n Request: *baseRequest,\n PathParams: pathParams,\n }\n return req\n}", "func newServer(deps dependencies) Component {\n\treturn newServerCompat(deps.Config, deps.Log, deps.Replay, deps.Debug, deps.Params.Serverless)\n}", "func (ServerEvent) Schema() string { return \"HTTPServer\" }", "func (s *BasePlSqlParserListener) EnterNew_constraint_name(ctx *New_constraint_nameContext) {}", "func (req *DiskCreateInput) ToServerCreateInput() *ServerCreateInput {\n\tinput := ServerCreateInput{\n\t\tServerConfigs: &ServerConfigs{\n\t\t\tPreferManager: req.PreferManager,\n\t\t\tPreferRegion: req.PreferRegion,\n\t\t\tPreferZone: req.PreferZone,\n\t\t\tPreferWire: req.PreferWire,\n\t\t\tPreferHost: req.PreferHost,\n\t\t\tHypervisor: req.Hypervisor,\n\t\t\tDisks: []*DiskConfig{req.DiskConfig},\n\t\t\t// Project: req.Project,\n\t\t\t// Domain: req.Domain,\n\t\t},\n\t}\n\tinput.Name = req.Name\n\tinput.ProjectId = req.ProjectId\n\tinput.ProjectDomainId = req.ProjectDomainId\n\treturn &input\n}", "func NewServer1Schema(name string) *tengo.Schema {\n\treturn newSchema(DSN1, name)\n}", "func AddInfluxServer(ctx *Context, dev config.InfluxCfg) {\n\t// swagger:operation POST /cfg/influxservers Config_InfluxServers AddInfluxServer\n\t//---\n\t// summary: Add new Influx Server Config\n\t// description: Add InfluxServer from Data\n\t// tags:\n\t// - \"Influx Servers Config\"\n\t//\n\t// parameters:\n\t// - name: InfluxCfg\n\t// in: body\n\t// description: InfluxConfig to add\n\t// required: true\n\t// schema:\n\t// \"$ref\": \"#/definitions/InfluxCfg\"\n\t//\n\t// responses:\n\t// '200':\n\t// description: \"OK\"\n\t// schema:\n\t// \"$ref\": \"#/definitions/InfluxCfg\"\n\t// '404':\n\t// description: unexpected error\n\t// schema:\n\t// \"$ref\": \"#/responses/idOfStringResp\"\n\tlog.Printf(\"ADDING Influx Backend %+v\", dev)\n\taffected, err := agent.MainConfig.Database.AddInfluxCfg(dev)\n\tif err != nil {\n\t\tlog.Warningf(\"Error on insert new Backend %s , affected : %+v , error: %s\", dev.ID, affected, err)\n\t\tctx.JSON(404, err.Error())\n\t} else {\n\t\t// TODO: review if needed return data or affected\n\t\tctx.JSON(200, &dev)\n\t}\n}", "func NewServer(store db.Store) *Server {\n\tserver := &Server{\n\t\tstore: store,\n\t}\n\trouter := gin.Default()\n\tif v, ok := binding.Validator.Engine().(*validator.Validate); ok{\n\t\tv.RegisterValidation(\"currency\", validCurrency)\n\t}\n\n\trouter.POST(\"/accounts\", server.createAccount)\n\trouter.GET(\"/accounts/:id\", server.getAccount)\n\trouter.GET(\"/accounts\", server.listAccount)\n\trouter.DELETE(\"/accounts/:id\", server.deleteAccount)\n\n\trouter.POST(\"/transfers\", server.createTransfer)\n\n\trouter.POST(\"/users\", server.createUser)\n\n\tserver.router = router\n\treturn server\n}", "func PersistentIpNetwork_NewServer(s PersistentIpNetwork_Server, policy *server.Policy) *server.Server {\n\tc, _ := s.(server.Shutdowner)\n\treturn server.New(PersistentIpNetwork_Methods(nil, s), s, c, policy)\n}", "func NewServer(store db.Store) *Server {\n\tserver := &Server{store: store}\n\trouter := gin.Default()\n\n\trouter.POST(\"/account\", server.createAccount)\n\trouter.GET(\"/account/:id\", server.getAccount)\n\trouter.GET(\"/account\", server.listAccount)\n\t// add routes to router\n\n\tserver.router = router\n\treturn server\n}", "func New(sto store.Service) *server {\n\ts := &server{sto: sto}\n\n\trouter := mux.NewRouter()\n\n\trouter.Handle(\"/todo\", allowedMethods(\n\t\t[]string{\"OPTIONS\", \"GET\", \"POST\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"GET\": http.HandlerFunc(s.getTodos),\n\t\t\t\"POST\": http.HandlerFunc(s.createTodo),\n\t\t}))\n\n\trouter.Handle(\"/todo/{id}\", idMiddleware(allowedMethods(\n\t\t[]string{\"OPTIONS\", \"GET\", \"PUT\", \"PATCH\", \"DELETE\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"GET\": http.HandlerFunc(s.getTodo),\n\t\t\t\"PUT\": http.HandlerFunc(s.putTodo),\n\t\t\t\"PATCH\": http.HandlerFunc(s.patchTodo),\n\t\t\t\"DELETE\": http.HandlerFunc(s.deleteTodo),\n\t\t})))\n\n\ts.handler = limitBody(defaultHeaders(router))\n\n\treturn s\n}", "func NewServer(config *config.Config, appCache *cache.AppCache, mySql *db.MysqlDB) *HttpServer {\n\ts := Server{\n\t\tConfig: config,\n\t\tInventory: &service.Inventory{\n\t\t\tAppCache: appCache,\n\t\t\tMysql: mySql,\n\t\t},\n\t}\n\n\t// Create a HTTP server for prometheus.\n\tserveMux := http.NewServeMux()\n\tserveMux.HandleFunc(\"/getQuantity\", func(res http.ResponseWriter, req *http.Request) {\n\t\ts.getQuantity(res, req)\n\t})\n\tserveMux.HandleFunc(\"/addQuantity\", func(res http.ResponseWriter, req *http.Request) {\n\t\ts.addQuantity(res, req)\n\t})\n\tserveMux.HandleFunc(\"/addNegativeQuantity\", func(res http.ResponseWriter, req *http.Request) {\n\t\ts.addNegativeQuantity(res, req)\n\t})\n\n\treturn &HttpServer{\n\t\tServeMux: serveMux,\n\t\tConfig: config,\n\t}\n}", "func NewMockUnaryInbound(ctrl *gomock.Controller) *MockUnaryInbound {\n\tmock := &MockUnaryInbound{ctrl: ctrl}\n\tmock.recorder = &MockUnaryInboundMockRecorder{mock}\n\treturn mock\n}", "func NewServer() *Server {}", "func NewServerInterrupt(prev io.Reader) gengokit.Renderable {\n\treturn &ServerInterruptRender{\n\t\tprev: prev,\n\t}\n}", "func ServeNew(w http.ResponseWriter, r *http.Request) {\n\tvar data newReq\n\n\tID, err := ulid.New(ulid.Now(), entropy)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\terr = json.NewDecoder(r.Body).Decode(&data)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tnewH := NewHMST(data.Resolution, data.MaxTime, data.Keys)\n\tregistry[ID.String()] = newH\n\tlog.Println(\"/new\", ID.String(), data, len(newH.Registers))\n\tfmt.Fprintf(w, \"%v\", ID)\n}", "func RegisterOcpRoadmapApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OcpRoadmapApiServer) error {\n\n\tmux.Handle(\"POST\", pattern_OcpRoadmapApi_CreateRoadmap_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_OcpRoadmapApi_CreateRoadmap_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_OcpRoadmapApi_CreateRoadmap_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_OcpRoadmapApi_MultiCreateRoadmaps_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_OcpRoadmapApi_MultiCreateRoadmaps_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_OcpRoadmapApi_MultiCreateRoadmaps_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_OcpRoadmapApi_UpdateRoadmap_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_OcpRoadmapApi_UpdateRoadmap_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_OcpRoadmapApi_UpdateRoadmap_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_OcpRoadmapApi_DescribeRoadmap_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_OcpRoadmapApi_DescribeRoadmap_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_OcpRoadmapApi_DescribeRoadmap_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_OcpRoadmapApi_ListRoadmap_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_OcpRoadmapApi_ListRoadmap_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_OcpRoadmapApi_ListRoadmap_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_OcpRoadmapApi_RemoveRoadmap_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_OcpRoadmapApi_RemoveRoadmap_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_OcpRoadmapApi_RemoveRoadmap_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func NewServerName() *ServerName {\n\tthis := ServerName{}\n\treturn &this\n}", "func NewServer(cells ...string) topo.Server {\n\treturn topo.Server{Impl: New(cells...)}\n}", "func NewUnary() grpc.UnaryServerInterceptor {\n\tinterceptor := func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {\n\t\tif md, ok := metadata.FromIncomingContext(ctx); ok {\n\t\t\tif lst, ok := md[ctxpkg.UserAgentHeader]; ok && len(lst) != 0 {\n\t\t\t\tctx = metadata.AppendToOutgoingContext(ctx, ctxpkg.UserAgentHeader, lst[0])\n\t\t\t}\n\t\t}\n\t\treturn handler(ctx, req)\n\t}\n\treturn interceptor\n}", "func New(prefix string, gIndex *osm.Data, styles map[string]map[string]config.Style) *Server {\n\treturn &Server{\n\t\tprefix: prefix,\n\t\tgIndex: gIndex,\n\t\tstyles: styles,\n\t}\n}", "func NewNameIn(vs ...string) predicate.User {\n\treturn predicate.User(sql.FieldIn(FieldNewName, vs...))\n}", "func OngoingNotification_NewServer(s OngoingNotification_Server, policy *server.Policy) *server.Server {\n\tc, _ := s.(server.Shutdowner)\n\treturn server.New(OngoingNotification_Methods(nil, s), s, c, policy)\n}", "func CloneServerIncomingData(ctx context.Context) metadata.MD {\n\tmd, ok := metadata.FromIncomingContext(ctx)\n\tif !ok {\n\t\treturn metadata.MD{}\n\t}\n\n\t//return a copy\n\treturn md.Copy()\n}", "func RegisterHandinServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HandinServiceServer) error {\n\n\tmux.Handle(\"GET\", pattern_HandinService_HandinSearch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HandinService_HandinSearch_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HandinService_HandinSearch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_HandinService_HandinCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HandinService_HandinCreate_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HandinService_HandinCreate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HandinService_HandinRead_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HandinService_HandinRead_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HandinService_HandinRead_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_HandinService_HandinUpdate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HandinService_HandinUpdate_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HandinService_HandinUpdate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_HandinService_HandinDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HandinService_HandinDelete_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HandinService_HandinDelete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PATCH\", pattern_HandinService_HandinPatch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HandinService_HandinPatch_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HandinService_HandinPatch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func NewServer() *gin.Engine {\n\te := gin.New()\n\n\t// -----define routres here------\n\tv1 := e.Group(\"/v1\")\n\t{\n\t\tuserGroup := v1.Group(\"/user\")\n\t\t{\n\t\t\tuserGroup.POST(\"/add\", controllers.AddUser)\n\t\t\tuserGroup.POST(\"/delete\", controllers.DeleteUSer)\n\t\t}\n\n\t\troleGroup := v1.Group(\"/role\")\n\t\t{\n\t\t\troleGroup.POST(\"/add\", controllers.AddRole)\n\t\t\troleGroup.POST(\"/delete\", controllers.DeleteRole)\n\t\t}\n\n\t\tresourceGroup := v1.Group(\"/resource\")\n\t\t{\n\t\t\tresourceGroup.POST(\"/add\", controllers.AddResource)\n\t\t\tresourceGroup.POST(\"/delete\", controllers.DeleteResource)\n\t\t}\n\n\t\tauthGroup := v1.Group(\"/auth\")\n\t\t{\n\t\t\tauthGroup.POST(\"/start\", controllers.StartAuth)\n\t\t\tauthGroup.POST(\"/verify\", controllers.VerifyAuth)\n\t\t\t// authGroup.POST(\"/end\")\n\t\t}\n\t}\n\n\t// -----end routers define-------\n\n\treturn e\n}", "func NewServer(run func(string, *sf.DB) *sf.PipeReader, db *sf.DB) *server {\n\treturn &server{run: run, db: db}\n}", "func NewServer() *gin.Engine {\n\tr := gin.Default()\n\n\tsetMetricsCollectors(r)\n\n\tr.GET(\"/ping\", pingHandler)\n\tr.GET(\"/metrics\", gin.WrapH(promhttp.Handler()))\n\n\treturn r\n}", "func NewServer(getter Getter) *AgentServer {\n\treturn &AgentServer{getAgent: getter}\n}", "func NewServer(config *ServerConfig) (*Server, errors.Error) {\n\tengine := gin.New()\n\tserver := &Server{*config, engine, nil, make(map[string]Service, 0)}\n\n\t// global middlewares\n\tengine.Use(ginLogger)\n\n\t// metrics\n\tp := ginprometheus.NewPrometheus(config.SubSystemName)\n\tp.ReqCntURLLabelMappingFn = func(c *gin.Context) string {\n\t\turl := c.Request.URL.String()\n\t\tfor _, p := range c.Params {\n\t\t\tif p.Key == \"id\" {\n\t\t\t\turl = strings.Replace(url, p.Value, \":id\", 1)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn url\n\t}\n\tp.Use(engine)\n\n\t// server specific routes\n\tengine.GET(\"/healthz\", server.handleGetHealthz)\n\tengine.GET(\"/readiness\", server.handleGetReadiness)\n\n\treturn server, nil\n}", "func New(\n\tserverID string,\n\ttracer *zipkin.Tracer,\n\tfS fetching.Service,\n\taS adding.Service,\n\tmS modifying.Service,\n\trS removing.Service,\n) Server {\n\ta := &server{\n\t\tserverID: serverID,\n\t\ttracer: tracer,\n\t\tfetching: fS,\n\t\tadding: aS,\n\t\tmodifying: mS,\n\t\tremoving: rS}\n\trouter(a)\n\n\treturn a\n}", "func New(\n\tserverID string,\n\ttracer *zipkin.Tracer,\n\tfS fetching.Service,\n\taS adding.Service,\n\tmS modifying.Service,\n\trS removing.Service,\n) Server {\n\ta := &server{\n\t\tserverID: serverID,\n\t\ttracer: tracer,\n\t\tfetching: fS,\n\t\tadding: aS,\n\t\tmodifying: mS,\n\t\tremoving: rS}\n\trouter(a)\n\n\treturn a\n}", "func NewServer(realm string, a AuthHandler,reply net.IP,port func()int) *Server {\n\tconst maxStunMessageSize = 1500\n\treturn &Server{\n\t\tpacket: make([]byte, maxStunMessageSize),\n\t\trealm: realm,\n\t\tauthHandler: a,\n\t\treply:reply,\n\t\tport: port,\n\t}\n}", "func NewServerSideEncryption(alg string) *ServerSideEncryption{\n\treturn &ServerSideEncryption{Algorithm:alg}\n}", "func NewIngressSidecar(nodeIP net.IP, lb *lbapi.LoadBalancer) (*IngressSidecar, error) {\n\tnodeInfo, err := corenet.InterfaceByIP(nodeIP.String())\n\tif err != nil {\n\t\tlog.Error(\"get node info err\", log.Fields{\"err\": err})\n\t\treturn nil, err\n\t}\n\texecer := k8sexec.New()\n\tdbus := utildbus.New()\n\tiptInterface := iptables.New(execer, dbus, iptables.ProtocolIpv4)\n\n\tsidecar := &IngressSidecar{\n\t\tnodeInfo: nodeInfo,\n\t\tsysctlDefault: make(map[string]string),\n\t\tipt: iptInterface,\n\t}\n\n\treturn sidecar, nil\n}", "func ServerInterceptor(keys ...interface{}) gin.HandlerFunc {\n\treturn func(ctx *gin.Context) {\n\t\tnewContextForHandleRequestID(ctx, keys...)\n\t\tctx.Next() // execute all the handlers\n\t}\n}", "func (client *ServersClient) importDatabaseCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters ImportNewDatabaseDefinition, options *ServersClientBeginImportDatabaseOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serverName == \"\" {\n\t\treturn nil, errors.New(\"parameter serverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serverName}\", url.PathEscape(serverName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, parameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "func NewTokenIn(vs ...string) predicate.User {\n\treturn predicate.User(sql.FieldIn(FieldNewToken, vs...))\n}", "func NewOIDCServer(serverFlow ServerFlowType, serverIP, serverPort, publicKeyPath, privateKeyPath string, devMode bool) OIDCServer {\n\n\treturn &oidcServer{\n\t\trsa: newRSAProcessor(serverFlow, publicKeyPath, privateKeyPath),\n\t\tkeyID: uuid.Must(uuid.NewV4()).String(),\n\t\tserverIP: serverIP,\n\t\tserverPort: serverPort,\n\t\tserverFlow: serverFlow,\n\t\tdevMode: devMode,\n\t}\n}", "func (s *BasePlSqlParserListener) EnterSchema_name(ctx *Schema_nameContext) {}", "func (a *FrinxOpenconfigNetworkInstanceApiService) PutFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2GlobalInterAreaPropagationPoliciesInterAreaPropagationPolicy(ctx context.Context, name string, identifier string, protocolName string, srcArea string, dstArea string, frinxOpenconfigOspfv2Ospfv2globalstructuralGlobalInterareapropagationpoliciesInterAreaPropagationPolicyBodyParam FrinxOpenconfigOspfv2Ospfv2globalstructuralGlobalInterareapropagationpoliciesInterAreaPropagationPolicyRequest, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:inter-area-propagation-policies/frinx-openconfig-network-instance:inter-area-propagation-policy/{src-area}/{dst-area}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"src-area\"+\"}\", fmt.Sprintf(\"%v\", srcArea), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"dst-area\"+\"}\", fmt.Sprintf(\"%v\", dstArea), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &frinxOpenconfigOspfv2Ospfv2globalstructuralGlobalInterareapropagationpoliciesInterAreaPropagationPolicyBodyParam\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func New(e *calc.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tDivideH: NewDivideHandler(e.Divide, uh),\n\t}\n}", "func newServer() (server, error) {\n\t// Connect to postgresql.\n\tdb, err := sqlx.Open(\"postgres\", \"postgres://postgres@localhost?sslmode=disable\")\n\tif err != nil {\n\t\treturn server{}, err\n\t}\n\n\t// Load a schema from disk. JDDF and jddf-go are agnostic to how you load your\n\t// schemas; ultimately, you could hard-code them, pass them in from\n\t// environment variables, download them from the network, or whatever other\n\t// approach best meets your requirements.\n\teventSchemaFile, err := os.Open(\"event.jddf.json\")\n\tif err != nil {\n\t\treturn server{}, err\n\t}\n\n\tdefer eventSchemaFile.Close()\n\n\t// Here, we parse a jddf.Schema from the JSON inside the \"event.jddf.json\"\n\t// file.\n\t//\n\t// You can, if you prefer, also hard-code schemas using native Golang syntax.\n\t// The README of jddf-go shows you how:\n\t//\n\t// https://github.com/jddf/jddf-go\n\tvar eventSchema jddf.Schema\n\tschemaDecoder := json.NewDecoder(eventSchemaFile)\n\tif err := schemaDecoder.Decode(&eventSchema); err != nil {\n\t\treturn server{}, err\n\t}\n\n\t// Return the server with everything it needs. The main function will handle\n\t// serving HTTP traffic using this server.\n\treturn server{\n\t\tEventSchema: eventSchema,\n\t\tDB: db,\n\t}, nil\n}", "func NewUnaryMiddleware(opts ...MiddlewareOption) *OutboundMiddleware {\n\toptions := defaultMiddlewareOptions\n\tfor _, opt := range opts {\n\t\topt.apply(&options)\n\t}\n\treturn &OutboundMiddleware{\n\t\tprovider: options.policyProvider,\n\t\tobserver: newObserver(options.scope),\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) PutFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceLsaFilter(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, frinxOpenconfigOspfv2Ospfv2areainterfacesstructureInterfacesInterfaceLsaFilterBodyParam FrinxOpenconfigOspfv2Ospfv2areainterfacesstructureInterfacesInterfaceLsaFilterRequest, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:lsa-filter/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &frinxOpenconfigOspfv2Ospfv2areainterfacesstructureInterfacesInterfaceLsaFilterBodyParam\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (s *BasePlSqlParserListener) EnterCreate_synonym(ctx *Create_synonymContext) {}", "func NewSideload(parents []ast.Node) *SideloadNode {\n\treturn &SideloadNode{\n\t\tFunction{\n\t\t\tParents: parents,\n\t\t},\n\t}\n}", "func CreateNewServer() *exchangeServer {\n\treturn &exchangeServer{make(map[string]Endpoint), nil}\n}", "func (self *journeyPlanner) planInbound(j * journey, pp flap.Passport, startOfDay flap.EpochTime,fe *flap.Engine) error {\n\t\n\t// Create return journey for last day of trip\n\toutboundStartOfDay := j.flight.Start - j.flight.Start % flap.SecondsInDay\n\tf,err := self.buildFlight(j.flight.ToAirport,j.flight.FromAirport,outboundStartOfDay + flap.EpochTime(j.length*flap.SecondsInDay),fe)\n\tif (err != nil) {\n\t\treturn err\n\t}\n\tjin := journey{jt:jtInbound,flight:*f,length:j.length}\n\treturn self.addJourney(pp,jin)\n}", "func UnaryServerInterceptor(label string) grpc.UnaryServerInterceptor {\n\treturn func(\n\t\tctx context.Context,\n\t\treq interface{},\n\t\tinfo *grpc.UnaryServerInfo,\n\t\thandler grpc.UnaryHandler,\n\t) (interface{}, error) {\n\t\tstarted := time.Now()\n\t\tmd, _ := metadata.FromIncomingContext(ctx)\n\t\tmetadataCopy := md.Copy()\n\n\t\ttracer := otel.Tracer(label)\n\t\tprop := otel.GetTextMapPropagator()\n\t\tctx = prop.Extract(ctx, &metadataSupplier{\n\t\t\tmetadata: &metadataCopy,\n\t\t})\n\n\t\tctx, span := tracer.Start(ctx, info.FullMethod)\n\t\tctx = logz.StartCollectingSeverity(ctx)\n\n\t\tvar res interface{}\n\t\tvar err error\n\t\tdefer func() {\n\t\t\tua, ip := extractUAAndIP(md)\n\t\t\treqSize := binarySize(req)\n\t\t\tresSize := binarySize(res)\n\t\t\tcode := httpStatusFromCode(status.Code(err))\n\n\t\t\tlogz.AccessLog(ctx, \"gRPC Unary\", info.FullMethod,\n\t\t\t\tua, ip, \"HTTP/2\",\n\t\t\t\tcode, reqSize, resSize, time.Since(started))\n\t\t\tspan.End()\n\t\t}()\n\n\t\tres, err = handler(ctx, req)\n\t\treturn res, err\n\t}\n}", "func NewNameIn(vs ...string) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldNewName), v...))\n\t})\n}", "func NewServer2Schema(name string) *tengo.Schema {\n\treturn newSchema(DSN2, name)\n}", "func NewServerless(key *rsa.PrivateKey, mongoURI, jwksURL, prefix string) *TodoServer {\n\trouter := mux.NewRouter().PathPrefix(prefix).Subrouter()\n\tdb := NewMongoRepository(mongoURI, \"togo\", \"todos\")\n\tjwt := createJWT(jwksURL)\n\n\t// Build UserServer struct\n\ts := &TodoServer{\n\t\tnil,\n\t\trouter,\n\t\tdb,\n\t\tjwt,\n\t}\n\n\tsetRoutes(s)\n\treturn s\n}", "func RegisterSRTInbound(server *server.Server, id string, options map[string]interface{}) (server.Inbound, error) {\n\topt := &SRTInboundOptions{}\n\tif err := mapstructure.Decode(options, opt); err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewSrtpInbound(opt)\n}", "func CreateFailoverHandler(w http.ResponseWriter, r *http.Request) {\n\tvar ns string\n\n\tlog.Debug(\"failoverservice.CreateFailoverHandler called\")\n\n\tvar request msgs.CreateFailoverRequest\n\t_ = json.NewDecoder(r.Body).Decode(&request)\n\n\tusername, err := apiserver.Authn(apiserver.CREATE_FAILOVER_PERM, w, r)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tw.Header().Set(\"WWW-Authenticate\", `Basic realm=\"Restricted\"`)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\n\tresp := msgs.CreateFailoverResponse{}\n\tresp.Status = msgs.Status{Code: msgs.Ok, Msg: \"\"}\n\n\tif request.ClientVersion != msgs.PGO_VERSION {\n\t\tresp.Status = msgs.Status{Code: msgs.Error, Msg: apiserver.VERSION_MISMATCH_ERROR}\n\t\tjson.NewEncoder(w).Encode(resp)\n\t\treturn\n\t}\n\n\tns, err = apiserver.GetNamespace(apiserver.Clientset, username, request.Namespace)\n\tif err != nil {\n\t\tresp.Status = msgs.Status{Code: msgs.Error, Msg: err.Error()}\n\t\tjson.NewEncoder(w).Encode(resp)\n\t\treturn\n\t}\n\n\tresp = CreateFailover(&request, ns)\n\n\tjson.NewEncoder(w).Encode(resp)\n}", "func mkServerInterceptor(s *GrpcServer) func(ctx context.Context,\n\treq interface{},\n\tinfo *grpc.UnaryServerInfo,\n\thandler grpc.UnaryHandler) (interface{}, error) {\n\n\treturn func(ctx context.Context,\n\t\treq interface{},\n\t\tinfo *grpc.UnaryServerInfo,\n\t\thandler grpc.UnaryHandler) (interface{}, error) {\n\n\t\tif (s.probe != nil) && (!s.probe.IsReady()) {\n\t\t\tlogger.Warnf(ctx, \"Grpc request received while not ready %v\", req)\n\t\t\treturn nil, status.Error(codes.Unavailable, \"system is not ready\")\n\t\t}\n\n\t\t// Calls the handler\n\t\th, err := handler(ctx, req)\n\n\t\treturn h, err\n\t}\n}", "func newServer() *negroni.Negroni {\n\tn := negroni.Classic()\n\tn.UseHandler(router())\n\treturn n\n}", "func New(e *goastarter.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t}\n}", "func RegisterInsuranceAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InsuranceAPIServer) error {\n\n\tmux.Handle(\"POST\", pattern_InsuranceAPI_AddInsurance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_InsuranceAPI_AddInsurance_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_InsuranceAPI_AddInsurance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_InsuranceAPI_GetInsurance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_InsuranceAPI_GetInsurance_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_InsuranceAPI_GetInsurance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_InsuranceAPI_DeleteInsurance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_InsuranceAPI_DeleteInsurance_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_InsuranceAPI_DeleteInsurance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_InsuranceAPI_UpdateInsurance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_InsuranceAPI_UpdateInsurance_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_InsuranceAPI_UpdateInsurance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_InsuranceAPI_ListInsurances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_InsuranceAPI_ListInsurances_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_InsuranceAPI_ListInsurances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_InsuranceAPI_SearchInsurances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_InsuranceAPI_SearchInsurances_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_InsuranceAPI_SearchInsurances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_InsuranceAPI_CheckSuspension_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_InsuranceAPI_CheckSuspension_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_InsuranceAPI_CheckSuspension_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func IpInterface_ServerToClient(s IpInterface_Server, policy *server.Policy) IpInterface {\n\treturn IpInterface{Client: capnp.NewClient(IpInterface_NewServer(s, policy))}\n}" ]
[ "0.58123165", "0.5554681", "0.5085616", "0.4942123", "0.4878319", "0.4824779", "0.47652727", "0.4713226", "0.46697146", "0.46233314", "0.46086112", "0.46034107", "0.45806482", "0.45372304", "0.4427155", "0.43847805", "0.43702087", "0.43596688", "0.43563846", "0.43306634", "0.43288085", "0.42469963", "0.42420462", "0.4238561", "0.42300025", "0.42267087", "0.4220288", "0.42168763", "0.4198115", "0.41930082", "0.41762966", "0.41727832", "0.41723537", "0.41698098", "0.41536874", "0.41491163", "0.4148584", "0.41456947", "0.41447175", "0.4143853", "0.413988", "0.41398013", "0.4129876", "0.41288614", "0.4123169", "0.41206798", "0.4118833", "0.41098058", "0.41020852", "0.40996534", "0.40989628", "0.40952036", "0.40930942", "0.408707", "0.40870237", "0.40829295", "0.40749708", "0.40641898", "0.40640885", "0.40576878", "0.4055728", "0.40535375", "0.40515825", "0.4047768", "0.40451315", "0.4042365", "0.40407476", "0.4038436", "0.40375262", "0.40370348", "0.4036726", "0.4036726", "0.4020521", "0.40202007", "0.40161946", "0.4016078", "0.40158987", "0.40147856", "0.40131536", "0.4006492", "0.4003987", "0.4002327", "0.40008086", "0.39954415", "0.39927128", "0.39906335", "0.39877132", "0.39876541", "0.39840198", "0.39736858", "0.39708805", "0.3970799", "0.39696446", "0.39693925", "0.39681524", "0.39650992", "0.39634013", "0.39633015", "0.3955668", "0.39477828" ]
0.8087149
0
NewHTTPClientOp creates a new schema for HTTP client outbound operations.
func NewHTTPClientOp(opts ...Option) *Schema { return NewClientOutboundOp("http", opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewHTTPServerOp(opts ...Option) *Schema {\n\treturn NewServerInboundOp(\"http\", opts...)\n}", "func NewClientOutboundOp(system string, opts ...Option) *Schema {\n\tcfg := &config{}\n\tfor _, opt := range opts {\n\t\topt(cfg)\n\t}\n\treturn New(&clientOutboundOp{cfg: cfg, system: system})\n}", "func NewGRPCClientOp(opts ...Option) *Schema {\n\treturn NewClientOutboundOp(\"grpc\", opts...)\n}", "func NewHTTPClient(options ...Opt) *HTTP {\n\tc := &HTTP{\n\t\tHTTPClient: &http.Client{},\n\t}\n\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n\n\tif c.latestManifestURLFmt == \"\" {\n\t\tc.latestManifestURLFmt = defaultLatestManifestURLFmt\n\t}\n\n\tif c.manifestURLFmt == \"\" {\n\t\tc.manifestURLFmt = defaultManifestURLFmt\n\t}\n\n\treturn c\n}", "func NewHTTPClient(slog slog.Logger, filer sio.Filer) (clt Client, err error) {\n\thttpClt := &HTTPClient{logger: slog}\n\thttpClt.client = httpClt\n\thttpClt.filer = filer\n\treturn httpClt.client, nil\n}", "func NewOperationClient(c config) *OperationClient {\n\treturn &OperationClient{config: c}\n}", "func NewHTTPClient(conn net.Conn, opt *codec.Option) (*Client, error) {\n\t_, _ = io.WriteString(conn, fmt.Sprintf(\"CONNECT %s HTTP/1.0\\n\\n\", defaultHandlePath))\n\n\tres, err := http.ReadResponse(bufio.NewReader(conn), &http.Request{Method: \"CONNECT\"})\n\tif err == nil && res.Status == \"200 Connected to Gingle RPC\" {\n\t\treturn NewRPCClient(conn, opt)\n\t}\n\n\tif err == nil {\n\t\terr = fmt.Errorf(\"client: failed to new http client, err: unexpected http response\")\n\t}\n\treturn nil, err\n}", "func (fgsc *FakeGKESDKClient) newOp() *container.Operation {\n\topName := strconv.Itoa(fgsc.opNumber)\n\top := &container.Operation{\n\t\tName: opName,\n\t\tStatus: \"DONE\",\n\t}\n\tif status, ok := fgsc.opStatus[opName]; ok {\n\t\top.Status = status\n\t}\n\tfgsc.opNumber++\n\tfgsc.ops[opName] = op\n\treturn op\n}", "func NewClient(endpointURL, soapActionBase string, cl *http.Client) Caller {\n\tif cl == nil {\n\t\tcl = http.DefaultClient\n\t}\n\tif cl.Transport == nil {\n\t\tcl.Transport = http.DefaultTransport\n\t}\n\tcl.Transport = soaptrip.New(cl.Transport)\n\treturn &soapClient{\n\t\tClient: cl,\n\t\tURL: endpointURL,\n\t\tSOAPActionBase: soapActionBase,\n\t\tbufpool: bp.New(1024),\n\t}\n}", "func NewHTTPClient(instance string, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) (service.AddsvcService, error) { // Quickly sanitize the instance string.\n\tif !strings.HasPrefix(instance, \"http\") {\n\t\tinstance = \"http://\" + instance\n\t}\n\tu, err := url.Parse(instance)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// We construct a single ratelimiter middleware, to limit the total outgoing\n\t// QPS from this client to all methods on the remote instance. We also\n\t// construct per-endpoint circuitbreaker middlewares to demonstrate how\n\t// that's done, although they could easily be combined into a single breaker\n\t// for the entire remote instance, too.\n\tlimiter := ratelimit.NewErroringLimiter(rate.NewLimiter(rate.Every(time.Second), 100))\n\n\t// Zipkin HTTP Client Trace can either be instantiated per endpoint with a\n\t// provided operation name or a global tracing client can be instantiated\n\t// without an operation name and fed to each Go kit endpoint as ClientOption.\n\t// In the latter case, the operation name will be the endpoint's http method.\n\tzipkinClient := zipkin.HTTPClientTrace(zipkinTracer)\n\n\t// global client middlewares\n\toptions := []httptransport.ClientOption{\n\t\tzipkinClient,\n\t}\n\n\te := endpoints.Endpoints{}\n\n\t// Each individual endpoint is an http/transport.Client (which implements\n\t// endpoint.Endpoint) that gets wrapped with various middlewares. If you\n\t// made your own client library, you'd do this work there, so your server\n\t// could rely on a consistent set of client behavior.\n\t// The Sum endpoint is the same thing, with slightly different\n\t// middlewares to demonstrate how to specialize per-endpoint.\n\tvar sumEndpoint endpoint.Endpoint\n\t{\n\t\tsumEndpoint = httptransport.NewClient(\n\t\t\t\"POST\",\n\t\t\tcopyURL(u, \"/sum\"),\n\t\t\tencodeHTTPSumRequest,\n\t\t\tdecodeHTTPSumResponse,\n\t\t\tappend(options, httptransport.ClientBefore(opentracing.ContextToHTTP(otTracer, logger)))...,\n\t\t).Endpoint()\n\t\tsumEndpoint = opentracing.TraceClient(otTracer, \"Sum\")(sumEndpoint)\n\t\tsumEndpoint = zipkin.TraceEndpoint(zipkinTracer, \"Sum\")(sumEndpoint)\n\t\tsumEndpoint = limiter(sumEndpoint)\n\t\tsumEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{\n\t\t\tName: \"Sum\",\n\t\t\tTimeout: 30 * time.Second,\n\t\t}))(sumEndpoint)\n\t\te.SumEndpoint = sumEndpoint\n\t}\n\n\t// The Concat endpoint is the same thing, with slightly different\n\t// middlewares to demonstrate how to specialize per-endpoint.\n\tvar concatEndpoint endpoint.Endpoint\n\t{\n\t\tconcatEndpoint = httptransport.NewClient(\n\t\t\t\"POST\",\n\t\t\tcopyURL(u, \"/concat\"),\n\t\t\tencodeHTTPConcatRequest,\n\t\t\tdecodeHTTPConcatResponse,\n\t\t\tappend(options, httptransport.ClientBefore(opentracing.ContextToHTTP(otTracer, logger)))...,\n\t\t).Endpoint()\n\t\tconcatEndpoint = opentracing.TraceClient(otTracer, \"Concat\")(concatEndpoint)\n\t\tconcatEndpoint = zipkin.TraceEndpoint(zipkinTracer, \"Concat\")(concatEndpoint)\n\t\tconcatEndpoint = limiter(concatEndpoint)\n\t\tconcatEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{\n\t\t\tName: \"Concat\",\n\t\t\tTimeout: 30 * time.Second,\n\t\t}))(concatEndpoint)\n\t\te.ConcatEndpoint = concatEndpoint\n\t}\n\n\t// Returning the endpoint.Set as a service.Service relies on the\n\t// endpoint.Set implementing the Service methods. That's just a simple bit\n\t// of glue code.\n\treturn e, nil\n}", "func NewHTTPClient(ctx context.Context, clientSecretKeyFile []byte, tokenFilepath string) (*http.Client, error) {\n\tconfig, err := google.ConfigFromJSON(clientSecretKeyFile, builderAPIScope)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttokenCacheFilename := \"\"\n\tif tokenFilepath == \"\" {\n\t\ttokenCacheFilename, err = tokenCacheFile()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\ttokenCacheFilename = tokenFilepath\n\t}\n\tif !exists(tokenCacheFilename) {\n\t\tlog.Infoln(\"Could not locate OAuth2 token\")\n\t\treturn nil, errors.New(`command requires authentication. try to run \"gactions login\" first`)\n\t}\n\ttok, err := tokenFromFile(tokenCacheFilename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn config.Client(ctx, tok), nil\n}", "func newClient(opts *ClientOpts) (*Client, error) {\n\tbaseClient, err := newAPIClient(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tAPIClient: *baseClient,\n\t}\n\n\t// init base operator\n\tclient.Node = newNodeClient(client)\n\tclient.Namespace = newNameSpaceClient(client)\n\tclient.ConfigMap = newConfigMapClient(client)\n\tclient.Service = newServiceClient(client)\n\tclient.Pod = newPodClient(client)\n\tclient.ReplicationController = newReplicationControllerClient(client)\n\tclient.StatefulSet = newStatefulSetClient(client)\n\tclient.DaemonSet = newDaemonSetClient(client)\n\tclient.Deployment = newDeploymentClient(client)\n\tclient.ReplicaSet = newReplicaSetClient(client)\n\n\treturn client, nil\n}", "func (rpc *RpcClient) newHTTPClient() (*http.Client, error) {\n\t// Configure proxy if needed.\n\tvar dial func(network, addr string) (net.Conn, error)\n\n\t// Configure TLS if needed.\n\tvar tlsConfig *tls.Config\n\n\t// Create and return the new HTTP client potentially configured with a\n\t// proxy and TLS.\n\tclient := http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tDial: dial,\n\t\t\tTLSClientConfig: tlsConfig,\n\t\t\tDialContext: (&net.Dialer{\n\t\t\t\tTimeout: 5 * time.Second,\n\t\t\t\tKeepAlive: 5 * time.Second,\n\t\t\t\tDualStack: true,\n\t\t\t}).DialContext,\n\t\t},\n\t}\n\treturn &client, nil\n}", "func NewOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient {\n\tcp := arm.ClientOptions{}\n\tif options != nil {\n\t\tcp = *options\n\t}\n\tif len(cp.Host) == 0 {\n\t\tcp.Host = arm.AzurePublicCloud\n\t}\n\treturn &OperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}\n}", "func NewHTTPClient(formats strfmt.Registry) *OpenbankingPaymentsClient {\n\treturn NewHTTPClientWithConfig(formats, nil)\n}", "func NewHTTPClient(uri string) HTTPClient {\n\treturn HTTPClient{\n\t\tBackendURI: uri,\n\t\tclient: &http.Client{},\n\t}\n}", "func CreateHTTPClient(handler http.Handler) (*http.Client, func()) {\n\ts := httptest.NewServer(handler)\n\n\tcli := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tDialContext: func(_ context.Context, network, _ string) (net.Conn, error) {\n\t\t\t\treturn net.Dial(network, s.Listener.Addr().String())\n\t\t\t},\n\t\t},\n\t}\n\n\treturn cli, s.Close\n}", "func NewClient(httpClient *http.Client, URL string, Token string, Source string, SourceType string, Index string) (*Client) {\n\t// Create a new client\n\tif httpClient == nil {\n\t\ttr := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}} // turn off certificate checking\n\t\thttpClient = &http.Client{Timeout: time.Second * 20, Transport: tr}\n\t}\n\n\tc := &Client{HTTPClient: httpClient, URL: URL, Token: Token, Source: Source, SourceType: SourceType, Index: Index}\n\n\treturn c\n}", "func newHTTPClient(cfg *OutboundCommConfig) (*http.Client, error) {\n\tvar err error\n\tvar caCertPool tlsCertPool.CertPool\n\tif cfg.CACertsPaths != \"\" {\n\t\tcaCertPool, err = tlsCertPool.NewCertPool(false)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Failed to create new Cert Pool\")\n\t\t}\n\n\t\tcaCertsPaths := strings.Split(cfg.CACertsPaths, \",\")\n\t\tvar caCerts []string\n\t\tfor _, path := range caCertsPaths {\n\t\t\tif path == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Create a pool with server certificates\n\t\t\tcaCert, e := ioutil.ReadFile(filepath.Clean(path))\n\t\t\tif e != nil {\n\t\t\t\treturn nil, errors.Wrap(e, \"Failed Reading server certificate\")\n\t\t\t}\n\t\t\tcaCerts = append(caCerts, string(caCert))\n\t\t}\n\n\t\tcaCertPool.Add(tlsCertPool.DecodeCerts(caCerts)...)\n\t} else {\n\t\tcaCertPool, err = tlsCertPool.NewCertPool(true)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// update the config's caCertPool\n\tcfg.caCertPool = caCertPool\n\n\ttlsConfig, err := buildNewCertPool(cfg.caCertPool)\n\tif err != nil {\n\t\tlog.Printf(\"HTTP Transport - Failed to build/get Cert Pool: %s\", err)\n\t\treturn nil, err\n\t}\n\n\treturn &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: tlsConfig,\n\t\t},\n\t\tTimeout: cfg.Timeout,\n\t}, nil\n}", "func NewHTTPClient(timeout time.Duration) *http.Client {\n\treturn &http.Client{\n\t\tTimeout: timeout,\n\t}\n}", "func NewHTTPClient(apiEndpoint string, pageSize int64, setAuth func(r *http.Request)) *APIClient {\n\treturn &APIClient{\n\t\tconn: connector.NewHTTPConnector(apiEndpoint, pageSize, setAuth),\n\t}\n}", "func NewClient(app App, opts ...Option) *Client {\n\tbaseURL, err := url.Parse(app.APIURL)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tc := &Client{\n\t\tClient: &http.Client{},\n\t\tlog: &LeveledLogger{},\n\t\tapp: app,\n\t\tbaseURL: baseURL,\n\t}\n\n\tc.Util = &UtilServiceOp{client: c}\n\tc.Auth = &AuthServiceOp{client: c}\n\tc.Media=&MediaSpaceServiceOp{client: c}\n\tc.Product=&ProductServiceOp{client: c}\n\tc.Logistics=&LogisticsServiceOp{client: c}\n\tc.Shop=&ShopServiceOp{client: c}\n\tc.Discount=&DiscountServiceOp{client: c}\n\tc.Order=&OrderServiceOp{client: c}\n\t\n\t// apply any options\n\tfor _, opt := range opts {\n\t\topt(c)\n\t}\n\n\treturn c\n}", "func NewHTTPClient(transport http.RoundTripper, ts TokenSource) (*HTTPClient, error) {\n\tif ts == nil {\n\t\treturn nil, errors.New(\"gcp: no credentials available\")\n\t}\n\treturn &HTTPClient{\n\t\tClient: http.Client{\n\t\t\tTransport: &oauth2.Transport{\n\t\t\t\tBase: transport,\n\t\t\t\tSource: ts,\n\t\t\t},\n\t\t},\n\t}, nil\n}", "func NewClient(meta *metadata.Client, acc string) *http.Client {\n\treturn &http.Client{\n\t\tTransport: newRoundTripper(meta, acc),\n\t}\n}", "func newHTTPClient() *http.Client {\n\tclient := &http.Client{\n\t\tTimeout: defaultTimeout,\n\t}\n\treturn client\n}", "func newHTTPClient() *http.Client {\n\treturn &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\tDialContext: (&net.Dialer{\n\t\t\t\tTimeout: timeout,\n\t\t\t\tKeepAlive: 30 * time.Second,\n\t\t\t\tDualStack: true,\n\t\t\t}).DialContext,\n\n\t\t\tTLSHandshakeTimeout: timeout,\n\t\t\tResponseHeaderTimeout: timeout,\n\t\t\tExpectContinueTimeout: 1 * time.Second,\n\t\t\tMaxIdleConns: 5,\n\t\t\tIdleConnTimeout: 90 * time.Second,\n\t\t},\n\t}\n}", "func NewHTTPClient(formats strfmt.Registry) *V3 {\n\treturn NewHTTPClientWithConfig(formats, nil)\n}", "func NewHTTPClient(rawURL string) (Client, error) {\n\tURL, err := url.Parse(rawURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &HTTPClient{\n\t\tComponent: Component{Name: \"http-config-client-\" + URL.Host},\n\t\tURL: rawURL,\n\t}, nil\n}", "func newHTTPClient(\n\tapiKey string,\n\tdebug bool,\n\tomitRetry bool,\n\ttimeout time.Duration,\n\ttransport http.RoundTripper,\n) httpC {\n\tif transport == nil {\n\t\ttransport = http.DefaultTransport\n\t}\n\treturn &gcmHTTP{\n\t\tGCMURL: httpAddress,\n\t\tapiKey: apiKey,\n\t\thttpClient: &http.Client{\n\t\t\tTransport: transport,\n\t\t\tTimeout: timeout,\n\t\t},\n\t\tdebug: debug,\n\t\tomitRetry: omitRetry,\n\t}\n}", "func newInputService20ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService20ProtocolTest {\n\tsvc := &InputService20ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice20protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func NewRequestHTTP(order string, url string, values io.Reader)(resp *http.Response, err error){\n req, err := http.NewRequest(order, url, values)\n if err != nil {\n logs.Error(\"Error Executing HTTP new request\")\n }\n tr := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, DisableKeepAlives: true,}\n client := &http.Client{Transport: tr}\n resp, err = client.Do(req)\n if err != nil {\n logs.Error(\"Error Retrieving response from client HTTP new request\")\n }\n return resp, err\n}", "func NewHdfsOperator(cfg OperatorConfig) (*HdfsController, error) {\n // Create an empty context\n //ctx := context.Background()\n clientConfig, err := newConfig()\n if err != nil {\n return nil, errors.Wrap(err, \"Failed to retrieve kubernetes client config\")\n }\n\n clientSet, err := kubernetes.NewForConfig(clientConfig)\n if err != nil {\n return nil, errors.Wrap(err, \"Failed to create Kubernetes client\")\n }\n\n/*\n restClient, err := NewClientForConfig(clientConfig)\n if err != nil {\n return nil, errors.Wrap(err, \"Failed to create REST client\")\n }\n*/\n\n controller := &HdfsController{\n ClientSet: clientSet,\n //restClient: restClient,\n cfg: &cfg,\n }\n\n\treturn controller, nil\n}", "func NewHTTPClient(conf Config, mgr interop.Manager, log log.Modular, stats metrics.Type) (output.Streamed, error) {\n\th, err := writer.NewHTTPClient(conf.HTTPClient, mgr, log, stats)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tw, err := NewAsyncWriter(TypeHTTPClient, conf.HTTPClient.MaxInFlight, h, log, stats)\n\tif err != nil {\n\t\treturn w, err\n\t}\n\tif !conf.HTTPClient.BatchAsMultipart {\n\t\tw = OnlySinglePayloads(w)\n\t}\n\treturn NewBatcherFromConfig(conf.HTTPClient.Batching, w, mgr, log, stats)\n}", "func NewHTTPClient(url string, backend Backend) (*HTTPClient, error) {\n b := backend\n if b == nil {\n b = newDefaultBackend()\n }\n return &HTTPClient{url: url, backend: b}, nil\n}", "func New(mws ...MiddlewareFunc) *http.Client {\n\tclient := &http.Client{\n\t\tTimeout: 5 * time.Second,\n\t\tTransport: http.DefaultTransport,\n\t}\n\twithMiddleware(client, mws...)\n\treturn client\n}", "func NewPrimitiveClient() PrimitiveClient {\n return NewPrimitiveClientWithBaseURI(DefaultBaseURI, )\n}", "func (rpc *RpcClient) newHTTPClient() (*http.Client, error) {\n\t// Configure proxy if needed.\n\tvar dial func(network, addr string) (net.Conn, error)\n\tif rpc.Cfg.OptionConfig.Proxy != \"\" {\n\t\tproxy := &socks.Proxy{\n\t\t\tAddr: rpc.Cfg.OptionConfig.Proxy,\n\t\t\tUsername: rpc.Cfg.OptionConfig.ProxyUser,\n\t\t\tPassword: rpc.Cfg.OptionConfig.ProxyPass,\n\t\t}\n\t\tdial = func(network, addr string) (net.Conn, error) {\n\t\t\tc, err := proxy.Dial(network, addr)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn c, nil\n\t\t}\n\t}\n\n\t// Configure TLS if needed.\n\tvar tlsConfig *tls.Config\n\tif !rpc.Cfg.SoloConfig.NoTLS && rpc.Cfg.SoloConfig.RPCCert != \"\" {\n\t\tpem, err := ioutil.ReadFile(rpc.Cfg.SoloConfig.RPCCert)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpool := x509.NewCertPool()\n\t\tpool.AppendCertsFromPEM(pem)\n\t\ttlsConfig = &tls.Config{\n\t\t\tRootCAs: pool,\n\t\t\tInsecureSkipVerify: rpc.Cfg.SoloConfig.NoTLS,\n\t\t}\n\t} else {\n\t\ttlsConfig = &tls.Config{\n\t\t\tInsecureSkipVerify: rpc.Cfg.SoloConfig.NoTLS,\n\t\t}\n\t}\n\n\t// Create and return the new HTTP client potentially configured with a\n\t// proxy and TLS.\n\tclient := http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tDial: dial,\n\t\t\tTLSClientConfig: tlsConfig,\n\t\t\tDialContext: (&net.Dialer{\n\t\t\t\tTimeout: time.Duration(rpc.Cfg.OptionConfig.Timeout) * time.Second,\n\t\t\t\tKeepAlive: time.Duration(rpc.Cfg.OptionConfig.Timeout) * time.Second,\n\t\t\t\tDualStack: true,\n\t\t\t}).DialContext,\n\t\t},\n\t}\n\treturn &client, nil\n}", "func NewHTTPClient() *http.Client {\n\n\ttr := &http.Transport{\n\t\t//TLSClientConfig: &tls.Config{\n\t\t//\tInsecureSkipVerify: conf.InsecureSkipVerify,\n\t\t//},\n\t\tMaxIdleConnsPerHost: DefaultMaxIdleConnsPerHost,\n\t\tProxy: http.ProxyFromEnvironment,\n\t\tDial: (&net.Dialer{\n\t\t\tTimeout: DefaultTimeout,\n\t\t\tKeepAlive: DefaultKeepAlive,\n\t\t}).Dial,\n\t\tTLSHandshakeTimeout: DefaultTimeout,\n\t}\n\n\treturn &http.Client{\n\t\tTimeout: DefaultTimeout,\n\t\tTransport: tr,\n\t}\n}", "func CreateHTTPClient(roundTripper func(*http.Request) (*http.Response, error)) *http.Client {\n\treturn &http.Client{\n\t\tTransport: roundTripperFunc(roundTripper),\n\t}\n}", "func NewClient(op Options, limit int) *Client {\n\treturn &Client{\n\t\tOptions: op,\n\t\tLimit: limit,\n\t\tlimitCh: make(chan struct{}, limit),\n\t}\n}", "func NewOutbound(opts ...OutboundHTTPOpt) (*OutboundHTTPClient, error) {\n\tclOpts := &outboundCommHTTPOpts{}\n\t// Apply options\n\tfor _, opt := range opts {\n\t\topt(clOpts)\n\t}\n\n\tif clOpts.client == nil {\n\t\treturn nil, errors.New(\"creation of outbound transport requires an HTTP client\")\n\t}\n\n\tcs := &OutboundHTTPClient{\n\t\tclient: clOpts.client,\n\t}\n\n\treturn cs, nil\n}", "func NewHTTPClient(tc *trace.Client, orig *http.Client) *HTTPClient {\n\tif orig == nil {\n\t\torig = http.DefaultClient\n\t}\n\trt := orig.Transport\n\tif rt == nil {\n\t\trt = http.DefaultTransport\n\t}\n\tclient := http.Client{\n\t\tTransport: &tracerTransport{base: rt},\n\t\tCheckRedirect: orig.CheckRedirect,\n\t\tJar: orig.Jar,\n\t\tTimeout: orig.Timeout,\n\t}\n\treturn &HTTPClient{\n\t\tClient: client,\n\t\ttc: tc,\n\t}\n}", "func NewClient(c *rpc.Client) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tvar (\n\t\t\terrs = make(chan error, 1)\n\t\t\tresponses = make(chan interface{}, 1)\n\t\t)\n\t\tgo func() {\n\t\t\tvar response reqrep.AddResponse\n\t\t\tif err := c.Call(\"addsvc.Add\", request, &response); err != nil {\n\t\t\t\terrs <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresponses <- response\n\t\t}()\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, context.DeadlineExceeded\n\t\tcase err := <-errs:\n\t\t\treturn nil, err\n\t\tcase response := <-responses:\n\t\t\treturn response, nil\n\t\t}\n\t}\n}", "func NewWithHTTPClient(sess *session.Session, client *http.Client, endpoint string) Client {\n\treturn Client{\n\t\tsession: sess,\n\t\tendpoint: endpoint,\n\t\thttpClient: client,\n\t}\n}", "func NewHTTPClient(source Source) (*http.Client, error) {\n\tcerts, err := x509.SystemCertPool()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(source.CACerts) > 0 {\n\t\tfor i := range source.CACerts {\n\t\t\tcerts.AddCert(source.CACerts[i])\n\t\t}\n\t}\n\n\treturn &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: true,\n\t\t\t\tRootCAs: certs,\n\t\t\t},\n\t\t\tProxy: func(req *http.Request) (*url.URL, error) {\n\t\t\t\tif strings.TrimSpace(source.HTTPProxy) != \"\" {\n\t\t\t\t\tos.Setenv(\"HTTP_PROXY\", source.HTTPProxy)\n\t\t\t\t}\n\n\t\t\t\tif strings.TrimSpace(source.HTTPSProxy) != \"\" {\n\t\t\t\t\tos.Setenv(\"HTTPS_PROXY\", source.HTTPSProxy)\n\t\t\t\t}\n\n\t\t\t\tif strings.TrimSpace(source.NoProxy) != \"\" {\n\t\t\t\t\tos.Setenv(\"NO_PROXY\", source.NoProxy)\n\t\t\t\t}\n\n\t\t\t\treturn http.ProxyFromEnvironment(req)\n\t\t\t},\n\t\t},\n\t}, nil\n}", "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\tbaseURL, _ := url.Parse(baseURL)\n\n\tc := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent}\n\tc.common.client = c\n\tc.RRSet = (*RRSetService)(&c.common)\n\tc.RData = (*RDataService)(&c.common)\n\n\treturn c\n}", "func NewHTTPClient(formats strfmt.Registry) *SipgateRest {\n\treturn NewHTTPClientWithConfig(formats, nil)\n}", "func (ClientEvent) Schema() string { return \"HTTPClient\" }", "func NewHTTPClient(addr string, client *http.Client) (*HTTPClient, error) {\n\ta, err := ParseHTTPAddress(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\turl, err := url.Parse(a.String())\n\tif err != nil {\n\t\treturn nil, NewError(AddressError, \"url.Parse failed.\", map[string]interface{}{\n\t\t\t\"url\": a.String(),\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t}\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\treturn &HTTPClient{\n\t\turl: url,\n\t\tclient: client,\n\t}, nil\n}", "func New(c transport.ClientConfig, opts ...thrift.ClientOption) Interface {\n\treturn client{\n\t\tc: thrift.New(thrift.Config{\n\t\t\tService: \"WorkflowService\",\n\t\t\tClientConfig: c,\n\t\t}, opts...),\n\t}\n}", "func NewHTTPClient() *HTTPClient {\n\treturn &HTTPClient{\n\t\tClient: http.DefaultClient,\n\t\tCacheDir: viper.GetString(\"http_cache_dir\"),\n\t}\n}", "func newHTTPReader(cli *http.Client) (*httpReader, error) {\n\tif cli == nil {\n\t\treturn nil, errInvalidClient\n\t}\n\treturn &httpReader{cli}, nil\n}", "func NewHTTPWriter(c HTTPWriterConfig) LineProtocolWriter {\n\treturn &HTTPWriter{\n\t\tclient: fasthttp.Client{\n\t\t\tName: \"bulk_load_opentsdb\",\n\t\t},\n\n\t\tc: c,\n\t\turl: []byte(c.Host + \"/api/put\"),\n\t}\n}", "func NewHTTPClientAPI(client http.Client, endpoint, from, accessKeyID, secretAccessKey string) *Option {\n\tSetDefaultHTTPClient(client)\n\n\treturn NewAPI(endpoint, from, accessKeyID, secretAccessKey)\n}", "func HTTPClient(cli HTTPer) func(*solrHttp) {\n\treturn func(c *solrHttp) {\n\t\tc.queryClient = cli\n\t\tc.writeClient = cli\n\t}\n}", "func NewHTTPClient(url, endpoint string, timeout time.Duration) *HTTPClient {\n\treturn &HTTPClient{\n\t\turl: url,\n\t\thttpClient: &http.Client{Timeout: timeout},\n\t\tendPoint: endpoint,\n\t}\n}", "func NewClient(c Configuration) (Client, error) {\n\tcli := Client{\n\t\tName: \"splunk-http-collector-client\",\n\t}\n\tif err := cli.Configure(c.Collector.Proto, c.Collector.Host, c.Collector.Port); err != nil {\n\t\treturn cli, err\n\t}\n\tlog.Debugf(\"%s: proto=%s\", cli.Name, c.Collector.Proto)\n\tlog.Debugf(\"%s: host=%s\", cli.Name, c.Collector.Host)\n\tlog.Debugf(\"%s: port=%d\", cli.Name, c.Collector.Port)\n\tlog.Debugf(\"%s: token=%s\", cli.Name, c.Collector.Token)\n\tlog.Debugf(\"%s: timeout=%d\", cli.Name, c.Collector.Timeout)\n\tlog.Debugf(\"%s: endpoint.health=%s\", cli.Name, cli.Endpoints.Health)\n\tlog.Debugf(\"%s: endpoint.event=%s\", cli.Name, cli.Endpoints.Event)\n\tlog.Debugf(\"%s: endpoint.raw=%s\", cli.Name, cli.Endpoints.Raw)\n\tt := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{\n\t\t\tInsecureSkipVerify: true,\n\t\t},\n\t}\n\tcli.client = &http.Client{\n\t\tTimeout: time.Duration(c.Collector.Timeout) * time.Second,\n\t\tTransport: t,\n\t}\n\tcli.Token = c.Collector.Token\n\tif err := cli.HealthCheck(); err != nil {\n\t\treturn cli, err\n\t}\n\treturn cli, nil\n}", "func newClient() (*client, error) {\n\tc, err := genetlink.Dial(nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Make a best effort to apply the strict options set to provide better\n\t// errors and validation. We don't apply Strict in the constructor because\n\t// this library is widely used on a range of kernels and we can't guarantee\n\t// it will always work on older kernels.\n\tfor _, o := range []netlink.ConnOption{\n\t\tnetlink.ExtendedAcknowledge,\n\t\tnetlink.GetStrictCheck,\n\t} {\n\t\t_ = c.SetOption(o, true)\n\t}\n\n\treturn initClient(c)\n}", "func New(options ...Option) (*Client, error) {\n\tc := &Client{\n\t\thttpHost: \"http://localhost:8080\",\n\t\twsHost: \"ws://localhost:8080\",\n\t}\n\n\t// apply options\n\tfor _, option := range options {\n\t\tif err := option(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c, nil\n}", "func NewHTTPClient(retries int) HTTPClient {\n\tif retries <= 0 {\n\t\tpanic(\"retries should be greater than 0\")\n\t}\n\treturn &httpClient{\n\t\tretries: retries,\n\t}\n}", "func NewClient(\n\tscheme string,\n\thost string,\n\tdoer goahttp.Doer,\n\tenc func(*http.Request) goahttp.Encoder,\n\tdec func(*http.Response) goahttp.Decoder,\n\trestoreBody bool,\n) *Client {\n\treturn &Client{\n\t\tUploadDoer: doer,\n\t\tScoreListDoer: doer,\n\t\tScoreDetailDoer: doer,\n\t\tRestoreResponseBody: restoreBody,\n\t\tscheme: scheme,\n\t\thost: host,\n\t\tdecoder: dec,\n\t\tencoder: enc,\n\t}\n}", "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = &http.Client{}\n\t}\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent}\n\tc.common.client = c\n\tc.Datasets = (*DatasetsService)(&c.common)\n\tc.Streams = (*StreamsService)(&c.common)\n\tc.Users = (*UsersService)(&c.common)\n\tc.Groups = (*GroupsService)(&c.common)\n\tc.Pages = (*PagesService)(&c.common)\n\tc.Logs = (*ActivityLogsService)(&c.common)\n\tc.Accounts = (*AccountsService)(&c.common)\n\n\treturn c\n}", "func NewHTTPClient(proxyNetwork, proxyAddress string, serviceNetwork, service string) http.Client {\n\tproxyClient := Client{proxyNetwork: proxyNetwork, proxyAddress: proxyAddress, serviceNetwork: serviceNetwork, service: service}\n\ttrans := &http.Transport{\n\t\tDial: proxyClient.proxyDial,\n\t\tDisableKeepAlives: false,\n\t}\n\treturn http.Client{Transport: trans}\n}", "func NewOverloadServiceHTTPClient(c *http.Client, addr string) *OverloadService_httpClient {\n\tif strings.HasSuffix(addr, \"/\") {\n\t\taddr = addr[:len(addr)-1]\n\t}\n\treturn &OverloadService_httpClient{c: c, host: addr}\n}", "func New(g *godo.Client) Client {\n\tc := &client{\n\t\tg: g,\n\t}\n\treturn c\n}", "func NewClient(network NetworkType, clientOptions *Options, customHTTPClient HTTPInterface) ClientInterface {\n\n\t// Sets the network, options and custom HTTP client\n\treturn createClient(network, clientOptions, customHTTPClient)\n}", "func NewWithHTTPClient(env common.Environment, apiKey string, processingChannelId *string, httpClient *http.Client) *CheckoutComClient {\n\treturn &CheckoutComClient{\n\t\tapiKey: apiKey,\n\t\thttpClient: httpClient,\n\t\tenv: GetEnv(env),\n\t\tprocessingChannelId: processingChannelId,\n\t}\n}", "func NewClient(opts client.Options) (client.ProtocolClient, error) {\n\tclient := &http.Client{}\n\tif opts.TLSConfig != nil {\n\t\tclient.Transport = &http2.Transport{\n\t\t\tTLSClientConfig: opts.TLSConfig,\n\t\t}\n\t} else {\n\t\tclient.Transport = &http2.Transport{\n\t\t\tAllowHTTP: true,\n\t\t\tDialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {\n\t\t\t\treturn net.Dial(network, addr)\n\t\t\t}}\n\t}\n\treturn &Client{\n\t\tc: client,\n\t\topts: opts,\n\t}, nil\n}", "func (c *OutputService14ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func newClient(ctx context.Context, cfg oconf.Config) (*client, error) {\n\tc := &client{\n\t\texportTimeout: cfg.Metrics.Timeout,\n\t\trequestFunc: cfg.RetryConfig.RequestFunc(retryable),\n\t\tconn: cfg.GRPCConn,\n\t}\n\n\tif len(cfg.Metrics.Headers) > 0 {\n\t\tc.metadata = metadata.New(cfg.Metrics.Headers)\n\t}\n\n\tif c.conn == nil {\n\t\t// If the caller did not provide a ClientConn when the client was\n\t\t// created, create one using the configuration they did provide.\n\t\tconn, err := grpc.DialContext(ctx, cfg.Metrics.Endpoint, cfg.DialOptions...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Keep track that we own the lifecycle of this conn and need to close\n\t\t// it on Shutdown.\n\t\tc.ourConn = true\n\t\tc.conn = conn\n\t}\n\n\tc.msc = colmetricpb.NewMetricsServiceClient(c.conn)\n\n\treturn c, nil\n}", "func newAPI(cfg *ClientConfig, options ...ClientOption) *Client {\n\tclient := &Client{\n\t\tConfig: cfg,\n\t\thttpClient: &http.Client{},\n\t}\n\n\tfor _, option := range options {\n\t\toption(client)\n\t}\n\n\treturn client\n}", "func NewHTTPClient() *http.Client {\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{\n\t\t\tInsecureSkipVerify: true, //nolint:gosec // Needs to be enabled in suites. Not used in production.\n\t\t},\n\t}\n\n\treturn &http.Client{\n\t\tTransport: tr,\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n}", "func newInputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService13ProtocolTest {\n\tsvc := &InputService13ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice13protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func (gc *GatewayClient) NewRequest(opData structures.OperationRequestInterface) (*http.Response, error) {\n\t// Build whole payload structure with nested data bundles\n\trawReqData := &GenericRequest{}\n\trawReqData.Auth = *gc.auth\n\trawReqData.Data = opData\n\n\t// Get prepared structure of json byte array\n\tbufPayload, bufErr := prepareJSONPayload(rawReqData)\n\tif bufErr != nil {\n\t\treturn nil, bufErr\n\t}\n\n\t// Get combined URL path for request to API\n\turl, errURLPath := determineURL(gc, opData.GetOperationType())\n\tif errURLPath != nil {\n\t\treturn nil, errURLPath\n\t}\n\n\t// Build correct HTTP request\n\tnewReq, reqErr := buildHTTPRequest(opData.GetHTTPMethod(), url, bufPayload)\n\tif reqErr != nil {\n\t\treturn nil, reqErr\n\t}\n\n\t// Send HTTP request object\n\tresp, respErr := gc.httpClient.Do(newReq)\n\tif respErr != nil {\n\t\treturn nil, respErr\n\t}\n\n\treturn resp, nil\n}", "func newInputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService14ProtocolTest {\n\tsvc := &InputService14ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice14protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func NewHTTPClient(serverEndpoint string, ticket *obtainer.Client) (*HTTPClient, error) {\n\n\tendpointUrl, err := url.Parse(serverEndpoint)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing endpoint: %s\", err)\n\t}\n\n\treturn &HTTPClient{\n\t\tserverEndpoint: endpointUrl,\n\t\tticket: ticket,\n\t}, nil\n}", "func NewHTTPClient() (*HTTPClient, error) {\n\tresp, err := http.Get(\"https://raw.githubusercontent.com/cvandeplas/pystemon/master/user-agents.txt\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tb, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create the client and attach a cookie jar\n\tclient := &http.Client{}\n\tclient.Jar, _ = cookiejar.New(nil)\n\n\t// Splits the user-agents into a slice and returns an HTTPClient with a random\n\t// user-agent on the header\n\tua := strings.Split(string(b), \"\\n\")\n\trand.Seed(time.Now().UnixNano())\n\treturn &HTTPClient{\n\t\tClient: client,\n\t\tUserAgent: ua[rand.Intn(len(ua))],\n\t}, nil\n}", "func NewHTTPClient(formats strfmt.Registry) *DivvyCloudV2 {\n\treturn NewHTTPClientWithConfig(formats, nil)\n}", "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tclient := &Client{\n\t\tClient: *httpClient,\n\t\tUserAgent: \"Akamai-Open-Edgegrid-golang/\" + libraryVersion +\n\t\t\t\" golang/\" + strings.TrimPrefix(runtime.Version(), \"go\"),\n\t}\n\n\treturn client\n}", "func NewClient(\n\tscheme string,\n\thost string,\n\tdoer goahttp.Doer,\n\tenc func(*http.Request) goahttp.Encoder,\n\tdec func(*http.Response) goahttp.Decoder,\n\trestoreBody bool,\n\tdialer goahttp.Dialer,\n\tcfn *ConnConfigurer,\n) *Client {\n\tif cfn == nil {\n\t\tcfn = &ConnConfigurer{}\n\t}\n\treturn &Client{\n\t\tAddDoer: doer,\n\t\tWordsDoer: doer,\n\t\tBattleDoer: doer,\n\t\tRestoreResponseBody: restoreBody,\n\t\tscheme: scheme,\n\t\thost: host,\n\t\tdecoder: dec,\n\t\tencoder: enc,\n\t\tdialer: dialer,\n\t\tconfigurer: cfn,\n\t}\n}", "func New(url string, httpClient *http.Client, customHeaders http.Header) *Client {\n\tif httpClient == nil {\n\t\thttpClient = &http.Client{\n\t\t\tTimeout: defaultHTTPTimeout,\n\t\t}\n\t}\n\n\treturn &Client{\n\t\turl: url,\n\t\thttpClient: httpClient,\n\t\tcustomHeaders: customHeaders,\n\t}\n}", "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\tcloned := *http.DefaultClient\n\t\thttpClient = &cloned\n\t}\n\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{\n\t\tclient: httpClient,\n\t\tBaseURL: baseURL,\n\t}\n\n\tc.common.client = c\n\tc.Question = (*QuestionService)(&c.common)\n\tc.Token = (*TokenService)(&c.common)\n\n\treturn c\n}", "func NewClient() *Client {\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{client: http.DefaultClient, BaseURL: baseURL, UserAgent: userAgent}\n\tc.Schedule = &ScheduleServiceOp{client: c}\n\tc.Time = &TimeServiceOp{client: c}\n\n\treturn c\n}", "func NewClient(addr *url.URL) (Client, error) {\n\tif addr == nil || addr.Host == \"\" {\n\t\tlogging.Info(\"Using nop metricd client.\")\n\t\treturn newNopClient(), nil\n\t}\n\tlogging.Infof(\"Using metricd at: %s\", addr.Host)\n\treturn newRealClient(addr, nil)\n}", "func NewHttpClient(urls ...string) *HttpProcessorConfig {\n\treturn &HttpProcessorConfig{\n\t\turls: urls,\n\t\tmode: Everyone,\n\t\tconnectionTimeout: 20 * time.Second,\n\t\tsuccess: http.StatusOK,\n\t\tmethod: http.MethodPost,\n\t}\n}", "func newClient(httpClient *http.Client) (c *Client) {\n\tc = &Client{httpClient: httpClient}\n\tc.service.client = c\n\tc.Auth = (*AuthService)(&c.service)\n\tc.Providers = (*ProvidersService)(&c.service)\n\tc.Projects = (*ProjectsService)(&c.service)\n\tc.Releases = (*ReleasesService)(&c.service)\n\tc.SlackChannels = (*SlackChannelsService)(&c.service)\n\tc.TelegramChats = (*TelegramChatsService)(&c.service)\n\tc.DiscordChannels = (*DiscordChannelsService)(&c.service)\n\tc.HangoutsChatWebhooks = (*HangoutsChatWebhooksService)(&c.service)\n\tc.MicrosoftTeamsWebhooks = (*MicrosoftTeamsWebhooksService)(&c.service)\n\tc.MattermostWebhooks = (*MattermostWebhooksService)(&c.service)\n\tc.RocketchatWebhooks = (*RocketchatWebhooksService)(&c.service)\n\tc.MatrixRooms = (*MatrixRoomsService)(&c.service)\n\tc.Webhooks = (*WebhooksService)(&c.service)\n\tc.Tags = (*TagsService)(&c.service)\n\treturn c\n}", "func New(o *Opt) *Client {\n\treturn &Client{\n\t\to: o,\n\t}\n}", "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\tc := &Client{client: httpClient}\n\tc.common.client = c\n\tc.Search = (*SearchService)(&c.common)\n\tc.PlaceSuggest = (*PlaceSuggestService)(&c.common)\n\tc.SpaceDetail = (*SpaceDetailService)(&c.common)\n\tc.Reviews = (*ReviewsService)(&c.common)\n\n\treturn c\n}", "func newTestClient(fn RoundTripFunc) *http.Client {\n\treturn &http.Client{\n\t\tTransport: fn,\n\t}\n}", "func New(httpClient HTTPClient) *Client {\n\tif httpClient == nil {\n\t\tpanic(\"http.Client cannot == nil\")\n\t}\n\n\treturn &Client{client: httpClient}\n}", "func New(server *url.URL) *genclient.Fulcio {\n\trt := httptransport.New(server.Host, genclient.DefaultBasePath, []string{server.Scheme})\n\trt.Consumers[\"application/pem-certificate-chain\"] = runtime.TextConsumer()\n\treturn genclient.New(rt, strfmt.Default)\n}", "func NewMyHTTPClient(timeZone, country, language, openudid string) *MyHTTPClient {\n\treturn &MyHTTPClient{\n\t\tTimezone: timeZone,\n\t\tCountry: country,\n\t\tLanguage: language,\n\t\tOpenudid: openudid,\n\t\tContentType: \"application/json;charset=utf-8\",\n\t\tclient: &http.Client{Timeout: 30 * time.Second},\n\t}\n}", "func NewHTTPClient(formats strfmt.Registry) *ID4I {\n\treturn NewHTTPClientWithConfig(formats, nil)\n}", "func newOIDCClient(tokens *oidc.Tokens[*oidc.IDTokenClaims]) *oidcClient {\n\tclient := oidcClient{\n\t\ttokens: tokens,\n\t\thttpClient: &http.Client{},\n\t\toidcTransport: &oidcTransport{},\n\t}\n\n\t// Ensure client.tokens is never nil otherwise authenticate() will panic.\n\tif client.tokens == nil {\n\t\tclient.tokens = &oidc.Tokens[*oidc.IDTokenClaims]{}\n\t}\n\n\treturn &client\n}", "func (c *OutputService13ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func HTTPClient(cli *http.Client) Option {\n\treturn func(e *HLTB) {\n\t\te.cli = cli\n\t}\n}", "func NewClient(httpClient *http.Client, space string, apiKey string) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tbaseURL, _ := url.Parse(\"https://\" + space + \".backlog.com/api/v2/\")\n\tc := &Client{client: httpClient, BaseURL: baseURL, apiKey: apiKey}\n\tc.common.client = c\n\tc.Space = (*SpaceService)(&c.common)\n\tc.Projects = (*ProjectsService)(&c.common)\n\tc.Issues = (*IssuesService)(&c.common)\n\treturn c\n}", "func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService2ProtocolTest {\n\tsvc := &InputService2ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice2protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func HTTPClient(client *http.Client) HTTPOption {\n\treturn func(c *HTTPCollector) { c.client = client }\n}", "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = &http.Client{}\n\t}\n\tbaseURL, _ := url.Parse(baseURL)\n\tc := &Client{\n\t\tclient: httpClient,\n\t\tBaseURL: baseURL,\n\t}\n\tc.common.client = c\n\tc.Tags = (*TagsService)(&c.common)\n\tc.Manifests = (*ManifestsService)(&c.common)\n\treturn c\n}" ]
[ "0.6413146", "0.6322009", "0.6066532", "0.6026513", "0.57708836", "0.5740239", "0.5691493", "0.56464857", "0.55885035", "0.55785453", "0.5576967", "0.55545264", "0.54876006", "0.54725325", "0.5447357", "0.5441663", "0.5370987", "0.5359461", "0.53584886", "0.534679", "0.5323859", "0.5315673", "0.530462", "0.5299263", "0.5280215", "0.52760756", "0.5264692", "0.5259972", "0.5255207", "0.5244171", "0.52405876", "0.5223326", "0.51919186", "0.51770735", "0.5163712", "0.51620907", "0.51535034", "0.5152278", "0.51418906", "0.5138587", "0.5128282", "0.51260513", "0.5125288", "0.51242065", "0.51229197", "0.5120991", "0.5112263", "0.5095713", "0.508978", "0.50739974", "0.50725776", "0.5067074", "0.50655764", "0.50427854", "0.503625", "0.5024876", "0.5014597", "0.50133175", "0.5006146", "0.5006123", "0.50044984", "0.50020576", "0.4998737", "0.4991313", "0.4989762", "0.49856293", "0.49848315", "0.4984219", "0.49833432", "0.49810794", "0.49810356", "0.49740627", "0.49736616", "0.49725744", "0.49704862", "0.49690816", "0.49645752", "0.49638084", "0.49614158", "0.49603868", "0.49591243", "0.495355", "0.4949906", "0.4948845", "0.49469894", "0.49421924", "0.4942065", "0.4941511", "0.49411768", "0.49306345", "0.49305895", "0.4925125", "0.49244264", "0.49205658", "0.49192882", "0.49135807", "0.4912993", "0.4910977", "0.4910507", "0.49071488" ]
0.859153
0
NewHTTPServerOp creates a new schema for HTTP server inbound operations.
func NewHTTPServerOp(opts ...Option) *Schema { return NewServerInboundOp("http", opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewServerInboundOp(system string, opts ...Option) *Schema {\n\tcfg := &config{}\n\tfor _, opt := range opts {\n\t\topt(cfg)\n\t}\n\treturn New(&serverInboundOp{cfg: cfg, system: system})\n}", "func NewOpServer(db *database.DB, addr string) *rpc.Server {\n\treturn rpc.NewServer(\"OpRpcServer\", &OpRpcServer{db}, addr)\n}", "func NewGRPCServerOp(opts ...Option) *Schema {\n\treturn NewServerInboundOp(\"grpc\", opts...)\n}", "func NewHTTPClientOp(opts ...Option) *Schema {\n\treturn NewClientOutboundOp(\"http\", opts...)\n}", "func NewHTTPServer(port string) (*http.Server, error) {\n\ts := &server{}\n\n\tmux := mux.NewRouter()\n\n\tmux.Handle(\"/\", handler.Playground(\"LINGVA Playground\", \"/graphql\"))\n\tconfig := gql.Config{Resolvers: s}\n\n\tmux.Handle(\"/graphql\", auth.ValidateMiddleware(handler.GraphQL(\n\t\tgql.NewExecutableSchema(config),\n\t\thandler.ErrorPresenter(func(ctx context.Context, err error) *gqlerror.Error {\n\t\t\treturn &gqlerror.Error{\n\t\t\t\tMessage: err.Error(),\n\t\t\t\tPath: graphql.GetResolverContext(ctx).Path(),\n\t\t\t}\n\t\t}),\n\t)))\n\n\tmux.HandleFunc(\"/login\", Login).Methods(\"POST\")\n\n\tmux.HandleFunc(\"/admin-login\", AdminLogin).Methods(\"POST\")\n\n\tmux.HandleFunc(\"/image/{imageName}\", ImageHandler).Methods(\"GET\")\n\n\treturn &http.Server{\n\t\tAddr: \":\" + port,\n\t\tHandler: cors.AllowAll().Handler(mux),\n\t}, nil\n}", "func newHTTPServer(appConfig config.AppConfig, logger services.Logger) services.HTTPServer {\n\treturn services.NewDefaultHTTPServer(appConfig.Port, logger)\n}", "func NewHTTPServer(listenHTTP, connectTCP string) Runner {\n\tresult := &httpServer{\n\t\twsHandler: wsHandler{\n\t\t\tconnectTCP: connectTCP,\n\t\t\twsUpgrader: websocket.Upgrader{\n\t\t\t\tReadBufferSize: BufferSize,\n\t\t\t\tWriteBufferSize: BufferSize,\n\t\t\t\tCheckOrigin: func(r *http.Request) bool { return true },\n\t\t\t},\n\t\t},\n\t\tlistenHTTP: listenHTTP,\n\t\thttpMux: &http.ServeMux{},\n\t}\n\n\tresult.httpMux.Handle(\"/\", &result.wsHandler)\n\tresult.httpMux.Handle(\"/metrics\", promhttp.Handler())\n\treturn result\n}", "func NewHTTPServer(route string, port int, handler http.Handler) *HTTPServer {\n\tif port == 0 {\n\t\treturn nil\n\t}\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/\"+route, handler)\n\n\tsvr := httputil.NewServer(\":\"+strconv.Itoa(port), mux, httputil.ReadHeaderTimeout(10*time.Second))\n\treturn &HTTPServer{\n\t\tsvr: &svr,\n\t}\n}", "func NewServerHTTP() *ServerHTTP {\n\treturn &ServerHTTP{}\n}", "func NewHTTPServer(hostPort string, manager ClientConfigManager, mFactory metrics.Factory) *http.Server {\n\thandler := newHTTPHandler(manager, mFactory)\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\thandler.serveSamplingHTTP(w, r, true /* thriftEnums092 */)\n\t})\n\tmux.HandleFunc(\"/sampling\", func(w http.ResponseWriter, r *http.Request) {\n\t\thandler.serveSamplingHTTP(w, r, false /* thriftEnums092 */)\n\t})\n\tmux.HandleFunc(\"/baggageRestrictions\", func(w http.ResponseWriter, r *http.Request) {\n\t\thandler.serveBaggageHTTP(w, r)\n\t})\n\treturn &http.Server{Addr: hostPort, Handler: mux}\n}", "func NewHTTPServer(c *C, p *Process) *HTTPServer {\n\th := NewHandler()\n\th.Process = p\n\n\tln, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", MustAtoi(p.Port)+1))\n\tc.Assert(err, IsNil)\n\n\ts := &HTTPServer{\n\t\tServer: &http.Server{\n\t\t\tHandler: h,\n\t\t},\n\t\tln: ln,\n\t}\n\tgo s.Serve(ln)\n\n\treturn s\n}", "func newHTTPServer(address string, tlsConfig *tls.Config, handler http.Handler) *http.Server {\n\tserver := &http.Server{\n\t\tAddr: address,\n\t\tTLSConfig: tlsConfig,\n\t\tHandler: handler,\n\t}\n\treturn server\n}", "func NewHTTPServer(httpServerBinding string, certFiles string, db *db.RocksDB, chain bchain.BlockChain, txCache *db.TxCache) (*HTTPServer, error) {\n\thttps := &http.Server{\n\t\tAddr: httpServerBinding,\n\t}\n\ts := &HTTPServer{\n\t\thttps: https,\n\t\tcertFiles: certFiles,\n\t\tdb: db,\n\t\ttxCache: txCache,\n\t\tchain: chain,\n\t\tchainParser: chain.GetChainParser(),\n\t}\n\n\tr := mux.NewRouter()\n\tr.HandleFunc(\"/\", s.info)\n\tr.HandleFunc(\"/bestBlockHash\", s.bestBlockHash)\n\tr.HandleFunc(\"/blockHash/{height}\", s.blockHash)\n\tr.HandleFunc(\"/transactions/{address}/{lower}/{higher}\", s.transactions)\n\tr.HandleFunc(\"/confirmedTransactions/{address}/{lower}/{higher}\", s.confirmedTransactions)\n\tr.HandleFunc(\"/unconfirmedTransactions/{address}\", s.unconfirmedTransactions)\n\n\tvar h http.Handler = r\n\th = handlers.LoggingHandler(os.Stderr, h)\n\thttps.Handler = h\n\n\treturn s, nil\n}", "func NewHTTPServer() *HTTPServer {\n\treturn &HTTPServer{\n\t\tdatabase: database.NewMySQLConnection(),\n\t\tlogger: logger.NewLog(),\n\t\trouter: router.NewGorillaMux(),\n\t\tvalidator: validation.NewValidator(),\n\t}\n}", "func NewHTTPFSMigrator(DBConnURL string) (*migrate.Migrate, error) {\n\tsrc, err := httpfs.New(http.FS(migrationFs), resourcePath)\n\tif err != nil {\n\t\treturn &migrate.Migrate{}, fmt.Errorf(\"db migrator: %v\", err)\n\t}\n\treturn migrate.NewWithSourceInstance(\"httpfs\", src, DBConnURL)\n}", "func New(auth0Creds auth0creds.Auth0Creds, mongoDBURL string, port int) TradingPostServer {\n\treturn &httpServer{\n\t\tauth0Creds: auth0Creds,\n\t\tport: port,\n\t\tmongoDBURL: mongoDBURL,\n\t}\n}", "func New(e *calc.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t}\n}", "func NewHTTPServer(addr string) *HTTPServer {\n\tmux := http.NewServeMux()\n\tsrv := &HTTPServer{\n\t\tmux: mux,\n\t\taddr: addr,\n\t\thandlers: make(map[string]*handler),\n\t}\n\treturn srv\n}", "func New(e *calc.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tDivideH: NewDivideHandler(e.Divide, uh),\n\t}\n}", "func NewServer(config *config.Config, appCache *cache.AppCache, mySql *db.MysqlDB) *HttpServer {\n\ts := Server{\n\t\tConfig: config,\n\t\tInventory: &service.Inventory{\n\t\t\tAppCache: appCache,\n\t\t\tMysql: mySql,\n\t\t},\n\t}\n\n\t// Create a HTTP server for prometheus.\n\tserveMux := http.NewServeMux()\n\tserveMux.HandleFunc(\"/getQuantity\", func(res http.ResponseWriter, req *http.Request) {\n\t\ts.getQuantity(res, req)\n\t})\n\tserveMux.HandleFunc(\"/addQuantity\", func(res http.ResponseWriter, req *http.Request) {\n\t\ts.addQuantity(res, req)\n\t})\n\tserveMux.HandleFunc(\"/addNegativeQuantity\", func(res http.ResponseWriter, req *http.Request) {\n\t\ts.addNegativeQuantity(res, req)\n\t})\n\n\treturn &HttpServer{\n\t\tServeMux: serveMux,\n\t\tConfig: config,\n\t}\n}", "func New(e *step.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tListH: NewListHandler(e.List, uh),\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t\tRemoveH: NewRemoveHandler(e.Remove, uh),\n\t\tUpdateH: NewUpdateHandler(e.Update, uh),\n\t}\n}", "func NewHTTPServer(ctx context.Context, endpoints Endpoints) http.Handler {\n\tm := http.NewServeMux()\n\tm.Handle(\"/payments\", httptransport.NewServer(\n\t\tendpoints.PaymentProcessorEndpoint,\n\t\tdecodePaymentRequest,\n\t\tencodeResponse,\n\t))\n\treturn m\n}", "func New(sto store.Service) *server {\n\ts := &server{sto: sto}\n\n\trouter := mux.NewRouter()\n\n\trouter.Handle(\"/todo\", allowedMethods(\n\t\t[]string{\"OPTIONS\", \"GET\", \"POST\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"GET\": http.HandlerFunc(s.getTodos),\n\t\t\t\"POST\": http.HandlerFunc(s.createTodo),\n\t\t}))\n\n\trouter.Handle(\"/todo/{id}\", idMiddleware(allowedMethods(\n\t\t[]string{\"OPTIONS\", \"GET\", \"PUT\", \"PATCH\", \"DELETE\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"GET\": http.HandlerFunc(s.getTodo),\n\t\t\t\"PUT\": http.HandlerFunc(s.putTodo),\n\t\t\t\"PATCH\": http.HandlerFunc(s.patchTodo),\n\t\t\t\"DELETE\": http.HandlerFunc(s.deleteTodo),\n\t\t})))\n\n\ts.handler = limitBody(defaultHeaders(router))\n\n\treturn s\n}", "func New(config Configuration, storage storage.Storage, groups map[string]groups.Group) *HTTPServer {\n\treturn &HTTPServer{\n\t\tConfig: config,\n\t\tStorage: storage,\n\t\tGroups: groups,\n\t}\n}", "func NewHTTPHandler() http.Handler { // Zipkin HTTP Server Trace can either be instantiated per endpoint with a\n\tm := bone.New()\n\tm.Get(\"/*\", httpSwagger.Handler(\n\t\thttpSwagger.URL(\"https://mask.goodideas-studio.com/docs/doc.json\"), //The url pointing to API definition\"\n\t))\n\treturn cors.AllowAll().Handler(m)\n}", "func NewHTTPWriter(c HTTPWriterConfig) LineProtocolWriter {\n\treturn &HTTPWriter{\n\t\tclient: fasthttp.Client{\n\t\t\tName: \"bulk_load_opentsdb\",\n\t\t},\n\n\t\tc: c,\n\t\turl: []byte(c.Host + \"/api/put\"),\n\t}\n}", "func New(e *goastarter.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t}\n}", "func NewHTTPServer(c *config.ConfigYaml, appsrv *service.AppExcelService) *http.Server {\n\tvar opts = []http.ServerOption{}\n\n\tif c.Server.Http.Network != \"\" {\n\t\topts = append(opts, http.Network(c.Server.Http.Network))\n\t}\n\tif c.Server.Http.Addr != \"\" {\n\t\topts = append(opts, http.Address(c.Server.Http.Addr))\n\t}\n\tif c.Server.Http.Timeout != 0 {\n\t\topts = append(opts, http.Timeout(time.Duration(c.Server.Http.Timeout)*time.Second))\n\t}\n\tsrv := http.NewServer(opts...)\n\tm := http.Middleware(\n\t\tmiddleware.Chain(\n\t\t\trecovery.Recovery(),\n\t\t\ttracing.Server(),\n\t\t\tlogging.Server(),\n\t\t),\n\t)\n\tsrv.HandlePrefix(\"/\", pb.NewAppExcelHandler(appsrv, m))\n\n\treturn srv\n}", "func NewHTTPServer(port int, handler http.Handler) (*Server, error) {\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/rpc\", withMiddlewares(handler))\n\n\tsrv := &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\tHandler: mux,\n\t}\n\n\tserver := Server{\n\t\tport: port,\n\t\tserver: srv,\n\t\tmux: mux,\n\t}\n\n\treturn &server, nil\n}", "func NewHTTPApp(cfg HTTPAppConfig) *HTTPApp {\n\treturn &HTTPApp{\n\t\tserver: &http.Server{},\n\t\tcfg: cfg,\n\t}\n}", "func NewHTTP(host string, port int) Static {\n\treturn Static{\n\t\tprotocol: ProtocolHTTP,\n\t\thost: host,\n\t\tport: port,\n\t}\n}", "func NewHTTPServer(ctx context.Context, endpoints Endpoints) http.Handler {\n\tr := mux.NewRouter()\n\tr.Use(commonMiddleware)\n\topts := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorEncoder(encodeError),\n\t}\n\n\tr.Methods(\"GET\").Path(\"/health\").Handler(httptransport.NewServer(\n\t\tendpoints.HealthEndpoint,\n\t\tdecodeHealthRequest,\n\t\tencodeResponse,\n\t\topts...,\n\t))\n\n\tr.Methods(\"GET\").Path(\"/books\").Handler(httptransport.NewServer(\n\t\tendpoints.GetBooksEndpoint,\n\t\tdecodeGetBooksRequest,\n\t\tencodeResponse,\n\t))\n\n\tr.Methods(\"GET\").Path(\"/books/{isbn}\").Handler(httptransport.NewServer(\n\t\tendpoints.GetBookEndpoint,\n\t\tdecodeGetBookRequest,\n\t\tencodeResponse,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/books\").Handler(httptransport.NewServer(\n\t\tendpoints.CreateBookEndpoint,\n\t\tdecodeCreateBookRequest,\n\t\tencodeResponse,\n\t))\n\n\tr.Methods(\"PUT\").Path(\"/books/{isbn}\").Handler(httptransport.NewServer(\n\t\tendpoints.UpdateBookEndpoint,\n\t\tdecodeUpdateBookRequest,\n\t\tencodeResponse,\n\t))\n\n\tr.Methods(\"DELETE\").Path(\"/books/{isbn}\").Handler(httptransport.NewServer(\n\t\tendpoints.DeleteBookEndpoint,\n\t\tdecodeDeleteBookRequest,\n\t\tencodeResponse,\n\t))\n\n\treturn handlers.CORS(handlers.AllowedMethods([]string{\"OPTIONS\", \"POST\", \"PUT\", \"DELETE\", \"GET\"}), handlers.AllowedOrigins([]string{\"*\"}))(r)\n}", "func (ServerEvent) Schema() string { return \"HTTPServer\" }", "func IpInterface_NewServer(s IpInterface_Server, policy *server.Policy) *server.Server {\n\tc, _ := s.(server.Shutdowner)\n\treturn server.New(IpInterface_Methods(nil, s), s, c, policy)\n}", "func NewHTTPServer(port int) HTTPServer {\n\tserver := HTTPServer{\n\t\tmux: http.NewServeMux(),\n\t}\n\tgo func() {\n\t\thttp.ListenAndServe(fmt.Sprintf(\":%d\", port), server.mux)\n\t}()\n\treturn server\n}", "func NewHTTPHandler(endpoints endpoint.EndpointSet, otTracer stdopentracing.Tracer, logger log.Logger) http.Handler {\n\n\toptions := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorEncoder(errorEncoder),\n\t\thttptransport.ServerErrorLogger(logger),\n\t}\n\n\tm := http.NewServeMux()\n\tm.Handle(\"/getallnodes\", httptransport.NewServer(\n\t\tendpoints.GetAllNodesEndpoint,\n\t\tdecodeHTTPGetAllNodesRequest,\n\t\tencodeHTTPGenericResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.HTTPToContext(otTracer, \"GetAllNodes\", logger)))...,\n\t))\n\tm.Handle(\"/newjob\", httptransport.NewServer(\n\t\tendpoints.NewJobEndpoint,\n\t\tdecodeHTTPNewJobRequest,\n\t\tencodeHTTPGenericResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.HTTPToContext(otTracer, \"NewJob\", logger)))...,\n\t))\n\treturn accessControl(m)\n}", "func NewHTTPHandler(endpoints endpoint.Endpoints, options map[string][]http.ServerOption) http1.Handler {\n\tm := http1.NewServeMux()\n\tmakeCreatePHandler(m, endpoints, options[\"CreateP\"])\n\tmakeReadPHandler(m, endpoints, options[\"ReadP\"])\n\tmakeUpdatePHandler(m, endpoints, options[\"UpdateP\"])\n\tmakeDeletePHandler(m, endpoints, options[\"DeleteP\"])\n\tmakeCreateFeedbackHandler(m, endpoints, options[\"CreateFeedback\"])\n\tmakeReadFeedbackHandler(m, endpoints, options[\"ReadFeedback\"])\n\tmakePostAttendanceHandler(m, endpoints, options[\"PostAttendance\"])\n\tmakeReadAttendanceHandler(m, endpoints, options[\"ReadAttendance\"])\n\treturn m\n}", "func New(body string, statusCode int) *FakeHTTPServer {\n\treturn &FakeHTTPServer{\n\t\tserver: httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tw.Write([]byte(body))\n\t\t\tw.WriteHeader(statusCode)\n\t\t})),\n\t}\n}", "func NewHttpServer(server *http.Server, config ServiceConfiguration) HttpServer {\n\tif config.Prefix == \"\" {\n\t\tconfig.Prefix = \"Http\"\n\t}\n\n\tif config.Name == \"\" {\n\t\tconfig.Name = \"Http Server Service\"\n\t}\n\n\treturn &enhanceHttpServer{\n\t\tserver: server,\n\t\tserviceConfig: config,\n\t}\n}", "func New(e *todo.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tGetH: NewGetHandler(e.Get, uh),\n\t\tListH: NewListHandler(e.List, uh),\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t\tRemoveH: NewRemoveHandler(e.Remove, uh),\n\t}\n}", "func NewServer(cli typedCore.CoreV1Interface, cfg ServerConfig) (*Server, error) {\n\tjwtSigningKey, err := ensureJWT(cli, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttlsConfig, err := prepareTLSConfig(cli, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tauth := &authorization{jwtSigningKey: jwtSigningKey}\n\n\ts := &Server{\n\t\thttpServer: &http.Server{\n\t\t\tAddr: cfg.HTTPAddress,\n\t\t\tReadTimeout: time.Second * 30,\n\t\t\tReadHeaderTimeout: time.Second * 15,\n\t\t\tWriteTimeout: time.Second * 30,\n\t\t\tTLSConfig: tlsConfig,\n\t\t},\n\t\tgrpcServer: grpc.NewServer(\n\t\t\tgrpc.UnaryInterceptor(auth.ensureGRPCAuth),\n\t\t\tgrpc.Creds(credentials.NewTLS(tlsConfig)),\n\t\t),\n\t\tgrpcAddress: cfg.GRPCAddress,\n\t}\n\thandler, err := buildHTTPHandler(s, cfg, auth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.httpServer.Handler = handler\n\n\tpb.RegisterOperatorServer(s.grpcServer, s)\n\treturn s, nil\n}", "func IpNetwork_NewServer(s IpNetwork_Server, policy *server.Policy) *server.Server {\n\tc, _ := s.(server.Shutdowner)\n\treturn server.New(IpNetwork_Methods(nil, s), s, c, policy)\n}", "func NewProtocolServer(r io.Reader, w io.Writer, s Store) *ProtocolServer {\n\treturn &ProtocolServer{\n\t\tp: NewProtocol(r, w),\n\t\tstore: s,\n\t}\n}", "func NewServer(cfg config.HTTP, staticResource bool, r *linmetric.Registry) Server {\n\ts := &server{\n\t\tcfg: cfg,\n\t\taddr: fmt.Sprintf(\":%d\", cfg.Port),\n\t\tgin: gin.New(),\n\t\tstaticResource: staticResource,\n\t\tserver: http.Server{\n\t\t\t// use extra timeout for ingestion and query timeout\n\t\t\t// if write timeout will return ERR_EMPTY_RESPONSE, chrome will does auto retry.\n\t\t\t// https://www.bennadel.com/blog/3257-google-chrome-will-automatically-retry-requests-on-certain-error-responses.htm\n\t\t\t// https://mariocarrion.com/2021/09/17/golang-software-architecture-resilience-http-servers.html\n\t\t\t// WriteTimeout: cfg.WriteTimeout.Duration(),\n\t\t\tReadTimeout: cfg.ReadTimeout.Duration(),\n\t\t\tIdleTimeout: cfg.IdleTimeout.Duration(),\n\t\t},\n\t\tr: r,\n\t\tlogger: logger.GetLogger(\"HTTP\", \"Server\"),\n\t}\n\ts.init()\n\treturn s\n}", "func NewHTTPServer(conf *conf.Server, service *service.UserService) *http.Server {\n\tvar opts []http.ServerOption\n\tif conf.Http.Network != \"\" {\n\t\topts = append(opts, http.Network(conf.Http.Network))\n\t}\n\tif conf.Http.Addr != \"\" {\n\t\topts = append(opts, http.Address(conf.Http.Addr))\n\t}\n\tif conf.Http.Timeout != nil {\n\t\topts = append(opts, http.Timeout(conf.Http.Timeout.AsDuration()))\n\t}\n\tsrv := http.NewServer(opts...)\n\tm := http.Middleware(\n\t\tmiddleware.Chain(\n\t\t\trecovery.Recovery(),\n\t\t\ttracing.Server(),\n\t\t\tlogging.Server(log.DefaultLogger),\n\t\t),\n\t)\n\tsrv.HandlePrefix(\"/\", v1.NewUserHandler(service, m))\n\treturn srv\n}", "func newHTTPHandler(c ServiceController, k8sStorage ServiceStorage) *httpHandler {\n\treturn &httpHandler{\n\t\tcontroller: c,\n\t\tk8sStorage: k8sStorage,\n\t}\n}", "func NewHTTPServer(ctx context.Context, endpoints transport.Endpoints) http.Handler {\n\n\trouter := mux.NewRouter()\n\trouter.Use(commonMiddleware)\n\tserverOpts := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorEncoder(transport.HTTPErrorHandler),\n\t}\n\n\trouter.Methods(\"GET\").Path(\"/question\").Handler(httptransport.NewServer(\n\t\tendpoints.FindAllQuestions,\n\t\ttransport.DecodeRequest,\n\t\ttransport.EncodeResponse,\n\t\tserverOpts...,\n\t))\n\n\trouter.Methods(\"GET\").Path(\"/question/{id}\").Handler(httptransport.NewServer(\n\t\tendpoints.FindQuestionById,\n\t\ttransport.DecodeIDParamRequest,\n\t\ttransport.EncodeResponse,\n\t\tserverOpts...,\n\t))\n\n\trouter.Methods(\"GET\").Path(\"/question/user/{userId}\").Handler(httptransport.NewServer(\n\t\tendpoints.FindQuestionsByUser,\n\t\ttransport.DecodeFindQuestionByUserRequest,\n\t\ttransport.EncodeResponse,\n\t\tserverOpts...,\n\t))\n\n\trouter.Methods(\"POST\").Path(\"/question\").Handler(httptransport.NewServer(\n\t\tendpoints.CreateQuestion,\n\t\ttransport.DecodeCreateQuestionRequest,\n\t\ttransport.EncodeResponse,\n\t\tserverOpts...,\n\t))\n\n\trouter.Methods(\"POST\").Path(\"/question/answer\").Handler(httptransport.NewServer(\n\t\tendpoints.AddAnswer,\n\t\ttransport.DecodeAddAnswerRequest,\n\t\ttransport.EncodeResponse,\n\t\tserverOpts...,\n\t))\n\n\trouter.Methods(\"PUT\").Path(\"/question/{id}\").Handler(httptransport.NewServer(\n\t\tendpoints.UpdateQuestion,\n\t\ttransport.DecodeUpdateQuestionRequest,\n\t\ttransport.EncodeResponse,\n\t\tserverOpts...,\n\t))\n\n\trouter.Methods(\"DELETE\").Path(\"/question/{id}\").Handler(httptransport.NewServer(\n\t\tendpoints.DeleteQuestion,\n\t\ttransport.DecodeIDParamRequest,\n\t\ttransport.EncodeResponse,\n\t\tserverOpts...,\n\t))\n\n\treturn router\n}", "func New(bindAddress string, tableauEndpoint string) *http.Server {\n\treturn &http.Server{\n\t\tAddr: bindAddress,\n\t\tHandler: TabAuth{\n\t\t\t&Client{tableauEndpoint, &http.Client{}},\n\t\t\taccounts(),\n\t\t},\n\t}\n}", "func New(middleware ...Handler) *Server {\n\tdebugPrintWARNINGNew()\n\tserv := &Server{\n\t\trouter: make(tree.Trees, 0, 9),\n\t\tnotFound: []Handler{default404Handler},\n\t\tnoMethod: []Handler{default405Handler},\n\t\tmiddleware: middleware,\n\t\tRedirectTrailingSlash: true,\n\t\tRedirectFixedPath: false,\n\t\tMaxMultipartMemory: defaultMultipartMemory,\n\t}\n\n\tserv.pool.New = func() interface{} {\n\t\treturn serv.allocateContext()\n\t}\n\treturn serv\n}", "func NewHTTPServer(l net.Listener, handle http.Handler, c *tls.Config) (*http.Server, net.Listener, error) {\n\ttl, ok := l.(*net.TCPListener)\n\n\tif !ok {\n\t\treturn nil, nil, fmt.Errorf(\"Listener is not type *net.TCPListener\")\n\t}\n\n\ttls := NewKeepAliveListener(tl)\n\n\ts := &http.Server{\n\t\tAddr: tl.Addr().String(),\n\t\tHandler: handle,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t\tTLSConfig: c,\n\t}\n\n\tlog.Printf(\"Serving http connection on: %+q\\n\", s.Addr)\n\tgo s.Serve(tls)\n\n\treturn s, tls, nil\n}", "func NewService() http.Handler {\n\th := http.NewServeMux()\n\th.HandleFunc(\"/ip\", IP)\n\th.HandleFunc(\"/headers\", Headers)\n\treturn h\n}", "func NewHTTPServer(c *conf.Server, greeter *service.GreeterService) *http.Server {\n\tvar opts = []http.ServerOption{}\n\tif c.Http.Network != \"\" {\n\t\topts = append(opts, http.Network(c.Http.Network))\n\t}\n\tif c.Http.Addr != \"\" {\n\t\topts = append(opts, http.Address(c.Http.Addr))\n\t}\n\tif c.Http.Timeout != nil {\n\t\topts = append(opts, http.Timeout(c.Http.Timeout.AsDuration()))\n\t}\n\tsrv := http.NewServer(opts...)\n\tm := http.Middleware(\n\t\tmiddleware.Chain(\n\t\t\trecovery.Recovery(),\n\t\t\ttracing.Server(),\n\t\t\tlogging.Server(),\n\t\t\tmiddlewares.Server(),\n\t\t),\n\t)\n\tm = http.ResponseEncoder(RegisterDataResponseEncoder)\n\tsrv.HandlePrefix(\"/\", v1.NewGreeterHandler(greeter, m))\n\treturn srv\n}", "func New(options *Options) (*HTTPServer, error) {\n\tvar h HTTPServer\n\tEnableUpload = options.EnableUpload\n\tEnableVerbose = options.Verbose\n\tfolder, err := filepath.Abs(options.Folder)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := os.Stat(folder); os.IsNotExist(err) {\n\t\treturn nil, errors.New(\"path does not exist\")\n\t}\n\toptions.Folder = folder\n\tvar dir http.FileSystem\n\tdir = http.Dir(options.Folder)\n\tif options.Sandbox {\n\t\tdir = SandboxFileSystem{fs: http.Dir(options.Folder), RootFolder: options.Folder}\n\t}\n\th.layers = h.loglayer(http.FileServer(dir))\n\tif options.BasicAuthUsername != \"\" || options.BasicAuthPassword != \"\" {\n\t\th.layers = h.loglayer(h.basicauthlayer(http.FileServer(dir)))\n\t}\n\th.options = options\n\n\treturn &h, nil\n}", "func New(sigs chan os.Signal) *Server {\n\ts := &Server{mux: http.NewServeMux(), sigs: sigs}\n\n\tif s.logger == nil {\n\t\ts.logger = log.New(os.Stdout, \"\", 0)\n\t}\n\n\ts.db = store.NewStore()\n\n\ts.mux.HandleFunc(\"/\", s.latencyMiddleware(s.index))\n\ts.mux.HandleFunc(\"/hash/\", s.latencyMiddleware(s.hash))\n\ts.mux.HandleFunc(\"/shutdown/\", s.latencyMiddleware(s.shutdown))\n\ts.mux.HandleFunc(\"/stats/\", s.stats)\n\n\treturn s\n}", "func NewHTTPServer(logger log.Logger) Server {\n\treturn &httpServer{logger: logger}\n}", "func NewHTTP(base mb.BaseMetricSet) (*HTTP, error) {\n\tconfig := defaultConfig()\n\tif err := base.Module().UnpackConfig(&config); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newHTTPFromConfig(config, base.Name(), base.HostData())\n}", "func NewServer() *Server {}", "func NewHTTPHandler(db *sql.DB) HandlerInterface {\n\treturn &Handler{\n\t\tps: NewService(db),\n\t}\n}", "func StartHttpServer(srv *http.Server) error {\n\thttp.HandleFunc(\"/new\", newServer)\n\terr := srv.ListenAndServe()\n\treturn err\n}", "func NewServer(proto, addr string, job *engine.Job) (Server, error) {\n\t// Basic error and sanity checking\n\tswitch proto {\n\tcase \"tcp\":\n\t\treturn setupTcpHttp(addr, job)\n\tdefault:\n\t\treturn nil, errors.New(\"Invalid protocol format. Windows only supports tcp.\")\n\t}\n}", "func NewHTTPServer(configs *config.Configs,\n\tmetricMiddleware h.MiddlewareWrapper) (*Server, *http.Server, error) {\n\n\t// TODO(sam): pass through database configs\n\tdb, err := database.Connect(configs.DBURL, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tapiClient := New(db, configs)\n\n\tvar apiHandler http.Handler = apiClient\n\tif metricMiddleware != nil {\n\t\tapiHandler = metricMiddleware(apiHandler)\n\t}\n\n\treturn apiClient, &http.Server{\n\t\tAddr: configs.APIAddress,\n\t\tWriteTimeout: configs.WriteTimeout,\n\t\tReadTimeout: configs.ReadTimeout,\n\t\tIdleTimeout: configs.IdleTimeout,\n\t\tHandler: apiHandler,\n\t}, nil\n}", "func NewServer(a string) *HTTPserver {\n\tmux := http.NewServeMux()\n\tsrv := HTTPserver{\n\t\thttp: &http.Server{Addr: a, Handler: mux},\n\t\tmux: mux,\n\t}\n\n\treturn &srv\n}", "func HttpServer() {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/order/\", findOrderHandle)\n\tmux.HandleFunc(\"/order/create/\", createOrderHandle)\n\tmux.HandleFunc(\"/order/addProduct/\", addProductHandle)\n\tmux.HandleFunc(\"/order/removeProduct/\", removeProductHandle)\n\tlog.Fatal(http.ListenAndServe(\":8080\", mux))\n}", "func New(listener net.Listener, httpServer *http.Server) goroutine.BackgroundRoutine {\n\treturn &server{\n\t\tserver: httpServer,\n\t\tmakeListener: func() (net.Listener, error) { return listener, nil },\n\t}\n}", "func NewServer(tokens []string, handlers []Handler) *Server {\n\tt := make(map[string]bool)\n\tfor _, v := range tokens {\n\t\tt[v] = true\n\t}\n\treturn &Server{\n\t\ttokens: t,\n\t\thandlers: handlers,\n\t}\n}", "func newTestServer(logStore logstore.LogStore) *HTTPServer {\n\t// note: address doesn't matter since we will use httptest server\n\tserver := NewHTTP(&Config{BindAddress: \"127.0.0.1:8080\"}, logStore)\n\treturn server\n}", "func NewHTTPHandler(endpoints endpoints.Endpoints, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) http.Handler { // Zipkin HTTP Server Trace can either be instantiated per endpoint with a\n\t// provided operation name or a global tracing service can be instantiated\n\t// without an operation name and fed to each Go kit endpoint as ServerOption.\n\t// In the latter case, the operation name will be the endpoint's http method.\n\t// We demonstrate a global tracing service here.\n\tzipkinServer := zipkin.HTTPServerTrace(zipkinTracer)\n\n\toptions := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorEncoder(httpEncodeError),\n\t\thttptransport.ServerErrorLogger(logger),\n\t\tzipkinServer,\n\t}\n\n\tm := http.NewServeMux()\n\tm.Handle(\"/sum\", httptransport.NewServer(\n\t\tendpoints.SumEndpoint,\n\t\tdecodeHTTPSumRequest,\n\t\thttptransport.EncodeJSONResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.HTTPToContext(otTracer, \"Sum\", logger)))...,\n\t))\n\tm.Handle(\"/concat\", httptransport.NewServer(\n\t\tendpoints.ConcatEndpoint,\n\t\tdecodeHTTPConcatRequest,\n\t\thttptransport.EncodeJSONResponse,\n\t\tappend(options, httptransport.ServerBefore(opentracing.HTTPToContext(otTracer, \"Concat\", logger)))...,\n\t))\n\tm.Handle(\"/metrics\", promhttp.Handler())\n\treturn m\n}", "func New(host, port string, h http.Handler) *WebServer {\n\tvar ws WebServer\n\n\tws.Addr = net.JoinHostPort(host, port)\n\tws.Handler = h\n\n\treturn &ws\n}", "func NewHTTPProviderServer(iface, port string) *HTTPProviderServer {\n\treturn &HTTPProviderServer{iface: iface, port: port}\n}", "func NewFirmwareHttpServer(classId string, objectType string) *FirmwareHttpServer {\n\tthis := FirmwareHttpServer{}\n\tthis.ClassId = classId\n\tthis.ObjectType = objectType\n\treturn &this\n}", "func NewServer(addr, jwksURL, mongoConnection string) *TodoServer {\n\t// Set up\n\trouter := mux.NewRouter()\n\thttpServer := &http.Server{\n\t\tAddr: addr,\n\t\tHandler: router,\n\t}\n\n\t// db := NewTodoMemoryRepository()\n\tdb := NewMongoRepository(mongoConnection, \"togo\", \"todos\")\n\tjwt := createJWT(jwksURL)\n\n\t// Build TodoServer struct\n\ts := &TodoServer{\n\t\thttpServer,\n\t\trouter,\n\t\tdb,\n\t\tjwt,\n\t}\n\n\tsetRoutes(s)\n\n\treturn s\n}", "func NewTestHTTPServer() TestHTTPServer {\n\trouter := mux.NewRouter()\n\trouter.HandleFunc(healthPath, healthFunc)\n\treturn &testHTTPServerImpl{\n\t\trouter: router,\n\t\tcallCounter: make(map[string]int),\n\t}\n}", "func New() *Server {\n\tws := &Server{}\n\tws.controls = make([]control.Control, 0)\n\tws.middleware = make([]middle.Handler, 0)\n\tws.staticFiles = make(map[string]string)\n\tws.router = mux.NewRouter()\n\n\thttp.Handle(\"/\", ws.router)\n\treturn ws\n}", "func New(swaggerStore string, hugoStore string, runMode string, externalIP string, hugoDir string) (*Server, error) {\n\t// Return a new struct\n\treturn &Server{\n\t\tServiceMap: make(map[string]string),\n\t\tSwaggerStore: swaggerStore,\n\t\tHugoStore: hugoStore,\n\t\tRunMode: runMode,\n\t\tExternalIP: externalIP,\n\t\tHugoDir: hugoDir,\n\t}, nil\n}", "func NewServer() *Server {\n\treturn &Server{\n\t\tBasepath: \"/oto/\",\n\t\troutes: make(map[string]http.Handler),\n\t\tOnErr: func(w http.ResponseWriter, r *http.Request, err error) {\n\t\t\terrObj := struct {\n\t\t\t\tError string `json:\"error\"`\n\t\t\t}{\n\t\t\t\tError: err.Error(),\n\t\t\t}\n\t\t\tif err := Encode(w, r, http.StatusInternalServerError, errObj); err != nil {\n\t\t\t\tlog.Printf(\"failed to encode error: %s\\n\", err)\n\t\t\t}\n\t\t},\n\t\tNotFound: http.NotFoundHandler(),\n\t}\n}", "func newServer(a *Air) *server {\n\treturn &server{\n\t\ta: a,\n\t\tserver: &http.Server{},\n\t\taddressMap: map[string]int{},\n\t\trequestPool: &sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn &Request{}\n\t\t\t},\n\t\t},\n\t\tresponsePool: &sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn &Response{}\n\t\t\t},\n\t\t},\n\t}\n}", "func NewSchema(m ...interface{}) *Schema {\n\tif len(m) > 0 {\n\t\tsche := &Schema{}\n\t\tstack := toMiddleware(m)\n\t\tfor _, s := range stack {\n\t\t\t*sche = append(*sche, s)\n\t\t}\n\t\treturn sche\n\t}\n\treturn nil\n}", "func NewServer(ops ServerOps) *Server {\n\treturn &Server{ops: ops}\n}", "func NewHTTPPool(serverID string) *HTTPPool {\n\treturn &HTTPPool{\n\t\tbasePath: defaultBasePath,\n\t\tserverID: serverID,\n\t}\n}", "func New(srv *cmutation.Server) *Server {\n\treturn &Server{srv}\n}", "func New(address string, branch string, secret string, logger *logrus.Logger) http.Handler {\n\tproto := \"tcp\"\n\taddr := address\n\tif strings.HasPrefix(addr, \"unix:\") {\n\t\tproto = \"unix\"\n\t\taddr = addr[5:]\n\t}\n\treturn &Server{\n\t\tproto: proto,\n\t\taddress: addr,\n\t\tbranch: branch,\n\t\tsecret: secret,\n\t\tlogger: logger,\n\t}\n}", "func NewOperation(op storage.SiteOperation) (storage.Operation, error) {\n\toperation := &storage.OperationV2{\n\t\tKind: storage.KindOperation,\n\t\tVersion: services.V2,\n\t\tMetadata: services.Metadata{\n\t\t\tName: op.ID,\n\t\t\tNamespace: defaults.Namespace,\n\t\t},\n\t\tSpec: storage.OperationSpecV2{\n\t\t\tType: op.Type,\n\t\t\tCreated: op.Created,\n\t\t\tState: op.State,\n\t\t},\n\t}\n\tswitch op.Type {\n\tcase OperationInstall:\n\t\toperation.Spec.Install = &storage.OperationInstall{\n\t\t\tNodes: newNodes(op.Servers),\n\t\t}\n\tcase OperationExpand:\n\t\tif len(op.Servers) != 0 {\n\t\t\toperation.Spec.Expand = &storage.OperationExpand{\n\t\t\t\tNode: newNode(op.Servers[0]),\n\t\t\t}\n\t\t}\n\tcase OperationShrink:\n\t\tif len(op.Shrink.Servers) != 0 {\n\t\t\toperation.Spec.Shrink = &storage.OperationShrink{\n\t\t\t\tNode: newNode(op.Shrink.Servers[0]),\n\t\t\t}\n\t\t}\n\tcase OperationUpdate:\n\t\tlocator, err := loc.ParseLocator(op.Update.UpdatePackage)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\toperation.Spec.Upgrade = &storage.OperationUpgrade{\n\t\t\tPackage: *locator,\n\t\t}\n\tcase OperationUpdateRuntimeEnviron:\n\t\toperation.Spec.UpdateEnviron = &storage.OperationUpdateEnviron{\n\t\t\tEnv: op.UpdateEnviron.Env,\n\t\t}\n\tcase OperationUpdateConfig:\n\t\toperation.Spec.UpdateConfig = &storage.OperationUpdateConfig{\n\t\t\tConfig: op.UpdateConfig.Config,\n\t\t}\n\tcase OperationReconfigure:\n\t\toperation.Spec.Reconfigure = &storage.OperationReconfigure{\n\t\t\tIP: op.Reconfigure.AdvertiseAddr,\n\t\t}\n\t}\n\treturn operation, nil\n}", "func New(prefix string, gIndex *osm.Data, styles map[string]map[string]config.Style) *Server {\n\treturn &Server{\n\t\tprefix: prefix,\n\t\tgIndex: gIndex,\n\t\tstyles: styles,\n\t}\n}", "func New() HelloServer {\n\thttp.DefaultServeMux = new(http.ServeMux)\n\treturn HelloServer{\n\t\t&http.Server{\n\t\t\tAddr: \":7100\",\n\t\t},\n\t}\n}", "func BridgeHttpSession_NewServer(s BridgeHttpSession_Server, policy *server.Policy) *server.Server {\n\tc, _ := s.(server.Shutdowner)\n\treturn server.New(BridgeHttpSession_Methods(nil, s), s, c, policy)\n}", "func NewHTTP(key client.ObjectKey) *HTTP {\n\treturn &HTTP{\n\t\tKey: key,\n\n\t\tOwnerConfigMap: corev1obj.NewConfigMap(key),\n\t\tService: corev1obj.NewService(key),\n\t\tPod: corev1obj.NewPod(key),\n\t}\n}", "func NewHTTPBackend(server, path, format string) (Platform, error) {\n\thb := &HTTPBackend{\n\t\tClient: http.DefaultClient,\n\t\tFormat: format,\n\t}\n\n\t// ensure the url is acceptable and can be parsed\n\taddr, err := url.Parse(\"http://\" + server + path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thb.URL = addr\n\n\treturn hb, nil\n}", "func NewHTTP(port uint16, pachClientFactory func(ctx context.Context) *client.APIClient) *HTTP {\n\tmux := http.NewServeMux()\n\thandler := &Server{\n\t\tpachClientFactory: pachClientFactory,\n\t}\n\tmux.Handle(\"/archive/\", CSRFWrapper(handler))\n\tmux.Handle(\"/healthz\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(\"healthy\\n\")) //nolint:errcheck\n\t}))\n\treturn &HTTP{\n\t\tmux: mux,\n\t\tserver: &http.Server{\n\t\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\t\tHandler: mux,\n\t\t},\n\t}\n}", "func NewHTTPStore(baseURL, metaPrefix, metaExtension, keyExtension string, roundTrip http.RoundTripper) (RemoteStore, error) {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !base.IsAbs() {\n\t\treturn nil, errors.New(\"HTTPStore requires an absolute baseURL\")\n\t}\n\tif roundTrip == nil {\n\t\treturn &OfflineStore{}, nil\n\t}\n\treturn &HTTPStore{\n\t\tbaseURL: *base,\n\t\tmetaPrefix: metaPrefix,\n\t\tmetaExtension: metaExtension,\n\t\tkeyExtension: keyExtension,\n\t\troundTrip: roundTrip,\n\t}, nil\n}", "func NewServer(e Engine, c http.ServerConfig) (*Server, error) {\n\tsvr, err := http.NewServer(c)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\ts := &Server{\n\t\tServer: svr,\n\t\tengine: e,\n\t\tlog: logger.WithFields(\"api\", \"http\"),\n\t}\n\ts.Handle(s.getPort, \"GET\", \"/ports/available\", \"host\", \"{host}\")\n\ts.Handle(s.startModule, \"PUT\", \"/modules/{name}/start\")\n\ts.Handle(s.stopModule, \"PUT\", \"/modules/{name}/stop\")\n\treturn s, nil\n}", "func New(appStateUpdater env.AppStateUpdater, config libkbfs.Config) (\n\ts *Server, err error) {\n\tlogger := config.MakeLogger(\"HTTP\")\n\ts = &Server{\n\t\tappStateUpdater: appStateUpdater,\n\t\tconfig: config,\n\t\tlogger: logger,\n\t\tvlog: config.MakeVLogger(logger),\n\t}\n\tif s.fs, err = lru.New(fsCacheSize); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = s.restart(); err != nil {\n\t\treturn nil, err\n\t}\n\tctx, cancel := context.WithCancel(context.Background())\n\tgo s.monitorAppState(ctx)\n\ts.cancel = cancel\n\tlibmime.Patch(additionalMimeTypes)\n\treturn s, nil\n}", "func NewHTTPServer(ctx context.Context, settings Settings) (*ServerHTTP, error) {\n\tserver := &ServerHTTP{\n\t\taddress: settings.Address,\n\t\tservice: settings.Service,\n\t\trouter: mux.NewRouter(),\n\t\ttracer: settings.Tracer,\n\t}\n\tserver.registerHandlers(ctx)\n\treturn server, nil\n}", "func New(h http.Handler, opts *Options) *Server {\n\tsrv := &Server{handler: h}\n\tif opts != nil {\n\t\tsrv.reqlog = opts.RequestLogger\n\t\tsrv.te = opts.TraceExporter\n\t\tfor _, c := range opts.HealthChecks {\n\t\t\tsrv.healthHandler.Add(c)\n\t\t}\n\t\tsrv.sampler = opts.DefaultSamplingPolicy\n\t\tsrv.driver = opts.Driver\n\t}\n\treturn srv\n}", "func New(b *board.Board, ps [2]match.Player) *HTTPServer {\n ms := new(vector.Vector)\n ms.Push(match.New(b, ps))\n return &HTTPServer{ms}\n}", "func NewProtocol(action string, hID int64, note string) Protocol {\n\treturn Protocol{\n\t\tTime: time.Now(),\n\t\tAction: action,\n\t\tHeroID: hID,\n\t\tNote: note,\n\t}\n}", "func NewLocalServer() *LocalServer {\n\tvar server LocalServer\n\n\t//TODO query should return an error as appropriate\n\tserver.query = func(request string) io.ReadCloser {\n\t\tresp, err := http.Get(\"http://127.0.0.1:8081/\" + request)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn nil\n\t\t}\n\t\treturn resp.Body\n\t}\n\n\tserver.post = func(url, contentType string, outbuf *bytes.Buffer) (io.ReadCloser, error) {\n\t\trepoUrl := \"http://127.0.0.1:8081/\" + url\n\t\ttr := &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t}\n\t\tclient := &http.Client{Transport: tr}\n\t\treq, err := http.NewRequest(\"POST\", repoUrl, outbuf)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treq.Header.Set(\"Content-Type\", contentType)\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn resp.Body, nil\n\t}\n\treturn &server\n}", "func NewHTTPHandler(endpoints endpoints.Endpoints) *mux.Router {\n\tt := mux.NewRouter()\n\tt.StrictSlash(true)\n\tm := t.PathPrefix(\"/mda\").Subrouter()\n\topts := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorEncoder(errorEncoder),\n\t}\n\tm.Handle(\"/\", httptransport.NewServer(\n\t\tendpoints.AddEndpoint,\n\t\tDecodeAddRequest,\n\t\tEncodeAddResponse,\n\t\topts...,\n\t)).Methods(\"POST\")\n\tm.Handle(\"/start/{id}\", httptransport.NewServer(\n\t\tendpoints.StartEndpoint,\n\t\tDecodeStartRequest,\n\t\tEncodeStartResponse,\n\t\topts...,\n\t)).Methods(\"POST\")\n\tm.Handle(\"/remove/{id}\", httptransport.NewServer(\n\t\tendpoints.RemoveEndpoint,\n\t\tDecodeRemoveRequest,\n\t\tEncodeRemoveResponse,\n\t\topts...,\n\t)).Methods(\"POST\")\n\tm.Handle(\"/change/{id}\", httptransport.NewServer(\n\t\tendpoints.ChangeEndpoint,\n\t\tDecodeChangeRequest,\n\t\tEncodeChangeResponse,\n\t\topts...,\n\t)).Methods(\"PUT\")\n\tm.Handle(\"/{id}\", httptransport.NewServer(\n\t\tendpoints.GetEndpoint,\n\t\tDecodeGetRequest,\n\t\tEncodeGetResponse,\n\t\topts...,\n\t)).Methods(\"GET\")\n\tm.Handle(\"/\", httptransport.NewServer(\n\t\tendpoints.ListEndpoint,\n\t\tDecodeListRequest,\n\t\tEncodeListResponse,\n\t\topts...,\n\t)).Methods(\"GET\")\n\tm.Handle(\"/enable\", httptransport.NewServer(\n\t\tendpoints.EnableEndpoint,\n\t\tDecodeEnableRequest,\n\t\tEncodeEnableResponse,\n\t\topts...,\n\t)).Methods(\"POST\")\n\tm.Handle(\"/disable\", httptransport.NewServer(\n\t\tendpoints.DisableEndpoint,\n\t\tDecodeDisableRequest,\n\t\tEncodeDisableResponse,\n\t\topts...,\n\t)).Methods(\"POST\")\n\treturn t\n}", "func newHTTPHandler(web3Handler Web3Handler) *hTTPHandler {\n\treturn &hTTPHandler{\n\t\tmsgHandler: web3Handler,\n\t}\n}", "func NewServer(addr,user, password string) (*HttpServer, error) {\n\tdb := pg.Connect(&pg.Options{\n\t\tAddr: addr,\n\t\tPassword: password,\n\t\tUser: user,\n\t})\n\t_, err := db.Exec(\"SELECT 1\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcron := cron.New()\n\treturn &HttpServer{\n\t\tdb: db,\n\t\tcron: cron,\n\t\trouter: httprouter.New(),\n\t}, nil\n}", "func NewServer(service waqi.Service, listenAddr string, logger *log.Logger) (Server, error) {\n\tgin.SetMode(gin.ReleaseMode)\n\n\trouter := gin.New()\n\trouter.Use(gin.Recovery())\n\thttp.Handle(\"/\", router)\n\n\t// REST API\n\tcontroller := &restController{service: service}\n\trouter.GET(\"/api/status/geo\", controller.GetByGeo)\n\trouter.GET(\"/api/status/city/:city\", controller.GetByCity)\n\trouter.GET(\"/api/status/station/:id\", controller.GetByStation)\n\n\t// Static files\n\terr := mime.AddExtensionType(\".js\", \"application/javascript\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trouter.NoRoute(func(c *gin.Context) {\n\t\tdir, file := path.Split(c.Request.RequestURI)\n\t\text := filepath.Ext(file)\n\t\tif file == \"\" || ext == \"\" {\n\t\t\tc.File(\"./www/index.html\")\n\t\t} else {\n\t\t\tc.File(\"./www\" + path.Join(dir, file))\n\t\t}\n\t})\n\n\ts := &server{\n\t\tlistenAddr: listenAddr,\n\t\tdone: make(chan bool),\n\t\tlogger: logger,\n\t}\n\treturn s, nil\n}" ]
[ "0.6888295", "0.6189121", "0.602804", "0.5942194", "0.5839386", "0.57312566", "0.56926584", "0.5610782", "0.55504155", "0.5543905", "0.54744565", "0.5453673", "0.5442349", "0.54244053", "0.53882587", "0.53776985", "0.5369273", "0.53098", "0.5299757", "0.52967995", "0.52923065", "0.52215725", "0.5219588", "0.5208562", "0.5205938", "0.5188299", "0.5160922", "0.5150946", "0.51275706", "0.5126159", "0.51178294", "0.5108891", "0.5091152", "0.5084456", "0.50835806", "0.50830245", "0.5079065", "0.5069121", "0.5067582", "0.5066388", "0.50622493", "0.5053925", "0.50511587", "0.5041935", "0.50388795", "0.50157964", "0.50033265", "0.49992317", "0.49976748", "0.49856737", "0.49784055", "0.49777988", "0.49675182", "0.49656326", "0.4965116", "0.49614754", "0.49538934", "0.49450356", "0.49394113", "0.49386576", "0.49339217", "0.49210653", "0.4920391", "0.49152425", "0.491337", "0.49033442", "0.48938376", "0.4891451", "0.48828965", "0.48597032", "0.4858147", "0.48579642", "0.48575753", "0.48494926", "0.4847419", "0.48423862", "0.48365194", "0.4835062", "0.48346695", "0.48296022", "0.48294938", "0.48264417", "0.48209986", "0.4814585", "0.48134068", "0.4809584", "0.48080263", "0.48012263", "0.48007947", "0.4798602", "0.4790992", "0.47823805", "0.47810915", "0.4778571", "0.47784308", "0.47725323", "0.47669625", "0.47650537", "0.47631985", "0.4758268" ]
0.847924
0
NewGRPCClientOp creates a new schema for gRPC client outbound operations.
func NewGRPCClientOp(opts ...Option) *Schema { return NewClientOutboundOp("grpc", opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewGRPCClient(conn *grpc.ClientConn, tracer stdopentracing.Tracer, logger log.Logger) Service {\n\t// global client middlewares\n\toptions := []grpctransport.ClientOption{\n\t\tgrpctransport.ClientBefore(opentracing.ContextToGRPC(tracer, logger)),\n\t}\n\n\treturn endpoints{\n\t\t// Each individual endpoint is an grpc/transport.Client (which implements\n\t\t// endpoint.Endpoint) that gets wrapped with various middlewares. If you\n\t\t// made your own client library, you'd do this work there, so your server\n\t\t// could rely on a consistent set of client behavior.\n\t\tApiUserConfirmEndpoint: grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"apipb.ApiService\",\n\t\t\t\"ApiUserConfirm\",\n\t\t\tencodeGRPCUserConfirmRequest,\n\t\t\tdecodeGRPCUserConfirmResponse,\n\t\t\tpb.UserConfirmResponse{},\n\t\t\toptions...,\n\t\t).Endpoint(),\n\t\tApiUserProfileEndpoint: grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"apipb.ApiService\",\n\t\t\t\"ApiUserProfile\",\n\t\t\tencodeGRPCUserProfileRequest,\n\t\t\tdecodeGRPCUserProfileResponse,\n\t\t\tpb.UserProfileResponse{},\n\t\t\toptions...,\n\t\t).Endpoint(),\n\t\tApiUserRegistrationEndpoint: grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"apipb.ApiService\",\n\t\t\t\"ApiUserRegistration\",\n\t\t\tencodeGRPCUserRegRequest,\n\t\t\tdecodeGRPCUserRegResponse,\n\t\t\tpb.UserRegResponse{},\n\t\t\toptions...,\n\t\t).Endpoint(),\n\t}\n}", "func NewGRPCClient(conn *grpc.ClientConn, otTracer stdopentracing.Tracer, logger log.Logger) Service {\n\t// We construct a single ratelimiter middleware, to limit the total outgoing\n\t// QPS from this client to all methods on the remote instance. We also\n\t// construct per-endpoint circuitbreaker middlewares to demonstrate how\n\t// that's done, although they could easily be combined into a single breaker\n\t// for the entire remote instance, too.\n\tlimiter := ratelimit.NewErroringLimiter(rate.NewLimiter(rate.Every(time.Second), 100))\n\n\t// global client middlewares\n\toptions := []grpctransport.ClientOption{}\n\n\t// Each individual endpoint is an grpc/transport.Client (which implements\n\t// endpoint.Endpoint) that gets wrapped with various middlewares. If you\n\t// made your own client library, you'd do this work there, so your server\n\t// could rely on a consistent set of client behavior.\n\tvar generateReportEndpoint endpoint.Endpoint\n\t{\n\t\tgenerateReportEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.GenerateReport\",\n\t\t\t\"GenerateReport\",\n\t\t\tencodeGRPCGenerateReportRequest,\n\t\t\tdecodeGRPCGenerateReportResponse,\n\t\t\tpb.GenerateReportReply{},\n\t\t\tappend(options, grpctransport.ClientBefore(opentracing.ContextToGRPC(otTracer, logger)))...,\n\t\t).Endpoint()\n\t\tgenerateReportEndpoint = opentracing.TraceClient(otTracer, \"GenerateReport\")(generateReportEndpoint)\n\t\tgenerateReportEndpoint = limiter(generateReportEndpoint)\n\t\tgenerateReportEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{\n\t\t\tName: \"GenerateReport\",\n\t\t\tTimeout: 30 * time.Second,\n\t\t}))(generateReportEndpoint)\n\t}\n\n\t// Returning the endpoint.Set as a service.Service relies on the\n\t// endpoint.Set implementing the Service methods. That's just a simple bit\n\t// of glue code.\n\treturn Set{\n\t\tGenerateReportEndpoint: generateReportEndpoint,\n\t}\n}", "func NewGRPCClient(conn *grpc.ClientConn, logger log.Logger) mathservice2.Service {\n\tvar divideEndpoint endpoint.Endpoint\n\t{\n\t\tdivideEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.Math\",\n\t\t\t\"Divide\",\n\t\t\tencodeGRPCMathOpRequest,\n\t\t\tdecodeGRPCMathOpResponse,\n\t\t\tpb.MathOpReply{},\n\t\t).Endpoint()\n\t}\n\tvar maxEndpoint endpoint.Endpoint\n\t{\n\t\tmaxEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.Math\",\n\t\t\t\"Max\",\n\t\t\tencodeGRPCMathOpRequest,\n\t\t\tdecodeGRPCMathOpResponse,\n\t\t\tpb.MathOpReply{},\n\t\t).Endpoint()\n\t}\n\tvar minEndpoint endpoint.Endpoint\n\t{\n\t\tminEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.Math\",\n\t\t\t\"Min\",\n\t\t\tencodeGRPCMathOpRequest,\n\t\t\tdecodeGRPCMathOpResponse,\n\t\t\tpb.MathOpReply{},\n\t\t).Endpoint()\n\t}\n\tvar multiplyEndpoint endpoint.Endpoint\n\t{\n\t\tmultiplyEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.Math\",\n\t\t\t\"Multiply\",\n\t\t\tencodeGRPCMathOpRequest,\n\t\t\tdecodeGRPCMathOpResponse,\n\t\t\tpb.MathOpReply{},\n\t\t).Endpoint()\n\t}\n\tvar powEndpoint endpoint.Endpoint\n\t{\n\t\tpowEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.Math\",\n\t\t\t\"Pow\",\n\t\t\tencodeGRPCMathOpRequest,\n\t\t\tdecodeGRPCMathOpResponse,\n\t\t\tpb.MathOpReply{},\n\t\t).Endpoint()\n\t}\n\tvar subtractEndpoint endpoint.Endpoint\n\t{\n\t\tsubtractEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.Math\",\n\t\t\t\"Subtract\",\n\t\t\tencodeGRPCMathOpRequest,\n\t\t\tdecodeGRPCMathOpResponse,\n\t\t\tpb.MathOpReply{},\n\t\t).Endpoint()\n\t}\n\tvar sumEndpoint endpoint.Endpoint\n\t{\n\t\tsumEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.Math\",\n\t\t\t\"Sum\",\n\t\t\tencodeGRPCMathOpRequest,\n\t\t\tdecodeGRPCMathOpResponse,\n\t\t\tpb.MathOpReply{},\n\t\t).Endpoint()\n\t}\n\n\t// Returning the endpoint.Set as a service.Service relies on the\n\t// endpoint.Set implementing the Service methods. That's just a simple bit\n\t// of glue code.\n\treturn mathendpoint2.Set{\n\t\tDivideEndpoint: divideEndpoint,\n\t\tMaxEndpoint: maxEndpoint,\n\t\tMinEndpoint: minEndpoint,\n\t\tMultiplyEndpoint: multiplyEndpoint,\n\t\tPowEndpoint: powEndpoint,\n\t\tSubtractEndpoint: subtractEndpoint,\n\t\tSumEndpoint: sumEndpoint,\n\t}\n}", "func NewGRPCClient(c *config.RootConfig, log *log.Logger) *GrpcClient {\n\tg := &GrpcClient{\n\t\tconfig: c,\n\t\tlogger: log,\n\t}\n\treturn g\n}", "func NewGRPCClient(conn *grpc.ClientConn, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) loginservice.Service {\n\t// We construct a single ratelimiter middleware, to limit the total outgoing\n\t// QPS from this client to all methods on the remote instance. We also\n\t// construct per-endpoint circuitbreaker middlewares to demonstrate how\n\t// that's done, although they could easily be combined into a single breaker\n\t// for the entire remote instance, too.\n\tlimiter := ratelimit.NewErroringLimiter(rate.NewLimiter(rate.Every(time.Second), 100))\n\n\t// global client middlewares\n\tvar options []grpctransport.ClientOption\n\n\tif zipkinTracer != nil {\n\t\t// Zipkin GRPC Client Trace can either be instantiated per gRPC method with a\n\t\t// provided operation name or a global tracing client can be instantiated\n\t\t// without an operation name and fed to each Go kit client as ClientOption.\n\t\t// In the latter case, the operation name will be the endpoint's grpc method\n\t\t// path.\n\t\t//\n\t\t// In this example, we demonstrace a global tracing client.\n\t\toptions = append(options, zipkin.GRPCClientTrace(zipkinTracer))\n\n\t}\n\t// Each individual endpoint is an grpc/transport.Client (which implements\n\t// endpoint.Endpoint) that gets wrapped with various middlewares. If you\n\t// made your own client library, you'd do this work there, so your server\n\t// could rely on a consistent set of client behavior.\n\tvar nameEndpoint endpoint.Endpoint\n\t{\n\t\tnameEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.Login\",\n\t\t\t\"Name\",\n\t\t\tencodeGRPCNameRequest,\n\t\t\tdecodeGRPCNameResponse,\n\t\t\tpb.NameReply{},\n\t\t\tappend(options, grpctransport.ClientBefore(opentracing.ContextToGRPC(otTracer, logger)))...,\n\t\t).Endpoint()\n\t\tnameEndpoint = opentracing.TraceClient(otTracer, \"Name\")(nameEndpoint)\n\t\tnameEndpoint = limiter(nameEndpoint)\n\t\tnameEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{\n\t\t\tName: \"Name\",\n\t\t\tTimeout: 30 * time.Second,\n\t\t}))(nameEndpoint)\n\t}\n\n\t// Returning the endpoint.Set as a service.Service relies on the\n\t// endpoint.Set implementing the Service methods. That's just a simple bit\n\t// of glue code.\n\treturn loginendpoint.Set{\n\t\tLoginEndpoint: nameEndpoint,\n\t}\n}", "func NewGRPCClient(broker Broker, client dashboard.PluginClient) *GRPCClient {\n\treturn &GRPCClient{\n\t\tclient: client,\n\t\tbroker: broker,\n\t}\n}", "func NewGRPCClient(conn *grpc.ClientConn, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) service.TictacService {\n\t// global client middlewares\n\toptions := []grpctransport.ClientOption{\n\t\tgrpctransport.ClientBefore(telepresence.ContextToGRPC()),\n\t}\n\n\tif zipkinTracer != nil {\n\t\t// Zipkin GRPC Client Trace can either be instantiated per gRPC method with a\n\t\t// provided operation name or a global tracing client can be instantiated\n\t\t// without an operation name and fed to each Go kit client as ClientOption.\n\t\t// In the latter case, the operation name will be the endpoint's grpc method\n\t\t// path.\n\t\t//\n\t\t// In this example, we demonstrace a global tracing client.\n\t\toptions = append(options, zipkin.GRPCClientTrace(zipkinTracer))\n\t}\n\n\t// The Tic endpoint is the same thing, with slightly different\n\t// middlewares to demonstrate how to specialize per-endpoint.\n\tvar ticEndpoint endpoint.Endpoint\n\t{\n\t\tticEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.Tictac\",\n\t\t\t\"Tic\",\n\t\t\tencodeGRPCTicRequest,\n\t\t\tdecodeGRPCTicResponse,\n\t\t\tpb.TicResponse{},\n\t\t\tappend(options, grpctransport.ClientBefore(opentracing.ContextToGRPC(otTracer, logger), jwt.ContextToGRPC()))...,\n\t\t).Endpoint()\n\t\tticEndpoint = opentracing.TraceClient(otTracer, \"Tic\")(ticEndpoint)\n\t}\n\n\t// The Tac endpoint is the same thing, with slightly different\n\t// middlewares to demonstrate how to specialize per-endpoint.\n\tvar tacEndpoint endpoint.Endpoint\n\t{\n\t\ttacEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"pb.Tictac\",\n\t\t\t\"Tac\",\n\t\t\tencodeGRPCTacRequest,\n\t\t\tdecodeGRPCTacResponse,\n\t\t\tpb.TacResponse{},\n\t\t\tappend(options, grpctransport.ClientBefore(opentracing.ContextToGRPC(otTracer, logger), jwt.ContextToGRPC()))...,\n\t\t).Endpoint()\n\t\ttacEndpoint = opentracing.TraceClient(otTracer, \"Tac\")(tacEndpoint)\n\t}\n\n\treturn endpoints.Endpoints{\n\t\tTicEndpoint: ticEndpoint,\n\t\tTacEndpoint: tacEndpoint,\n\t}\n}", "func NewGRPCClient(creator ClientCreator, opts ...ClientOption) *GRPCClient {\n\tcopts := &clientOptions{}\n\tfor _, opt := range opts {\n\t\topt(copts)\n\t}\n\n\treturn &GRPCClient{\n\t\topts: copts,\n\t\tcreator: creator,\n\t\tclients: make(map[string]interface{}),\n\t}\n}", "func NewHTTPClientOp(opts ...Option) *Schema {\n\treturn NewClientOutboundOp(\"http\", opts...)\n}", "func NewGRPCClient(ctx context.Context) (pb.TransporterClient, error) {\n\tconn, err := grpc.Dial(portDomainServiceURI, grpc.WithInsecure())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not establish connection wit grpc server\")\n\t}\n\treturn pb.NewTransporterClient(conn), nil\n}", "func NewGRPCServerOp(opts ...Option) *Schema {\n\treturn NewServerInboundOp(\"grpc\", opts...)\n}", "func createGRPCClientConnection(logger *logrus.Logger) (*grpc.ClientConn, error) {\n\tvar dialOption grpc.DialOption\n\n\tcertPath := viper.GetString(common.AppTLSCertPath)\n\tif certPath != \"\" {\n\t\t// secure connection\n\t\tcertBytes, err := ioutil.ReadFile(certPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"reading TLS cert file: %v\", err)\n\t\t}\n\n\t\tcertPool := x509.NewCertPool()\n\t\tif ok := certPool.AppendCertsFromPEM(certBytes); !ok {\n\t\t\treturn nil, fmt.Errorf(\"CertPool append failed\")\n\t\t}\n\n\t\ttransportCreds := credentials.NewClientTLSFromCert(certPool, \"\")\n\t\tdialOption = grpc.WithTransportCredentials(transportCreds)\n\n\t\tlogger.Infof(\"client gRPC connection: TLS enabled\")\n\t} else {\n\t\t// insecure connection\n\t\tdialOption = grpc.WithInsecure()\n\n\t\tlogger.Infof(\"client gRPC connection: insecure\")\n\t}\n\n\tserverAddr := fmt.Sprintf(\"%s:%s\", viper.GetString(common.ServerHost), viper.GetString(common.ServerPort))\n\tconn, err := grpc.Dial(\n\t\tserverAddr,\n\t\tdialOption,\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating client connection failed: %v\", err)\n\t}\n\n\tlogger.Infof(\"client gRPC: %s\", serverAddr)\n\n\treturn conn, nil\n}", "func NewGRPCClient(\n\tconfig config.GRPCClientConfig,\n\tserver *Server,\n\tmetricsReporters []metrics.Reporter,\n\tbindingStorage interfaces.BindingStorage,\n\tinfoRetriever InfoRetriever,\n) (*GRPCClient, error) {\n\tgs := &GRPCClient{\n\t\tbindingStorage: bindingStorage,\n\t\tinfoRetriever: infoRetriever,\n\t\tmetricsReporters: metricsReporters,\n\t\tserver: server,\n\t}\n\n\tgs.dialTimeout = config.DialTimeout\n\tgs.lazy = config.LazyConnection\n\tgs.reqTimeout = config.RequestTimeout\n\n\treturn gs, nil\n}", "func NewGRPCClientConn(opts *Options) (*grpc.ClientConn, error) {\n\tif opts.Addr == nil {\n\t\treturn nil, errors.New(\"internal/grpc: connection address required\")\n\t}\n\tconnAddr := opts.Addr.Host\n\n\t// no colon exists in the connection string, assume one must be added manually\n\tif _, _, err := net.SplitHostPort(connAddr); err != nil {\n\t\tif opts.Addr.Scheme == \"https\" {\n\t\t\tconnAddr = net.JoinHostPort(connAddr, strconv.Itoa(defaultGRPCSecurePort))\n\t\t} else {\n\t\t\tconnAddr = net.JoinHostPort(connAddr, strconv.Itoa(defaultGRPCInsecurePort))\n\t\t}\n\t}\n\tdialOptions := []grpc.DialOption{\n\t\tgrpc.WithChainUnaryInterceptor(\n\t\t\trequestid.UnaryClientInterceptor(),\n\t\t\tmetrics.GRPCClientInterceptor(opts.ServiceName),\n\t\t\tgrpcTimeoutInterceptor(opts.RequestTimeout),\n\t\t),\n\t\tgrpc.WithStreamInterceptor(requestid.StreamClientInterceptor()),\n\t\tgrpc.WithStatsHandler(&ocgrpc.ClientHandler{}),\n\t\tgrpc.WithDefaultCallOptions([]grpc.CallOption{grpc.WaitForReady(true)}...),\n\t}\n\n\tif opts.WithInsecure {\n\t\tlog.Info().Str(\"addr\", connAddr).Msg(\"internal/grpc: grpc with insecure\")\n\t\tdialOptions = append(dialOptions, grpc.WithInsecure())\n\t} else {\n\t\trootCAs, err := x509.SystemCertPool()\n\t\tif err != nil {\n\t\t\tlog.Warn().Msg(\"internal/grpc: failed getting system cert pool making new one\")\n\t\t\trootCAs = x509.NewCertPool()\n\t\t}\n\t\tif opts.CA != \"\" || opts.CAFile != \"\" {\n\t\t\tvar ca []byte\n\t\t\tvar err error\n\t\t\tif opts.CA != \"\" {\n\t\t\t\tca, err = base64.StdEncoding.DecodeString(opts.CA)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"failed to decode certificate authority: %w\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tca, err = ioutil.ReadFile(opts.CAFile)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"certificate authority file %v not readable: %w\", opts.CAFile, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ok := rootCAs.AppendCertsFromPEM(ca); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to append CA cert to certPool\")\n\t\t\t}\n\t\t\tlog.Debug().Msg(\"internal/grpc: added custom certificate authority\")\n\t\t}\n\n\t\tcert := credentials.NewTLS(&tls.Config{RootCAs: rootCAs})\n\n\t\t// override allowed certificate name string, typically used when doing behind ingress connection\n\t\tif opts.OverrideCertificateName != \"\" {\n\t\t\tlog.Debug().Str(\"cert-override-name\", opts.OverrideCertificateName).Msg(\"internal/grpc: grpc\")\n\t\t\terr := cert.OverrideServerName(opts.OverrideCertificateName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\t// finally add our credential\n\t\tdialOptions = append(dialOptions, grpc.WithTransportCredentials(cert))\n\t}\n\n\tif opts.ClientDNSRoundRobin {\n\t\tdialOptions = append(dialOptions, grpc.WithBalancerName(roundrobin.Name), grpc.WithDisableServiceConfig())\n\t\tconnAddr = fmt.Sprintf(\"dns:///%s\", connAddr)\n\t}\n\treturn grpc.Dial(\n\t\tconnAddr,\n\t\tdialOptions...,\n\t)\n}", "func NewAuthGRPCClient(addr string) (as *AuthGRPCClient, err error) {\n\tret := AuthGRPCClient{\n\t\tlog: logrus.WithField(\"component\", \"auth_client\"),\n\t\taddr: addr,\n\t}\n\n\tcherrygrpc.JSONMarshal = jsoniter.ConfigFastest.Marshal\n\tcherrygrpc.JSONUnmarshal = jsoniter.ConfigFastest.Unmarshal\n\n\tret.log.Debugf(\"grpc connect to %s\", addr)\n\tret.conn, err = grpc.Dial(addr,\n\t\tgrpc.WithInsecure(),\n\t\tgrpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient(\n\t\t\tcherrygrpc.UnaryClientInterceptor(errors.ErrInternal),\n\t\t\tgrpc_logrus.UnaryClientInterceptor(ret.log),\n\t\t)),\n\t\tgrpc.WithKeepaliveParams(keepalive.ClientParameters{\n\t\t\tTime: 5 * time.Second,\n\t\t\tTimeout: 10 * time.Second,\n\t\t\tPermitWithoutStream: true,\n\t\t}))\n\tif err != nil {\n\t\treturn\n\t}\n\tret.client = authProto.NewAuthClient(ret.conn)\n\n\treturn &ret, nil\n}", "func NewServicCGRPCClient() (*ServiceCClient, error) {\n\tconn, err := grpc.DialContext(\n\t\tcontext.Background(),\n\t\t\"localhost:50051\",\n\t\tgrpc.WithInsecure(),\n\t\tgrpc.WithUnaryInterceptor(tracers.GRPCClientTrace()))\n\tif err != nil {\n\t\tlog.Println(\"msg\", \"error dialing StockEventService\", \"error\", err)\n\t\treturn &ServiceCClient{}, err\n\t}\n\tnewServiceCClient := ServiceCClient{\n\t\tclient: pb.NewItemCodeServiceClient(conn),\n\t}\n\treturn &newServiceCClient, nil\n}", "func NewClientOutboundOp(system string, opts ...Option) *Schema {\n\tcfg := &config{}\n\tfor _, opt := range opts {\n\t\topt(cfg)\n\t}\n\treturn New(&clientOutboundOp{cfg: cfg, system: system})\n}", "func NewRPCClient(conn net.Conn, opt *codec.Option) (*Client, error) {\n\tfn := codec.NewCodecFuncMap[opt.CodecType]\n\tif fn == nil {\n\t\terrMsg := \"client: failed to generate codec func\"\n\t\tlog.Printf(errMsg + \"\\n\")\n\t\treturn nil, fmt.Errorf(errMsg)\n\t}\n\n\tif err := json.NewEncoder(conn).Encode(opt); err != nil {\n\t\terrMsg := fmt.Sprintf(\"client: failed to decode option, err: %v\", err)\n\t\tlog.Printf(errMsg + \"\\n\")\n\t\treturn nil, fmt.Errorf(errMsg)\n\t}\n\n\tclient := &Client{\n\t\tseq: 1,\n\t\tcc: fn(conn),\n\t\topt: opt,\n\t\tpending: make(map[uint64]*Call),\n\t}\n\tgo client.receive()\n\n\treturn client, nil\n}", "func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {\n\tclientOpts := defaultGRPCClientOptions()\n\tif newClientHook != nil {\n\t\thookOpts, err := newClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := Client{CallOptions: defaultCallOptions()}\n\n\tc := &gRPCClient{\n\t\tconnPool: connPool,\n\t\tclient: netapppb.NewNetAppClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t\toperationsClient: longrunningpb.NewOperationsClient(connPool),\n\t\tlocationsClient: locationpb.NewLocationsClient(connPool),\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\tclient.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))\n\tif err != nil {\n\t\t// This error \"should not happen\", since we are just reusing old connection pool\n\t\t// and never actually need to dial.\n\t\t// If this does happen, we could leak connp. However, we cannot close conn:\n\t\t// If the user invoked the constructor with option.WithGRPCConn,\n\t\t// we would close a connection that's still in use.\n\t\t// TODO: investigate error conditions.\n\t\treturn nil, err\n\t}\n\tc.LROClient = &client.LROClient\n\treturn &client, nil\n}", "func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {\n\tclientOpts := defaultGRPCClientOptions()\n\tif newClientHook != nil {\n\t\thookOpts, err := newClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := Client{CallOptions: defaultCallOptions()}\n\n\tc := &gRPCClient{\n\t\tconnPool: connPool,\n\t\tclient: serviceusagepb.NewServiceUsageClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\tclient.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))\n\tif err != nil {\n\t\t// This error \"should not happen\", since we are just reusing old connection pool\n\t\t// and never actually need to dial.\n\t\t// If this does happen, we could leak connp. However, we cannot close conn:\n\t\t// If the user invoked the constructor with option.WithGRPCConn,\n\t\t// we would close a connection that's still in use.\n\t\t// TODO: investigate error conditions.\n\t\treturn nil, err\n\t}\n\tc.LROClient = &client.LROClient\n\treturn &client, nil\n}", "func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {\n\tclientOpts := defaultGRPCClientOptions()\n\tif newClientHook != nil {\n\t\thookOpts, err := newClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := Client{CallOptions: defaultCallOptions()}\n\n\tc := &gRPCClient{\n\t\tconnPool: connPool,\n\t\tclient: osconfigpb.NewOsConfigServiceClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\treturn &client, nil\n}", "func (fgsc *FakeGKESDKClient) newOp() *container.Operation {\n\topName := strconv.Itoa(fgsc.opNumber)\n\top := &container.Operation{\n\t\tName: opName,\n\t\tStatus: \"DONE\",\n\t}\n\tif status, ok := fgsc.opStatus[opName]; ok {\n\t\top.Status = status\n\t}\n\tfgsc.opNumber++\n\tfgsc.ops[opName] = op\n\treturn op\n}", "func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {\n\tclientOpts := defaultGRPCClientOptions()\n\tif newClientHook != nil {\n\t\thookOpts, err := newClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tdisableDeadlines, err := checkDisableDeadlines()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := Client{CallOptions: defaultCallOptions()}\n\n\tc := &gRPCClient{\n\t\tconnPool: connPool,\n\t\tdisableDeadlines: disableDeadlines,\n\t\tclient: bigtablepb.NewBigtableClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\treturn &client, nil\n}", "func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {\n\tclientOpts := defaultGRPCClientOptions()\n\tif newClientHook != nil {\n\t\thookOpts, err := newClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := Client{CallOptions: defaultCallOptions()}\n\n\tc := &gRPCClient{\n\t\tconnPool: connPool,\n\t\tclient: firestorepb.NewFirestoreClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t\toperationsClient: longrunningpb.NewOperationsClient(connPool),\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\treturn &client, nil\n}", "func NewClient(cc *grpc.ClientConn, opts ...grpc.CallOption) *Client {\n\treturn &Client{\n\t\tgrpccli: steppb.NewStepClient(cc),\n\t\topts: opts,\n\t}\n}", "func NewRPCClient(conf *RPCClientConfig) (*RPCClient, error) {\n\tlog.Infof(\"create rpc client for netword %s address %s service %s\", conf.network, conf.address, conf.servicePath)\n\tvar conn net.Conn\n\tvar err error\n\tif conf.network == \"tcp\" {\n\t\tconn, err = Dial(conf.network, conf.address, conf.dialTimeout)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else if conf.network == \"http\" {\n\t\tconn, err = DialHTTP(conf.network, conf.address, conf.dialTimeout)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unsupport network %s\", conf.network)\n\t}\n\n\tclient := &RPCClient{\n\t\tnetwork: conf.network,\n\t\taddress: conf.address,\n\t\tservicePath: strings.ToLower(conf.servicePath),\n\t\tconn: conn,\n\t\tpending: make(map[uint64]*Call),\n\t\theartBeatInterval: defHeatBeatInterval,\n\t\tdoneChan: make(chan struct{}),\n\t\tDialTimeout: conf.dialTimeout,\n\t}\n\n\tgo client.input()\n\tgo client.keepalive()\n\treturn client, nil\n}", "func NewOperationClient(c config) *OperationClient {\n\treturn &OperationClient{config: c}\n}", "func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {\n\tclientOpts := defaultGRPCClientOptions()\n\tif newClientHook != nil {\n\t\thookOpts, err := newClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := Client{CallOptions: defaultCallOptions()}\n\n\tc := &gRPCClient{\n\t\tconnPool: connPool,\n\t\tclient: cloudtaskspb.NewCloudTasksClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t\tlocationsClient: locationpb.NewLocationsClient(connPool),\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\treturn &client, nil\n}", "func (p *ResourceGRPCPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {\n\treturn &resourceGRPCClient{client: pluginv2.NewResourceClient(c)}, nil\n}", "func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {\n\tclientOpts := defaultGRPCClientOptions()\n\tif newClientHook != nil {\n\t\thookOpts, err := newClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tdisableDeadlines, err := checkDisableDeadlines()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := Client{CallOptions: defaultCallOptions()}\n\n\tc := &gRPCClient{\n\t\tconnPool: connPool,\n\t\tdisableDeadlines: disableDeadlines,\n\t\tclient: assetpb.NewAssetServiceClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\treturn &client, nil\n}", "func NewClient(uri string, opts ...grpc.DialOption) (services.Project, error) {\n\t// Initialize connection pool\n\tpool, err := grpcpool.New(func() (*grpc.ClientConn, error) {\n\t\treturn grpc.Dial(uri, opts...)\n\t}, PoolInitial, PoolMax, PoolTimeout)\n\n\t// Close on destruction\n\truntime.SetFinalizer(pool, func(p *grpcpool.Pool) {\n\t\tif !p.IsClosed() {\n\t\t\tp.Close()\n\t\t}\n\t})\n\n\t// Return wrapper\n\treturn &client{\n\t\tpool: pool,\n\t}, err\n}", "func NewRPCClient(network, address, servicePath string, dialTimeout time.Duration) (*RPCClient, error) {\n\tlog.Infof(\"create rpc client for netword %s address %s service %s\", network, address, servicePath)\n\tvar conn net.Conn\n\tvar err error\n\tif network == \"tcp\" {\n\t\tconn, err = Dial(network, address, dialTimeout)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else if network == \"http\" {\n\t\tconn, err = DialHTTP(network, address, dialTimeout)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unsupport network %s\", network)\n\t}\n\n\tclient := &RPCClient{\n\t\tnetwork: network,\n\t\taddress: address,\n\t\tservicePath: strings.ToLower(servicePath),\n\t\tconn: conn,\n\t\tpending: make(map[uint64]*Call),\n\t\theartBeatInterval: defHeatBeatInterval,\n\t\tdoneChan: make(chan struct{}),\n\t\tDialTimeout: dialTimeout,\n\t}\n\n\tgo client.input()\n\tgo client.keepalive()\n\treturn client, nil\n}", "func newClient(opts *ClientOpts) (*Client, error) {\n\tbaseClient, err := newAPIClient(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tAPIClient: *baseClient,\n\t}\n\n\t// init base operator\n\tclient.Node = newNodeClient(client)\n\tclient.Namespace = newNameSpaceClient(client)\n\tclient.ConfigMap = newConfigMapClient(client)\n\tclient.Service = newServiceClient(client)\n\tclient.Pod = newPodClient(client)\n\tclient.ReplicationController = newReplicationControllerClient(client)\n\tclient.StatefulSet = newStatefulSetClient(client)\n\tclient.DaemonSet = newDaemonSetClient(client)\n\tclient.Deployment = newDeploymentClient(client)\n\tclient.ReplicaSet = newReplicaSetClient(client)\n\n\treturn client, nil\n}", "func NewRPCClient(client *rpc.Client) *RPCClient {\n\treturn &RPCClient{\n\t\tclient: client,\n\t}\n}", "func newRPCClientService() (*rpcClientService, error) {\n return &rpcClientService{rpcCh: make(chan *sendRPCState)}, nil\n}", "func NewTDepositWithdrawServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *TDepositWithdrawServiceClient {\n return &TDepositWithdrawServiceClient{\n c: thrift.NewTStandardClient(iprot, oprot),\n }\n}", "func newGRPCClusterService(hostPortStr string) (clusterService, error) {\n\tconn, err := mkConnection(hostPortStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcds := envoyapi.NewClusterDiscoveryServiceClient(conn)\n\n\treturn clusterService(\n\t\tfnDiscoveryService{\n\t\t\tfetchFn: func(req *envoyapi.DiscoveryRequest) (*envoyapi.DiscoveryResponse, error) {\n\t\t\t\treturn cds.FetchClusters(context.Background(), req)\n\t\t\t},\n\t\t\tcloseFn: conn.Close,\n\t\t},\n\t), nil\n}", "func NewClient(c *rpc.Client) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tvar (\n\t\t\terrs = make(chan error, 1)\n\t\t\tresponses = make(chan interface{}, 1)\n\t\t)\n\t\tgo func() {\n\t\t\tvar response reqrep.AddResponse\n\t\t\tif err := c.Call(\"addsvc.Add\", request, &response); err != nil {\n\t\t\t\terrs <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresponses <- response\n\t\t}()\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, context.DeadlineExceeded\n\t\tcase err := <-errs:\n\t\t\treturn nil, err\n\t\tcase response := <-responses:\n\t\t\treturn response, nil\n\t\t}\n\t}\n}", "func NewClient(protocol Protocol, pool Pool) (Client, error) {\n\tfactory, ok := clients[protocol]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"client for protocol '%v' does not exist\", protocol)\n\t}\n\n\treturn factory(pool)\n}", "func NewOpServer(db *database.DB, addr string) *rpc.Server {\n\treturn rpc.NewServer(\"OpRpcServer\", &OpRpcServer{db}, addr)\n}", "func New(c grpc.UserClient) nethttp.Handler {\n\tfn := func(w nethttp.ResponseWriter, r *nethttp.Request) {\n\t\tvar e error\n\n\t\tif r.Body == nil {\n\t\t\tresponse.WithError(r.Context(), response.HTTPError{\n\t\t\t\tCode: nethttp.StatusBadRequest,\n\t\t\t\tError: ErrEmptyRequestBody,\n\t\t\t\tMessage: ErrEmptyRequestBody.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tparams, ok := gorouter.FromContext(r.Context())\n\t\tif !ok {\n\t\t\tresponse.WithError(r.Context(), response.HTTPError{\n\t\t\t\tCode: nethttp.StatusBadRequest,\n\t\t\t\tError: ErrInvalidURLParams,\n\t\t\t\tMessage: ErrInvalidURLParams.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tdefer r.Body.Close()\n\t\tbody, e := ioutil.ReadAll(r.Body)\n\t\tif e != nil {\n\t\t\tresponse.WithError(r.Context(), response.HTTPError{\n\t\t\t\tCode: nethttp.StatusBadRequest,\n\t\t\t\tError: e,\n\t\t\t\tMessage: \"Invalid request body\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\te = c.DispatchAndClose(r.Context(), params.Value(\"command\"), body)\n\t\tif e != nil {\n\t\t\tresponse.WithError(r.Context(), response.HTTPError{\n\t\t\t\tCode: nethttp.StatusBadRequest,\n\t\t\t\tError: e,\n\t\t\t\tMessage: \"Invalid request\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(nethttp.StatusCreated)\n\n\t\treturn\n\t}\n\n\treturn nethttp.HandlerFunc(fn)\n}", "func (p *AppPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {\n\treturn NewClient(pluginproto.NewNodeClient(c)), nil\n}", "func NewClient(proto protocol.Protocol, conn redigo.Conn) *Client {\n\n\treturn &Client{\n\t\tconn: conn,\n\t\tproto: proto,\n\t}\n\n}", "func NewTensorboardClient(ctx context.Context, opts ...option.ClientOption) (*TensorboardClient, error) {\n\tclientOpts := defaultTensorboardGRPCClientOptions()\n\tif newTensorboardClientHook != nil {\n\t\thookOpts, err := newTensorboardClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := TensorboardClient{CallOptions: defaultTensorboardCallOptions()}\n\n\tc := &tensorboardGRPCClient{\n\t\tconnPool: connPool,\n\t\ttensorboardClient: aiplatformpb.NewTensorboardServiceClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t\toperationsClient: longrunningpb.NewOperationsClient(connPool),\n\t\tiamPolicyClient: iampb.NewIAMPolicyClient(connPool),\n\t\tlocationsClient: locationpb.NewLocationsClient(connPool),\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\tclient.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))\n\tif err != nil {\n\t\t// This error \"should not happen\", since we are just reusing old connection pool\n\t\t// and never actually need to dial.\n\t\t// If this does happen, we could leak connp. However, we cannot close conn:\n\t\t// If the user invoked the constructor with option.WithGRPCConn,\n\t\t// we would close a connection that's still in use.\n\t\t// TODO: investigate error conditions.\n\t\treturn nil, err\n\t}\n\tc.LROClient = &client.LROClient\n\treturn &client, nil\n}", "func newClient(ctx context.Context, cfg oconf.Config) (*client, error) {\n\tc := &client{\n\t\texportTimeout: cfg.Metrics.Timeout,\n\t\trequestFunc: cfg.RetryConfig.RequestFunc(retryable),\n\t\tconn: cfg.GRPCConn,\n\t}\n\n\tif len(cfg.Metrics.Headers) > 0 {\n\t\tc.metadata = metadata.New(cfg.Metrics.Headers)\n\t}\n\n\tif c.conn == nil {\n\t\t// If the caller did not provide a ClientConn when the client was\n\t\t// created, create one using the configuration they did provide.\n\t\tconn, err := grpc.DialContext(ctx, cfg.Metrics.Endpoint, cfg.DialOptions...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Keep track that we own the lifecycle of this conn and need to close\n\t\t// it on Shutdown.\n\t\tc.ourConn = true\n\t\tc.conn = conn\n\t}\n\n\tc.msc = colmetricpb.NewMetricsServiceClient(c.conn)\n\n\treturn c, nil\n}", "func NewGCPgRPCConn(ctx context.Context, t *testing.T, endPoint string) (*grpc.ClientConn, func()) {\n\tmode := recorder.ModeReplaying\n\tif *Record {\n\t\tmode = recorder.ModeRecording\n\t}\n\n\topts, done := replay.NewGCPDialOptions(t, mode, t.Name()+\".replay\")\n\topts = append(opts, grpc.WithTransportCredentials(grpccreds.NewClientTLSFromCert(nil, \"\")))\n\tif mode == recorder.ModeRecording {\n\t\tcreds, err := gcp.DefaultCredentials(ctx)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\topts = append(opts, grpc.WithPerRPCCredentials(oauth.TokenSource{TokenSource: gcp.CredentialsTokenSource(creds)}))\n\t}\n\tconn, err := grpc.DialContext(ctx, endPoint, opts...)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn conn, done\n}", "func StoreClientGRPCOpts(logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, secure, skipVerify bool, cert, key, caCert, serverName string) ([]grpc.DialOption, error) {\n\tgrpcMets := grpc_prometheus.NewClientMetrics()\n\tgrpcMets.EnableClientHandlingTimeHistogram(\n\t\tgrpc_prometheus.WithHistogramBuckets([]float64{0.001, 0.01, 0.1, 0.3, 0.6, 1, 3, 6, 9, 20, 30, 60, 90, 120, 240, 360, 720}),\n\t)\n\tdialOpts := []grpc.DialOption{\n\t\t// We want to make sure that we can receive huge gRPC messages from storeAPI.\n\t\t// On TCP level we can be fine, but the gRPC overhead for huge messages could be significant.\n\t\t// Current limit is ~2GB.\n\t\t// TODO(bplotka): Split sent chunks on store node per max 4MB chunks if needed.\n\t\tgrpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxInt32)),\n\t\tgrpc.WithUnaryInterceptor(\n\t\t\tgrpc_middleware.ChainUnaryClient(\n\t\t\t\tgrpcMets.UnaryClientInterceptor(),\n\t\t\t\ttracing.UnaryClientInterceptor(tracer),\n\t\t\t),\n\t\t),\n\t\tgrpc.WithStreamInterceptor(\n\t\t\tgrpc_middleware.ChainStreamClient(\n\t\t\t\tgrpcMets.StreamClientInterceptor(),\n\t\t\t\ttracing.StreamClientInterceptor(tracer),\n\t\t\t),\n\t\t),\n\t}\n\tif reg != nil {\n\t\treg.MustRegister(grpcMets)\n\t}\n\n\tif !secure {\n\t\treturn append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials())), nil\n\t}\n\n\tlevel.Info(logger).Log(\"msg\", \"enabling client to server TLS\")\n\n\ttlsCfg, err := tls.NewClientConfig(logger, cert, key, caCert, serverName, skipVerify)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn append(dialOpts, grpc.WithTransportCredentials(credentials.NewTLS(tlsCfg))), nil\n}", "func NewClient(conn *grpc.ClientConn) *Client {\n\treturn &Client{\n\t\tclient: pb.NewCalculatorClient(conn),\n\t}\n}", "func NewGrpcClient(dialOpt grpc.DialOption, messenger *Messenger) *GrpcClient {\n\tif dialOpt == nil {\n\t\tdialOpt = grpc.WithInsecure()\n\t}\n\treturn &GrpcClient{\n\t\tdialOption: []grpc.DialOption{\n\t\t\tdialOpt,\n\t\t\tgrpc.WithBlock(),\n\t\t},\n\t\tmessenger: messenger,\n\t}\n}", "func NewRPCClient(rpcEndpointURL string) RPCClient {\n\tcli := rpcClient{\n\t\tendpointURL: rpcEndpointURL,\n\t}\n\n\treturn &cli\n}", "func NewClient() (*Client, error) {\n\tgoprscClient, err := newGoprscClient()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to initialize Postfix REST Server API client: %s\", err)\n\t}\n\n\tc := &Client{client: goprscClient}\n\ts := service{client: goprscClient} // Reuse the same structure instead of allocating one for each service\n\tc.Auth = (*AuthService)(&s)\n\tc.Domains = (*DomainService)(&s)\n\tc.Accounts = (*AccountService)(&s)\n\tc.Aliases = (*AliasService)(&s)\n\t// Allocate separate structs for the BCC services as they have different state\n\tc.InputBccs = NewInputBccService(goprscClient)\n\tc.OutputBccs = NewOutputBccService(goprscClient)\n\treturn c, nil\n}", "func GRPCGenClient(c agent.ConfigClient, options ...tlsx.Option) (credentials.TransportCredentials, error) {\n\tvar (\n\t\terr error\n\t\ttlscreds *tls.Config\n\t)\n\n\tif tlscreds, err = TLSGenClient(c, options...); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn credentials.NewTLS(tlscreds), nil\n}", "func NewTUserKycServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *TUserKycServiceClient {\n return &TUserKycServiceClient{\n c: thrift.NewTStandardClient(iprot, oprot),\n }\n}", "func (t *transformer) generateClient(protoPackage, serviceName string, iface *ast.InterfaceType) ([]ast.Decl, error) {\n\t// This function used to construct an AST. It was a lot of code.\n\t// Now it generates code via a template and parses back to AST.\n\t// Slower, but saner and easier to make changes.\n\n\ttype Method struct {\n\t\tName string\n\t\tInputMessage string\n\t\tOutputMessage string\n\t}\n\tmethods := make([]Method, 0, len(iface.Methods.List))\n\n\tvar buf bytes.Buffer\n\ttoGoCode := func(n ast.Node) (string, error) {\n\t\tdefer buf.Reset()\n\t\terr := format.Node(&buf, t.fset, n)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn buf.String(), nil\n\t}\n\n\tfor _, m := range iface.Methods.List {\n\t\tsignature, ok := m.Type.(*ast.FuncType)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected embedded interface in %sClient\", serviceName)\n\t\t}\n\n\t\tinStructPtr := signature.Params.List[1].Type.(*ast.StarExpr)\n\t\tinStruct, err := toGoCode(inStructPtr.X)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\toutStructPtr := signature.Results.List[0].Type.(*ast.StarExpr)\n\t\toutStruct, err := toGoCode(outStructPtr.X)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmethods = append(methods, Method{\n\t\t\tName: m.Names[0].Name,\n\t\t\tInputMessage: inStruct,\n\t\t\tOutputMessage: outStruct,\n\t\t})\n\t}\n\n\tprpcSymbolPrefix := \"prpc.\"\n\tif t.inPRPCPackage {\n\t\tprpcSymbolPrefix = \"\"\n\t}\n\terr := clientCodeTemplate.Execute(&buf, map[string]any{\n\t\t\"Service\": serviceName,\n\t\t\"ProtoPkg\": protoPackage,\n\t\t\"StructName\": firstLower(serviceName) + \"PRPCClient\",\n\t\t\"Methods\": methods,\n\t\t\"PRPCSymbolPrefix\": prpcSymbolPrefix,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"client template execution: %s\", err)\n\t}\n\n\tf, err := parser.ParseFile(t.fset, \"\", buf.String(), 0)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"client template result parsing: %s. Code: %#v\", err, buf.String())\n\t}\n\treturn f.Decls, nil\n}", "func CreateClientConn(target string, optsOverrides ...grpc.DialOption) (*grpc.ClientConn, error) {\n\tvar creds credentials.TransportCredentials\n\tif strings.Contains(target, \"443\") {\n\t\tcreds = credentials.NewTLS(&tls.Config{})\n\t}\n\n\tauth := TokenAuth{}\n\tvar opts []grpc.DialOption\n\tif creds != nil {\n\t\topts = append(opts, grpc.WithTransportCredentials(creds))\n\t\tauth.Secure = true\n\t} else {\n\t\topts = append(opts, grpc.WithInsecure())\n\t}\n\n\topts = append(opts, grpc.WithPerRPCCredentials(auth))\n\topts = append(opts, optsOverrides...)\n\n\tconn, err := grpc.Dial(target, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn conn, nil\n}", "func NewJobsClient(ctx context.Context, opts ...option.ClientOption) (*JobsClient, error) {\n\tclientOpts := defaultJobsGRPCClientOptions()\n\tif newJobsClientHook != nil {\n\t\thookOpts, err := newJobsClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := JobsClient{CallOptions: defaultJobsCallOptions()}\n\n\tc := &jobsGRPCClient{\n\t\tconnPool: connPool,\n\t\tjobsClient: runpb.NewJobsClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t\toperationsClient: longrunningpb.NewOperationsClient(connPool),\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\tclient.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))\n\tif err != nil {\n\t\t// This error \"should not happen\", since we are just reusing old connection pool\n\t\t// and never actually need to dial.\n\t\t// If this does happen, we could leak connp. However, we cannot close conn:\n\t\t// If the user invoked the constructor with option.WithGRPCConn,\n\t\t// we would close a connection that's still in use.\n\t\t// TODO: investigate error conditions.\n\t\treturn nil, err\n\t}\n\tc.LROClient = &client.LROClient\n\treturn &client, nil\n}", "func NewClient(config *sdk.Config, credential *auth.Credential) *Client {\n\tvar handler sdk.RequestHandler = func(c *sdk.Client, req request.Common) (request.Common, error) {\n\t\terr := req.SetProjectId(PickResourceID(req.GetProjectId()))\n\t\treturn req, err\n\t}\n\tvar (\n\t\tuaccountClient = *uaccount.NewClient(config, credential)\n\t\tuhostClient = *uhost.NewClient(config, credential)\n\t\tunetClient = *unet.NewClient(config, credential)\n\t\tvpcClient = *vpc.NewClient(config, credential)\n\t\tudpnClient = *udpn.NewClient(config, credential)\n\t\tpathxClient = *pathx.NewClient(config, credential)\n\t\tudiskClient = *udisk.NewClient(config, credential)\n\t\tulbClient = *ulb.NewClient(config, credential)\n\t\tudbClient = *udb.NewClient(config, credential)\n\t\tumemClient = *umem.NewClient(config, credential)\n\t\tuphostClient = *uphost.NewClient(config, credential)\n\t\tpuhostClient = *puhost.NewClient(config, credential)\n\t\tpudbClient = *pudb.NewClient(config, credential)\n\t\tpumemClient = *pumem.NewClient(config, credential)\n\t\tppathxClient = *ppathx.NewClient(config, credential)\n\t)\n\n\tuaccountClient.Client.AddRequestHandler(handler)\n\tuhostClient.Client.AddRequestHandler(handler)\n\tunetClient.Client.AddRequestHandler(handler)\n\tvpcClient.Client.AddRequestHandler(handler)\n\tudpnClient.Client.AddRequestHandler(handler)\n\tpathxClient.Client.AddRequestHandler(handler)\n\tudiskClient.Client.AddRequestHandler(handler)\n\tulbClient.Client.AddRequestHandler(handler)\n\tudbClient.Client.AddRequestHandler(handler)\n\tumemClient.Client.AddRequestHandler(handler)\n\tuphostClient.Client.AddRequestHandler(handler)\n\tpuhostClient.Client.AddRequestHandler(handler)\n\tpudbClient.Client.AddRequestHandler(handler)\n\tpumemClient.Client.AddRequestHandler(handler)\n\tppathxClient.Client.AddRequestHandler(handler)\n\n\treturn &Client{\n\t\tuaccountClient,\n\t\tuhostClient,\n\t\tunetClient,\n\t\tvpcClient,\n\t\tudpnClient,\n\t\tpathxClient,\n\t\tudiskClient,\n\t\tulbClient,\n\t\tudbClient,\n\t\tumemClient,\n\t\tuphostClient,\n\t\tpuhostClient,\n\t\tpudbClient,\n\t\tpumemClient,\n\t\tppathxClient,\n\t}\n}", "func NewClient(op Options, limit int) *Client {\n\treturn &Client{\n\t\tOptions: op,\n\t\tLimit: limit,\n\t\tlimitCh: make(chan struct{}, limit),\n\t}\n}", "func createGRPCOptions() []grpc.DialOption {\n\tvar dialOptions []grpc.DialOption\n\tdialOptions = append(dialOptions, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxUint32)))\n\tdialOptions = append(dialOptions, grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(math.MaxUint32)))\n\treturn dialOptions\n}", "func NewRPCClient(chainParams *chaincfg.Params, connect, user, pass string, certs []byte,\n\tdisableTLS bool, reconnectAttempts int) (*RPCClient, er.R) {\n\n\tif reconnectAttempts < 0 {\n\t\treturn nil, er.New(\"reconnectAttempts must be positive\")\n\t}\n\n\tclient := &RPCClient{\n\t\tconnConfig: &rpcclient.ConnConfig{\n\t\t\tHost: connect,\n\t\t\tEndpoint: \"ws\",\n\t\t\tUser: user,\n\t\t\tPass: pass,\n\t\t\tCertificates: certs,\n\t\t\tDisableAutoReconnect: false,\n\t\t\tDisableConnectOnNew: true,\n\t\t\tDisableTLS: disableTLS,\n\t\t},\n\t\tchainParams: chainParams,\n\t\treconnectAttempts: reconnectAttempts,\n\t\tquit: make(chan struct{}),\n\t}\n\trpcClient, err := rpcclient.New(client.connConfig, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.Client = rpcClient\n\treturn client, nil\n}", "func NewClient(ipAddress, username, password, apiVersion string, waitOnJobs, isTenant bool) (*GroupMgmtClient, error) {\n\tif apiVersion != \"v1\" {\n\t\treturn nil, fmt.Errorf(\"API version \\\"%s\\\" is not recognized\", apiVersion)\n\t}\n\n\t// Get resty client\n\tgroupMgmtClient := newGroupMgmtClient(ipAddress, username, password, apiVersion, waitOnJobs, isTenant)\n\n\t// Get session token\n\tsessionToken, err := groupMgmtClient.login(username, password)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgroupMgmtClient.SessionToken = sessionToken\n\n\t// Add retryCondition\n\t// This flag is set during a relogin attempt to prevent retry recursion\n\treloginInProgress := false\n\n\t// Add a retry condition to perform a relogin if the session has expired\n\tgroupMgmtClient.Client.\n\t\tAddRetryCondition(\n\t\t\tfunc(resp *resty.Response, err error) bool {\n\t\t\t\t// Attempt relogin on an authorization error if relogin is not already in progress\n\t\t\t\tif err == nil && resp.StatusCode() == 401 && !reloginInProgress {\n\t\t\t\t\treloginInProgress = true\n\t\t\t\t\tsessionToken, err = groupMgmtClient.login(username, password)\n\t\t\t\t\treloginInProgress = false\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\n\t\t\t\t\t// replace the original client session token with new session token\n\t\t\t\t\tgroupMgmtClient.SessionToken = sessionToken\n\t\t\t\t\tresp.Request.SetHeader(\"X-Auth-Token\", groupMgmtClient.SessionToken)\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t},\n\t\t).SetRetryCount(maxLoginRetries)\n\treturn groupMgmtClient, nil\n}", "func NewOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient {\n\tcp := arm.ClientOptions{}\n\tif options != nil {\n\t\tcp = *options\n\t}\n\tif len(cp.Host) == 0 {\n\t\tcp.Host = arm.AzurePublicCloud\n\t}\n\treturn &OperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}\n}", "func newClientArg(methName string, field *svcdef.Field) *ClientArg {\n\tnewArg := ClientArg{}\n\tnewArg.Name = lowCamelName(field.Name)\n\n\tif field.Type.ArrayType {\n\t\tnewArg.Repeated = true\n\t}\n\n\tnewArg.FlagName = fmt.Sprintf(\"%s\", strings.ToLower(field.Name))\n\tnewArg.FlagArg = fmt.Sprintf(\"flag%s%s\", gogen.CamelCase(field.Name), gogen.CamelCase(methName))\n\n\tif field.Type.Enum != nil {\n\t\tnewArg.Enum = true\n\t}\n\t// Determine the FlagType and flag invocation\n\tvar ft string\n\tif field.Type.Message == nil && field.Type.Enum == nil && field.Type.Map == nil {\n\t\tft = field.Type.Name\n\t\tnewArg.IsBaseType = true\n\t} else {\n\t\t// For types outside the base types, have flag treat them as strings\n\t\tft = \"string\"\n\t\tnewArg.IsBaseType = false\n\t}\n\tif newArg.Repeated {\n\t\tft = \"string\"\n\t}\n\tnewArg.FlagType = ft\n\tnewArg.FlagConvertFunc = createFlagConvertFunc(newArg, methName)\n\n\tnewArg.GoArg = fmt.Sprintf(\"%s%s\", gogen.CamelCase(newArg.Name), gogen.CamelCase(methName))\n\t// For types outside the base types, treat them as strings\n\tif newArg.IsBaseType {\n\t\t//newArg.GoType = ProtoToGoTypeMap[field.Type.GetName()]\n\t\tnewArg.GoType = field.Type.Name\n\t} else {\n\t\tnewArg.GoType = \"pb.\" + field.Type.Name\n\t}\n\t// The GoType is a slice of the GoType if it's a repeated field\n\tif newArg.Repeated {\n\t\tif newArg.IsBaseType || newArg.Enum {\n\t\t\tnewArg.GoType = \"[]\" + newArg.GoType\n\t\t} else {\n\t\t\tnewArg.GoType = \"[]*\" + newArg.GoType\n\t\t}\n\t}\n\n\tnewArg.GoConvertInvoc = goConvInvoc(newArg)\n\n\treturn &newArg\n}", "func GetRPCClient(cmd *cobra.Command, targetRepo rr.LocalRepo) (*client.RPCClient, error) {\n\tremoteName := viper.GetString(\"remote.name\")\n\trpcAddress := viper.GetString(\"remote.address\")\n\trpcUser := viper.GetString(\"rpc.user\")\n\trpcPassword := viper.GetString(\"rpc.password\")\n\n\tvar err error\n\tvar host, port string\n\n\t// If a target repo is provided and --remote.address flag is unset,\n\t// get the rpc address from the specified repo remote.\n\tif targetRepo != nil && !cmd.Flags().Changed(\"remote.address\") {\n\t\th, p, ok := GetRemoteAddrFromRepo(targetRepo, remoteName)\n\t\tif ok {\n\t\t\thost, port = h, cast.ToString(p)\n\t\t\tgoto create\n\t\t}\n\t}\n\n\thost, port, err = net.SplitHostPort(rpcAddress)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed parse rpc address\")\n\t}\n\ncreate:\n\tc := client.NewClient(&types2.Options{\n\t\tHost: host,\n\t\tPort: cast.ToInt(port),\n\t\tUser: rpcUser,\n\t\tPassword: rpcPassword,\n\t})\n\n\treturn c, nil\n}", "func newGrpcListener(ghandler *GrpcHandler) net.Listener {\n\tl := &grpcListener{\n\t\tGrpcHandler: ghandler,\n\t}\n\tl.listenerCtx, l.listenerCtxCancel = context.WithCancel(ghandler.ctx)\n\treturn l\n}", "func (ctx Context) WithGRPCClient(grpcClient *grpc.ClientConn) Context {\n\tctx.GRPCClient = grpcClient\n\treturn ctx\n}", "func NewClient(modifiers ...RequestModifier) *Client {\n\treturn &Client{modifiers}\n}", "func NewClient() (*Client, error) {\n\tpipePath := client.PipePath(GroupName, Version)\n\treturn NewClientWithPipePath(pipePath)\n}", "func NewGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GroupClient {\n\tcp := arm.ClientOptions{}\n\tif options != nil {\n\t\tcp = *options\n\t}\n\tif len(cp.Host) == 0 {\n\t\tcp.Host = arm.AzurePublicCloud\n\t}\n\treturn &GroupClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}\n}", "func NewOperationroomClient(c config) *OperationroomClient {\n\treturn &OperationroomClient{config: c}\n}", "func NewGroup(client *Client) *GroupService {\n\treturn &GroupService{\n\t\tclient: client,\n\t}\n}", "func newInputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService14ProtocolTest {\n\tsvc := &InputService14ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice14protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func NewGRpcServer(c queue.Client, api client.QueueProtocolAPI) *Grpcserver {\r\n\ts := &Grpcserver{grpc: &Grpc{}}\r\n\ts.grpc.cli.Init(c, api)\r\n\tvar opts []grpc.ServerOption\r\n\t//register interceptor\r\n\t//var interceptor grpc.UnaryServerInterceptor\r\n\tinterceptor := func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {\r\n\t\tif err := auth(ctx, info); err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t\t// Continue processing the request\r\n\t\treturn handler(ctx, req)\r\n\t}\r\n\topts = append(opts, grpc.UnaryInterceptor(interceptor))\r\n\tif rpcCfg.EnableTLS {\r\n\t\tcreds, err := credentials.NewServerTLSFromFile(rpcCfg.CertFile, rpcCfg.KeyFile)\r\n\t\tif err != nil {\r\n\t\t\tpanic(err)\r\n\t\t}\r\n\t\tcredsOps := grpc.Creds(creds)\r\n\t\topts = append(opts, credsOps)\r\n\t}\r\n\r\n\tkp := keepalive.EnforcementPolicy{\r\n\t\tMinTime: 10 * time.Second,\r\n\t\tPermitWithoutStream: true,\r\n\t}\r\n\topts = append(opts, grpc.KeepaliveEnforcementPolicy(kp))\r\n\r\n\tserver := grpc.NewServer(opts...)\r\n\ts.s = server\r\n\ttypes.RegisterChain33Server(server, s.grpc)\r\n\treturn s\r\n}", "func newTopoClient(cfg ServiceConfig) (topoapi.TopoClient, error) {\n\topts := []grpc.DialOption{\n\t\tgrpc.WithStreamInterceptor(southbound.RetryingStreamClientInterceptor(100 * time.Millisecond)),\n\t}\n\tif cfg.Insecure {\n\t\topts = append(opts, grpc.WithInsecure())\n\t}\n\n\tconn, err := getTopoConn(\"onos-topo\", opts...)\n\tif err != nil {\n\t\tstat, ok := status.FromError(err)\n\t\tif ok {\n\t\t\tlog.Error(\"Unable to connect to topology service\", err)\n\t\t\treturn nil, errors.FromStatus(stat)\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn topoapi.NewTopoClient(conn), nil\n}", "func NewGrpcClient(seed ma.Multiaddr, node *locators.Node, peers *Peers) Service {\n\treturn &grpcClient{peers, seed, node}\n}", "func (t *liverpc) generateClient(file *descriptor.FileDescriptorProto, service *descriptor.ServiceDescriptorProto) {\n\tclientName := clientName(service)\n\tstructName := unexported(clientName)\n\tnewClientFunc := \"New\" + clientName\n\n\tt.P(`type `, structName, ` struct {`)\n\tt.P(` client *liverpc.Client`)\n\tt.P(`}`)\n\tt.P()\n\tt.P(`// `, newClientFunc, ` creates a client that implements the `, clientName, ` interface.`)\n\tt.P(`func `, newClientFunc, `(client *liverpc.Client) `, clientName, ` {`)\n\tt.P(` return &`, structName, `{`)\n\tt.P(` client: client,`)\n\tt.P(` }`)\n\tt.P(`}`)\n\tt.P()\n\n\tfor _, method := range service.Method {\n\t\tmethName := methodName(method)\n\t\tpkgName := pkgName(file)\n\n\t\tinputType := t.goTypeName(method.GetInputType())\n\t\toutputType := t.goTypeName(method.GetOutputType())\n\n\t\tparts := strings.Split(pkgName, \".\")\n\t\tif len(parts) < 2 {\n\t\t\tpanic(\"package name must contain at least to parts, eg: service.v1, get \" + pkgName + \"!\")\n\t\t}\n\t\tvStr := parts[len(parts)-1]\n\t\tif len(vStr) < 2 {\n\t\t\tpanic(\"package name must contain a valid version, eg: service.v1\")\n\t\t}\n\t\t_, err := strconv.Atoi(vStr[1:])\n\t\tif err != nil {\n\t\t\tpanic(\"package name must contain a valid version, eg: service.v1, get \" + vStr)\n\t\t}\n\n\t\trpcMethod := method.GetName()\n\t\trpcCtrl := service.GetName()\n\t\trpcCmd := rpcCtrl + \".\" + rpcMethod\n\n\t\tt.P(`func (c *`, structName, `) `, methName, `(ctx `, t.pkgs[\"context\"], `.Context, in *`, inputType, `, opts ...liverpc.CallOption) (*`, outputType, `, error) {`)\n\t\tt.P(` out := new(`, outputType, `)`)\n\t\tt.P(` err := doRPCRequest(ctx,c.client, `, vStr[1:], `, \"`, rpcCmd, `\", in, out, opts)`)\n\t\tt.P(` if err != nil {`)\n\t\tt.P(` return nil, err`)\n\t\tt.P(` }`)\n\t\tt.P(` return out, nil`)\n\t\tt.P(`}`)\n\t\tt.P()\n\t}\n}", "func NewClient(rpcURL string, rpcClient rpcclient.Client) *Client {\n\tcliCtx := sdkclient.Context{}.\n\t\tWithNodeURI(rpcURL).\n\t\tWithClient(rpcClient).\n\t\tWithAccountRetriever(authtypes.AccountRetriever{}).\n\t\tWithJSONMarshaler(codec.EncodingConfig.Marshaler).\n\t\tWithLegacyAmino(codec.EncodingConfig.Amino).\n\t\tWithTxConfig(codec.EncodingConfig.TxConfig).\n\t\tWithInterfaceRegistry(codec.EncodingConfig.InterfaceRegistry)\n\n\treturn &Client{cliCtx}\n}", "func New(ctx context.Context, cc *grpc.ClientConn, logger log.Logger) server.AddService {\n\treturn client{ctx, pb.NewAddClient(cc), logger}\n}", "func NewHTTPServerOp(opts ...Option) *Schema {\n\treturn NewServerInboundOp(\"http\", opts...)\n}", "func newClientMethod(r *raml.Resource, rd *cr.Resource, m *raml.Method,\n\tmethodName string) (cr.MethodInterface, error) {\n\treturn newMethod(nil, r, rd, m, methodName)\n}", "func NewOperationGenerator(recorder record.EventRecorder) OperationGenerator {\n\n\treturn &operationGenerator{\n\t\trecorder: recorder,\n\t}\n}", "func NewPolicyBasedRoutingClient(ctx context.Context, opts ...option.ClientOption) (*PolicyBasedRoutingClient, error) {\n\tclientOpts := defaultPolicyBasedRoutingGRPCClientOptions()\n\tif newPolicyBasedRoutingClientHook != nil {\n\t\thookOpts, err := newPolicyBasedRoutingClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := PolicyBasedRoutingClient{CallOptions: defaultPolicyBasedRoutingCallOptions()}\n\n\tc := &policyBasedRoutingGRPCClient{\n\t\tconnPool: connPool,\n\t\tpolicyBasedRoutingClient: networkconnectivitypb.NewPolicyBasedRoutingServiceClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t\toperationsClient: longrunningpb.NewOperationsClient(connPool),\n\t\tiamPolicyClient: iampb.NewIAMPolicyClient(connPool),\n\t\tlocationsClient: locationpb.NewLocationsClient(connPool),\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\tclient.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))\n\tif err != nil {\n\t\t// This error \"should not happen\", since we are just reusing old connection pool\n\t\t// and never actually need to dial.\n\t\t// If this does happen, we could leak connp. However, we cannot close conn:\n\t\t// If the user invoked the constructor with option.WithGRPCConn,\n\t\t// we would close a connection that's still in use.\n\t\t// TODO: investigate error conditions.\n\t\treturn nil, err\n\t}\n\tc.LROClient = &client.LROClient\n\treturn &client, nil\n}", "func NewPoliciesClient(cc grpc.ClientConnInterface) PoliciesClient { return src.NewPoliciesClient(cc) }", "func New(conn *grpc.ClientConn, opts ...Option) (*backend, error) {\n\toptions := new(backendOptions)\n\tfor _, opt := range opts {\n\t\topt(options)\n\t}\n\treturn &backend{conn}, nil\n}", "func NewGrpcClient(addr string, protos []string, opts ...grpc.DialOption) (*GrpcClient, error) {\n\tvar descSource grpcurl.DescriptorSource\n\n\tif addr == \"\" {\n\t\treturn nil, fmt.Errorf(\"addr should not be empty\")\n\t}\n\n\tconn, err := grpc.Dial(addr, opts...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"did not connect: %v\", err)\n\t}\n\n\tif len(protos) > 0 {\n\t\tdescSource, err := grpcurl.DescriptorSourceFromProtoFiles([]string{}, protos...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot parse proto file: %v\", err)\n\t\t}\n\t\treturn &GrpcClient{addr: addr, conn: conn, desc: descSource}, nil\n\t}\n\n\t// fetch from server reflection RPC\n\tc := rpb.NewServerReflectionClient(conn)\n\trefClient := grpcreflect.NewClient(clientCTX, c)\n\tdescSource = grpcurl.DescriptorSourceFromServer(clientCTX, refClient)\n\n\treturn &GrpcClient{addr: addr, conn: conn, desc: descSource}, nil\n}", "func NewClientRequest(serviceName string, methodName string, args []interface{}) *ClientRequest {\n\treturn &ClientRequest{ServiceName: serviceName, MethodName: methodName, Arguments: args}\n}", "func NewGRpcServer(c queue.Client, api client.QueueProtocolAPI) *Grpcserver {\n\ts := &Grpcserver{grpc: &Grpc{}}\n\ts.grpc.cli.Init(c, api)\n\tvar opts []grpc.ServerOption\n\t//register interceptor\n\t//var interceptor grpc.UnaryServerInterceptor\n\tinterceptor := func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {\n\t\tif err := auth(ctx, info); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Continue processing the request\n\t\treturn handler(ctx, req)\n\t}\n\topts = append(opts, grpc.UnaryInterceptor(interceptor))\n\tif rpcCfg.EnableTLS {\n\t\tcreds, err := credentials.NewServerTLSFromFile(rpcCfg.CertFile, rpcCfg.KeyFile)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tcredsOps := grpc.Creds(creds)\n\t\topts = append(opts, credsOps)\n\t}\n\n\tkp := keepalive.EnforcementPolicy{\n\t\tMinTime: 10 * time.Second,\n\t\tPermitWithoutStream: true,\n\t}\n\topts = append(opts, grpc.KeepaliveEnforcementPolicy(kp))\n\n\tserver := grpc.NewServer(opts...)\n\ts.s = server\n\ttypes.RegisterChain33Server(server, s.grpc)\n\treturn s\n}", "func NewGroup(client *gosip.SPClient, endpoint string, config *RequestConfig) *Group {\n\treturn &Group{\n\t\tclient: client,\n\t\tendpoint: endpoint,\n\t\tconfig: config,\n\t\tmodifiers: NewODataMods(),\n\t}\n}", "func NewClient(\n\taddress string,\n\tdialTimeout time.Duration,\n\twriteTimeout time.Duration,\n\tglobalPrefix string,\n\tprefixCounter string,\n\tprefixTimer string,\n\tprefixGauge string,\n\tprefixSet string,\n\tglobalSuffix string,\n\tmode string,\n\tdisabled gostatsd.TimerSubtypes,\n\tlogger logrus.FieldLogger,\n) (*Client, error) {\n\tif address == \"\" {\n\t\treturn nil, fmt.Errorf(\"[%s] address is required\", BackendName)\n\t}\n\tif dialTimeout <= 0 {\n\t\treturn nil, fmt.Errorf(\"[%s] dialTimeout should be positive\", BackendName)\n\t}\n\tif writeTimeout < 0 {\n\t\treturn nil, fmt.Errorf(\"[%s] writeTimeout should be non-negative\", BackendName)\n\t}\n\tglobalSuffix = strings.Trim(globalSuffix, \".\")\n\n\tvar legacyNamespace, enableTags bool\n\tswitch mode {\n\tcase \"legacy\":\n\t\tlegacyNamespace = true\n\t\tenableTags = false\n\tcase \"basic\":\n\t\tlegacyNamespace = false\n\t\tenableTags = false\n\tcase \"tags\":\n\t\tlegacyNamespace = false\n\t\tenableTags = true\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"[%s] mode must be one of 'legacy', 'basic', or 'tags'\", BackendName)\n\t}\n\n\tvar counterNamespace, timerNamespace, gaugesNamespace, setsNamespace string\n\n\tif legacyNamespace {\n\t\tcounterNamespace = DefaultGlobalPrefix\n\t\ttimerNamespace = combine(DefaultGlobalPrefix, \"timers\")\n\t\tgaugesNamespace = combine(DefaultGlobalPrefix, \"gauges\")\n\t\tsetsNamespace = combine(DefaultGlobalPrefix, \"sets\")\n\t} else {\n\t\tglobalPrefix := globalPrefix\n\t\tcounterNamespace = combine(globalPrefix, prefixCounter)\n\t\ttimerNamespace = combine(globalPrefix, prefixTimer)\n\t\tgaugesNamespace = combine(globalPrefix, prefixGauge)\n\t\tsetsNamespace = combine(globalPrefix, prefixSet)\n\t}\n\n\tcounterNamespace = normalizeMetricName(counterNamespace)\n\ttimerNamespace = normalizeMetricName(timerNamespace)\n\tgaugesNamespace = normalizeMetricName(gaugesNamespace)\n\tsetsNamespace = normalizeMetricName(setsNamespace)\n\tglobalSuffix = normalizeMetricName(globalSuffix)\n\n\tlogger.WithFields(logrus.Fields{\n\t\t\"address\": address,\n\t\t\"dial-timeout\": dialTimeout,\n\t\t\"write-timeout\": writeTimeout,\n\t\t\"counter-namespace\": counterNamespace,\n\t\t\"timer-namespace\": timerNamespace,\n\t\t\"gauges-namespace\": gaugesNamespace,\n\t\t\"sets-namespace\": setsNamespace,\n\t\t\"global-suffix\": globalSuffix,\n\t\t\"mode\": mode,\n\t}).Info(\"created backend\")\n\n\treturn &Client{\n\t\tsender: sender.Sender{\n\t\t\tLogger: logger,\n\t\t\tConnFactory: func() (net.Conn, error) {\n\t\t\t\treturn net.DialTimeout(\"tcp\", address, dialTimeout)\n\t\t\t},\n\t\t\tSink: make(chan sender.Stream, maxConcurrentSends),\n\t\t\tBufPool: sync.Pool{\n\t\t\t\tNew: func() interface{} {\n\t\t\t\t\tbuf := new(bytes.Buffer)\n\t\t\t\t\tbuf.Grow(bufSize)\n\t\t\t\t\treturn buf\n\t\t\t\t},\n\t\t\t},\n\t\t\tWriteTimeout: writeTimeout,\n\t\t},\n\t\tcounterNamespace: counterNamespace,\n\t\ttimerNamespace: timerNamespace,\n\t\tgaugesNamespace: gaugesNamespace,\n\t\tsetsNamespace: setsNamespace,\n\t\tglobalSuffix: globalSuffix,\n\t\tlegacyNamespace: legacyNamespace,\n\t\tenableTags: enableTags,\n\t\tdisabledSubtypes: disabled,\n\t}, nil\n}", "func New(g *godo.Client) Client {\n\tc := &client{\n\t\tg: g,\n\t}\n\treturn c\n}", "func NewClient(profileName string) (*newrelic.NewRelic, error) {\n\tapiKey := configAPI.GetProfileString(profileName, config.APIKey)\n\tinsightsInsertKey := configAPI.GetProfileString(profileName, config.InsightsInsertKey)\n\n\tif apiKey == \"\" && insightsInsertKey == \"\" {\n\t\treturn nil, errors.New(\"a User API key or Ingest API key is required, set a default profile or use the NEW_RELIC_API_KEY or NEW_RELIC_INSIGHTS_INSERT_KEY environment variables\")\n\t}\n\n\tregion := configAPI.GetProfileString(profileName, config.Region)\n\tuserAgent := fmt.Sprintf(\"newrelic-cli/%s (https://github.com/newrelic/newrelic-cli)\", cli.Version())\n\n\t// Feed our logrus instance to the client's logrus adapter\n\tlogger := clientLogging.NewLogrusLogger(clientLogging.ConfigLoggerInstance(config.Logger))\n\n\tcfgOpts := []newrelic.ConfigOption{\n\t\tnewrelic.ConfigPersonalAPIKey(apiKey),\n\t\tnewrelic.ConfigInsightsInsertKey(insightsInsertKey),\n\t\tnewrelic.ConfigLogger(logger),\n\t\tnewrelic.ConfigRegion(region),\n\t\tnewrelic.ConfigUserAgent(userAgent),\n\t\tnewrelic.ConfigServiceName(serviceName),\n\t}\n\n\tnrClient, err := newrelic.New(cfgOpts...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create New Relic client with error: %s\", err)\n\t}\n\n\treturn nrClient, nil\n}", "func NewPrimitiveClient() PrimitiveClient {\n return NewPrimitiveClientWithBaseURI(DefaultBaseURI, )\n}", "func NewClient(kclient k8s.Client) (*Client, error) {\n\tctx := context.Background()\n\tsecret := &corev1.Secret{}\n\terr := kclient.Get(\n\t\tctx,\n\t\ttypes.NamespacedName{\n\t\t\tName: config.GCPSecretName,\n\t\t\tNamespace: config.OperatorNamespace,\n\t\t},\n\t\tsecret)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't get Secret with credentials %w\", err)\n\t}\n\tserviceAccountJSON, ok := secret.Data[\"service_account.json\"]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"access credentials missing service account\")\n\t}\n\n\t// initialize actual client\n\tc, err := newClient(ctx, serviceAccountJSON)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't create GCP client %s\", err)\n\t}\n\n\t// enchant the client with params required\n\tregion, err := getClusterRegion(kclient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.region = region\n\n\tmasterList, err := baseutils.GetMasterMachines(kclient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.masterList = masterList\n\tinfrastructureName, err := baseutils.GetClusterName(kclient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.clusterName = infrastructureName\n\tbaseDomain, err := baseutils.GetClusterBaseDomain(kclient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.baseDomain = baseDomain\n\n\treturn c, nil\n}", "func NewBillServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *BillServiceClient {\n return &BillServiceClient{\n c: thrift.NewTStandardClient(iprot, oprot),\n }\n}", "func NewGRPC(c services.ContrailServiceClient) *GRPC {\n\treturn &GRPC{c: c}\n}", "func CreateClient(token, toURL, repoType string, tlsVerify bool) *scm.Client {\n\tvar client *scm.Client\n\tu, _ := url.Parse(toURL)\n\tif repoType == \"gitlab\" {\n\t\tclient = gitlab.NewDefault()\n\t} else if repoType == \"ghe\" {\n\t\tclient, _ = github.New(u.Scheme + \"://\" + u.Host + \"/api/v3\")\n\t} else {\n\t\tclient = github.NewDefault()\n\t}\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: token},\n\t)\n\tif tlsVerify {\n\t\tclient.Client = oauth2.NewClient(context.Background(), ts)\n\t} else {\n\t\tclient.Client = &http.Client{\n\t\t\tTransport: &oauth2.Transport{\n\t\t\t\tSource: ts,\n\t\t\t\tBase: &http.Transport{\n\t\t\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\tif repoType == \"gitlab\" {\n\t\tu, _ := url.Parse(toURL)\n\t\tclient.BaseURL.Host = u.Host\n\t}\n\treturn client\n}", "func newClientFromFlags(fs tbnflag.FlagSet) client {\n\treturn &clientImpl{}\n}", "func NewRPC(ctx context.Context, lgr log.Logger, addr string, opts ...RPCOption) (RPC, error) {\n\tvar cfg rpcConfig\n\tfor i, opt := range opts {\n\t\tif err := opt(&cfg); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"rpc option %d failed to apply to RPC config: %w\", i, err)\n\t\t}\n\t}\n\tif cfg.backoffAttempts < 1 { // default to at least 1 attempt, or it always fails to dial.\n\t\tcfg.backoffAttempts = 1\n\t}\n\tunderlying, err := dialRPCClientWithBackoff(ctx, lgr, addr, cfg.backoffAttempts, cfg.gethRPCOptions...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar wrapped RPC = &BaseRPCClient{c: underlying}\n\n\tif cfg.limit != 0 {\n\t\twrapped = NewRateLimitingClient(wrapped, rate.Limit(cfg.limit), cfg.burst)\n\t}\n\n\tif httpRegex.MatchString(addr) {\n\t\twrapped = NewPollingClient(ctx, lgr, wrapped, WithPollRate(cfg.httpPollInterval))\n\t}\n\n\treturn wrapped, nil\n}", "func newReconciler(mgr manager.Manager, osClient openstack.OpenStackClientInterface) reconcile.Reconciler {\n\treturn &ReconcileSecurityGroup{Client: mgr.GetClient(), scheme: mgr.GetScheme(), osClient: osClient}\n}", "func NewGRPCServer(_ context.Context, endpoint endpoints.Endpoints) pb.LoremServer {\n\treturn &grpcServer{\n\t\tlorem: grpctransport.NewServer(\n\t\t\tendpoint.LoremEndpoint,\n\t\t\tDecodeGRPCLoremRequest,\n\t\t\tEncodeGRPCLoremResponse,\n\t\t),\n\t}\n}" ]
[ "0.6970858", "0.6615248", "0.64932156", "0.64715034", "0.64497036", "0.6236621", "0.61910707", "0.61746126", "0.6151978", "0.61293536", "0.60714155", "0.5993147", "0.5943901", "0.58555377", "0.582731", "0.5810902", "0.57990116", "0.5792996", "0.5768569", "0.56438947", "0.55374426", "0.5525155", "0.5428953", "0.54200494", "0.54198545", "0.53625077", "0.5349216", "0.5302882", "0.5277807", "0.52690107", "0.5230032", "0.5214263", "0.52100885", "0.5197646", "0.5144382", "0.51363575", "0.51069146", "0.50452304", "0.50162756", "0.5016018", "0.50021553", "0.49988672", "0.4918324", "0.48970622", "0.4877924", "0.48609668", "0.48474154", "0.48366243", "0.48357013", "0.48298198", "0.48276877", "0.4811617", "0.4808458", "0.48032066", "0.47966787", "0.47870842", "0.47656003", "0.47627613", "0.47627136", "0.4759906", "0.47563335", "0.47470096", "0.47361472", "0.472368", "0.47218218", "0.4714592", "0.47012976", "0.4696648", "0.46946445", "0.4690417", "0.46892628", "0.46790504", "0.46720633", "0.46711415", "0.46626958", "0.46564424", "0.46516854", "0.4647413", "0.46458808", "0.4644262", "0.46391517", "0.4638844", "0.46280462", "0.46274063", "0.46236607", "0.46219411", "0.4614671", "0.46017754", "0.45961723", "0.4591086", "0.45826268", "0.45708585", "0.45699674", "0.45627365", "0.45621428", "0.45586154", "0.4558312", "0.4550203", "0.45489177", "0.45471504" ]
0.8485648
0
NewGRPCServerOp creates a new schema for gRPC server inbound operations.
func NewGRPCServerOp(opts ...Option) *Schema { return NewServerInboundOp("grpc", opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewGRPCServer(s *service.Service) *grpc.Server {\n\tg := s.ConnFactory.NewServer(\n\t\tgrpc.UnaryInterceptor(\n\t\t\tgrpc_middleware.ChainUnaryServer(\n\t\t\t\ttracing.ServerInterceptor(tracing.GlobalTracer()),\n\t\t\t\tInputValidationInterceptor(),\n\t\t\t),\n\t\t),\n\t)\n\thealth.RegisterHealthServer(g, health.NewService())\n\treflection.Register(g)\n\treturn g\n}", "func NewServerInboundOp(system string, opts ...Option) *Schema {\n\tcfg := &config{}\n\tfor _, opt := range opts {\n\t\topt(cfg)\n\t}\n\treturn New(&serverInboundOp{cfg: cfg, system: system})\n}", "func NewGrpcServer(addr string, protos []string, opts ...grpc.ServerOption) (*GrpcServer, error) {\n\tdescFromProto, err := grpcurl.DescriptorSourceFromProtoFiles([]string{}, protos...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot parse proto file: %v\", err)\n\t}\n\tgs := &GrpcServer{\n\t\taddr: addr,\n\t\tdesc: descFromProto,\n\t\tserver: grpc.NewServer(opts...),\n\t\thandlerM: map[string]func(in *dynamic.Message, out *dynamic.Message, stream grpc.ServerStream) error{},\n\t}\n\n\tgs.server = grpc.NewServer()\n\tservices, err := grpcurl.ListServices(gs.desc)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list services\")\n\t}\n\tfor _, svcName := range services {\n\t\tdsc, err := gs.desc.FindSymbol(svcName)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to find service: %s, error: %v\", svcName, err)\n\t\t}\n\t\tsd := dsc.(*desc.ServiceDescriptor)\n\n\t\tunaryMethods := []grpc.MethodDesc{}\n\t\tstreamMethods := []grpc.StreamDesc{}\n\t\tfor _, mtd := range sd.GetMethods() {\n\t\t\tlogger.Debugf(\"protocols/grpc\", \"try to add method: %v of service: %s\", mtd, svcName)\n\n\t\t\tif mtd.IsClientStreaming() || mtd.IsServerStreaming() {\n\t\t\t\tstreamMethods = append(streamMethods, grpc.StreamDesc{\n\t\t\t\t\tStreamName: mtd.GetName(),\n\t\t\t\t\tHandler: gs.getStreamHandler(mtd),\n\t\t\t\t\tServerStreams: mtd.IsServerStreaming(),\n\t\t\t\t\tClientStreams: mtd.IsClientStreaming(),\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tunaryMethods = append(unaryMethods, grpc.MethodDesc{\n\t\t\t\t\tMethodName: mtd.GetName(),\n\t\t\t\t\tHandler: gs.getUnaryHandler(mtd),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tsvcDesc := grpc.ServiceDesc{\n\t\t\tServiceName: svcName,\n\t\t\tHandlerType: (*interface{})(nil),\n\t\t\tMethods: unaryMethods,\n\t\t\tStreams: streamMethods,\n\t\t\tMetadata: sd.GetFile().GetName(),\n\t\t}\n\t\tgs.server.RegisterService(&svcDesc, &mockServer{})\n\t}\n\n\treturn gs, nil\n}", "func newGRPCServer(ctx context.Context, cfg *config.ServerConfig, authCtx interfaces.AuthenticationContext,\n\topts ...grpc.ServerOption) (*grpc.Server, error) {\n\t// Not yet implemented for streaming\n\tvar chainedUnaryInterceptors grpc.UnaryServerInterceptor\n\tif cfg.Security.UseAuth {\n\t\tlogger.Infof(ctx, \"Creating gRPC server with authentication\")\n\t\tchainedUnaryInterceptors = grpc_middleware.ChainUnaryServer(grpcPrometheus.UnaryServerInterceptor,\n\t\t\tauth.GetAuthenticationCustomMetadataInterceptor(authCtx),\n\t\t\tgrpcauth.UnaryServerInterceptor(auth.GetAuthenticationInterceptor(authCtx)),\n\t\t\tauth.AuthenticationLoggingInterceptor,\n\t\t\tblanketAuthorization,\n\t\t)\n\t} else {\n\t\tlogger.Infof(ctx, \"Creating gRPC server without authentication\")\n\t\tchainedUnaryInterceptors = grpc_middleware.ChainUnaryServer(grpcPrometheus.UnaryServerInterceptor)\n\t}\n\n\tserverOpts := []grpc.ServerOption{\n\t\tgrpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor),\n\t\tgrpc.UnaryInterceptor(chainedUnaryInterceptors),\n\t}\n\tserverOpts = append(serverOpts, opts...)\n\tgrpcServer := grpc.NewServer(serverOpts...)\n\tgrpcPrometheus.Register(grpcServer)\n\tflyteService.RegisterAdminServiceServer(grpcServer, adminservice.NewAdminServer(cfg.KubeConfig, cfg.Master))\n\tif cfg.Security.UseAuth {\n\t\tflyteService.RegisterAuthMetadataServiceServer(grpcServer, authCtx.AuthMetadataService())\n\t\tflyteService.RegisterIdentityServiceServer(grpcServer, authCtx.IdentityService())\n\t}\n\n\thealthServer := health.NewServer()\n\thealthServer.SetServingStatus(\"\", grpc_health_v1.HealthCheckResponse_SERVING)\n\tgrpc_health_v1.RegisterHealthServer(grpcServer, healthServer)\n\n\tif cfg.GrpcServerReflection {\n\t\treflection.Register(grpcServer)\n\t}\n\treturn grpcServer, nil\n}", "func NewGrpcServer(c *Config) internal.Server {\n\ts := grpc.NewServer(c.serverOptions()...)\n\treflection.Register(s)\n\tfor _, svr := range c.Servers {\n\t\tsvr.RegisterWithServer(s)\n\t}\n\treturn &GrpcServer{\n\t\tserver: s,\n\t\tConfig: c,\n\t}\n}", "func NewOpServer(db *database.DB, addr string) *rpc.Server {\n\treturn rpc.NewServer(\"OpRpcServer\", &OpRpcServer{db}, addr)\n}", "func NewGrpcServer(ep endpoints.Set) proto.ServiceExercicioServer {\n\treturn &grpcServer{\n\t\tcreate: grpctransport.NewServer(\n\t\t\tep.CreateEndpoint,\n\t\t\tdecodeGrpcCreateAlterRequest,\n\t\t\tencodeGrpcCreateAlterResponse,\n\t\t),\n\t\talter: grpctransport.NewServer(\n\t\t\tep.AlterEndpoint,\n\t\t\tdecodeGrpcCreateAlterRequest,\n\t\t\tencodeGrpcCreateAlterResponse,\n\t\t),\n\t\tget: grpctransport.NewServer(\n\t\t\tep.GetEndpoint,\n\t\t\tdecodeGrpcGetRequest,\n\t\t\tencodeGrpcGetResponse,\n\t\t),\n\t\tgetSomes: grpctransport.NewServer(\n\t\t\tep.GetSomesEndpoint,\n\t\t\tdecodeGrpcGetSomesRequest,\n\t\t\tencodeGrpcGetSomesResponse,\n\t\t),\n\t\tdelete: grpctransport.NewServer(\n\t\t\tep.DeleteEndpoint,\n\t\t\tdecodeGrpcDeleteRequest,\n\t\t\tencodeGrpcDeleteResponse,\n\t\t),\n\t\tstatusService: grpctransport.NewServer(\n\t\t\tep.StatusServiceEndpoint,\n\t\t\tdecodeGrpcStatusServiceRequest,\n\t\t\tencodeGrpcStatusServiceResponse,\n\t\t),\n\t}\n}", "func NewServer(opt ...Option) Server {\n\treturn newGrpcServer(opt...)\n}", "func NewServer(ops ...Option) (*Server, error) {\n\tconf := toGRPCConfig(ops...)\n\tvar srv *grpc.Server\n\tif conf.tlsConfig != nil {\n\t\tsrv = grpc.NewServer(grpc.Creds(credentials.NewTLS(conf.tlsConfig)), grpc.MaxRecvMsgSize(math.MaxInt32), grpc.MaxSendMsgSize(math.MaxInt32))\n\t} else {\n\t\tsrv = grpc.NewServer(grpc.MaxRecvMsgSize(math.MaxInt32), grpc.MaxSendMsgSize(math.MaxInt32))\n\t}\n\n\trpc.RegisterGRpcServer(srv)\n\n\tls, err := net.Listen(\"tcp\", conf.addr)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"grpc: listen failed, addr = %s\", conf.addr)\n\t}\n\n\treturn &Server{\n\t\tserver: srv,\n\t\tlistener: ls,\n\t\trunning: utils.NewAtomicBool(false),\n\t\treadyCh: make(chan struct{}),\n\t\tstopCh: make(chan struct{}),\n\t}, nil\n}", "func NewGRPCServer(c *conf.Config, rs registry.Registry, srv center.ICenter) *grpc.Server {\n\t// 启动grpc服务\n\tsv := grpc.NewServer(&c.GrpcServer, app.WithHost(c.App.Host), app.WithID(c.App.ServerID),\n\t\tapp.WithName(c.App.Name), app.WithRegistry(rs))\n\tsv.Init()\n\tpb.RegisterCenterServer(sv.Server, &server{srv})\n\tsv.AddHook(grpc.NewTracingHook())\n\t//启动服务\n\tsv.Start()\n\treturn sv\n}", "func NewGrpcServer(option *ServerOption) *grpc.Server {\n\topts := []grpc.ServerOption{\n\t\tgrpc.MaxRecvMsgSize(option.MaxRecvMsgSize),\n\t\tgrpc.MaxSendMsgSize(option.MaxSendMsgSize),\n\t\tgrpc.InitialWindowSize(option.InitialWindowSize),\n\t\tgrpc.InitialConnWindowSize(option.InitialConnWindowSize),\n\t\tgrpc.MaxConcurrentStreams(option.MaxConcurrentStreams),\n\t\tgrpc.KeepaliveParams(keepalive.ServerParameters{Time: option.KeepaliveTime, Timeout: option.KeepaliveTimeout}),\n\t\tgrpc.KeepaliveEnforcementPolicy(serverEnforcement),\n\t}\n\tif option.StatsHandler != nil {\n\t\topts = append(opts, grpc.StatsHandler(option.StatsHandler))\n\t}\n\n\tvar unaryInterceptor grpc.UnaryServerInterceptor\n\tvar streamInterceptor grpc.StreamServerInterceptor\n\tif option.Interceptor != nil {\n\t\tunaryInterceptor = func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {\n\t\t\tif err := option.Interceptor(info.FullMethod); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn handler(ctx, req)\n\t\t}\n\n\t\tstreamInterceptor = func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\t\t\tif err := option.Interceptor(info.FullMethod); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn handler(srv, stream)\n\t\t}\n\t}\n\tif unaryInterceptor != nil {\n\t\topts = append(opts, grpc.UnaryInterceptor(unaryInterceptor))\n\t}\n\tif streamInterceptor != nil {\n\t\topts = append(opts, grpc.StreamInterceptor(streamInterceptor))\n\t}\n\n\tserver := grpc.NewServer(opts...)\n\theartbeat.RegisterHeartbeatServer(server, &heartbeat.HeartbeatService{ClusterID: option.ClusterID})\n\treturn server\n}", "func New(svcs svc.Services, opts ...grpc.ServerOption) *grpc.Server {\n\topts = append(opts, grpc.CustomCodec(sourcegraph.GRPCCodec))\n\ts := grpc.NewServer(opts...)\n\tsvc.RegisterAll(s, svcs)\n\treturn s\n}", "func NewServer(cli typedCore.CoreV1Interface, cfg ServerConfig) (*Server, error) {\n\tjwtSigningKey, err := ensureJWT(cli, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttlsConfig, err := prepareTLSConfig(cli, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tauth := &authorization{jwtSigningKey: jwtSigningKey}\n\n\ts := &Server{\n\t\thttpServer: &http.Server{\n\t\t\tAddr: cfg.HTTPAddress,\n\t\t\tReadTimeout: time.Second * 30,\n\t\t\tReadHeaderTimeout: time.Second * 15,\n\t\t\tWriteTimeout: time.Second * 30,\n\t\t\tTLSConfig: tlsConfig,\n\t\t},\n\t\tgrpcServer: grpc.NewServer(\n\t\t\tgrpc.UnaryInterceptor(auth.ensureGRPCAuth),\n\t\t\tgrpc.Creds(credentials.NewTLS(tlsConfig)),\n\t\t),\n\t\tgrpcAddress: cfg.GRPCAddress,\n\t}\n\thandler, err := buildHTTPHandler(s, cfg, auth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.httpServer.Handler = handler\n\n\tpb.RegisterOperatorServer(s.grpcServer, s)\n\treturn s, nil\n}", "func NewGRPC(ctx context.Context, config *Config) *grpc.Server {\n\t// Setup our gRPC connection factory\n\tconnFactory := secureconn.NewFactory(*config.ServiceCerts)\n\n\t// Register our API\n\tgrpcServer := connFactory.NewServer(tracing.GlobalServerInterceptor())\n\tsrv := NewLicenseControlServer(config)\n\tlc.RegisterLicenseControlServer(grpcServer, srv)\n\thealth.RegisterHealthServer(grpcServer, srv.health)\n\n\t// Register reflection service on gRPC server.\n\treflection.Register(grpcServer)\n\treturn grpcServer\n}", "func NewGrpcServer(ctx context.Context, host string, port int) *GrpcServer {\n\treturn &GrpcServer{\n\t\tCtx: ctx,\n\t\thost: host,\n\t\tport: port,\n\t\tServer: grpc.NewServer(grpc.WriteBufferSize(2147483647), grpc.ReadBufferSize(2147483647)),\n\t\tState: Init,\n\t\tlistener: nil,\n\t\tservices: make([]ServiceInterface, 0),\n\t};\n}", "func NewServer(ctx interface{}) (*Server, error) {\n\tif ctx == nil {\n\t\treturn nil, fmt.Errorf(\"rpc: ctx is nil\")\n\t}\n\tctxType := reflect.TypeOf(ctx)\n\tif ctxType.Kind() != reflect.Ptr {\n\t\treturn nil, fmt.Errorf(\"rpc: ctx is not pointer\")\n\t}\n\n\treturn &Server{\n\t\tcodecs: make(map[string]Codec),\n\t\tservices: new(serviceMap),\n\t\tctxType: ctxType.Elem(),\n\t}, nil\n}", "func NewGrpcServer() *Grpcserver {\r\n\treturn &Grpcserver{grpc: &Grpc{}}\r\n}", "func NewHTTPServerOp(opts ...Option) *Schema {\n\treturn NewServerInboundOp(\"http\", opts...)\n}", "func NewGrpcServer(configuration *config.EndpointConfiguration, producer kafka.Producer, db *sqlx.DB, metric metrics.Metrics, chunkSize int, errChan chan<- error) *GrpcServer {\n\treturn &GrpcServer{\n\t\tconfiguration: configuration,\n\t\tproducer: producer,\n\t\tdb: db,\n\t\terrChan: errChan,\n\t\tchunkSize: chunkSize,\n\t\tmetric: metric,\n\t}\n}", "func NewGRPCServer(endpoints endpoints.Endpoints) pb.EventServiceServer {\n\treturn &gRPCServer{\n\t\tcreate: gkit.NewServer(\n\t\t\tendpoints.Create,\n\t\t\tdecodeCreateEventRequest,\n\t\t\tencodeCreateEventResponse,\n\t\t),\n\t\tretrieve: gkit.NewServer(\n\t\t\tendpoints.Retrieve,\n\t\t\tdecodeRetrieveEventRequest,\n\t\t\tencodeRetrieveEventResponse,\n\t\t),\n\t}\n}", "func NewGRPCServer(l hclog.Logger, idb *data.ItemDB) *GRPCServer {\n\treturn &GRPCServer{l, idb}\n}", "func NewGRPCServer(_ context.Context, endpoint endpoints.Endpoints) pb.LoremServer {\n\treturn &grpcServer{\n\t\tlorem: grpctransport.NewServer(\n\t\t\tendpoint.LoremEndpoint,\n\t\t\tDecodeGRPCLoremRequest,\n\t\t\tEncodeGRPCLoremResponse,\n\t\t),\n\t}\n}", "func newGRPCServer(t *testing.T, srv transportv1pb.TransportServiceServer) *fakeGRPCServer {\n\t// gRPC testPack.\n\tlis := bufconn.Listen(100)\n\tt.Cleanup(func() { require.NoError(t, lis.Close()) })\n\n\ts := grpc.NewServer()\n\tt.Cleanup(s.Stop)\n\n\t// Register service.\n\tif srv != nil {\n\t\ttransportv1pb.RegisterTransportServiceServer(s, srv)\n\t}\n\n\t// Start.\n\tgo func() {\n\t\tif err := s.Serve(lis); err != nil && !errors.Is(err, grpc.ErrServerStopped) {\n\t\t\tpanic(fmt.Sprintf(\"Serve returned err = %v\", err))\n\t\t}\n\t}()\n\n\treturn &fakeGRPCServer{Listener: lis}\n}", "func NewGrpcServer() *Grpcserver {\n\treturn &Grpcserver{grpc: &Grpc{}}\n}", "func NewGRPCServer(logger log.Logger, protoAddr string, app types.Application) service.Service {\n\tproto, addr := tmnet.ProtocolAndAddress(protoAddr)\n\ts := &GRPCServer{\n\t\tlogger: logger,\n\t\tproto: proto,\n\t\taddr: addr,\n\t\tapp: app,\n\t}\n\ts.BaseService = *service.NewBaseService(logger, \"ABCIServer\", s)\n\treturn s\n}", "func NewGRPCServer(endpoints mathendpoint2.Set, logger log.Logger) pb.MathServer {\n\toptions := []grpctransport.ServerOption{\n\t\tgrpctransport.ServerErrorHandler(transport.NewLogErrorHandler(logger)),\n\t}\n\n\treturn &grpcServer{\n\t\tdivide: grpctransport.NewServer(\n\t\t\tendpoints.DivideEndpoint,\n\t\t\tdecodeGRPCMathOpRequest,\n\t\t\tencodeGRPCMathOpResponse,\n\t\t\toptions...,\n\t\t),\n\t\tmax: grpctransport.NewServer(\n\t\t\tendpoints.MaxEndpoint,\n\t\t\tdecodeGRPCMathOpRequest,\n\t\t\tencodeGRPCMathOpResponse,\n\t\t\toptions...,\n\t\t),\n\t\tmin: grpctransport.NewServer(\n\t\t\tendpoints.MinEndpoint,\n\t\t\tdecodeGRPCMathOpRequest,\n\t\t\tencodeGRPCMathOpResponse,\n\t\t\toptions...,\n\t\t),\n\t\tmultiply: grpctransport.NewServer(\n\t\t\tendpoints.MultiplyEndpoint,\n\t\t\tdecodeGRPCMathOpRequest,\n\t\t\tencodeGRPCMathOpResponse,\n\t\t\toptions...,\n\t\t),\n\t\tpow: grpctransport.NewServer(\n\t\t\tendpoints.PowEndpoint,\n\t\t\tdecodeGRPCMathOpRequest,\n\t\t\tencodeGRPCMathOpResponse,\n\t\t\toptions...,\n\t\t),\n\t\tsubtact: grpctransport.NewServer(\n\t\t\tendpoints.SubtractEndpoint,\n\t\t\tdecodeGRPCMathOpRequest,\n\t\t\tencodeGRPCMathOpResponse,\n\t\t\toptions...,\n\t\t),\n\t\tsum: grpctransport.NewServer(\n\t\t\tendpoints.SumEndpoint,\n\t\t\tdecodeGRPCMathOpRequest,\n\t\t\tencodeGRPCMathOpResponse,\n\t\t\toptions...,\n\t\t),\n\t}\n}", "func NewGrpcServer(movieGrpcHandler *movieDelivery.GrpcHandler) (*Server, error) {\n\treturn &Server{\n\t\tmovieGrpcHandler: movieGrpcHandler,\n\t}, nil\n\n}", "func NewGRPCServer(insecure bool, opt ...grpc.ServerOption) *grpc.Server {\n\topts := append([]grpc.ServerOption{\n\t\tgrpc.StreamInterceptor(grpc_middleware.ChainStreamServer(grpc_prometheus.StreamServerInterceptor)),\n\t\tgrpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(grpc_prometheus.UnaryServerInterceptor)),\n\t\tgrpc.StatsHandler(&ocgrpc.ServerHandler{})},\n\t\topt...)\n\tif !insecure {\n\t\tcreds, err := credentials.NewServerTLSFromFile(\"/tls/server-cert.pem\", \"/tls/server-key.pem\")\n\t\tif err == nil {\n\t\t\topts = append(opts, grpc.Creds(creds))\n\t\t}\n\t}\n\treturn grpc.NewServer(opts...)\n}", "func NewGRPC(ctx context.Context, config *config.DataFeedConfig, connFactory *secureconn.Factory) *grpc.Server {\n\tgrpcServer := connFactory.NewServer(tracing.GlobalServerInterceptor())\n\tsrv := &Server{\n\t\tcfg: config,\n\t\thealth: health.NewService(),\n\t}\n\thealth.RegisterHealthServer(grpcServer, srv.health)\n\n\t// Register reflection service on gRPC server.\n\treflection.Register(grpcServer)\n\treturn grpcServer\n}", "func NewGRPCServer(ctx context.Context, endpoint ServiceEndpoints) pb.MicroServiceServer {\n\treturn &grpcServer{\n\t\tService: grpctransport.NewServer(\n\t\t\tendpoint.ServiceEndpoint,\n\t\t\tDecodeGRPCServiceRequest,\n\t\t\tEncodeGRPCServiceResponse,\n\t\t),\n\t}\n}", "func NewServer(opt ...Option) Server {\r\n\treturn newRpcServer(opt...)\r\n}", "func NewServer(gserver *grpc.Server, evalUC usecase.Eval) {\n\tevalServer := &server{\n\t\tusecase: evalUC,\n\t}\n\tentity.RegisterCalcServer(gserver, evalServer)\n}", "func NewGRPCServer(srv *grpc.Server, backend api.Backend) {\n\ts := &grpcServer{\n\t\tbackend: backend,\n\t}\n\tpb.RegisterEntityRegistryServer(srv, s)\n\tpb.RegisterRuntimeRegistryServer(srv, s)\n}", "func New(c *conf.RPCServer, l *logic.Logic) *grpc.Server {\n\tkeepParams := grpc.KeepaliveParams(keepalive.ServerParameters{\n\t\tMaxConnectionIdle: time.Duration(c.IdleTimeout),\n\t\tMaxConnectionAgeGrace: time.Duration(c.ForceCloseWait),\n\t\tTime: time.Duration(c.KeepAliveInterval),\n\t\tTimeout: time.Duration(c.KeepAliveTimeout),\n\t\tMaxConnectionAge: time.Duration(c.MaxLifeTime),\n\t})\n\tsrv := grpc.NewServer(keepParams)\n\tpb.RegisterLogicServer(srv, &server{l})\n\tlis, err := net.Listen(c.Network, c.Addr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tgo func() {\n\t\tif err := srv.Serve(lis); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\treturn srv\n}", "func NewGrpcServer(\n\taddress string,\n\tcerts *GrpcSecurity,\n\tsecure bool,\n\tprobe ReadyProbe,\n) *GrpcServer {\n\tserver := &GrpcServer{\n\t\taddress: address,\n\t\tsecure: secure,\n\t\tGrpcSecurity: certs,\n\t\tprobe: probe,\n\t}\n\treturn server\n}", "func NewGRPCServerHandler(ipamd *IpamD) *GRPCServerHandler {\n\treturn &GRPCServerHandler{\n\t\tipamd: ipamd,\n\t}\n}", "func NewGrpcServer(scaleHandler *scaling.ScaleHandler, address, certDir string, certsReady chan struct{}) GrpcServer {\n\treturn GrpcServer{\n\t\taddress: address,\n\t\tscalerHandler: scaleHandler,\n\t\tcertDir: certDir,\n\t\tcertsReady: certsReady,\n\t}\n}", "func NewGrpcServer(service pb.UserServiceServer, port string) (GrpcServer, error) {\n\tlis, err := net.Listen(\"tcp\", \":\"+port)\n\tif err != nil {\n\t\treturn GrpcServer{}, err\n\t}\n\tserver := grpc.NewServer()\n\tpb.RegisterUserServiceServer(server, service)\n\n\treturn GrpcServer{\n\t\tserver: server,\n\t\tlistener: lis,\n\t\terrCh: make(chan error),\n\t}, nil\n}", "func newGRPCDummyServer(_ context.Context, cfg *config.Config) *grpc.Server {\n\tgrpcServer := grpc.NewServer()\n\tdatacatalog.RegisterDataCatalogServer(grpcServer, &datacatalogservice.DataCatalogService{})\n\tif cfg.GrpcServerReflection {\n\t\treflection.Register(grpcServer)\n\t}\n\treturn grpcServer\n}", "func NewServer() *Server {\n\n\tsrvr := grpc.NewServer(\n\t\tgrpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(unaryInterceptors...)),\n\t)\n\n\ts := &Server{Server: srvr}\n\treturn s\n}", "func NewGRPCServer(endpoints Set, otTracer stdopentracing.Tracer, logger log.Logger) pb.AddServer {\n\n\toptions := []grpctransport.ServerOption{\n\t\tgrpctransport.ServerErrorLogger(logger),\n\t}\n\n\treturn &grpcServer{\n\t\tgenerateReport: grpctransport.NewServer(\n\t\t\tendpoints.GenerateReportEndpoint,\n\t\t\tdecodeGRPCGenerateReportRequest,\n\t\t\tencodeGRPCGenerateReportResponse,\n\t\t\tappend(options, grpctransport.ServerBefore(opentracing.GRPCToContext(otTracer, \"GenerateReport\", logger)))...,\n\t\t),\n\t}\n}", "func NewGRPCServer(srv *grpc.Server, timeSource epochtime.Backend, registry registry.Backend) {\n\ts := &grpcServer{\n\t\tlogger: logging.GetLogger(\"dummydebug/grpc\"),\n\t\ttimeSource: timeSource,\n\t\tregistry: registry,\n\t}\n\tdbgPB.RegisterDummyDebugServer(srv, s)\n}", "func NewServer(gsrv *grpc.Server, readHandler ReadHandler, writeHandler WriteHandler) (*Server, error) {\n\tif readHandler == nil && writeHandler == nil {\n\t\treturn nil, fmt.Errorf(\"readHandler and writeHandler cannot both be nil\")\n\t}\n\n\tserver := &Server{\n\t\tstatus: make(map[string]*pb.QueryWriteStatusResponse),\n\t\treadHandler: readHandler,\n\t\twriteHandler: writeHandler,\n\t\trpc: &grpcService{},\n\t}\n\tserver.rpc.parent = server\n\n\t// Register a server.\n\tpb.RegisterByteStreamServer(gsrv, server.rpc)\n\n\treturn server, nil\n}", "func NewGRPCServer(addr string, pluginHost PluginHost) (*GRPCServer, error) {\n\tl, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create listener: %w\", err)\n\t}\n\n\tif pluginHost == nil {\n\t\treturn nil, errors.New(\"plugin host is nil\")\n\t}\n\n\tserver := &GRPCServer{\n\t\tlistener: l,\n\t\tpluginHost: pluginHost,\n\t}\n\n\treturn server, nil\n}", "func NewRPCServer(netService *net.NetworkingService) RPCServer {\n\tp := RPCServer{\n\t\tservice: netService,\n\t\tsubscriptions: make(map[uint64]*pubsub.Subscription),\n\t\tsubChannels: make(map[uint64]chan []byte),\n\t\tcancelChannels: make(map[uint64]chan bool),\n\t\tcurrentSubID: new(uint64),\n\t}\n\t*p.currentSubID = 0\n\treturn p\n}", "func NewServer(svc things.Service) mainflux.ThingsServiceServer {\n\treturn &grpcServer{\n\t\tcanAccess: kitgrpc.NewServer(\n\t\t\tcanAccessEndpoint(svc),\n\t\t\tdecodeCanAccessRequest,\n\t\t\tencodeIdentityResponse,\n\t\t),\n\t\tidentify: kitgrpc.NewServer(\n\t\t\tidentifyEndpoint(svc),\n\t\t\tdecodeIdentifyRequest,\n\t\t\tencodeIdentityResponse,\n\t\t),\n\t}\n}", "func NewServer(binding string, nodeMgr NodeManagerInterface) GRPCServer {\n\ts := grpc.NewServer()\n\tmyServer := &server{\n\t\tbinding: binding,\n\t\ts: s,\n\t\tnodeMgr: nodeMgr,\n\t}\n\tpb.RegisterCloudProviderVsphereServer(s, myServer)\n\treflection.Register(s)\n\treturn myServer\n}", "func NewGRPCServer(endpoints loginendpoint.Set, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) pb.LoginServer {\n\toptions := []grpctransport.ServerOption{\n\t\tgrpctransport.ServerErrorHandler(transport.NewLogErrorHandler(logger)),\n\t}\n\n\tif zipkinTracer != nil {\n\t\t// Zipkin GRPC Server Trace can either be instantiated per gRPC method with a\n\t\t// provided operation name or a global tracing service can be instantiated\n\t\t// without an operation name and fed to each Go kit gRPC server as a\n\t\t// ServerOption.\n\t\t// In the latter case, the operation name will be the endpoint's grpc method\n\t\t// path if used in combination with the Go kit gRPC Interceptor.\n\t\t//\n\t\t// In this example, we demonstrate a global Zipkin tracing service with\n\t\t// Go kit gRPC Interceptor.\n\t\toptions = append(options, zipkin.GRPCServerTrace(zipkinTracer))\n\t}\n\n\tg := &grpcServer{\n\t\tname: grpctransport.NewServer(\n\t\t\tendpoints.LoginEndpoint,\n\t\t\tdecodeGRPCNameRequest,\n\t\t\tencodeGRPCNameResponse,\n\t\t\tappend(options, grpctransport.ServerBefore(opentracing.GRPCToContext(otTracer, \"Name\", logger)))...,\n\t\t),\n\t}\n\treturn g\n}", "func NewServer(opts ...server.Option) server.Server {\n\treturn grpc.NewServer(opts...)\n}", "func MakeGRPCServer(endpoints Endpoints) pb.MinAppServer {\n\tserverOptions := []grpctransport.ServerOption{\n\t\tgrpctransport.ServerBefore(metadataToContext),\n\t}\n\treturn &grpcServer{\n\t\t// minapp\n\n\t\tlogin: grpctransport.NewServer(\n\t\t\tendpoints.LoginEndpoint,\n\t\t\tDecodeGRPCLoginRequest,\n\t\t\tEncodeGRPCLoginResponse,\n\t\t\tserverOptions...,\n\t\t),\n\t\tcheckusersession: grpctransport.NewServer(\n\t\t\tendpoints.CheckUserSessionEndpoint,\n\t\t\tDecodeGRPCCheckUserSessionRequest,\n\t\t\tEncodeGRPCCheckUserSessionResponse,\n\t\t\tserverOptions...,\n\t\t),\n\t\tgetuserinfo: grpctransport.NewServer(\n\t\t\tendpoints.GetUserInfoEndpoint,\n\t\t\tDecodeGRPCGetUserInfoRequest,\n\t\t\tEncodeGRPCGetUserInfoResponse,\n\t\t\tserverOptions...,\n\t\t),\n\t\tupdateuserinfo: grpctransport.NewServer(\n\t\t\tendpoints.UpdateUserInfoEndpoint,\n\t\t\tDecodeGRPCUpdateUserInfoRequest,\n\t\t\tEncodeGRPCUpdateUserInfoResponse,\n\t\t\tserverOptions...,\n\t\t),\n\t\tgetuserconfig: grpctransport.NewServer(\n\t\t\tendpoints.GetUserConfigEndpoint,\n\t\t\tDecodeGRPCGetUserConfigRequest,\n\t\t\tEncodeGRPCGetUserConfigResponse,\n\t\t\tserverOptions...,\n\t\t),\n\t\tsetuserconfig: grpctransport.NewServer(\n\t\t\tendpoints.SetUserConfigEndpoint,\n\t\t\tDecodeGRPCSetUserConfigRequest,\n\t\t\tEncodeGRPCSetUserConfigResponse,\n\t\t\tserverOptions...,\n\t\t),\n\t}\n}", "func MakeGRPCServer(ctx context.Context, endpoints Endpoints, logger log.Logger) pb.FirewallServiceServer {\n\toptions := []grpctransport.ServerOption{\n\t\tgrpctransport.ServerErrorLogger(logger),\n\t}\n\n\treturn &grpcServer{\n\t\tinitbridge: grpctransport.NewServer(\n\t\t\tendpoints.InitBridgeEndpoint,\n\t\t\tDecodeGRPCInitBridgeRequest,\n\t\t\tEncodeGRPCInitBridgeResponse,\n\t\t\toptions...,\n\t\t),\n\t\tallowconnection: grpctransport.NewServer(\n\t\t\tendpoints.AllowConnectionEndpoint,\n\t\t\tDecodeGRPCAllowConnectionRequest,\n\t\t\tEncodeGRPCAllowConnectionResponse,\n\t\t\toptions...,\n\t\t),\n\t\tblockconnection: grpctransport.NewServer(\n\t\t\tendpoints.BlockConnectionEndpoint,\n\t\t\tDecodeGRPCBlockConnectionRequest,\n\t\t\tEncodeGRPCBlockConnectionResponse,\n\t\t\toptions...,\n\t\t),\n\t\tallowport: grpctransport.NewServer(\n\t\t\tendpoints.AllowPortEndpoint,\n\t\t\tDecodeGRPCAllowPortRequest,\n\t\t\tEncodeGRPCAllowPortResponse,\n\t\t\toptions...,\n\t\t),\n\t\tblockport: grpctransport.NewServer(\n\t\t\tendpoints.BlockPortEndpoint,\n\t\t\tDecodeGRPCBlockPortRequest,\n\t\t\tEncodeGRPCBlockPortResponse,\n\t\t\toptions...,\n\t\t),\n\t}\n}", "func New(cfg Config, dis *disbad.Disbad) service.Service {\n\treturn &grpcServer{\n\t\tcfg: cfg,\n\t\tserver: &server{\n\t\t\tcfg: cfg,\n\t\t\tdis: dis,\n\t\t},\n\t}\n}", "func NewServer(cfg ServerConfig, logger *log.Logger, unaryInterceptors []grpc.UnaryServerInterceptor, streamInterceptors []grpc.StreamServerInterceptor) *grpc.Server {\n\topts := []grpcrecovery.Option{\n\t\tgrpcrecovery.WithRecoveryHandlerContext(func(ctx context.Context, rec interface{}) (err error) {\n\t\t\tlogger.Critical(ctx, \"[gRPC|Server] Recovered in %v\", rec)\n\n\t\t\treturn status.Errorf(codes.Internal, \"Recovered in %v\", rec)\n\t\t}),\n\t}\n\n\tserver := grpc.NewServer(\n\t\tgrpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{\n\t\t\tMinTime: cfg.ServerMinTime, // If a client pings more than once every 5 minutes, terminate the connection\n\t\t\tPermitWithoutStream: true, // Allow pings even when there are no active streams\n\t\t}),\n\t\tgrpc.KeepaliveParams(keepalive.ServerParameters{\n\t\t\tTime: cfg.ServerTime, // Ping the client if it is idle for 2 hours to ensure the connection is still active\n\t\t\tTimeout: cfg.ServerTimeout, // Wait 20 second for the ping ack before assuming the connection is dead\n\t\t}),\n\t\tgrpcmiddleware.WithUnaryServerChain(\n\t\t\tappend([]grpc.UnaryServerInterceptor{\n\t\t\t\tgrpcrecovery.UnaryServerInterceptor(opts...),\n\t\t\t\tmiddleware.TransformUnaryIncomingError(),\n\t\t\t\tmiddleware.SetMetadataFromUnaryRequest(),\n\t\t\t\tfirewall.SetIdentityFromUnaryRequest(),\n\t\t\t\tmiddleware.LogUnaryRequest(logger),\n\t\t\t}, unaryInterceptors...)...,\n\t\t),\n\t\tgrpcmiddleware.WithStreamServerChain(\n\t\t\tappend([]grpc.StreamServerInterceptor{\n\t\t\t\tgrpcrecovery.StreamServerInterceptor(opts...),\n\t\t\t\tmiddleware.TransformStreamIncomingError(),\n\t\t\t\tmiddleware.SetMetadataFromStreamRequest(),\n\t\t\t\tfirewall.SetIdentityFromStreamRequest(),\n\t\t\t\tmiddleware.LogStreamRequest(logger),\n\t\t\t}, streamInterceptors...)...,\n\t\t),\n\t)\n\n\treturn server\n}", "func New(config *GrpcServerConfig) (*GrpcServer, error) {\n\tif nil == config {\n\t\treturn nil, fmt.Errorf(\"Configuration must be provided\")\n\t}\n\tif len(config.Name) == 0 {\n\t\treturn nil, fmt.Errorf(\"Name of server must be provided\")\n\t}\n\tif len(config.Address) == 0 {\n\t\treturn nil, fmt.Errorf(\"Address must be provided\")\n\t}\n\tif len(config.Net) == 0 {\n\t\treturn nil, fmt.Errorf(\"Net must be provided\")\n\t}\n\n\tl, err := net.Listen(config.Net, config.Address)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to setup server: %s\", err.Error())\n\t}\n\n\treturn &GrpcServer{\n\t\tname: config.Name,\n\t\tlistener: l,\n\t\topts: config.Opts,\n\t}, nil\n}", "func NewGRPCServer(\n\tendpoints endpoints.Endpoints,\n\toptions []kitgrpc.ServerOption,\n\tlogger log.Logger,\n) pb.JoblistingServiceServer {\n\terrorLogger := kitgrpc.ServerErrorLogger(logger)\n\toptions = append(options, errorLogger)\n\n\treturn &grpcServer{\n\t\tcreateJobPost: kitgrpc.NewServer(\n\t\t\tendpoints.CreateJobPost,\n\t\t\tdecodeCreateJobPostRequest,\n\t\t\tencodeCreateJobPostResponse,\n\t\t\toptions...,\n\t\t),\n\t\tbulkCreateJobPost: kitgrpc.NewServer(\n\t\t\tendpoints.BulkCreateJobPost,\n\t\t\tdecodeBulkCreateJobPostRequest,\n\t\t\tencodeBulkCreateJobPostResponse,\n\t\t\toptions...,\n\t\t),\n\t\tgetAllJobPosts: kitgrpc.NewServer(\n\t\t\tendpoints.GetAllJobPosts,\n\t\t\tdecodeGetAllJobPostsRequest,\n\t\t\tencodeGetAllJobPostsResponse,\n\t\t\toptions...,\n\t\t),\n\t\tgetJobPostByID: kitgrpc.NewServer(\n\t\t\tendpoints.GetJobPostByID,\n\t\t\tdecodeGetJobPostByIDRequest,\n\t\t\tencodeGetJobPostByIDResponse,\n\t\t\toptions...,\n\t\t),\n\t\tupdateJobPost: kitgrpc.NewServer(\n\t\t\tendpoints.UpdateJobPost,\n\t\t\tdecodeUpdateJobPostRequest,\n\t\t\tencodeUpdateJobPostResponse,\n\t\t\toptions...,\n\t\t),\n\t\tdeleteJobPost: kitgrpc.NewServer(\n\t\t\tendpoints.DeleteJobPost,\n\t\t\tdecodeDeleteJobPostRequest,\n\t\t\tencodeDeleteJobPostResponse,\n\t\t\toptions...,\n\t\t),\n\n\t\tcreateCompany: kitgrpc.NewServer(\n\t\t\tendpoints.CreateCompany,\n\t\t\tdecodeCreateCompanyRequest,\n\t\t\tencodeCreateCompanyResponse,\n\t\t\toptions...,\n\t\t),\n\t\tlocalCreateCompany: kitgrpc.NewServer(\n\t\t\tendpoints.LocalCreateCompany,\n\t\t\tdecodeCreateCompanyRequest,\n\t\t\tencodeCreateCompanyResponse,\n\t\t\toptions...,\n\t\t),\n\t\tgetAllCompanies: kitgrpc.NewServer(\n\t\t\tendpoints.GetAllCompanies,\n\t\t\tdecodeGetAllCompaniesRequest,\n\t\t\tencodeGetAllCompaniesResponse,\n\t\t\toptions...,\n\t\t),\n\t\tupdateCompany: kitgrpc.NewServer(\n\t\t\tendpoints.UpdateCompany,\n\t\t\tdecodeUpdateCompanyRequest,\n\t\t\tencodeUpdateCompanyResponse,\n\t\t\toptions...,\n\t\t),\n\t\tlocalUpdateCompany: kitgrpc.NewServer(\n\t\t\tendpoints.LocalUpdateCompany,\n\t\t\tdecodeUpdateCompanyRequest,\n\t\t\tencodeUpdateCompanyResponse,\n\t\t\toptions...,\n\t\t),\n\t\tdeleteCompany: kitgrpc.NewServer(\n\t\t\tendpoints.DeleteCompany,\n\t\t\tdecodeDeleteCompanyRequest,\n\t\t\tencodeDeleteCompanyResponse,\n\t\t\toptions...,\n\t\t),\n\n\t\tcreateIndustry: kitgrpc.NewServer(\n\t\t\tendpoints.CreateIndustry,\n\t\t\tdecodeCreateIndustryRequest,\n\t\t\tencodeCreateIndustryResponse,\n\t\t\toptions...,\n\t\t),\n\t\tgetAllIndustries: kitgrpc.NewServer(\n\t\t\tendpoints.GetAllIndustries,\n\t\t\tdecodeGetAllIndustriesRequest,\n\t\t\tencodeGetAllIndustriesResponse,\n\t\t\toptions...,\n\t\t),\n\t\tdeleteIndustry: kitgrpc.NewServer(\n\t\t\tendpoints.DeleteIndustry,\n\t\t\tdecodeDeleteIndustryRequest,\n\t\t\tencodeDeleteIndustryResponse,\n\t\t\toptions...,\n\t\t),\n\n\t\tcreateJobFunction: kitgrpc.NewServer(\n\t\t\tendpoints.CreateJobFunction,\n\t\t\tdecodeCreateJobFunctionRequest,\n\t\t\tencodeCreateJobFunctionResponse,\n\t\t\toptions...,\n\t\t),\n\t\tgetAllJobFunctions: kitgrpc.NewServer(\n\t\t\tendpoints.GetAllJobFunctions,\n\t\t\tdecodeGetAllJobFunctionsRequest,\n\t\t\tencodeGetAllJobFunctionsResponse,\n\t\t\toptions...,\n\t\t),\n\t\tdeleteJobFunction: kitgrpc.NewServer(\n\t\t\tendpoints.DeleteJobFunction,\n\t\t\tdecodeDeleteJobFunctionRequest,\n\t\t\tencodeDeleteJobFunctionResponse,\n\t\t\toptions...,\n\t\t),\n\n\t\tcreateKeyPerson: kitgrpc.NewServer(\n\t\t\tendpoints.CreateKeyPerson,\n\t\t\tdecodeCreateKeyPersonRequest,\n\t\t\tencodeCreateKeyPersonResponse,\n\t\t\toptions...,\n\t\t),\n\t\tbulkCreateKeyPerson: kitgrpc.NewServer(\n\t\t\tendpoints.BulkCreateKeyPerson,\n\t\t\tdecodeBulkCreateKeyPersonRequest,\n\t\t\tencodeBulkCreateKeyPersonResponse,\n\t\t\toptions...,\n\t\t),\n\t\tgetAllKeyPersons: kitgrpc.NewServer(\n\t\t\tendpoints.GetAllKeyPersons,\n\t\t\tdecodeGetAllKeyPersonsRequest,\n\t\t\tencodeGetAllKeyPersonsResponse,\n\t\t\toptions...,\n\t\t),\n\t\tgetKeyPersonByID: kitgrpc.NewServer(\n\t\t\tendpoints.GetKeyPersonByID,\n\t\t\tdecodeGetKeyPersonByIDRequest,\n\t\t\tencodeGetKeyPersonByIDResponse,\n\t\t\toptions...,\n\t\t),\n\t\tupdateKeyPerson: kitgrpc.NewServer(\n\t\t\tendpoints.UpdateKeyPerson,\n\t\t\tdecodeUpdateKeyPersonRequest,\n\t\t\tencodeUpdateKeyPersonResponse,\n\t\t\toptions...,\n\t\t),\n\t\tdeleteKeyPerson: kitgrpc.NewServer(\n\t\t\tendpoints.DeleteKeyPerson,\n\t\t\tdecodeDeleteKeyPersonRequest,\n\t\t\tencodeDeleteKeyPersonResponse,\n\t\t\toptions...,\n\t\t),\n\n\t\tcreateJobPlatform: kitgrpc.NewServer(\n\t\t\tendpoints.CreateJobPlatform,\n\t\t\tdecodeCreateJobPlatformRequest,\n\t\t\tencodeCreateJobPlatformResponse,\n\t\t\toptions...,\n\t\t),\n\t\tgetAllJobPlatforms: kitgrpc.NewServer(\n\t\t\tendpoints.GetAllJobPlatforms,\n\t\t\tdecodeGetAllJobPlatformsRequest,\n\t\t\tencodeGetAllJobPlatformsResponse,\n\t\t\toptions...,\n\t\t),\n\t\tdeleteJobPlatform: kitgrpc.NewServer(\n\t\t\tendpoints.DeleteJobPlatform,\n\t\t\tdecodeDeleteJobPlatformRequest,\n\t\t\tencodeDeleteJobPlatformResponse,\n\t\t\toptions...,\n\t\t),\n\n\t\tlogger: logger,\n\t}\n}", "func NewServer(opts Opts) (net.Listener, *grpc.Server) {\n\tlis, err := net.Listen(\"tcp\", fmt.Sprintf(\"%s:%d\", opts.Host, opts.Port))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to listen on %s:%d: %v\", opts.Host, opts.Port, err)\n\t}\n\tlog.Notice(\"Listening on %s:%d\", opts.Host, opts.Port)\n\n\ts := grpc.NewServer(OptionalTLS(opts.KeyFile, opts.CertFile, opts.TLSMinVersion,\n\t\tgrpc.ChainUnaryInterceptor(append([]grpc.UnaryServerInterceptor{\n\t\t\tLogUnaryRequests,\n\t\t\tserverMetrics.UnaryServerInterceptor(),\n\t\t\tgrpc_recovery.UnaryServerInterceptor(),\n\t\t}, unaryAuthInterceptor(opts)...)...),\n\t\tgrpc.ChainStreamInterceptor(append([]grpc.StreamServerInterceptor{\n\t\t\tLogStreamRequests,\n\t\t\tserverMetrics.StreamServerInterceptor(),\n\t\t\tgrpc_recovery.StreamServerInterceptor(),\n\t\t}, streamAuthInterceptor(opts)...)...),\n\t\tgrpc.MaxRecvMsgSize(419430400), // 400MB\n\t\tgrpc.MaxSendMsgSize(419430400),\n\t)...)\n\n\tserverMetrics.InitializeMetrics(s)\n\treflection.Register(s)\n\tif !opts.NoHealth {\n\t\tgrpc_health_v1.RegisterHealthServer(s, health.NewServer())\n\t}\n\treturn lis, s\n}", "func NewRPCServer(svc RPC, opts ...interface{}) TwirpServer {\n\tserverOpts := twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(&serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(&serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T on NewRPCServer\", o))\n\t\t}\n\t}\n\n\treturn &rPCServer{\n\t\tRPC: svc,\n\t\tpathPrefix: serverOpts.PathPrefix(),\n\t\tinterceptor: twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\thooks: serverOpts.Hooks,\n\t\tjsonSkipDefaults: serverOpts.JSONSkipDefaults,\n\t}\n}", "func NewGRPCServer(srv *grpc.Server, backend api.Backend) {\n\ts := &grpcServer{\n\t\tbackend: backend,\n\t}\n\tpb.RegisterSentryServer(srv, s)\n}", "func NewGRPCClientOp(opts ...Option) *Schema {\n\treturn NewClientOutboundOp(\"grpc\", opts...)\n}", "func NewGrpcServer(port int, logger *log.Entry) *GrpcWrapper {\n\treturn &GrpcWrapper{\n\t\tport: port,\n\t\tlogger: logger,\n\t\thandlerFuncs: []func(*grpc.Server){},\n\t}\n}", "func NewGRPC(port string, options ...grpc.ServerOption) *GRPC {\n\tsrv := grpc.NewServer(options...)\n\treturn &GRPC{\n\t\tServer: srv,\n\t\tport: port,\n\t}\n}", "func NewRPC(server *Server) *RPC {\n\treturn &RPC{server}\n}", "func MakeGRPCServer(endpoints endpoints.Endpoints, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) (req pb.TictacServer) {\n\toptions := []grpctransport.ServerOption{\n\t\tgrpctransport.ServerBefore(telepresence.GRPCToContext()),\n\t\tgrpctransport.ServerErrorLogger(logger),\n\t}\n\n\tif zipkinTracer != nil {\n\t\t// Zipkin GRPC Server Trace can either be instantiated per gRPC method with a\n\t\t// provided operation name or a global tracing service can be instantiated\n\t\t// without an operation name and fed to each Go kit gRPC server as a\n\t\t// ServerOption.\n\t\t// In the latter case, the operation name will be the endpoint's grpc method\n\t\t// path if used in combination with the Go kit gRPC Interceptor.\n\t\t//\n\t\t// In this example, we demonstrate a global Zipkin tracing service with\n\t\t// Go kit gRPC Interceptor.\n\t\toptions = append(options, zipkin.GRPCServerTrace(zipkinTracer))\n\t}\n\n\treturn &grpcServer{\n\t\ttic: grpctransport.NewServer(\n\t\t\tendpoints.TicEndpoint,\n\t\t\tdecodeGRPCTicRequest,\n\t\t\tencodeGRPCTicResponse,\n\t\t\tappend(options, grpctransport.ServerBefore(opentracing.GRPCToContext(otTracer, \"Tic\", logger), jwt.GRPCToContext()))...,\n\t\t),\n\n\t\ttac: grpctransport.NewServer(\n\t\t\tendpoints.TacEndpoint,\n\t\t\tdecodeGRPCTacRequest,\n\t\t\tencodeGRPCTacResponse,\n\t\t\tappend(options, grpctransport.ServerBefore(opentracing.GRPCToContext(otTracer, \"Tac\", logger), jwt.GRPCToContext()))...,\n\t\t),\n\t}\n}", "func NewGRPCServer(handlers Handler, tracer tracing.Tracer, gp *pool.GoroutinePool) mixerpb.MixerServer {\n\treturn &grpcServer{\n\t\thandlers: handlers,\n\t\tattrMgr: attribute.NewManager(),\n\t\ttracer: tracer,\n\t\tgp: gp,\n\t\tsendMsg: func(stream grpc.Stream, m proto.Message) error {\n\t\t\treturn stream.SendMsg(m)\n\t\t},\n\t}\n}", "func newRPCServerService() (*rpcServerService, error) {\n return &rpcServerService{serviceMap: util.NewSyncMap()}, nil\n}", "func NewServer(driver Driver, addr chan string) *GrpcServer {\n\treturn &GrpcServer{\n\t\tdriver: driver,\n\t\taddress: addr,\n\t}\n}", "func New(srv *cmutation.Server) *Server {\n\treturn &Server{srv}\n}", "func NewRPCServer(config *config.Config, dom *domain.Domain, sm util.SessionManager) *grpc.Server {\n\tdefer func() {\n\t\tif v := recover(); v != nil {\n\t\t\tlogutil.BgLogger().Error(\"panic in TiDB RPC server\", zap.Reflect(\"r\", v),\n\t\t\t\tzap.Stack(\"stack trace\"))\n\t\t}\n\t}()\n\n\ts := grpc.NewServer(\n\t\tgrpc.KeepaliveParams(keepalive.ServerParameters{\n\t\t\tTime: time.Duration(config.Status.GRPCKeepAliveTime) * time.Second,\n\t\t\tTimeout: time.Duration(config.Status.GRPCKeepAliveTimeout) * time.Second,\n\t\t}),\n\t\tgrpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{\n\t\t\t// Allow clients send consecutive pings in every 5 seconds.\n\t\t\t// The default value of MinTime is 5 minutes,\n\t\t\t// which is too long compared with 10 seconds of TiDB's keepalive time.\n\t\t\tMinTime: 5 * time.Second,\n\t\t}),\n\t\tgrpc.MaxConcurrentStreams(uint32(config.Status.GRPCConcurrentStreams)),\n\t\tgrpc.InitialWindowSize(int32(config.Status.GRPCInitialWindowSize)),\n\t\tgrpc.MaxSendMsgSize(config.Status.GRPCMaxSendMsgSize),\n\t)\n\trpcSrv := &rpcServer{\n\t\tDiagnosticsServer: sysutil.NewDiagnosticsServer(config.Log.File.Filename),\n\t\tdom: dom,\n\t\tsm: sm,\n\t}\n\tdiagnosticspb.RegisterDiagnosticsServer(s, rpcSrv)\n\ttikvpb.RegisterTikvServer(s, rpcSrv)\n\ttopsql.RegisterPubSubServer(s)\n\treturn s\n}", "func NewServer(s Service) pb.BookingServiceServer {\n\treturn &grpcServer{s, pb.UnimplementedBookingServiceServer{}}\n}", "func (a *ArgoCDRepoServer) CreateGRPC(gitClient git.Client) *grpc.Server {\n\tserver := grpc.NewServer(\n\t\tgrpc.StreamInterceptor(grpc_middleware.ChainStreamServer(\n\t\t\tgrpc_logrus.StreamServerInterceptor(a.log),\n\t\t\tgrpc_util.PanicLoggerStreamServerInterceptor(a.log),\n\t\t)),\n\t\tgrpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(\n\t\t\tgrpc_logrus.UnaryServerInterceptor(a.log),\n\t\t\tgrpc_util.PanicLoggerUnaryServerInterceptor(a.log),\n\t\t)),\n\t)\n\tversion.RegisterVersionServiceServer(server, &version.Server{})\n\tmanifestService := repository.NewService(a.ns, a.kubeclientset, gitClient)\n\trepository.RegisterRepositoryServiceServer(server, manifestService)\n\n\t// Register reflection service on gRPC server.\n\treflection.Register(server)\n\n\treturn server\n}", "func NewServer(conf *Config, be *backend.Backend) (*Server, error) {\n\tauthInterceptor := interceptors.NewAuthInterceptor(be.Config.AuthWebhookURL)\n\tdefaultInterceptor := interceptors.NewDefaultInterceptor()\n\n\topts := []grpc.ServerOption{\n\t\tgrpc.UnaryInterceptor(grpcmiddleware.ChainUnaryServer(\n\t\t\tauthInterceptor.Unary(),\n\t\t\tdefaultInterceptor.Unary(),\n\t\t\tgrpcprometheus.UnaryServerInterceptor,\n\t\t)),\n\t\tgrpc.StreamInterceptor(grpcmiddleware.ChainStreamServer(\n\t\t\tauthInterceptor.Stream(),\n\t\t\tdefaultInterceptor.Stream(),\n\t\t\tgrpcprometheus.StreamServerInterceptor,\n\t\t)),\n\t}\n\n\tif conf.CertFile != \"\" && conf.KeyFile != \"\" {\n\t\tcreds, err := credentials.NewServerTLSFromFile(conf.CertFile, conf.KeyFile)\n\t\tif err != nil {\n\t\t\tlog.Logger.Error(err)\n\t\t\treturn nil, err\n\t\t}\n\t\topts = append(opts, grpc.Creds(creds))\n\t}\n\n\topts = append(opts, grpc.MaxConcurrentStreams(math.MaxUint32))\n\n\tyorkieServiceCtx, yorkieServiceCancel := context.WithCancel(context.Background())\n\n\tgrpcServer := grpc.NewServer(opts...)\n\thealthpb.RegisterHealthServer(grpcServer, health.NewServer())\n\tapi.RegisterYorkieServer(grpcServer, newYorkieServer(yorkieServiceCtx, be))\n\tapi.RegisterClusterServer(grpcServer, newClusterServer(be))\n\tgrpcprometheus.Register(grpcServer)\n\n\treturn &Server{\n\t\tconf: conf,\n\t\tgrpcServer: grpcServer,\n\t\tyorkieServiceCancel: yorkieServiceCancel,\n\t}, nil\n}", "func NewGRpcServer(c queue.Client, api client.QueueProtocolAPI) *Grpcserver {\r\n\ts := &Grpcserver{grpc: &Grpc{}}\r\n\ts.grpc.cli.Init(c, api)\r\n\tvar opts []grpc.ServerOption\r\n\t//register interceptor\r\n\t//var interceptor grpc.UnaryServerInterceptor\r\n\tinterceptor := func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {\r\n\t\tif err := auth(ctx, info); err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t\t// Continue processing the request\r\n\t\treturn handler(ctx, req)\r\n\t}\r\n\topts = append(opts, grpc.UnaryInterceptor(interceptor))\r\n\tif rpcCfg.EnableTLS {\r\n\t\tcreds, err := credentials.NewServerTLSFromFile(rpcCfg.CertFile, rpcCfg.KeyFile)\r\n\t\tif err != nil {\r\n\t\t\tpanic(err)\r\n\t\t}\r\n\t\tcredsOps := grpc.Creds(creds)\r\n\t\topts = append(opts, credsOps)\r\n\t}\r\n\r\n\tkp := keepalive.EnforcementPolicy{\r\n\t\tMinTime: 10 * time.Second,\r\n\t\tPermitWithoutStream: true,\r\n\t}\r\n\topts = append(opts, grpc.KeepaliveEnforcementPolicy(kp))\r\n\r\n\tserver := grpc.NewServer(opts...)\r\n\ts.s = server\r\n\ttypes.RegisterChain33Server(server, s.grpc)\r\n\treturn s\r\n}", "func NewGRpcServer(c queue.Client, api client.QueueProtocolAPI) *Grpcserver {\n\ts := &Grpcserver{grpc: &Grpc{}}\n\ts.grpc.cli.Init(c, api)\n\tvar opts []grpc.ServerOption\n\t//register interceptor\n\t//var interceptor grpc.UnaryServerInterceptor\n\tinterceptor := func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {\n\t\tif err := auth(ctx, info); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Continue processing the request\n\t\treturn handler(ctx, req)\n\t}\n\topts = append(opts, grpc.UnaryInterceptor(interceptor))\n\tif rpcCfg.EnableTLS {\n\t\tcreds, err := credentials.NewServerTLSFromFile(rpcCfg.CertFile, rpcCfg.KeyFile)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tcredsOps := grpc.Creds(creds)\n\t\topts = append(opts, credsOps)\n\t}\n\n\tkp := keepalive.EnforcementPolicy{\n\t\tMinTime: 10 * time.Second,\n\t\tPermitWithoutStream: true,\n\t}\n\topts = append(opts, grpc.KeepaliveEnforcementPolicy(kp))\n\n\tserver := grpc.NewServer(opts...)\n\ts.s = server\n\ttypes.RegisterChain33Server(server, s.grpc)\n\treturn s\n}", "func NewServer(t *testing.T, dbc *sql.DB) (*server.Server, string) {\n\tl, err := net.Listen(\"tcp\", \"127.0.0.1:0\")\n\tjtest.RequireNil(t, err)\n\n\tgrpcServer := grpc.NewServer(\n\t\tgrpc.UnaryInterceptor(interceptors.UnaryServerInterceptor),\n\t\tgrpc.StreamInterceptor(interceptors.StreamServerInterceptor))\n\n\tsrv := server.New(dbc, dbc)\n\n\tpb.RegisterGokuServer(grpcServer, srv)\n\n\tgo func() {\n\t\terr := grpcServer.Serve(l)\n\t\tjtest.RequireNil(t, err)\n\t}()\n\n\treturn srv, l.Addr().String()\n}", "func NewServer(conn *grpc.ClientConn) *Server {\n\treturn &Server{\n\t\ttopoConn: conn,\n\t\tclients: make(map[uint32]*webClient),\n\t}\n}", "func NewServer(ctx context.Context, factory dependency.Factory) (*Server, error) {\n\tctx1, cancel := context.WithCancel(ctx)\n\n\ts := &Server{\n\t\tctx: ctx1,\n\t\tcancel: cancel,\n\t\tquerynode: qn.NewQueryNode(ctx, factory),\n\t\tgrpcErrChan: make(chan error),\n\t}\n\treturn s, nil\n}", "func NewGRPCServer(c *conf.DownloaderServerConfig, downloaderService *service.DownloaderService, logger log.Logger) *grpc.Server {\n\tvar opts = []grpc.ServerOption{\n\t\tgrpc.Middleware(\n\t\t\trecovery.Recovery(),\n\t\t),\n\t}\n\tif c.Grpc.Network != \"\" {\n\t\topts = append(opts, grpc.Network(c.Grpc.Network))\n\t}\n\tif c.Grpc.Addr != \"\" {\n\t\topts = append(opts, grpc.Address(c.Grpc.Addr))\n\t}\n\tif c.Grpc.Timeout > 0 {\n\t\topts = append(opts, grpc.Timeout(time.Duration(c.Grpc.Timeout)*time.Second))\n\t}\n\tsrv := grpc.NewServer(opts...)\n\tv1.RegisterDownloaderServer(srv, downloaderService)\n\treturn srv\n}", "func newRPCServer(parallelTotal int, reporter reporters.Reporter) (*RPCServer, error) {\n\tlistener, err := net.Listen(\"tcp\", \"127.0.0.1:0\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &RPCServer{\n\t\tlistener: listener,\n\t\thandler: newServerHandler(parallelTotal, reporter),\n\t}, nil\n}", "func serverFile(genpkg string, svc *expr.GRPCServiceExpr) *codegen.File {\n\tvar (\n\t\tfpath string\n\t\tsections []*codegen.SectionTemplate\n\n\t\tdata = GRPCServices.Get(svc.Name())\n\t)\n\t{\n\t\tsvcName := data.Service.PathName\n\t\tfpath = filepath.Join(codegen.Gendir, \"grpc\", svcName, \"server\", \"server.go\")\n\t\timports := []*codegen.ImportSpec{\n\t\t\t{Path: \"context\"},\n\t\t\t{Path: \"errors\"},\n\t\t\tcodegen.GoaImport(\"\"),\n\t\t\tcodegen.GoaNamedImport(\"grpc\", \"goagrpc\"),\n\t\t\t{Path: \"google.golang.org/grpc/codes\"},\n\t\t\t{Path: path.Join(genpkg, svcName), Name: data.Service.PkgName},\n\t\t\t{Path: path.Join(genpkg, svcName, \"views\"), Name: data.Service.ViewsPkg},\n\t\t\t{Path: path.Join(genpkg, \"grpc\", svcName, pbPkgName), Name: data.PkgName},\n\t\t}\n\t\timports = append(imports, data.Service.UserTypeImports...)\n\t\tsections = []*codegen.SectionTemplate{\n\t\t\tcodegen.Header(svc.Name()+\" gRPC server\", \"server\", imports),\n\t\t\t{Name: \"server-struct\", Source: serverStructT, Data: data},\n\t\t}\n\t\tfor _, e := range data.Endpoints {\n\t\t\tif e.ServerStream != nil {\n\t\t\t\tsections = append(sections, &codegen.SectionTemplate{\n\t\t\t\t\tName: \"server-stream-struct-type\",\n\t\t\t\t\tSource: streamStructTypeT,\n\t\t\t\t\tData: e.ServerStream,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tsections = append(sections, &codegen.SectionTemplate{\n\t\t\tName: \"server-init\",\n\t\t\tSource: serverInitT,\n\t\t\tData: data,\n\t\t})\n\t\tfor _, e := range data.Endpoints {\n\t\t\tsections = append(sections, &codegen.SectionTemplate{\n\t\t\t\tName: \"grpc-handler-init\",\n\t\t\t\tSource: handlerInitT,\n\t\t\t\tData: e,\n\t\t\t})\n\t\t\tsections = append(sections, &codegen.SectionTemplate{\n\t\t\t\tName: \"server-grpc-interface\",\n\t\t\t\tSource: serverGRPCInterfaceT,\n\t\t\t\tData: e,\n\t\t\t})\n\t\t}\n\t\tfor _, e := range data.Endpoints {\n\t\t\tif e.ServerStream != nil {\n\t\t\t\tif e.ServerStream.SendConvert != nil {\n\t\t\t\t\tsections = append(sections, &codegen.SectionTemplate{\n\t\t\t\t\t\tName: \"server-stream-send\",\n\t\t\t\t\t\tSource: streamSendT,\n\t\t\t\t\t\tData: e.ServerStream,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tif e.Method.StreamKind == expr.ClientStreamKind || e.Method.StreamKind == expr.BidirectionalStreamKind {\n\t\t\t\t\tsections = append(sections, &codegen.SectionTemplate{\n\t\t\t\t\t\tName: \"server-stream-recv\",\n\t\t\t\t\t\tSource: streamRecvT,\n\t\t\t\t\t\tData: e.ServerStream,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tif e.ServerStream.MustClose {\n\t\t\t\t\tsections = append(sections, &codegen.SectionTemplate{\n\t\t\t\t\t\tName: \"server-stream-close\",\n\t\t\t\t\t\tSource: streamCloseT,\n\t\t\t\t\t\tData: e.ServerStream,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tif e.Method.ViewedResult != nil && e.Method.ViewedResult.ViewName == \"\" {\n\t\t\t\t\tsections = append(sections, &codegen.SectionTemplate{\n\t\t\t\t\t\tName: \"server-stream-set-view\",\n\t\t\t\t\t\tSource: streamSetViewT,\n\t\t\t\t\t\tData: e.ServerStream,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn &codegen.File{Path: fpath, SectionTemplates: sections}\n}", "func New(e *calc.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t}\n}", "func NewRPCServer(client LLClient) *RPCServer {\n\treturn &RPCServer{\n\t\tllclient: client,\n\t}\n}", "func NewGRPCServer(endpoints greeterendpoint.Endpoints, logger log.Logger) pb.GreeterServer {\n\toptions := []grpctransport.ServerOption{\n\t\tgrpctransport.ServerErrorLogger(logger),\n\t}\n\n\treturn &grpcServer{\n\t\tgreeter: grpctransport.NewServer(\n\t\t\tendpoints.GreetingEndpoint,\n\t\t\tdecodeGRPCGreetingRequest,\n\t\t\tencodeGRPCGreetingResponse,\n\t\t\toptions...,\n\t\t),\n\t}\n}", "func NewServer() (server *Server, err error) {\n\tserver = &Server{\n\t\tserviceName: OwnService,\n\t\thandlers: make(map[string]*handlerEntry),\n\t\tstreamingHandlers: make(map[string]*handlerEntry),\n\t}\n\tlistenAddr := \":\" + core.InstanceListenPortFlag.Get()\n\tserver.listener, err = net.Listen(\"tcp\", listenAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tserver.grpcServer = grpc.NewServer()\n\tcore.RegisterLeverRPCServer(server.grpcServer, server)\n\treturn server, nil\n}", "func NewUnaryServerInterceptor(gcpProjectID string) grpc.UnaryServerInterceptor {\n\treturn func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {\n\t\tincomingMetadata, _ := metadata.FromIncomingContext(ctx)\n\t\tmetadataCopy := incomingMetadata.Copy()\n\t\t_, spanCtx := otelgrpc.Extract(ctx, &metadataCopy)\n\n\t\tif spanCtx.IsValid() {\n\t\t\tt := traceInfo{ProjectID: gcpProjectID, TraceID: spanCtx.TraceID().String(), SpanID: spanCtx.SpanID().String()}\n\t\t\tctx = ctxzap.ToContext(ctx, ctxzap.Extract(ctx).With(\n\t\t\t\tzapdriver.TraceContext(t.TraceID, t.SpanID, true, t.ProjectID)...,\n\t\t\t))\n\t\t}\n\n\t\treqJsonBytes, _ := json.Marshal(req)\n\t\tLogger(ctx).Info(\n\t\t\tinfo.FullMethod,\n\t\t\tzap.ByteString(\"params\", reqJsonBytes),\n\t\t)\n\n\t\treturn handler(ctx, req)\n\t}\n}", "func NewServer(\n\taddr string,\n\tcontrollerNS string,\n\tidentityTrustDomain string,\n\tenableH2Upgrade bool,\n\tk8sAPI *k8s.API,\n\tshutdown <-chan struct{},\n) *grpc.Server {\n\tlog := logging.WithFields(logging.Fields{\n\t\t\"addr\": addr,\n\t\t\"component\": \"server\",\n\t})\n\tendpoints := watcher.NewEndpointsWatcher(k8sAPI, log)\n\tprofiles := watcher.NewProfileWatcher(k8sAPI, log)\n\ttrafficSplits := watcher.NewTrafficSplitWatcher(k8sAPI, log)\n\n\tsrv := server{\n\t\tendpoints,\n\t\tprofiles,\n\t\ttrafficSplits,\n\t\tenableH2Upgrade,\n\t\tcontrollerNS,\n\t\tidentityTrustDomain,\n\t\tlog,\n\t\tshutdown,\n\t}\n\n\ts := prometheus.NewGrpcServer()\n\t// linkerd2-proxy-api/destination.Destination (proxy-facing)\n\tpb.RegisterDestinationServer(s, &srv)\n\t// controller/discovery.Discovery (controller-facing)\n\tdiscoveryPb.RegisterDiscoveryServer(s, &srv)\n\treturn s\n}", "func NewServer(addr string) (*Server, error) {\n\ts := &Server{\n\t\trequests: make(chan *protocol.NetRequest, 8),\n\t\tresponses: make(chan *protocol.NetResponse, 8),\n\t\tAddr: addr,\n\t\trunning: true,\n\t\tgames: make(map[uint64]poker.GameLike, 0),\n\t}\n\n\tlis, err := net.Listen(\"tcp\", serverAddr())\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to listen: %v\\n\", err)\n\t}\n\tgrpcServer := grpc.NewServer()\n\tpb.RegisterGameServerServer(grpcServer, s)\n\n\tlog.Printf(\"server listening at %v\\n\", lis.Addr())\n\tif err := grpcServer.Serve(lis); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to serve: `%v`\\n\", err)\n\t}\n\n\treturn s, nil\n}", "func NewServer(s *grpc.Server) *Server {\n\tts := NewUnstartedServer(s)\n\tts.Start()\n\treturn ts\n}", "func newSdkGrpcServer(config *ServerConfig) (*sdkGrpcServer, error) {\n\tif nil == config {\n\t\treturn nil, fmt.Errorf(\"Configuration must be provided\")\n\t}\n\n\t// Create a log object for this server\n\tname := \"SDK-\" + config.Net\n\tlog := logrus.WithFields(logrus.Fields{\n\t\t\"name\": name,\n\t})\n\n\t// Save the driver for future calls\n\tvar (\n\t\td volume.VolumeDriver\n\t\terr error\n\t)\n\n\tif len(config.DriverName) != 0 {\n\t\td, err = volumedrivers.Get(config.DriverName)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Unable to get driver %s info: %s\", config.DriverName, err.Error())\n\t\t}\n\t}\n\n\t// Setup authentication\n\tfor issuer := range config.Security.Authenticators {\n\t\tlog.Infof(\"Authentication enabled for issuer: %s\", issuer)\n\n\t\t// Check the necessary security config options are set\n\t\tif config.Security.Role == nil {\n\t\t\treturn nil, fmt.Errorf(\"Must supply role manager when authentication enabled\")\n\t\t}\n\t}\n\n\tif config.StoragePolicy == nil {\n\t\treturn nil, fmt.Errorf(\"Must supply storage policy server\")\n\t}\n\n\t// Create gRPC server\n\tgServer, err := grpcserver.New(&grpcserver.GrpcServerConfig{\n\t\tName: name,\n\t\tNet: config.Net,\n\t\tAddress: config.Address,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to setup %s server: %v\", name, err)\n\t}\n\n\ts := &sdkGrpcServer{\n\t\tGrpcServer: gServer,\n\t\taccessLogOutput: config.AccessOutput,\n\t\tauditLogOutput: config.AuditOutput,\n\t\tconfig: *config,\n\t\tname: name,\n\t\tlog: log,\n\t\tclusterHandler: config.Cluster,\n\t\tvolumeDriverHandlers: map[string]volume.VolumeDriver{\n\t\t\tconfig.DriverName: d,\n\t\t\tDefaultDriverName: d,\n\t\t},\n\t\talertHandler: config.AlertsFilterDeleter,\n\t\tpolicyServer: config.StoragePolicy,\n\t}\n\n\ts.identityServer = &IdentityServer{\n\t\tserver: s,\n\t}\n\ts.clusterServer = &ClusterServer{\n\t\tserver: s,\n\t}\n\ts.nodeServer = &NodeServer{\n\t\tserver: s,\n\t}\n\ts.volumeServer = &VolumeServer{\n\t\tserver: s,\n\t\tspecHandler: spec.NewSpecHandler(),\n\t}\n\ts.objectstoreServer = &ObjectstoreServer{\n\t\tserver: s,\n\t}\n\ts.schedulePolicyServer = &SchedulePolicyServer{\n\t\tserver: s,\n\t}\n\ts.cloudBackupServer = &CloudBackupServer{\n\t\tserver: s,\n\t}\n\ts.credentialServer = &CredentialServer{\n\t\tserver: s,\n\t}\n\ts.alertsServer = &alertsServer{\n\t\tserver: s,\n\t}\n\ts.clusterPairServer = &ClusterPairServer{\n\t\tserver: s,\n\t}\n\ts.clusterDomainsServer = &ClusterDomainsServer{\n\t\tserver: s,\n\t}\n\ts.filesystemTrimServer = &FilesystemTrimServer{\n\t\tserver: s,\n\t}\n\ts.filesystemCheckServer = &FilesystemCheckServer{\n\t\tserver: s,\n\t}\n\ts.storagePoolServer = &StoragePoolServer{\n\t\tserver: s,\n\t}\n\ts.diagsServer = &DiagsServer{\n\t\tserver: s,\n\t}\n\ts.jobServer = &JobServer{\n\t\tserver: s,\n\t}\n\ts.bucketServer = &BucketServer{\n\t\tserver: s,\n\t}\n\ts.watcherServer = &WatcherServer{\n\t\tvolumeServer: s.volumeServer,\n\t}\n\n\ts.roleServer = config.Security.Role\n\ts.policyServer = config.StoragePolicy\n\t// For the SDK server set the grpc balancer to the provided round robin balancer\n\ts.grpcBalancer = config.RoundRobinBalancer\n\n\treturn s, nil\n}", "func NewServer(config *Config, opts []grpc.ServerOption) (*Server, error) {\n\tif config == nil {\n\t\treturn nil, errors.New(\"config not provided\")\n\t}\n\n\ts := grpc.NewServer(opts...)\n\treflection.Register(s)\n\n\tsrv := &Server{\n\t\ts: s,\n\t\tconfig: config,\n\t\tclients: map[string]*Client{},\n\t}\n\tvar err error\n\tif srv.config.Port < 0 {\n\t\tsrv.config.Port = 0\n\t}\n\tsrv.lis, err = net.Listen(\"tcp\", fmt.Sprintf(\":%d\", srv.config.Port))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open listener port %d: %v\", srv.config.Port, err)\n\t}\n\tgnmipb.RegisterGNMIServer(srv.s, srv)\n\tlog.V(1).Infof(\"Created Server on %s\", srv.Address())\n\treturn srv, nil\n}", "func NewServer() api.PProfServiceServer {\n\treturn server{}\n}", "func NewServer(rpc *cosmos.RPC, eventPublisher *publisher.EventPublisher, tokenToRunnerHash *sync.Map, logger tmlog.Logger) *Server {\n\treturn &Server{\n\t\trpc: rpc,\n\t\teventPublisher: eventPublisher,\n\t\ttokenToRunnerHash: tokenToRunnerHash,\n\t\texecInProgress: &sync.Map{},\n\t\tlogger: logger,\n\t}\n}", "func (p *AppPlugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error {\n\tpluginproto.RegisterNodeServer(s, NewServer(p.app))\n\treturn nil\n}", "func New(server *grpc.Server) Service {\n\ts := &service{}\n\tpb.RegisterRuntimeServiceServer(server, s)\n\tpb.RegisterImageServiceServer(server, s)\n\treturn s\n}", "func NewServer(\n\taddr string,\n\tcontrollerNS string,\n\tidentityTrustDomain string,\n\tenableH2Upgrade bool,\n\tenableEndpointSlices bool,\n\tk8sAPI *k8s.API,\n\tmetadataAPI *k8s.MetadataAPI,\n\tclusterStore *watcher.ClusterStore,\n\tclusterDomain string,\n\tdefaultOpaquePorts map[uint32]struct{},\n\tshutdown <-chan struct{},\n) (*grpc.Server, error) {\n\tlog := logging.WithFields(logging.Fields{\n\t\t\"addr\": addr,\n\t\t\"component\": \"server\",\n\t})\n\n\t// Initialize indexers that are used across watchers\n\terr := watcher.InitializeIndexers(k8sAPI)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tendpoints, err := watcher.NewEndpointsWatcher(k8sAPI, metadataAPI, log, enableEndpointSlices, \"local\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\topaquePorts, err := watcher.NewOpaquePortsWatcher(k8sAPI, log, defaultOpaquePorts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tprofiles, err := watcher.NewProfileWatcher(k8sAPI, log)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tservers, err := watcher.NewServerWatcher(k8sAPI, log)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsrv := server{\n\t\tpb.UnimplementedDestinationServer{},\n\t\tendpoints,\n\t\topaquePorts,\n\t\tprofiles,\n\t\tservers,\n\t\tclusterStore,\n\t\tenableH2Upgrade,\n\t\tcontrollerNS,\n\t\tidentityTrustDomain,\n\t\tclusterDomain,\n\t\tdefaultOpaquePorts,\n\t\tk8sAPI,\n\t\tmetadataAPI,\n\t\tlog,\n\t\tshutdown,\n\t}\n\n\ts := prometheus.NewGrpcServer()\n\t// linkerd2-proxy-api/destination.Destination (proxy-facing)\n\tpb.RegisterDestinationServer(s, &srv)\n\treturn s, nil\n}", "func NewServer(options ...ServerOptionFunc) (*Server, error) {\n\ts := &Server{\n\t\taddress: \"127.0.0.1:8080\",\n\t}\n\n\tfor _, f := range options {\n\t\tif err := f(s); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to set options\")\n\t\t}\n\t}\n\n\tif s.ctx == nil || s.cancel == nil {\n\t\ts.ctx, s.cancel = context.WithCancel(context.Background())\n\t}\n\n\tif s.StorageProvider == nil {\n\t\treturn nil, errors.New(\"storage provider is required\")\n\t}\n\n\tif s.chart == nil {\n\t\treturn nil, errors.New(\"chart provider is required\")\n\t}\n\n\tif s.deploy == nil {\n\t\treturn nil, errors.New(\"deploy provider is required\")\n\t}\n\n\treturn s, nil\n}", "func NewServer(s server.Server, tls *tls.Config) *grpc.Server {\n\tvar opts []grpc.ServerOption\n\tif tls != nil {\n\t\t// Add TLS Credentials as a ServerOption for server connections.\n\t\topts = append(opts, grpc.Creds(credentials.NewTLS(tls)))\n\t}\n\n\tgrpcServer := grpc.NewServer(opts...)\n\trpcpb.RegisterGroupsServer(grpcServer, newGroupServer(s))\n\trpcpb.RegisterProfilesServer(grpcServer, newProfileServer(s))\n\trpcpb.RegisterSelectServer(grpcServer, newSelectServer(s))\n\trpcpb.RegisterIgnitionServer(grpcServer, newIgnitionServer(s))\n\trpcpb.RegisterGenericServer(grpcServer, newGenericServer(s))\n\treturn grpcServer\n}", "func NewServer(c *Config) (*Server, error) {\n\t// validate config\n\tif err := validation.Validate.Struct(c); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid config: %v\", err)\n\t}\n\n\t// create root context\n\tctx, cancel := context.WithCancel(context.Background())\n\n\t// register handlers\n\tmux := runtime.NewServeMux()\n\topts := []grpc.DialOption{grpc.WithInsecure()}\n\terr := proto.RegisterTodosHandlerFromEndpoint(ctx, mux, c.Endpoint, opts)\n\tif err != nil {\n\t\tdefer cancel()\n\t\treturn nil, fmt.Errorf(\"unable to register gateway handler: %v\", err)\n\t}\n\n\ts := Server{\n\t\tcancel: cancel,\n\t\tlog: c.Log,\n\t\tmux: mux,\n\t\tport: c.Port,\n\t}\n\treturn &s, nil\n}", "func MakeGRPCServer(endpoints Endpoints, options ...grpctransport.ServerOption) pb.GeoServer {\n\tserverOptions := []grpctransport.ServerOption{\n\t\tgrpctransport.ServerBefore(metadataToContext),\n\t}\n\tserverOptions = append(serverOptions, options...)\n\treturn &grpcServer{\n\t\t// geo\n\n\t\tstatus: grpctransport.NewServer(\n\t\t\tendpoints.StatusEndpoint,\n\t\t\tDecodeGRPCStatusRequest,\n\t\t\tEncodeGRPCStatusResponse,\n\t\t\tserverOptions...,\n\t\t),\n\t\tdistance: grpctransport.NewServer(\n\t\t\tendpoints.DistanceEndpoint,\n\t\t\tDecodeGRPCDistanceRequest,\n\t\t\tEncodeGRPCDistanceResponse,\n\t\t\tserverOptions...,\n\t\t),\n\t}\n}", "func CreateGRPCService(wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\n\tlistener, err := net.Listen(\"tcp\", port)\n\tif err != nil {\n\t\tlog.Fatal(\"Unable to create grpc listener:\", err)\n\t}\n\n\tserver := grpc.NewServer()\n\tpb.RegisterGPRCServiceServer(server, &fibServer{})\n\n\tlog.Println(\"gRPC server is listening...\")\n\tif err = server.Serve(listener); err != nil {\n\t\tlog.Fatal(\"Unable to start server:\", err)\n\t}\n}", "func NewGRPCServer(caFile, certFile, keyFile string, switchService proto.SwitchServiceServer) (GRPCServer, error) {\n\topts := []grpc.ServerOption{}\n\n\t// Configure MTLS\n\tif caFile != \"\" && certFile != \"\" && keyFile != \"\" {\n\t\tca, err := ioutil.ReadFile(caFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpool := x509.NewCertPool()\n\t\tif ok := pool.AppendCertsFromPEM(ca); !ok {\n\t\t\treturn nil, errors.New(\"Failed to append certificate authority\")\n\t\t}\n\n\t\tcert, err := tls.LoadX509KeyPair(certFile, keyFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttlsConfig := &tls.Config{\n\t\t\tCertificates: []tls.Certificate{cert},\n\t\t\tClientAuth: tls.RequireAndVerifyClientCert,\n\t\t\tClientCAs: pool,\n\t\t}\n\n\t\tcreds := credentials.NewTLS(tlsConfig)\n\t\topts = append(opts, grpc.Creds(creds))\n\t}\n\n\tgrpcServer := grpc.NewServer(opts...)\n\tproto.RegisterSwitchServiceServer(grpcServer, switchService)\n\n\treturn grpcServer, nil\n}" ]
[ "0.65307856", "0.6465759", "0.638635", "0.63605416", "0.6218937", "0.6209357", "0.6159027", "0.6125592", "0.61150086", "0.61064684", "0.6038607", "0.6023678", "0.60186785", "0.60011286", "0.5998306", "0.5959716", "0.59547335", "0.5933221", "0.5931417", "0.59279203", "0.5922626", "0.5910473", "0.5904626", "0.5887027", "0.58869165", "0.58854914", "0.58772314", "0.58756894", "0.5855263", "0.5803567", "0.5782479", "0.57677877", "0.57568264", "0.57442546", "0.5741689", "0.57401496", "0.5734292", "0.5683978", "0.5676997", "0.56493706", "0.56474763", "0.56323147", "0.5631479", "0.56304526", "0.5599639", "0.55968124", "0.5593722", "0.5584813", "0.5556392", "0.55511636", "0.5548557", "0.5536889", "0.55311245", "0.55270404", "0.551945", "0.546168", "0.5460739", "0.5460198", "0.5453299", "0.5444804", "0.5424495", "0.5415929", "0.5415571", "0.5401906", "0.53976923", "0.53763366", "0.53602403", "0.5360071", "0.53543746", "0.53327113", "0.53128684", "0.53030825", "0.5291656", "0.52735394", "0.5272102", "0.5267702", "0.52635497", "0.5260614", "0.5255478", "0.5244903", "0.5243325", "0.5239942", "0.5238768", "0.52372384", "0.523177", "0.5219273", "0.5217669", "0.52138275", "0.520847", "0.52075213", "0.52047455", "0.51951736", "0.51942354", "0.51925737", "0.5176987", "0.5167498", "0.5163362", "0.5157185", "0.5137011", "0.5135802" ]
0.8469104
0
DBCheck is a function that allows me to check the database status
func DBCheck(next http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if db.ConnectionCheck() == 0 { http.Error(w, "DB Connection lost.", http.StatusInternalServerError) return } next.ServeHTTP(w, r) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *ConsulDB) CheckDatabase() error {\n\tkv := c.consulClient.KV()\n\t_, _, err := kv.Get(\"test\", nil)\n\tif err != nil {\n\t\treturn pkgerrors.New(\"[ERROR] Cannot talk to Datastore. Check if it is running/reachable.\")\n\t}\n\treturn nil\n}", "func CheckDb(f echo.HandlerFunc) {\n\t//return func(c echo.Context) error {\n\t//\tif db.CheckConnection() == 0 {\n\t//\t\tlog.Fatal(\"Error DB\")\n\t//\t}\n\t//\treturn f(c)\n\t//}\n}", "func (db *DBNonRealtional) CheckDatabase() error {\n\n\t//Check projectId\n\tif err := db.CheckDatabaseProjectId(); err != nil {\n\t\treturn err\n\t}\n\n\t//Check Key\n\tif err := db.CheckDatabaseKey(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func StatusCheck(ctx context.Context, db *DB) error {\n\tctx, span := otel.Tracer(\"database\").Start(ctx, \"foundation.database.statuscheck\")\n\tdefer span.End()\n\n\t// First check we can ping the database.\n\tvar pingError error\n\tfor attempts := 1; ; attempts++ {\n\t\tpingError = db.Ping(ctx)\n\t\tif pingError == nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(time.Duration(attempts) * 100 * time.Millisecond)\n\t\tif ctx.Err() != nil {\n\t\t\treturn ctx.Err()\n\t\t}\n\t}\n\n\t// Make sure we didn't timeout or be cancelled.\n\tif ctx.Err() != nil {\n\t\treturn ctx.Err()\n\t}\n\n\t// Run a simple query to determine connectivity. Running this query forces\n\t// a round trip to the database.\n\tconst q = `SELECT true`\n\tvar tmp bool\n\treturn db.QueryRow(ctx, q).Scan(&tmp)\n}", "func CheckDB(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif bd.CheckConnection() == false {\n\t\t\thttp.Error(w, \"Lost database connection\", 500)\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t}\n}", "func (db *DB) Check() ([]string, bool) {\n\tif err := db.Ping(); err != nil {\n\t\treturn []string{err.Error()}, false\n\t}\n\treturn []string{\"database connection ok\"}, true\n}", "func CheckConnectionDB() int {\n\terr := MongoCN.Ping(context.TODO(), nil)\n\tif err != nil {\n\t\treturn 0\n\t}\n\n\treturn 1\n}", "func CheckDB() bool {\n\n\tsess := session.Must(session.NewSession(&aws.Config{Region: aws.String(\"us-east-1\")})) // TODO handle default region preference\n\tsvc := simpledb.New(sess)\n\n\tparams := &simpledb.DomainMetadataInput{\n\t\tDomainName: aws.String(\"awsm\"), // Required\n\t}\n\t_, err := svc.DomainMetadata(params)\n\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// TODO handle the response stats?\n\treturn true\n}", "func (cli *FakeDatabaseClient) CheckDatabaseState(ctx context.Context, in *dbdpb.CheckDatabaseStateRequest, opts ...grpc.CallOption) (*dbdpb.CheckDatabaseStateResponse, error) {\n\tpanic(\"implement me\")\n}", "func CheckDB(db *sql.DB, strDBName string) (bool, error) {\n\n\t// Does the database exist?\n\tresult, err := db.Query(\"SELECT db_id('\" + strDBName + \"')\")\n\tdefer result.Close()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tfor result.Next() {\n\t\tvar s sql.NullString\n\t\terr := result.Scan(&s)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\t// Check result\n\t\tif s.Valid {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t}\n\n\t// This return() should never be hit...\n\treturn false, err\n}", "func (extDb *Database) checkStatus() error {\n\tif atomic.LoadInt32(&extDb.isReady) == cDatabaseStateReconnect {\n\t\treturn ErrReconInProcess\n\t}\n\tdb := extDb.getDb()\n\tif atomic.LoadInt32(&extDb.isReady) == cDatabaseStateNotReady || db == nil {\n\t\tif err := extDb.Reconnect(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func databaseCheck(redisClient *redis.Client, logger log.Logger) (ok bool, err error) {\n\t// Checking if letters list exists.\n\tlogger.Info(\"Checking database\")\n\tvar flag int64\n\tflag, err = redisClient.Exists(\"letters\").Result()\n\tif err != nil {\n\t\treturn\n\t}\n\tif flag == 0 {\n\t\treturn\n\t}\n\tvar letters []string\n\tletters, err = redisClient.SMembers(\"letters\").Result()\n\tsort.Strings(letters)\n\n\tlogger.Info(\"Letters\", \"letters\", letters)\n\tfor _, i := range letters {\n\t\tvar flag int64\n\t\tflag, err = redisClient.Exists(\"letter:\" + i).Result()\n\t\tif err != nil {\n\t\t\terr = errors.New(\"Damaged database. You should write in teminal: \\\"redis-cli\\\", \\\"FLUSHALL\\\" and restart app\")\n\t\t\treturn\n\t\t}\n\t\tif flag == 0 {\n\t\t\treturn\n\t\t}\n\t\tvar letterNames string\n\t\tletterNames, err = redisClient.Get(\"letter:\" + i).Result()\n\t\tlogger.Info(\"\\\"Letter : Names\\\"\", \"Letter\", i, \"Names\", letterNames)\n\t\tnames := strings.Split(letterNames, \"\\n\")\n\t\tfor _, name := range names {\n\t\t\tvar link string\n\t\t\tlink, err = redisClient.Get(\"name:\" + strings.ToLower(name)).Result()\n\t\t\tif err != nil {\n\t\t\t\terr = errors.New(\"Damaged database. You should write in teminal: \\\"redis-cli\\\", \\\"FLUSHALL\\\" and restart app\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlogger.Info(\"\\\"Name : Link\\\"\", \"Name\", name, \"Link\", link)\n\t\t}\n\t}\n\n\t// Database if ready.\n\tlogger.Info(\"Database is ready\")\n\tok = true\n\treturn\n}", "func CheckDBConnection() error {\n\tinMemConn, err := GetDBConnection(InMemory)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create InMemory DB connection: %v\", err)\n\t}\n\tonDiskConn, err := GetDBConnection(OnDisk)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create OnDisk DB connection: %v\", err)\n\t}\n\n\tif err := inMemConn.Ping(); err != nil {\n\t\treturn fmt.Errorf(\"unable to ping InMemory DB: %v\", err)\n\t}\n\tif err := onDiskConn.Ping(); err != nil {\n\t\treturn fmt.Errorf(\"unable to ping OnDisk DB: %v\", err)\n\t}\n\n\treturn nil\n}", "func (db *Database) HealthCheck() error {\n\tsqlDB, err := db.conn.DB()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = sqlDB.Ping()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func CheckDB() (*gorm.DB, error) {\n\tdb, err := userDB.DB()\n\tif err != nil {\n\t\tlog.WithField(\"CheckDB\", \"Access DB\").Error(err)\n\t\treturn nil, err\n\t}\n\terr = db.Ping()\n\tif err != nil {\n\t\tlog.WithField(\"CheckDB\", \"First Ping failed\").Error(err)\n\t\terr = db.Ping()\n\t\tif err != nil {\n\t\t\tlog.WithField(\"CheckDB\", \"Second Ping failed, connection to DB not possible\").Error(err)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn userDB, nil\n}", "func CheckDatabase() {\n\tLogField.Info(\"check database\")\n\tif appconfig.Config.Database.Type == \"sqlite\" {\n\t\treturn\n\t}\n\tdb, err := sql.Open(\"mysql\", fmt.Sprintf(\n\t\t\"%s:%s@tcp(%s:%s)/\",\n\t\tappconfig.Config.Mysql.Username,\n\t\tappconfig.Config.Mysql.Password,\n\t\tappconfig.Config.Mysql.Host,\n\t\tappconfig.Config.Mysql.Port,\n\t))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_, err = db.Exec(\"CREATE DATABASE IF NOT EXISTS \" + appconfig.Config.Mysql.Database)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (s *orm) Check(ctx context.Context) {\n\ts.client.DB().PingContext(ctx)\n}", "func HealthCheck(w http.ResponseWriter, r *http.Request) {\n\tdbUp := DBClient.Check()\n\n\tif dbUp {\n\t\tdata, _ := json.Marshal(healthCheckResponse{Status: \"UP\"})\n\t\twriteJSONResponse(w, http.StatusOK, data)\n\t} else {\n\t\tdata, _ := json.Marshal(healthCheckResponse{Status: \"Database not accessible\"})\n\t\twriteJSONResponse(w, http.StatusServiceUnavailable, data)\n\t}\n}", "func CheckStatus(database string) error {\n\treturn nil\n}", "func checkDatabase() {\n\tlog.Info().Msgf(\n\t\t\"found %d train numbers and %d log records in the database\",\n\t\tmodels.CountRecords(\"emu_latest\"),\n\t\tmodels.CountRecords(\"emu_log\"),\n\t)\n\tlog.Info().Msgf(\n\t\t\"found %d units and %d QR codes in the database\",\n\t\tmodels.CountRecords(\"emu_qr_code\", \"DISTINCT emu_no\"),\n\t\tmodels.CountRecords(\"emu_qr_code\"),\n\t)\n}", "func (d *DBHealthChecker) CheckHealth() error {\n\treturn d.db.Ping()\n}", "func (db *BotDB) CheckStatus() bool {\n\tif !db.Status.Get() {\n\t\tif db.statuslock.TestAndSet() { // If this was already true, bail out\n\t\t\treturn false\n\t\t}\n\t\tdefer db.statuslock.Clear()\n\n\t\tif db.Status.Get() { // If the database was already fixed, return true\n\t\t\treturn true\n\t\t}\n\n\t\tif db.lastattempt.Add(DBReconnectTimeout).Before(time.Now().UTC()) {\n\t\t\tdb.log.Log(\"Database failure detected! Attempting to reboot database connection...\")\n\t\t\tdb.lastattempt = time.Now().UTC()\n\t\t\terr := db.db.Ping()\n\t\t\tif err != nil {\n\t\t\t\tdb.log.LogError(\"Reconnection failed! Another attempt will be made in \"+TimeDiff(DBReconnectTimeout)+\". Error: \", err)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\terr = db.LoadStatements() // If we re-establish connection, we must reload statements in case they were lost or never loaded in the first place\n\t\t\tdb.log.LogError(\"LoadStatements failed: \", err) // if loading the statements fails we're screwed anyway so we just log the error and keep going\n\t\t\tdb.Status.Set(true) // Only after loading the statements do we set status to true\n\t\t\tdb.log.Log(\"Reconnection succeeded, exiting out of No Database mode.\")\n\t\t} else { // If not, just fail\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func DatabasePingCheck(database *sql.DB, timeout time.Duration) Check {\n\treturn func() error {\n\t\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\t\tdefer cancel()\n\t\tif database == nil {\n\t\t\treturn fmt.Errorf(\"database is nil\")\n\t\t}\n\t\treturn database.PingContext(ctx)\n\t}\n}", "func DatabasePingCheck(database *sql.DB, timeout time.Duration) Check {\n\treturn func() error {\n\t\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\t\tdefer cancel()\n\t\tif database == nil {\n\t\t\treturn fmt.Errorf(\"database is nil\")\n\t\t}\n\t\treturn database.PingContext(ctx)\n\t}\n}", "func (q *worldstateQueryProcessor) getDBStatus(dbName string) (*types.GetDBStatusResponse, error) {\n\t// ACL is meaningless here as this call is to check whether a DB exist. Even with ACL,\n\t// the user can infer the information.\n\treturn &types.GetDBStatusResponse{\n\t\tExist: q.isDBExists(dbName),\n\t}, nil\n}", "func DbExists(s *mg.Session, db string) (bool) {\n names, err := s.DatabaseNames()\n if err != nil {\n return false\n }\n for _, value := range names {\n if (value == db){\n return true\n }\n }\n return false;\n}", "func checkDbExist(db *sql.DB) bool {\n\trows, err := db.Query(\"SELECT * FROM kitemmuorts\")\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer rows.Close()\n\tif rows != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func DBClientCheck(name string) bool {\n\tclient := redis.NewClient(&redis.Options{\n\t\tAddr: \"localhost:6379\",\n\t\tPassword: \"\", // no password set\n\t\tDB: 0, // use default DB\n\t})\n\n\texisted, err := client.Exists(\"location:\" + name).Result()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t/**\n\t// don't need to check duration for timeout, the key will removed in redis\n\tduration, err2 := client.TTL(\"location:\" + name).Result()\n\tif err2 != nil {\n\t\tpanic(err2)\n\t}\n\tdurationAsSecond := duration / time.Second\n\treturn existed == 0 || (existed == 1 && durationAsSecond < 0)\n\t**/\n\treturn existed == 0\n}", "func (c *postgresConnection) Check() error {\n\tvar tmp bool\n\treturn c.DB.QueryRow(`SELECT true`).Scan(&tmp)\n}", "func (db *Db) CheckReady() error {\n\tif db.session.Closed() {\n\t\treturn errors.New(\"Session is closed\")\n\t}\n\n\tif err := db.session.Query(\"SELECT now() FROM system.local\").Exec(); err != nil {\n\t\treturn fmt.Errorf(\"Health check query failed: %s\", err.Error())\n\t}\n\n\treturn nil\n}", "func checkDbAccess( conn mongo.Conn, dbName string, username string, password string ) bool {\n\t\n\tdb := mongo.Database{conn, dbName , mongo.DefaultLastErrorCmd}\t\n\tif len(username) > 0 {\n\t\terrAuth := db.Authenticate(username, password) \n\t\tif errAuth != nil {\n\t\t\tif errAuth.Error() == shardErr {\n\t\t\t\tfmt.Println(\"db \",dbName, \" not available via shard \", errAuth )\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\tlog.Println(\"auth for db\",dbName, \"failed for\",username,\"-\", password, \":\", errAuth )\n\t\t\t\treturn false\n\t\t\t}\n\t\t} \n\t}\telse {\n\t\tvar m mongo.M\n\t errAccess := db.Run(mongo.D{{\"dbStats\", 1}}, &m)\t\n\t\tif errAccess != nil {\n\t\t\tlog.Println(\"access to db \",dbName, \" failed: \", errAccess )\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n\t\n\t\n}", "func (bdm *MySQLDBManager) CheckDBExists() (bool, error) {\n\tbc, err := bdm.GetBlockchainObject()\n\n\tif err != nil {\n\t\treturn false, nil\n\t}\n\n\ttophash, err := bc.GetTopHash()\n\n\tif err != nil {\n\t\treturn false, nil\n\t}\n\n\tif len(tophash) > 0 {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (p *PostgreSQL) Check(ctx context.Context) (err error) {\n\tdb, err := sql.Open(\"postgres\", p.dsn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer func(db *sql.DB) {\n\t\tif dberr := db.Close(); dberr != nil {\n\t\t\terr = dberr\n\t\t}\n\t}(db)\n\n\terr = db.PingContext(ctx)\n\tif err != nil {\n\t\tif checker.IsConnectionRefused(err) {\n\t\t\treturn checker.NewExpectedError(\n\t\t\t\t\"failed to establish a connection to the postgresql server\", err,\n\t\t\t\t\"dsn\", p.dsn,\n\t\t\t)\n\t\t}\n\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func checkDBSetup() {\n\trows, _ := db_con.Query(\"SELECT to_regclass('public.log');\")\n\trows.Next()\n\n\t// Update schema if log table doesn't exists\n\tvar exists string\n\trows.Scan(&exists)\n\tif (exists == \"\") {\n\t\tdb_con.Query(dbSchema)\n\t}\n}", "func CheckDBID(loggedInUser, dbOwner string, dbID int64) (avail bool, dbFolder, dbName string, err error) {\n\tdbQuery := `\n\t\tSELECT folder, db_name\n\t\tFROM sqlite_databases\n\t\tWHERE user_id = (\n\t\t\t\tSELECT user_id\n\t\t\t\tFROM users\n\t\t\t\tWHERE lower(user_name) = lower($1)\n\t\t\t)\n\t\t\tAND db_id = $2\n\t\t\tAND is_deleted = false`\n\t// If the request is from someone who's not logged in, or is for another users database, ensure we only consider\n\t// public databases\n\tif strings.ToLower(loggedInUser) != strings.ToLower(dbOwner) || loggedInUser == \"\" {\n\t\tdbQuery += `\n\t\t\tAND public = true`\n\t}\n\terr = pdb.QueryRow(dbQuery, dbOwner, dbID).Scan(&dbFolder, &dbName)\n\tif err != nil {\n\t\tif err == pgx.ErrNoRows {\n\t\t\tavail = false\n\t\t} else {\n\t\t\tlog.Printf(\"Checking if a database exists failed: %v\\n\", err)\n\t\t}\n\t\treturn\n\t}\n\n\t// Database exists\n\tavail = true\n\treturn\n}", "func CheckDBWatched(loggedInUser, dbOwner, dbFolder, dbName string) (bool, error) {\n\tdbQuery := `\n\t\tSELECT count(db_id)\n\t\tFROM watchers\n\t\tWHERE user_id = (\n\t\t\t\tSELECT user_id\n\t\t\t\tFROM users\n\t\t\t\tWHERE lower(user_name) = lower($4)\n\t\t\t)\n\t\t\tAND db_id = (\n\t\t\t\t\tSELECT db_id\n\t\t\t\t\tFROM sqlite_databases\n\t\t\t\t\tWHERE user_id = (\n\t\t\t\t\t\t\tSELECT user_id\n\t\t\t\t\t\t\tFROM users\n\t\t\t\t\t\t\tWHERE lower(user_name) = lower($1)\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND folder = $2\n\t\t\t\t\t\tAND db_name = $3\n\t\t\t\t\t\tAND is_deleted = false)`\n\tvar watchCount int\n\terr := pdb.QueryRow(dbQuery, dbOwner, dbFolder, dbName, loggedInUser).Scan(&watchCount)\n\tif err != nil {\n\t\tlog.Printf(\"Error looking up watchers count for database. User: '%s' DB: '%s%s%s'. Error: %v\\n\",\n\t\t\tloggedInUser, dbOwner, dbFolder, dbName, err)\n\t\treturn true, err\n\t}\n\tif watchCount == 0 {\n\t\t// Database isn't being watched by the user\n\t\treturn false, nil\n\t}\n\n\t// Database IS being watched by the user\n\treturn true, nil\n}", "func checkIfDatabaseExists(connDetail ConnectionDetails, dbName string) (found bool, err error) {\n\n\tvar db *sql.DB\n\n\tif db, err = connect(connDetail); err != nil {\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\ttotalRows := 0\n\tif err = db.QueryRow(\"SELECT count(1) FROM pg_database WHERE datname = $1\", dbName).Scan(&totalRows); err != nil {\n\t\treturn\n\t}\n\n\tfound = (totalRows > 0)\n\n\treturn\n}", "func (db Database) checkConnection() bool {\n\t// Connect to database\n\tconnection, err := sql.Open(\"postgres\", db.getDBConnectionString())\n\tif err != nil {\n\t\treturn false\n\t}\n\t// Ping database\n\terr = connection.Ping()\n\treturn err == nil\n}", "func checkAuditorDB(auditorDB *gorm.DB) error {\n\tdb, err := auditorDB.DB()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := db.Ping(); err != nil {\n\t\treturn err\n\t}\n\n\t// 初始化 Gen 配置\n\tgenM := gen.Use(auditorDB)\n\tq := genM.Audit.WithContext(context.Background())\n\n\tif _, err := q.Limit(1).Find(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func CheckAndInitializeDatabase(dbType string) {\n\tdbVersion, versionFlag, err := GetCompleteDatabaseVersion()\n\tif err != nil {\n\t\tgclog.Printf(FatalSQLFlags, \"Failed to initialise database: %s\", err.Error())\n\t}\n\n\tswitch versionFlag {\n\tcase DBIsPreApril:\n\t\tfallthrough\n\tcase DBModernButBehind:\n\t\tgclog.Printf(FatalSQLFlags,\n\t\t\t\"Database layout is deprecated. Please run gochan-migrate. Target version is %d\", targetDatabaseVersion) //TODO give exact command\n\tcase DBClean:\n\t\tbuildNewDatabase(dbType)\n\t\treturn\n\tcase DBUpToDate:\n\t\treturn\n\tcase DBCorrupted:\n\t\tgclog.Println(FatalSQLFlags,\n\t\t\t\"Database contains gochan prefixed tables but is missing versioning tables. Database is possible corrupted. Please contact the devs for help.\")\n\t\treturn\n\tcase DBModernButAhead:\n\t\tgclog.Printf(gclog.LFatal,\n\t\t\t\"Database layout is ahead of current version. Current version %d, target version: %d.\\n\"+\n\t\t\t\t\"Are you running an old gochan version?\", dbVersion, targetDatabaseVersion)\n\t\treturn\n\tdefault:\n\t\tgclog.Printf(FatalSQLFlags,\n\t\t\t\"Failed to initialise database: Checkdatabase, none of paths matched. Should never be executed. Check for outcome of GetCompleteDatabaseVersion()\")\n\t\treturn\n\t}\n}", "func testDB(d *sql.DB) error {\n\terr := d.Ping()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func isDatabaseReady() bool {\n\ttimeout := time.After(30 * time.Second)\n\ttick := time.Tick(1 * time.Second)\n\tfor {\n\t\tselect {\n\t\tcase <-timeout:\n\t\t\tlog.Println(\"Could not communicate with database after an expected period, terminating containers\")\n\t\t\tDockerComposeDown()\n\t\t\treturn false\n\t\tcase <-tick:\n\t\t\tresponse, err := pingDatabaseContainer()\n\t\t\tif err != nil && strings.Contains(err.Error(), \"EOF\") || err == nil && response.StatusCode == http.StatusOK {\n\t\t\t\tlog.Println(\"Test database is ready to use\")\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n}", "func CheckDBExists(loggedInUser, dbOwner, dbFolder, dbName string) (bool, error) {\n\tdbQuery := `\n\t\tSELECT count(db_id)\n\t\tFROM sqlite_databases\n\t\tWHERE user_id = (\n\t\t\t\tSELECT user_id\n\t\t\t\tFROM users\n\t\t\t\tWHERE lower(user_name) = lower($1)\n\t\t\t)\n\t\t\tAND folder = $2\n\t\t\tAND db_name = $3\n\t\t\tAND is_deleted = false`\n\t// If the request is from someone who's not logged in, or is for another users database, ensure we only consider\n\t// public databases\n\tif strings.ToLower(loggedInUser) != strings.ToLower(dbOwner) || loggedInUser == \"\" {\n\t\tdbQuery += `\n\t\t\tAND public = true`\n\t}\n\tvar DBCount int\n\terr := pdb.QueryRow(dbQuery, dbOwner, dbFolder, dbName).Scan(&DBCount)\n\tif err != nil {\n\t\tlog.Printf(\"Checking if a database exists failed: %v\\n\", err)\n\t\treturn true, err\n\t}\n\tif DBCount == 0 {\n\t\t// Database isn't in our system\n\t\treturn false, nil\n\t}\n\n\t// Database exists\n\treturn true, nil\n}", "func (h *HTTPApi) ensureDatabase(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tdefer r.Body.Close()\n\tbytes, _ := ioutil.ReadAll(r.Body)\n\n\tvar database metadata.Database\n\tif err := json.Unmarshal(bytes, &database); err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t} else {\n\t\tif err := h.storageNode.Datasources[ps.ByName(\"datasource\")].EnsureExistsDatabase(r.Context(), &database); err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\t}\n}", "func CheckConnection() int {\n err := MongoConnection.Ping(context.TODO(), nil)\n if err != nil {\n return 0\n }\n return 1\n}", "func VerifyDB(next http.HandlerFunc) http.HandlerFunc {\r\n\treturn func(w http.ResponseWriter, r *http.Request) {\r\n\t\tif db.VerifyConnection() == false {\r\n\t\t\thttp.Error(w, \"Lost connection with database\", 500)\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tnext.ServeHTTP(w, r)\r\n\t}\r\n}", "func (bdm *MySQLDBManager) CheckConnection() error {\n\tconn, err := bdm.getConnection()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\t_, err = conn.Query(\"SHOW TABLES\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (db *Database) HealthCheck() error {\n\tif db == nil || db.conn == nil {\n\t\treturn hord.ErrNoDial\n\t}\n\terr := db.conn.Query(\"SELECT now() FROM system.local;\").Exec()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"health check of Cassandra cluster failed\")\n\t}\n\treturn nil\n}", "func isDbConnected() bool {\n\treturn Session != nil && DB != nil\n}", "func (s *server) checkdb(ctx context.Context, alias string) (string, error) {\n\traw, err := s.db.FetchAlias(ctx, alias)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tc := arecord{}\n\terr = json.Unmarshal(str2b(raw), &c)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn c.URL, nil\n}", "func CheckAndCreateDB(db *DB) (*DB, error) {\n\tvar err error\n\tif !fresh.Exists(db.Database, db.Logger) {\n\t\terr = fresh.Create(db.Database, db.Logger)\n\t\tif err != nil {\n\t\t\tdb.Logger.Error(\"error\", err, \"msg\", \"couldn't create database\")\n\t\t}\n\t}\n\treturn db, err\n}", "func check() {\n\tconn, err := pool.Acquire(context.Background())\n\n\tif err != nil {\n\t\tlogger.Error(\"connection acquirement failed, reason %v\", err)\n\t} else {\n\t\tctx, cancel := context.WithDeadline(context.Background(),\n\t\t\ttime.Now().Add(2*time.Second))\n\t\tdefer cancel()\n\n\t\terr = conn.Conn().Ping(ctx)\n\n\t\tif err != nil {\n\t\t\tlogger.Error(\"database pool is unhealthy, reason %v\", err)\n\t\t\tos.Exit(1)\n\t\t} else {\n\t\t\tlogger.Info(\"database connection ok\")\n\t\t}\n\t}\n}", "func (d Database) ValidateDatabase() (valid bool) {\n\tvalid = true\n\n\tswitch \"\" {\n\tcase d.Host:\n\tcase d.Name:\n\tcase d.User:\n\tcase d.Password:\n\tcase d.SslMode:\n\t\tvalid = false\n\t\treturn\n\t}\n\tif d.Port == 0 {\n\t\tvalid = false\n\t}\n\treturn\n}", "func checkBeat(db *sql.DB) (err error) {\n\tctx := context.Background()\n\tctx, cancel := context.WithTimeout(ctx, heartbeatTimeout)\n\tdefer cancel()\n\n\treturn db.PingContext(ctx)\n}", "func status() {\n\tgetDBVersion()\n}", "func verifyDB(db *sql.DB) error {\n\trow := db.QueryRow(\"select version from schema_version\")\n\tvar detectedSchemaVersion string\n\terr := row.Scan(&detectedSchemaVersion)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to determine schema version\")\n\t}\n\tif detectedSchemaVersion != schemaVersion {\n\t\treturn fmt.Errorf(\"schema version has changed. Detected schema version: %q. App's schema version: %q. Remove or migrate the database\", detectedSchemaVersion, schemaVersion)\n\t}\n\n\treturn nil\n}", "func (e *Endpoint) Check(ctx echo.Context) error {\n\thealthData := e.service.HealthCheck()\n\n\tif !healthData.Database {\n\t\treturn ctx.JSON(http.StatusServiceUnavailable, healthData)\n\t}\n\treturn ctx.JSON(http.StatusOK, healthData)\n}", "func checkDatabaseVersion(store kvstore.KVStore) error {\n\tentry, err := store.Get(dbVersionKey)\n\tif errors.Is(err, kvstore.ErrKeyNotFound) {\n\t\t// set the version in an empty DB\n\t\treturn store.Set(dbVersionKey, []byte{DBVersion})\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(entry) == 0 {\n\t\treturn fmt.Errorf(\"%w: no database version was persisted\", ErrDBVersionIncompatible)\n\t}\n\tif entry[0] != DBVersion {\n\t\treturn fmt.Errorf(\"%w: supported version: %d, version of database: %d\", ErrDBVersionIncompatible, DBVersion, entry[0])\n\t}\n\treturn nil\n}", "func (s *Server) HealthCheck(ctx context.Context) error {\n\treturn s.db.PingContext(ctx)\n}", "func (env *Env) ReadinessCheck(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\terr := env.db.Ping()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttputil.SendErr(w, httputil.InternalServerError)\n\t\treturn\n\t}\n\thttputil.SendOK(w)\n}", "func (m *MongoStore) HealthCheck() error {\n\n\t_, err := decodeBytes(m.db.RunCommand(context.Background(), bson.D{{\"serverStatus\", 1}}))\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Error getting server status\")\n\t}\n\n\treturn nil\n}", "func CheckConnection() error {\n\n\t_, err := StatusAll() // StatusAll method is required for Exists method\n\treturn err\n}", "func (db *DBNonRealtional) CheckDatabaseKey() error {\n\tif _, err := os.Stat(db.Key); os.IsNotExist(err) {\n\t\treturn errors.New(fmt.Sprintf(`Key database file path \"%s\", not exist. Modify config file \"server.yml!\"`, db.Key))\n\t}\n\treturn nil\n}", "func dbWait(db *sql.DB) error {\n\tdeadline := time.Now().Add(dbTimeout)\n\tvar err error\n\tfor tries := 0; time.Now().Before(deadline); tries++ {\n\t\terr = db.Ping()\n\t\tif err == nil {\n\t\t\treturn nil\n\t\t}\n\t\tlevel.Warn(util_log.Logger).Log(\"msg\", \"db connection not established, retrying...\", \"err\", err)\n\t\ttime.Sleep(time.Second << uint(tries))\n\t}\n\treturn errors.Wrapf(err, \"db connection not established after %s\", dbTimeout)\n}", "func DatabaseExists(ctx context.Context, name string, opts ...db.Option) (exists bool, err error) {\n\tvar conn *db.Connection\n\tdefer func() {\n\t\terr = db.PoolCloseFinalizer(conn, err)\n\t}()\n\n\tconn, err = OpenManagementConnection(opts...)\n\tif err != nil {\n\t\treturn\n\t}\n\n\texists, err = conn.QueryContext(ctx, \"SELECT 1 FROM pg_database WHERE datname = $1\", name).Any()\n\treturn\n}", "func CheckDBStarred(loggedInUser, dbOwner, dbFolder, dbName string) (bool, error) {\n\tdbQuery := `\n\t\tSELECT count(db_id)\n\t\tFROM database_stars\n\t\tWHERE database_stars.user_id = (\n\t\t\t\tSELECT user_id\n\t\t\t\tFROM users\n\t\t\t\tWHERE lower(user_name) = lower($4)\n\t\t\t)\n\t\t\tAND database_stars.db_id = (\n\t\t\t\t\tSELECT db_id\n\t\t\t\t\tFROM sqlite_databases\n\t\t\t\t\tWHERE user_id = (\n\t\t\t\t\t\t\tSELECT user_id\n\t\t\t\t\t\t\tFROM users\n\t\t\t\t\t\t\tWHERE lower(user_name) = lower($1)\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND folder = $2\n\t\t\t\t\t\tAND db_name = $3\n\t\t\t\t\t\tAND is_deleted = false)`\n\tvar starCount int\n\terr := pdb.QueryRow(dbQuery, dbOwner, dbFolder, dbName, loggedInUser).Scan(&starCount)\n\tif err != nil {\n\t\tlog.Printf(\"Error looking up star count for database. User: '%s' DB: '%s/%s'. Error: %v\\n\",\n\t\t\tloggedInUser, dbOwner, dbName, err)\n\t\treturn true, err\n\t}\n\tif starCount == 0 {\n\t\t// Database hasn't been starred by the user\n\t\treturn false, nil\n\t}\n\n\t// Database HAS been starred by the user\n\treturn true, nil\n}", "func DbReset() bool { // Add warning system\n\treturn DbCreate()\n}", "func CheckConnection() int {\n\terr := MongoConnection.Ping(context.TODO(), nil)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn 1\n}", "func isConnected(db *sql.DB) bool {\n\treturn db.Ping() == nil\n}", "func DBEnsure(ctx context.Context, stmt *sql.Stmt, params ...interface{}) error {\n\tresult, err := stmt.ExecContext(ctx, params...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"mysql: fail to execute: %v\", err)\n\t}\n\trow, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"mysql: fail to query the num of affected rows: %v\", err)\n\t}\n\tif row <= 0 {\n\t\treturn ErrNoRowAffected\n\t}\n\treturn nil\n}", "func (secretsDb *DB) Ping() error {\n\treturn secretsDb.Db.Ping()\n}", "func (sq *SQ3Driver) checkProvision() error {\n\n\t// First, let's see if we are a new database by checking the existence of our table(s)\n\tfound, err := sq.queryExists(\"SELECT name FROM sqlite_master WHERE type='table' AND name=$1\", dbTable)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !found {\n\t\t// We need to create our table\n\t\treturn sq.provision()\n\t}\n\n\treturn nil\n}", "func TestGetDB(t *testing.T) {\n\tdb, _ := GetDB()\n\n\tassert.NotNil(t, db)\n\tassert.Nil(t, err)\n}", "func (v *VerticaDatasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error) {\n\n\tlog.DefaultLogger.Debug(\"Inside datasource.CheckHealth Function\", \"request\", req)\n\n\tvar status = backend.HealthStatusOk\n\tconnDB, err := v.GetVerticaDb(req.PluginContext)\n\n\tif err != nil {\n\t\tlog.DefaultLogger.Error(\"unable to get sql.DB connection: \" + err.Error())\n\t\treturn &backend.CheckHealthResult{\n\t\t\tStatus: backend.HealthStatusError,\n\t\t\tMessage: fmt.Sprintf(\"%s\", err),\n\t\t}, nil\n\t}\n\t// https://golang.org/pkg/database/sql/#DBStats\n\tlog.DefaultLogger.Debug(fmt.Sprintf(\"%s connection stats open connections =%d, InUse = %d, Ideal = %d\", req.PluginContext.DataSourceInstanceSettings.Name, connDB.Stats().MaxOpenConnections, connDB.Stats().InUse, connDB.Stats().Idle))\n\tconnection, err := connDB.Conn(ctx)\n\n\tif err != nil {\n\t\tlog.DefaultLogger.Info(fmt.Sprintf(\"CheckHealth :connection: %s\", err))\n\t\treturn &backend.CheckHealthResult{\n\t\t\tStatus: backend.HealthStatusError,\n\t\t\tMessage: fmt.Sprintf(\"%s\", err),\n\t\t}, nil\n\t}\n\n\tif err = connection.PingContext(context.Background()); err != nil {\n\t\tlog.DefaultLogger.Error(\"Error while connecting to the Vertica Database: \" + err.Error())\n\t\treturn &backend.CheckHealthResult{\n\t\t\tStatus: backend.HealthStatusError,\n\t\t\tMessage: fmt.Sprintf(\"%s\", err),\n\t\t}, nil\n\t}\n\tdefer connection.Close()\n\n\tresult, err := connection.QueryContext(ctx, \"SELECT version()\")\n\n\tif err != nil {\n\t\tlog.DefaultLogger.Error(\"Health check error: \" + err.Error())\n\t\treturn &backend.CheckHealthResult{\n\t\t\tStatus: backend.HealthStatusError,\n\t\t\tMessage: fmt.Sprintf(\"%s\", err),\n\t\t}, nil\n\t}\n\n\tdefer result.Close()\n\n\tvar queryResult string\n\n\tif result.Next() {\n\t\terr = result.Scan(&queryResult)\n\t\tif err != nil {\n\t\t\tlog.DefaultLogger.Error(\"Health check error: \" + err.Error())\n\t\t\treturn &backend.CheckHealthResult{\n\t\t\t\tStatus: backend.HealthStatusError,\n\t\t\t\tMessage: fmt.Sprintf(\"%s\", err),\n\t\t\t}, nil\n\t\t}\n\t}\n\n\treturn &backend.CheckHealthResult{\n\t\tStatus: status,\n\t\tMessage: fmt.Sprintf(\"Successfully connected to %s\", queryResult),\n\t}, nil\n}", "func (s *SQLDBMonitor) Ping() bool {\n\tdb, err := sql.Open(s.sqlType, s.URI)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif err := db.Ping(); err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func pingDatabase(ctx context.Context, dbConn *core_database.DatabaseConn) error {\n\tdb, err := dbConn.Engine.DB()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := db.Ping(); err != nil {\n\t\treturn err\n\t}\n\n\tsetConnectionConfigs(ctx, dbConn)\n\treturn nil\n}", "func CheckConnection() bool {\n\tif Mongo == nil {\n\t\tConnect(databases)\n\t}\n\n\tif Mongo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func CheckConnection() bool {\n\tif Mongo == nil {\n\t\tConnect(databases)\n\t}\n\n\tif Mongo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func EnsureDB(host string, port int, username string, password string, dbName string) (db *sql.DB, err error) {\n\t// Connect to the postgres DB\n\tpostgresDb, err := connectToDB(host, port, username, password, \"postgres\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Check if the DB exists in the list of databases\n\tvar count int\n\tsb := sq.StatementBuilder.PlaceholderFormat(sq.Dollar)\n\tq := sb.Select(\"count(*)\").From(\"pg_database\").Where(sq.Eq{\"datname\": dbName})\n\terr = q.RunWith(postgresDb).QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// If it doesn't exist create it\n\tif count == 0 {\n\t\t_, err = postgresDb.Exec(\"CREATE database \" + dbName)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tdb, err = connectToDB(host, port, username, password, dbName)\n\treturn\n}", "func (s *PostgresStorage) HealthCheck() error {\n\treturn s.db.Ping()\n}", "func pingDatabase(db *sql.DB) (err error) {\n\tfor i := 0; i < 30; i++ {\n\t\terr = db.Ping()\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t\tlogrus.Infof(\"database ping failed. retry in 1s\")\n\t\ttime.Sleep(time.Second)\n\t}\n\treturn\n}", "func Ping(){\n\tif err := db.Ping(); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (a *AbuseIPDB) Check(ipaddr net.IP) error {\n\tapiKey, err := getConfigValue(\"ABUSEIPDB_API_KEY\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't call API: %w\", err)\n\t}\n\n\theaders := map[string]string{\n\t\t\"Key\": apiKey,\n\t\t\"Accept\": \"application/json\",\n\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\n\t}\n\n\tqueryParams := map[string]string{\n\t\t\"ipAddress\": ipaddr.String(),\n\t\t\"maxAgeInDays\": maxAgeInDays,\n\t}\n\n\tresp, err := makeAPIcall(\"https://api.abuseipdb.com/api/v2/check\", headers, queryParams)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"calling API: %s\", resp.Status)\n\t}\n\n\tif err := json.NewDecoder(resp.Body).Decode(a); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Client) DBPresent() error {\n\tif !stringInSlice(c.db, c.DBList()) {\n\n\t\t_, err := r.DBCreate(c.db).RunWrite(c.session)\n\t\tif err != nil {\n\t\t\tc.Log(fmt.Sprintf(\"%v ... create failed\", c.db))\n\t\t\treturn err\n\t\t}\n\t}\n\tc.Log(fmt.Sprintf(\"+ %v\", c.db))\n\treturn nil\n}", "func (c *DBConfig) Validate() error {\n\n\tconnString := c.ConnectionInfo()\n\n\tlog.Printf(\"default %s validation: opening connection\\n\", c.DBDialect)\n\tdbHandle, err := sql.Open(c.DBDialect, connString)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"default %s validation: connected to %s\\n\", c.DBDialect, c.DBDialect)\n\n\tdefer dbHandle.Close()\n\n\tlog.Printf(\"default %s validation: getting db transaction handle\\n\", c.DBDialect)\n\ttx, err := dbHandle.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"default %s validation: got db transaction handle\\n\", c.DBDialect)\n\n\tvar pid1 int\n\tlog.Printf(\"default %s validation: reading db PID\\n\", c.DBDialect)\n\terr = tx.QueryRow(\"SELECT pg_backend_pid()\").Scan(&pid1)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"default %s validation: got db PID %v\\n\", c.DBDialect, pid1)\n\treturn nil\n}", "func ExistDb(name string) bool {\n\n\tif _, err := os.Stat(name); err != nil {\n\n\t\tif os.IsNotExist(err) {\n\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func isAlive(db *gosql.DB, l *logger) bool {\n\t// The cluster might have just restarted, in which case the first call to db\n\t// might return an error. In fact, the first db.Ping() reliably returns an\n\t// error (but a db.Exec() only seldom returns an error). So, we're gonna\n\t// Ping() twice to allow connections to be re-established.\n\t_ = db.Ping()\n\tif err := db.Ping(); err != nil {\n\t\tl.Printf(\"isAlive returned err=%v (%T)\", err, err)\n\t} else {\n\t\treturn true\n\t}\n\treturn false\n}", "func CheckConnection() int {\n\terr := MongoCN().Ping(context.TODO(), nil)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn 1\n}", "func (db Database) VerifyConnection() (err error) {\n\tif db.checkConnection() {\n\t\tlog.Info(\"Database is reachable\")\n\t} else {\n\t\tlog.Fatal(\"Database is unreachable\")\n\t}\n\treturn\n}", "func (db *RethinkDBAdapter) DbExists() (bool, *CASServerError) {\n\tcursor, err := r.\n\t\tDBList().\n\t\tRun(db.session)\n\tif err != nil {\n\t\tcasErr := &DbExistsCheckFailedError\n\t\tcasErr.err = &err\n\t\treturn false, casErr\n\t}\n\n\tvar response []interface{}\n\terr = cursor.All(&response)\n\n\t// Check that the list contains the database name for the adapter\n\tfor _, listedDb := range response {\n\t\tif listedDb == db.dbName {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "func HandleGetDatabaseConnectionState(adminMan *admin.Manager, modules *modules.Modules) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\n\t\tcrud := modules.DB()\n\t\tconnState := crud.GetConnectionState(ctx, dbAlias)\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: connState})\n\t}\n}", "func CheckSQLConnectivity(t *testing.T, driver string, connString string) {\r\n\r\n\t// Create connection pool\r\n\tdb, err := sql.Open(driver, connString)\r\n\trequire.NoErrorf(t, err, \"Error creating connection pool: %s \", err)\r\n\r\n\t// Close the database connection pool after program executes\r\n\tdefer db.Close()\r\n\r\n\t// Use background context\r\n\tctx := context.Background()\r\n\r\n\t//As open doesn't actually create the connection we need to make some sort of command to check that connectivity works\r\n\t//err = db.Ping()\r\n\t//require.NoErrorf(t, err, \"Error pinging database: %s\", err)\r\n\r\n\tvar result string\r\n\r\n\t// Run query and scan for result\r\n\terr = db.QueryRowContext(ctx, \"SELECT @@version\").Scan(&result)\r\n\trequire.NoErrorf(t, err, \"Error: %s\", err)\r\n\tt.Logf(\"%s\\n\", result)\r\n}", "func ConnectionCheck() int {\n\terr := MongoCN.Ping(context.TODO(), nil)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn 1\n}", "func databaseExists(ctx context.Context, pgConn *pgx.Conn, dbName string) (exists bool, err error) {\n\tconst query = \"SELECT EXISTS (SELECT 1 FROM pg_database WHERE datname=$1)\"\n\terr = pgConn.QueryRow(ctx, query, dbName).Scan(&exists)\n\tif err != nil {\n\t\treturn false, trace.Wrap(err)\n\t}\n\treturn exists, nil\n}", "func InitDB(driverName, dataSourceName string) (*sql.DB) {\n conn, err := sql.Open(driverName, dataSourceName)\n \n log.Println(\"open main db conn\")\n \n if err != nil {\n log.Fatal(\"DB is not connected\")\n }\n \n if err = conn.Ping(); err != nil {\n log.Fatal(\"DB is not responded\")\n }\n \n return conn\n}", "func CheckStatus() error {\n\tdial := setUpMgoConn()\n\tlogger.Infof(\"\\n - Dial details: %+v \\n\", dial)\n\tsess, err := mgo.DialWithInfo(dial)\n\tif err != nil {\n\t\tlogger.Errorf(\"\\nError: %s \\n\", err.Error())\n\t\treturn err\n\t}\n\tdefer sess.Close()\n\terr = sess.Ping()\n\tif err != nil {\n\t\tlogger.Errorf(\"\\nError: %s \\n\", err.Error())\n\t\treturn err\n\t}\n\tlogger.Infof(\"MongoDB server is healthy.\")\n\treturn nil\n}", "func (config *Config) Check() error {\n\tif db, err := config.OpenDB(); err != nil {\n\t\treturn err\n\t} else {\n\t\tdefer db.Close()\n\t}\n\n\tif log, err := config.OpenLog(); err != nil {\n\t\treturn err\n\t} else {\n\t\tdefer log.Close()\n\t}\n\n\tif client, err := config.OpenSMTP(); err != nil {\n\t\treturn err\n\t} else {\n\t\tdefer client.Close()\n\t}\n\n\treturn nil\n}", "func dbVersion(db *sql.DB, dataType string) (v int, table string) {\n\ttable, err := whatTable(dataType)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tsqlStmt := `SELECT version FROM status WHERE table_name = ?`\n\terr = db.QueryRow(sqlStmt, table).Scan(&v)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func CheckingConnection() int {\n\terr := MongoCN.Ping(context.TODO(), nil)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn 1\n}", "func HealthCheck(db *gorm.DB) func(c *gin.Context) {\n\treturn func(c *gin.Context) {\n\t\tginutils.FormatResponse(c, http.StatusNoContent, \"\", \"\", \"\", utils.WhereAmI())\n\t}\n}" ]
[ "0.7774666", "0.7736073", "0.76800054", "0.767038", "0.7568293", "0.7485334", "0.7421833", "0.7317335", "0.7281443", "0.72527796", "0.72176474", "0.71533126", "0.7129956", "0.7129282", "0.7091933", "0.70844454", "0.70654994", "0.70491153", "0.6918515", "0.6870139", "0.6852552", "0.6786809", "0.67665327", "0.67665327", "0.6738238", "0.67255014", "0.67089444", "0.670626", "0.6673664", "0.6642758", "0.66292304", "0.6612829", "0.656575", "0.6505299", "0.6489845", "0.6486793", "0.6461016", "0.6459843", "0.6447657", "0.6435674", "0.63795835", "0.6353899", "0.63323987", "0.63223785", "0.6303021", "0.62991035", "0.6297249", "0.62888145", "0.6274942", "0.6254474", "0.6221353", "0.62086046", "0.61960375", "0.61865443", "0.6181457", "0.61393374", "0.61309165", "0.6109599", "0.6103821", "0.61014205", "0.6099107", "0.60852283", "0.60436887", "0.6013857", "0.6011808", "0.59793085", "0.59547657", "0.5934071", "0.5933045", "0.5931673", "0.5926786", "0.59063864", "0.59054375", "0.585601", "0.585221", "0.5839305", "0.58316517", "0.58316517", "0.58291453", "0.5821199", "0.5820455", "0.58199716", "0.57958615", "0.577082", "0.57662773", "0.5759849", "0.5756684", "0.57500875", "0.57490265", "0.57429653", "0.5741901", "0.57143104", "0.57038236", "0.56979895", "0.569727", "0.5696095", "0.568252", "0.56700486", "0.5669784", "0.56672233" ]
0.7554263
5
NewRID returns a new resource ID.
func NewRID() *RID { rid := &RID{} var gdRID C.godot_rid C.godot_rid_new(&gdRID) rid.rid = &gdRID return rid }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewRIDWithResource(object Class) *RID {\n\trid := &RID{}\n\tvar gdRID C.godot_rid\n\tC.godot_rid_new_with_resource(&gdRID, unsafe.Pointer(object.getOwner()))\n\trid.rid = &gdRID\n\n\treturn rid\n}", "func NewID() string {\n\treturn idFunc()\n}", "func newID() string {\n\treturn \"_\" + uuid.New().String()\n}", "func (b *Bolt) NewID() (sid string, err error) {\n\terr = b.client.Update(func(tx *bolt.Tx) error {\n\t\tbkt := tx.Bucket([]byte(b.bucket))\n\t\tid, err := bkt.NextSequence()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsid = strconv.FormatUint(id, 10)\n\t\treturn nil\n\t})\n\treturn\n}", "func NewID() string {\n\treturn ksuid.New().String()\n}", "func NewID(typ string) string {\n\treturn typ + \"_\" + NewBareID(16)\n}", "func NewObjectID() ObjectID{\n\tres:=(ObjectID{0,nil})\n\tres.IDArray=make(map[string]interface{},constants.MAXOBJECTS)\n\treturn res\n}", "func NewID() string {\n\treturn replacer.Replace(NewV4().String())\n}", "func NewObjectID(id string) GrapheneObject {\n\tgid := new(ObjectID)\n\tif err := gid.Parse(id); err != nil {\n\t\tlogging.Errorf(\n\t\t\t\"ObjectID parser error %v\",\n\t\t\terrors.Annotate(err, \"Parse\"),\n\t\t)\n\t\treturn nil\n\t}\n\n\treturn gid\n}", "func NewID(zone, node int) ID {\n\tif zone < 0 {\n\t\tzone = -zone\n\t}\n\tif node < 0 {\n\t\tnode = -node\n\t}\n\t// return ID(fmt.Sprintf(\"%d.%d\", zone, node))\n\treturn ID(strconv.Itoa(zone) + \".\" + strconv.Itoa(node))\n}", "func NewObjectId() ObjectId {\n\treturn newObjectId(time.Seconds(), nextOidCounter())\n}", "func newID() int64 {\n\treturn time.Now().UnixNano()\n}", "func NewId(id string) mgobson.ObjectId { return mgobson.ObjectIdHex(id) }", "func GetNewID() ID {\n\treturn ID(uuid.New().String())\n}", "func NewID(v string) ID {\n\treturn ID{v, true}\n}", "func GetNewObjectId () string {\n\treturn bson.NewObjectId().String()\n}", "func NewID() string {\n\tif i, err := uuid.NewV4(); err == nil {\n\t\treturn i.String()\n\t}\n\treturn \"\"\n}", "func NewID() string {\n\tid, err := uuid.NewUUID()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error while getting id: %v\\n\", err)\n\t}\n\treturn fmt.Sprintf(\"id-%s\", id.String())\n}", "func NewID(service Service, modelIndex string, uuid string) ID {\n\treturn &id{service, modelIndex, uuid}\n}", "func (f *testIDService) New() (string, error) {\n\treturn \"new-ID\", nil\n}", "func NewIdentifier() string {\n\tif !seededrng {\n\t\trand.Seed(time.Now().Unix())\n\t\tseededrng = true\n\t}\n\tr := make([]byte, 9) // 9 bytes * (4/3 encoding) = 12 characters\n\trand.Read(r)\n\ts := base64.URLEncoding.EncodeToString(r)\n\treturn s\n}", "func NewRequestID() (string, error) {\n\treturn strings.Replace(util.UniqueID(), \"-\", \"\", -1), nil\n}", "func NewRequestID() (string, error) {\n\treturn strings.Replace(util.UniqueID(), \"-\", \"\", -1), nil\n}", "func (ids *IDServiceImpl) NewUUID(clientID string) string {\n\tresult := atomic.AddInt64(&lastID, 1)\n\treturn fmt.Sprintf(\"%v:%v\", clientID, result)\n}", "func (g *generator) NewId() int {\n\tg.mutex.Lock()\n\tdefer g.mutex.Unlock()\n\tvar id = 0\n\tvar now = time.Now().UnixNano()\n\tid |= int(now) & zeroLowShort\n\tid |= int(g.uniqueKey) << 8\n\tid |= int(g.seqNum)\n\tg.seqNum += 1\n\treturn id\n}", "func NewID(length int) string {\n\tb := make([]byte, length*6/8)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn base64.RawURLEncoding.EncodeToString(b)\n}", "func NewResourceId(in *wyc.Resource) string {\n\treturn wyc.NewId(\"resource\", divisor, in.Parent, divisor, strings.ToLower(in.Name), divisor, strings.ToLower(in.ResourceType))\n}", "func NewId() string {\n\treturn uuid.NewV4().String()\n}", "func New(cacheNodeidentityInfo bool) (nodeidentity.Identifier, error) {\n\tclient, err := newClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &nodeIdentifier{\n\t\tvmssGetter: client,\n\t\tcache: expirationcache.NewTTLStore(stringKeyFunc, cacheTTL),\n\t\tcacheEnabled: cacheNodeidentityInfo,\n\t}, nil\n}", "func newid() string {\n\treturn make_key(6)\n}", "func newID() string {\n\tvar b [8]byte\n\t_, err := rand.Read(b[:])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn fmt.Sprintf(\"%x\", b[:])\n}", "func NewObjectId() string {\n\tvar b [12]byte\n\t// Timestamp, 4 bytes, big endian\n\tbinary.BigEndian.PutUint32(b[:], uint32(time.Now().Unix()))\n\t// Machine, first 3 bytes of md5(hostname)\n\tb[4] = machineId[0]\n\tb[5] = machineId[1]\n\tb[6] = machineId[2]\n\t// Pid, 2 bytes, specs don't specify endianness, but we use big endian.\n\tb[7] = byte(processId >> 8)\n\tb[8] = byte(processId)\n\t// Increment, 3 bytes, big endian\n\ti := atomic.AddUint32(&objectIdCounter, 1)\n\tb[9] = byte(i >> 16)\n\tb[10] = byte(i >> 8)\n\tb[11] = byte(i)\n\treturn hex.EncodeToString(b[:])\n}", "func NewID() string {\n\tvar p [randomIDEntropyBytes]byte\n\n\tif _, err := io.ReadFull(idReader, p[:]); err != nil {\n\t\tpanic(fmt.Errorf(\"failed to read random bytes: %v\", err))\n\t}\n\n\tvar nn big.Int\n\tnn.SetBytes(p[:])\n\treturn fmt.Sprintf(\"%0[1]*s\", maxRandomIDLength, nn.Text(randomIDBase))\n}", "func NewId(jobType, jobName, jobId string) Id {\n\treturn Id{\n\t\tType: jobType,\n\t\tName: jobName,\n\t\tId: jobId,\n\t}\n}", "func NewReqID() int {\n\treturn rand.Intn(1000-1) + 1\n}", "func NewID() string {\n\tu2 := uuid.NewV4()\n\treturn u2.String()\n}", "func NewNumberID(v int64) ID { return ID{number: v} }", "func New(trustDomain string, segments ...string) (ID, error) {\n\ttd, err := TrustDomainFromString(trustDomain)\n\tif err != nil {\n\t\treturn ID{}, err\n\t}\n\n\treturn ID{\n\t\ttd: td,\n\t\tpath: normalizePath(path.Join(segments...)),\n\t}, nil\n}", "func CreateResourceID(bucket, expectedBucketOwner string) string {\n\tif expectedBucketOwner == \"\" {\n\t\treturn bucket\n\t}\n\n\tparts := []string{bucket, expectedBucketOwner}\n\tid := strings.Join(parts, resourceIDSeparator)\n\n\treturn id\n}", "func NewId() string {\n\t// generate 128 random bits (6 more than standard UUID)\n\tbytes := make([]byte, 16)\n\t_, err := rand.Read(bytes)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// convert them to base 32 encoding\n\ts := base32.StdEncoding.EncodeToString(bytes)\n\treturn strings.ToLower(strings.TrimRight(s, \"=\"))\n}", "func NewId() string {\n\tid := uuid.New()\n\tbytes, err := id.MarshalBinary()\n\tif err != nil {\n\t\tpanic(\"UUID encoding error.\")\n\t}\n\n\treturn strings.TrimRight(base64.URLEncoding.EncodeToString(bytes), \"=\")\n}", "func NewID() (string, error) {\n\tid, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn id.String(), nil\n}", "func NewID() string {\n\tid := ulid.MustNew(ulid.Now(), entropy)\n\treturn id.String()\n}", "func NewID() ID {\n\treturn ID(atomic.AddUint64(&next, 1))\n}", "func newTransactionID() configapi.TransactionID {\n\tnewUUID := configapi.NewUUID()\n\treturn configapi.TransactionID(newUUID.String())\n}", "func NewEventID() int64 {\n\treturn TimestampNow()\n}", "func newIdentifier(req messages.Alias, c *models.Customer) (m *models.Identifier, err error) {\n\tm = models.NewIdentifier(c)\n\tm.AliasName = req.AliasName\n\tm.IP, err = newIp(req.Ip)\n\tif err != nil {\n\t\treturn\n\t}\n\tm.Prefix, err = newPrefix(req.Prefix)\n\tif err != nil {\n\t\treturn\n\t}\n\tm.PortRange, err = newPortRange(req.PortRange)\n\tif err != nil {\n\t\treturn\n\t}\n\tm.TrafficProtocol.AddList(req.TrafficProtocol)\n\tm.FQDN.AddList(req.FQDN)\n\tm.URI.AddList(req.URI)\n\n\treturn\n}", "func newULID() ulid.ULID {\n\tt := time.Now()\n\tentropy := rand.New(rand.NewSource(t.UnixNano()))\n\treturn ulid.MustNew(ulid.Timestamp(t), entropy)\n}", "func NewRequestID() string {\n\treturn xid.New().String()\n}", "func NewRunID(engine *string) (string, error) {\n\ts, err := newUUIDv4()\n\treturn fmt.Sprintf(\"%s-%s\", *engine, s[4:]), err\n}", "func (s *session) newID() (interface{}, error) {\n\tvar b [32]byte\n\t_, err := rand.Read(b[:])\n\treturn hex.EncodeToString(b[:]), err\n}", "func New() ID {\n\tvar id ID\n\t// Timestamp, 4 bytes, big endian\n\tbinary.BigEndian.PutUint32(id[:], uint32(time.Now().Unix()))\n\t// Machine, first 3 bytes of md5(hostname)\n\tid[4] = machineID[0]\n\tid[5] = machineID[1]\n\tid[6] = machineID[2]\n\t// Pid, 2 bytes, specs don't specify endianness, but we use big endian.\n\tpid := os.Getpid()\n\tid[7] = byte(pid >> 8)\n\tid[8] = byte(pid)\n\t// Increment, 3 bytes, big endian\n\ti := atomic.AddUint32(&objectIDCounter, 1)\n\tid[9] = byte(i >> 16)\n\tid[10] = byte(i >> 8)\n\tid[11] = byte(i)\n\treturn id\n}", "func newJobID(tm Time) (Job, error) {\n\tk, err := ksuid.NewRandomWithTime(tm)\n\tif err != nil {\n\t\treturn Job{}, err\n\t}\n\treturn Job(k), nil\n}", "func NewLID() LID {\n\treturn LID(atomic.AddUint32(&Next, 1))\n}", "func NewID(body []byte) ID {\n\treturn ID(xxhash.Sum64(body))\n}", "func NewID(infix Infix) ID {\n\treturn ID(idgen.Generate(uint16(infix)).String())\n}", "func NewUniqueID(pooledID int64, partition int32, segmentedID int32) (UniqueID, error) {\n\tif pooledID > MaxPooledID || partition > PartitionKeyMask || segmentedID > SegmentedIDMask {\n\t\treturn UniqueID{0}, ErrOutOfRange\n\t}\n\n\treturn UniqueID{(pooledID << PooledIDBitWidth) | int64((partition<<SegmentedIDBitWidth)|segmentedID)}, nil\n}", "func (s *Set) NewID() int64 {\n\tfor id := range s.free {\n\t\treturn id\n\t}\n\tif s.maxID != math.MaxInt64 {\n\t\treturn s.maxID + 1\n\t}\n\tfor id := int64(0); id <= s.maxID; id++ {\n\t\tif !s.used.Has(id) {\n\t\t\treturn id\n\t\t}\n\t}\n\tpanic(\"unreachable\")\n}", "func NewIdentifier(login string, password string) *Identifier {\n\treturn &Identifier{\n\t\tlogin: login,\n\t\tpassword: password,\n\t\tauthEndpoint: authEndpoint,\n\t\tHTTPClient: &http.Client{Timeout: 10 * time.Second},\n\t}\n}", "func newClientID() string {\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\tip, err := getIP()\n\t\tif err != nil {\n\t\t\tbuffer := make([]byte, 8)\n\t\t\t_, _ = rand.Read(buffer)\n\t\t\thostname = fmt.Sprintf(\"%X\", buffer)\n\n\t\t} else {\n\t\t\thostname = ip.String()\n\t\t}\n\t}\n\ttimestamp := time.Now().UTC().Format(time.RFC3339)\n\t// sarama validation regexp for the client ID doesn't allow ':' characters\n\ttimestamp = strings.Replace(timestamp, \":\", \".\", -1)\n\treturn fmt.Sprintf(\"pixy_%s_%s_%d\", hostname, timestamp, os.Getpid())\n}", "func New() ID {\n\treturn dgen.New()\n}", "func NewRPort() int {\n\tmu.Lock()\n\tlog.Debug(pathLOG + \"[newRPort] Getting new PORT ...\")\n\trport = rport + 1\n\tb := rport\n\tlog.Debug(pathLOG + \"[newRPort] New PORT = \" + strconv.Itoa(b))\n\tmu.Unlock()\n\treturn b\n}", "func NewRoomId() int64 {\n\tlock.Lock()\n\tseq := roomSeq & 0x00000fff\n\troomSeq = seq + 1\n\tlock.Unlock()\n\n\tt := time.Now().Unix()\n\tt = (t & 0x0000000001ffffffffff) << 22\n\n\treturn (t | seq | machineID)\n}", "func NewRoutingID(val string) RoutingIDField {\n\treturn RoutingIDField{quickfix.FIXString(val)}\n}", "func NewUID() string {\n\tt := strconv.FormatInt(time.Now().Unix(), 10)\n\tc := strconv.FormatInt(counter, 10)\n\tcounter++\n\treturn t + \"-\" + c\n}", "func (this *IdBuilder) NewId() (rv string) {\n\tarr := [24]byte{}\n\ts := arr[:]\n\n\t//\n\t// base32 encode all 64 bits of counter\n\t// - encode 5 bits at a time allows us to use base62 routine to get base32\n\t// - we stop at 10 because that's where date/time begins\n\t//\n\tu := atomic.AddUint64(&this.counter, 1)\n\tvar shift uint = 0\n\tfor i := len(arr) - 1; i > 10; i-- {\n\t\tb := byte(u >> shift)\n\t\tshift += 5\n\t\ts[i] = base62(b & 0x1f)\n\t}\n\n\t//\n\t// encode YMMDDHHMMSS\n\t//\n\t// we need the year as these can get databased\n\t//\n\t// we want the MMDDHHMMSS to be easily human readable\n\t//\n\tnow := time.Now().UTC()\n\tyear, month, day := now.Date()\n\thour, minute, second := now.Clock()\n\ts[0] = base62(byte(year - 2016))\n\ts[1], s[2] = base10(byte(month))\n\ts[3], s[4] = base10(byte(day))\n\ts[5], s[6] = base10(byte(hour))\n\ts[7], s[8] = base10(byte(minute))\n\ts[9], s[10] = base10(byte(second))\n\n\treturn string(s)\n}", "func NewNodeID() string {\n\tvar p [randomNodeIDEntropyBytes]byte\n\n\tif _, err := io.ReadFull(idReader, p[:]); err != nil {\n\t\tpanic(fmt.Errorf(\"failed to read random bytes: %v\", err))\n\t}\n\n\trandomInt := binary.LittleEndian.Uint64(p[:])\n\treturn FormatNodeID(randomInt)\n}", "func NewRequestID() string {\n\tbytes := make([]byte, 8)\n\t_, _ = rand.Read(bytes) // In case of failure, do not fail request, just use default bytes (zero)\n\treturn hex.EncodeToString(bytes)\n}", "func NewID() (ID, error) {\n\tid, err := uuid.NewV4()\n\treturn ID{id}, err\n}", "func (tp *ThreadPool) NewThreadID() uint64 {\n\n\ttp.workerIDLock.Lock()\n\n\tres := tp.workerIDCount\n\ttp.workerIDCount++\n\n\ttp.workerIDLock.Unlock()\n\n\treturn res\n}", "func New() GID {\n\tvar id [12]byte\n\n\t// Timestamp, 4 bytes, big endian\n\tbinary.BigEndian.PutUint32(id[:], uint32(time.Now().Unix()))\n\n\t// Machine, first 3 bytes of md5(hostname)\n\tid[4] = macID[0]\n\tid[5] = macID[1]\n\tid[6] = macID[2]\n\n\t// Pid, 2 bytes, specs don't specify endianness, but we use big endian.\n\tpid := os.Getpid()\n\tid[7] = byte(pid >> 8)\n\tid[8] = byte(pid)\n\n\t// Increment, 3 bytes, big endian\n\ti := atomic.AddUint32(&gidCounter, 1)\n\tid[9] = byte(i >> 16)\n\tid[10] = byte(i >> 8)\n\tid[11] = byte(i)\n\n\treturn GID(id[:])\n}", "func newHashID() (*hashids.HashID, error) {\n\t// Defaults\n\tsalt := \"Best salt\"\n\tminLength := 8\n\n\t// Initiliazing HashID\n\thd := hashids.NewData()\n\thd.Salt = salt\n\thd.MinLength = minLength\n\th, err := hashids.NewWithData(hd)\n\treturn h, err\n}", "func (s *Server) NewUUID(c context.Context, r *idserv.IdRequest) (*idserv.IdReply, error) {\n\tservice := core.IDServiceImpl{}\n\treturn &idserv.IdReply{Uuid: service.NewUUID(r.GetClientId())}, nil\n}", "func GetNewId() string {\n\treturn srand(5)\n}", "func New(namespace, collection string) (SemanticID, error) {\n\treturn newWithParams(namespace, collection, DefaultIDProvider)\n}", "func LangIdNew(filename string) *LangId {\n\tlId := new(LangId)\n\tlId.filename = filename\n\tlId.varNames = varNamesList\n\treturn lId\n}", "func NewPid(pid int) (Capabilities, error) {\n\treturn newPid(pid)\n}", "func newLeaderID() *cobra.Command {\n\tvar cluster []string\n\tvar timeout time.Duration\n\n\tcmd := &cobra.Command{\n\t\tUse: \"leader\",\n\t\tShort: \"print the id of the current leader node.\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\t\t\tdefer cancel()\n\t\t\tid, err := LeaderID(ctx, &globalKeys, cluster)\n\t\t\tfmt.Println(id)\n\t\t\treturn err\n\t\t},\n\t}\n\tflags := cmd.Flags()\n\tflags.DurationVarP(&timeout, \"timeout\", \"t\", time.Second*60, \"time to wait for connection to complete\")\n\tflags.StringSliceVarP(&cluster, \"cluster\", \"c\", clusterList(), \"addresses of existing cluster nodes\")\n\n\treturn cmd\n}", "func NewID(b []byte) (*SHA1, error) {\n\tif len(b) != 20 {\n\t\treturn nil, errors.New(\"length must be 20\")\n\t}\n\treturn MustID(b), nil\n}", "func newUserID(vres *hyuserviews.UserView) *User {\n\tres := &User{\n\t\tUserID: vres.UserID,\n\t}\n\treturn res\n}", "func NewStringID(v string) ID { return ID{name: v} }", "func NewResource() Resource {\n\tid, _ := NewID()\n\treturn Resource{ID: id}\n}", "func (o *Order) GetNewID() int {\n\ttotalOrders++\n\to.ID = totalOrders\n\treturn o.ID\n}", "func New() *Tkeyid {\n\treturn &Tkeyid{keytoid: make(map[string]uint), idtokey: make(map[uint]string)}\n}", "func createMyId(localip string) id {\n\tcurTime := time.Now().String()\n\treturn id{localip, curTime}\n}", "func NewID() ID {\n\treturn uuid.New()\n}", "func NewID() ID {\n\treturn ID(ulid.MustNew(ulid.Timestamp(time.Now()), rand.Reader))\n}", "func (gen *defaultIDGenerator) NewTraceID() core.TraceID {\n\tgen.Lock()\n\tdefer gen.Unlock()\n\ttid := core.TraceID{}\n\tgen.randSource.Read(tid[:])\n\treturn tid\n}", "func New() (uuid.UUID, error) {\n\tid, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn uuid.Nil, err\n\t}\n\treturn id, nil\n}", "func newUID() ([]byte, error) {\n\t// uuid := make([]byte, 16)\n\t// n, err := io.ReadFull(rand.Reader, uuid)\n\t// if n != len(uuid) || err != nil {\n\t// \treturn nil, err\n\t// }\n\t// // variant bits; see section 4.1.1\n\t// uuid[8] = uuid[8]&^0xc0 | 0x80\n\t// // version 4 (pseudo-random); see section 4.1.3\n\t// uuid[6] = uuid[6]&^0xf0 | 0x40\n\t// return []byte(fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:])), nil\n\treturn []byte(uniuri.New()), nil\n}", "func (h *CustomerHandler) RIDToID(rid string, pathParams map[string]string) string {\n\treturn pathParams[\"id\"]\n}", "func (g Generator) NewVisitID() uint64 {\n\treturn rand.Uint64()\n}", "func newSubId() uint64 {\n\tz := atomic.AddUint64(&lastSubId, uint64(1))\n\t// FIXME: And when we hit max? Rollover?\n\tif z == math.MaxUint64 {\n\t\tatomic.StoreUint64(&lastSubId, uint64(0))\n\t}\n\treturn z\n}", "func NewId(value string) Id {\n\tid := Id{\n\t\tValue: value,\n\t}\n\n\treturn id\n}", "func New() ULID {\n\treturn Must(NewRandom())\n}", "func (correlation) New() string {\n\treturn utils.NewUUID()\n}", "func New() string {\n\treturn uuid.NewV4().String()\n}", "func NewAllocID(val string) AllocIDField {\n\treturn AllocIDField{quickfix.FIXString(val)}\n}", "func (s Keygen) RID() []byte {\n\treturn make([]byte, params.SecBytes)\n}", "func newDocWithId(c *gin.Context) {\n\tkey := c.Params.ByName(\"id\")\n\tres := saveDocument(key, c)\n\tif res.Ok == false {\n\t\tlog.Printf(\"Error saving document: %s\", res.Error)\n\t\tc.JSON(statusErr, res)\n\t} else {\n\t\tc.JSON(statusOk, res)\n\t}\n}" ]
[ "0.6503277", "0.6493216", "0.63052696", "0.6271093", "0.62527996", "0.62355113", "0.61633074", "0.6148319", "0.61066115", "0.6049247", "0.6021035", "0.602054", "0.60179543", "0.59745395", "0.59593815", "0.59555197", "0.5902665", "0.5893014", "0.58699316", "0.5830927", "0.5805606", "0.57741505", "0.57741505", "0.576835", "0.5755604", "0.5753915", "0.57420826", "0.5732603", "0.5680542", "0.56796986", "0.5667248", "0.5652551", "0.5646556", "0.5644142", "0.5632166", "0.56254894", "0.5617021", "0.56071377", "0.55931485", "0.55567884", "0.552841", "0.5527103", "0.5525794", "0.55242527", "0.55138004", "0.5507267", "0.54655623", "0.5464068", "0.54561687", "0.5451577", "0.5445943", "0.5444787", "0.543549", "0.5433554", "0.54019725", "0.5395159", "0.5391992", "0.5377545", "0.5350506", "0.5338222", "0.533389", "0.53315115", "0.5328582", "0.5322931", "0.53203297", "0.5299024", "0.5292921", "0.52756333", "0.5271625", "0.5260355", "0.5258441", "0.52380484", "0.5233014", "0.52239317", "0.521881", "0.520728", "0.52038336", "0.5201463", "0.51908773", "0.51894397", "0.5166982", "0.5156404", "0.51553524", "0.5152275", "0.515133", "0.5150217", "0.51439184", "0.5141674", "0.51360625", "0.51292676", "0.5128272", "0.51219267", "0.5117397", "0.5115886", "0.5104016", "0.50832385", "0.5071024", "0.5058115", "0.5050705", "0.504787" ]
0.74852544
0
NewRIDWithResource returns the RID of an object.
func NewRIDWithResource(object Class) *RID { rid := &RID{} var gdRID C.godot_rid C.godot_rid_new_with_resource(&gdRID, unsafe.Pointer(object.getOwner())) rid.rid = &gdRID return rid }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewRID() *RID {\n\trid := &RID{}\n\tvar gdRID C.godot_rid\n\tC.godot_rid_new(&gdRID)\n\trid.rid = &gdRID\n\n\treturn rid\n}", "func NewResourceId(in *wyc.Resource) string {\n\treturn wyc.NewId(\"resource\", divisor, in.Parent, divisor, strings.ToLower(in.Name), divisor, strings.ToLower(in.ResourceType))\n}", "func NewObjectID() ObjectID{\n\tres:=(ObjectID{0,nil})\n\tres.IDArray=make(map[string]interface{},constants.MAXOBJECTS)\n\treturn res\n}", "func NewResource() Resource {\n\tid, _ := NewID()\n\treturn Resource{ID: id}\n}", "func NewObjectID(id string) GrapheneObject {\n\tgid := new(ObjectID)\n\tif err := gid.Parse(id); err != nil {\n\t\tlogging.Errorf(\n\t\t\t\"ObjectID parser error %v\",\n\t\t\terrors.Annotate(err, \"Parse\"),\n\t\t)\n\t\treturn nil\n\t}\n\n\treturn gid\n}", "func CreateResourceID(bucket, expectedBucketOwner string) string {\n\tif expectedBucketOwner == \"\" {\n\t\treturn bucket\n\t}\n\n\tparts := []string{bucket, expectedBucketOwner}\n\tid := strings.Join(parts, resourceIDSeparator)\n\n\treturn id\n}", "func newResource(r interface{}) corev2.Resource {\n\treturn reflect.New(reflect.ValueOf(r).Elem().Type()).Interface().(corev2.Resource)\n}", "func GetResourceID(obj ARMMetaObject) (string, bool) {\n\tresult, ok := obj.GetAnnotations()[ResourceIDAnnotation]\n\treturn result, ok\n}", "func NewResourceKey(o metav1.Object, t metav1.Type) ResourceKey {\n\treturn ResourceKey(fmt.Sprintf(\"%s/%s=%s,Kind=%s\", o.GetNamespace(), o.GetName(), t.GetAPIVersion(), t.GetKind()))\n}", "func NewObjectId() ObjectId {\n\treturn newObjectId(time.Seconds(), nextOidCounter())\n}", "func (n *Namespace) GetResourceID() int64 {\n\treturn n.Metadata.ID\n}", "func (j JID) WithResource(resourcepart string) (JID, error) {\n\tvar err error\n\tnew := j.Bare()\n\tdata := make([]byte, len(new.data), len(new.data)+len(resourcepart))\n\tcopy(data, new.data)\n\tif resourcepart != \"\" {\n\t\tif !utf8.ValidString(resourcepart) {\n\t\t\treturn JID{}, errInvalidUTF8\n\t\t}\n\t\tdata, err = precis.OpaqueString.Append(data, []byte(resourcepart))\n\t\tif err != nil {\n\t\t\treturn JID{}, err\n\t\t}\n\t\tnew.data = data\n\t}\n\treturn new, resourceChecks(data[j.locallen+j.domainlen:])\n}", "func (app *App) NewObjectWithId(resourceName string, objectId string) *Object {\n\treturn &Object{\n\t\tapp: app,\n\t\tResourceName: resourceName,\n\t\tObjectId: objectId,\n\t\tdata: make(map[string]interface{}),\n\t\tchangedData: make(map[string]interface{}),\n\t\tbaseURL: fmt.Sprintf(\"%s/resources/%s\", app.baseURL, resourceName),\n\t}\n}", "func (s *DatabaseServerV3) GetResourceID() int64 {\n\treturn s.Metadata.ID\n}", "func (r ManagedResource) id() ReferenceID { return r.ID }", "func (r *ReconcileApplicationMonitoring) createResource(cr *applicationmonitoringv1alpha1.ApplicationMonitoring, resourceName string) (runtime.Object, error) {\n\ttemplateHelper := newTemplateHelper(cr, r.extraParams)\n\tresourceHelper := newResourceHelper(cr, templateHelper)\n\tresource, err := resourceHelper.createResource(resourceName)\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"createResource failed\")\n\t}\n\n\t// Set the CR as the owner of this resource so that when\n\t// the CR is deleted this resource also gets removed\n\terr = controllerutil.SetControllerReference(cr, resource.(metav1.Object), r.scheme)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error setting controller reference\")\n\t}\n\n\terr = r.client.Create(context.TODO(), resource)\n\tif err != nil {\n\t\tif !kerrors.IsAlreadyExists(err) {\n\t\t\treturn nil, errors.Wrap(err, \"error creating resource\")\n\t\t}\n\t}\n\n\treturn resource, nil\n}", "func (s Keygen) RID() []byte {\n\treturn make([]byte, params.SecBytes)\n}", "func (o DatasourcePtrOutput) ResourceID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Datasource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ResourceID\n\t}).(pulumi.StringPtrOutput)\n}", "func (o DatasourceSetPtrOutput) ResourceID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatasourceSet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ResourceID\n\t}).(pulumi.StringPtrOutput)\n}", "func (s *AppServerV3) GetResourceID() int64 {\n\treturn s.Metadata.ID\n}", "func ResourceId(w http.ResponseWriter, params martini.Params, m martini.Context) {\n\tid, err := strconv.ParseInt(params[\"id\"], 10, 64)\n\n\tif err != nil || id < 1 {\n\t\thttp.Error(w, \"Unprocessable Entity\", 422)\n\t}\n\n\tm.Map(IdParameter{Id: id})\n}", "func (o DatasourceSetResponsePtrOutput) ResourceID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatasourceSetResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ResourceID\n\t}).(pulumi.StringPtrOutput)\n}", "func (p *ProvisionTokenV2) GetResourceID() int64 {\n\treturn p.Metadata.ID\n}", "func (crd *CRDHandlers) ResourceUID(ctx *processors.ProcessorContext, resource interface{}) types.UID {\n\treturn resource.(*v1.CustomResourceDefinition).UID\n}", "func (o *GetSsoParams) SetResourceID(resourceID string) {\n\to.ResourceID = resourceID\n}", "func (d *IPFSStore) GenerateResourceId() (ResourceId, error) {\n objdata := make([]byte, 256)\n rand.Read(objdata)\n\n //FIXME: This could probably be done better somewhere else ...\n s, e := d.client.ObjectPutData(objdata)\n if e != nil { return ResourceId(\"\"), e }\n\n return ResourceId(d.TypeId() + \":\" + s.Hash), nil\n}", "func (track *baseTrack) RID() string {\n\treturn \"\"\n}", "func GetNewObjectId () string {\n\treturn bson.NewObjectId().String()\n}", "func newIdentifier(req messages.Alias, c *models.Customer) (m *models.Identifier, err error) {\n\tm = models.NewIdentifier(c)\n\tm.AliasName = req.AliasName\n\tm.IP, err = newIp(req.Ip)\n\tif err != nil {\n\t\treturn\n\t}\n\tm.Prefix, err = newPrefix(req.Prefix)\n\tif err != nil {\n\t\treturn\n\t}\n\tm.PortRange, err = newPortRange(req.PortRange)\n\tif err != nil {\n\t\treturn\n\t}\n\tm.TrafficProtocol.AddList(req.TrafficProtocol)\n\tm.FQDN.AddList(req.FQDN)\n\tm.URI.AddList(req.URI)\n\n\treturn\n}", "func NewObjectId() string {\n\tvar b [12]byte\n\t// Timestamp, 4 bytes, big endian\n\tbinary.BigEndian.PutUint32(b[:], uint32(time.Now().Unix()))\n\t// Machine, first 3 bytes of md5(hostname)\n\tb[4] = machineId[0]\n\tb[5] = machineId[1]\n\tb[6] = machineId[2]\n\t// Pid, 2 bytes, specs don't specify endianness, but we use big endian.\n\tb[7] = byte(processId >> 8)\n\tb[8] = byte(processId)\n\t// Increment, 3 bytes, big endian\n\ti := atomic.AddUint32(&objectIdCounter, 1)\n\tb[9] = byte(i >> 16)\n\tb[10] = byte(i >> 8)\n\tb[11] = byte(i)\n\treturn hex.EncodeToString(b[:])\n}", "func (o DatasourceResponsePtrOutput) ResourceID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatasourceResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ResourceID\n\t}).(pulumi.StringPtrOutput)\n}", "func (o DatasourceOutput) ResourceID() pulumi.StringOutput {\n\treturn o.ApplyT(func(v Datasource) string { return v.ResourceID }).(pulumi.StringOutput)\n}", "func NewResource(typ, name, group, version, kind string, namespaced bool, opts ...Option) (*Resource, error) {\n\tropts := Options{}\n\tfor _, apply := range opts {\n\t\tapply(&ropts)\n\t}\n\n\tuid := ropts.UID\n\tif uid == nil {\n\t\tuid = memuid.New()\n\t}\n\n\ta := ropts.Attrs\n\tif a == nil {\n\t\ta = memattrs.New()\n\t}\n\n\tdotid := ropts.DOTID\n\tif dotid == \"\" {\n\t\tdotid = strings.Join([]string{\n\t\t\tgroup,\n\t\t\tversion,\n\t\t\tkind}, \"/\")\n\t}\n\n\treturn &Resource{\n\t\tuid: uid,\n\t\ttyp: typ,\n\t\tname: name,\n\t\tgroup: group,\n\t\tversion: version,\n\t\tkind: kind,\n\t\tnamespaced: namespaced,\n\t\tdotid: dotid,\n\t\tattrs: a,\n\t}, nil\n}", "func (c *CreateRedfishResource) AggregateID() eh.UUID { return c.ID }", "func NewResource(parent *xreflect.Types) *Resource {\n\treturn &Resource{_types: xreflect.NewTypes(xreflect.WithRegistry(parent))}\n}", "func (h *ResourceHeader) GetResourceID() int64 {\n\treturn h.Metadata.ID\n}", "func (h Handlers[R, T]) CreateResource(r *http.Request) (corev3.Resource, error) {\n\tvar payload R\n\tif err := json.NewDecoder(r.Body).Decode(&payload); err != nil {\n\t\treturn nil, actions.NewError(actions.InvalidArgument, err)\n\t}\n\n\tmeta := payload.GetMetadata()\n\tif meta == nil {\n\t\treturn nil, actions.NewError(actions.InvalidArgument, errors.New(\"nil metadata\"))\n\t}\n\tif err := checkMeta(*meta, mux.Vars(r), \"id\"); err != nil {\n\t\treturn nil, actions.NewError(actions.InvalidArgument, err)\n\t}\n\n\tif claims := jwt.GetClaimsFromContext(r.Context()); claims != nil {\n\t\tmeta.CreatedBy = claims.StandardClaims.Subject\n\t}\n\n\tgstore := storev2.Of[R](h.Store)\n\n\tif err := gstore.CreateIfNotExists(r.Context(), payload); err != nil {\n\t\tswitch err := err.(type) {\n\t\tcase *store.ErrAlreadyExists:\n\t\t\treturn nil, actions.NewErrorf(actions.AlreadyExistsErr)\n\t\tcase *store.ErrNotValid:\n\t\t\treturn nil, actions.NewError(actions.InvalidArgument, err)\n\t\tdefault:\n\t\t\treturn nil, actions.NewError(actions.InternalErr, err)\n\t\t}\n\t}\n\n\treturn nil, nil\n}", "func (m Message) RID() metainfo.Hash {\n\treturn m.R.ID\n}", "func NewResultIdentifier(o ObjectIdent) ResultIdentifier {\n\treturn ResultIdentifier{\n\t\tName: types.TypeString(o.Type(), nil),\n\t\tPos: o.FileSet.Position(findDef(o.Type())),\n\t}\n}", "func (o *UpdateGroupAttributesParams) SetResourceID(resourceID string) {\n\to.ResourceID = resourceID\n}", "func New(cacheNodeidentityInfo bool) (nodeidentity.Identifier, error) {\n\tclient, err := newClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &nodeIdentifier{\n\t\tvmssGetter: client,\n\t\tcache: expirationcache.NewTTLStore(stringKeyFunc, cacheTTL),\n\t\tcacheEnabled: cacheNodeidentityInfo,\n\t}, nil\n}", "func (n *Namespace) SetResourceID(id int64) {\n\tn.Metadata.ID = id\n}", "func (i *Invoice) New() Resource {\n\tvar obj = &Invoice{}\n\treturn obj\n}", "func (o DatasourceSetOutput) ResourceID() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DatasourceSet) string { return v.ResourceID }).(pulumi.StringOutput)\n}", "func (o DatasourceSetResponseOutput) ResourceID() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DatasourceSetResponse) string { return v.ResourceID }).(pulumi.StringOutput)\n}", "func NewId(id string) mgobson.ObjectId { return mgobson.ObjectIdHex(id) }", "func NewID() string {\n\treturn replacer.Replace(NewV4().String())\n}", "func NewBridgeResource(b bridges.BridgeType) *BridgeResource {\n\treturn &BridgeResource{\n\t\t// Uses the name as the id...Should change this to the id\n\t\tJAID: NewJAID(b.Name.String()),\n\t\tName: b.Name.String(),\n\t\tURL: b.URL.String(),\n\t\tConfirmations: b.Confirmations,\n\t\tOutgoingToken: b.OutgoingToken,\n\t\tMinimumContractPayment: b.MinimumContractPayment,\n\t\tCreatedAt: b.CreatedAt,\n\t}\n}", "func NewIdentifier(login string, password string) *Identifier {\n\treturn &Identifier{\n\t\tlogin: login,\n\t\tpassword: password,\n\t\tauthEndpoint: authEndpoint,\n\t\tHTTPClient: &http.Client{Timeout: 10 * time.Second},\n\t}\n}", "func (c *client) createResource(obj interface{}, namespace string, resource schema.GroupVersionResource) error {\n\tresultMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Failed to translate %s to Unstructed (for create operation), with error: %v\", resource.Resource, err)\n\t\tlog.Printf(\"[Error] %s\", msg)\n\t\treturn fmt.Errorf(msg)\n\t}\n\tinput := unstructured.Unstructured{}\n\tinput.SetUnstructuredContent(resultMap)\n\tresp, err := c.dynamicClient.Resource(resource).Namespace(namespace).Create(context.Background(), &input, meta_v1.CreateOptions{})\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Failed to create %s, with error: %v\", resource.Resource, err)\n\t\tlog.Printf(\"[Error] %s\", msg)\n\t\treturn fmt.Errorf(msg)\n\t}\n\tunstructured := resp.UnstructuredContent()\n\treturn runtime.DefaultUnstructuredConverter.FromUnstructured(unstructured, obj)\n}", "func (r Resource) ID() string {\n\treturn r.id\n}", "func NewIdentifier() string {\n\tif !seededrng {\n\t\trand.Seed(time.Now().Unix())\n\t\tseededrng = true\n\t}\n\tr := make([]byte, 9) // 9 bytes * (4/3 encoding) = 12 characters\n\trand.Read(r)\n\ts := base64.URLEncoding.EncodeToString(r)\n\treturn s\n}", "func NewResource(resourceType string) *Resource {\n\treturn &Resource{\n\t\t// Mux is a goji.SubMux, inherits context from parent Mux\n\t\tMux: goji.SubMux(),\n\t\t// Type of the resource, makes no assumptions about plurality\n\t\tType: resourceType,\n\t\tRelationships: map[string]Relationship{},\n\t\t// A list of registered routes, useful for debugging\n\t\tRoutes: []string{},\n\t}\n}", "func (b *Bolt) NewID() (sid string, err error) {\n\terr = b.client.Update(func(tx *bolt.Tx) error {\n\t\tbkt := tx.Bucket([]byte(b.bucket))\n\t\tid, err := bkt.NextSequence()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsid = strconv.FormatUint(id, 10)\n\t\treturn nil\n\t})\n\treturn\n}", "func newResource(tm unversioned.TypeMetadata) (unversioned.Resource, error) {\n\trh, ok := resourceToType[tm]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Unknown resource type (%s) and/or version (%s)\", tm.Kind, tm.APIVersion)\n\t}\n\tlog.Debugf(\"Found resource helper: %s\", rh)\n\n\t// Create new resource and fill in the type metadata.\n\tnew := reflect.New(rh)\n\telem := new.Elem()\n\telem.FieldByName(\"Kind\").SetString(tm.GetTypeMetadata().Kind)\n\telem.FieldByName(\"APIVersion\").SetString(tm.GetTypeMetadata().APIVersion)\n\n\treturn new.Interface().(unversioned.Resource), nil\n}", "func (s *AppServerV3) SetResourceID(id int64) {\n\ts.Metadata.ID = id\n}", "func (p *ProvisionTokenV2) SetResourceID(id int64) {\n\tp.Metadata.ID = id\n}", "func (s *DatabaseServerV3) SetResourceID(id int64) {\n\ts.Metadata.ID = id\n}", "func (h *CustomerHandler) RIDToID(rid string, pathParams map[string]string) string {\n\treturn pathParams[\"id\"]\n}", "func LegacyInstanceObjectID(obj *ResourceInstanceObjectSrc) string {\n\tif obj == nil {\n\t\treturn \"<not created>\"\n\t}\n\n\tif obj.AttrsJSON != nil {\n\t\ttype WithID struct {\n\t\t\tID string `json:\"id\"`\n\t\t}\n\t\tvar withID WithID\n\t\terr := json.Unmarshal(obj.AttrsJSON, &withID)\n\t\tif err == nil {\n\t\t\treturn withID.ID\n\t\t}\n\t} else if obj.AttrsFlat != nil {\n\t\tif flatID, exists := obj.AttrsFlat[\"id\"]; exists {\n\t\t\treturn flatID\n\t\t}\n\t}\n\n\t// For resource types created after we removed id as special there may\n\t// not actually be one at all. This is okay because older tests won't\n\t// encounter this, and new tests shouldn't be using ids.\n\treturn \"<none>\"\n}", "func (o DatasourceResponseOutput) ResourceID() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DatasourceResponse) string { return v.ResourceID }).(pulumi.StringOutput)\n}", "func (o GrafanaAzureMonitorWorkspaceIntegrationOutput) ResourceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GrafanaAzureMonitorWorkspaceIntegration) string { return v.ResourceId }).(pulumi.StringOutput)\n}", "func (o baseObject) ObjectID() int64 {\n\treturn o.ID\n}", "func NewResource(name, rtype, state, owner string, t time.Time) Resource {\n\t// If no state defined, mark as Free\n\tif state == \"\" {\n\t\tstate = Free\n\t}\n\treturn Resource{\n\t\tName: name,\n\t\tType: rtype,\n\t\tState: state,\n\t\tOwner: owner,\n\t\tLastUpdate: t,\n\t}\n}", "func (m *RegeneratingDiscoveryRESTMapper) ResourceFor(input schema.GroupVersionResource) (schema.GroupVersionResource, error) {\n\tm.mu.RLock()\n\tdefer m.mu.RUnlock()\n\n\treturn m.delegate.ResourceFor(input)\n\n}", "func NewID() string {\n\treturn idFunc()\n}", "func NewResource() (Resource, error) {\n\t// Get cluster config\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error getting in cluster config: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup event source client\n\teventSrcClient, err := eventsrcclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building event source client: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup tektoncd client\n\ttektonClient, err := tektoncdclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building tekton clientset: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup k8s client\n\tk8sClient, err := k8sclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building k8s clientset: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\tr := Resource{\n\t\tK8sClient: k8sClient,\n\t\tTektonClient: tektonClient,\n\t\tEventSrcClient: eventSrcClient,\n\t}\n\treturn r, nil\n}", "func GetAndParseResourceID(obj ARMMetaObject) (*arm.ResourceID, error) {\n\tresourceID, hasResourceID := GetResourceID(obj)\n\tif !hasResourceID {\n\t\treturn nil, errors.Errorf(\"cannot find resource id for obj %s/%s\", obj.GetNamespace(), obj.GetName())\n\t}\n\n\treturn arm.ParseResourceID(resourceID)\n}", "func NewResourceNode(networkID string, pubKey crypto.PubKey, ownerAddr sdk.AccAddress,\n\tdescription Description, nodeType string, creationTime time.Time) ResourceNode {\n\treturn ResourceNode{\n\t\tNetworkID: networkID,\n\t\tPubKey: pubKey,\n\t\tSuspend: false,\n\t\tStatus: sdk.Unbonded,\n\t\tTokens: sdk.ZeroInt(),\n\t\tOwnerAddress: ownerAddr,\n\t\tDescription: description,\n\t\tNodeType: nodeType,\n\t\tCreationTime: creationTime,\n\t}\n}", "func (m *WindowsUniversalAppX) SetIdentityResourceIdentifier(value *string)() {\n m.identityResourceIdentifier = value\n}", "func New(name string) *Resource {\n\n\tlastId := (int64)(len(resourceMap))\n\n\treturn &Resource{\n\t\tId: lastId + 1,\n\t\tName: name,\n\t\tStatus: true,\n\t\tCreatedAt: time.Now(),\n\t\tUpdatedAt: time.Now(),\n\t}\n}", "func NewCRUDResource(resourceType string, storage store.CRUD) *Resource {\n\tresource := NewResource(resourceType)\n\tresource.CRUD(storage)\n\treturn resource\n}", "func NewResource(\n\tconf Config, mgr types.Manager, log log.Modular, stats metrics.Type,\n) (Type, error) {\n\tif err := interop.ProbeInput(context.Background(), mgr, conf.Resource); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Resource{\n\t\tmgr: mgr,\n\t\tname: conf.Resource,\n\t\tlog: log,\n\t\tmErrNotFound: stats.GetCounter(\"error_not_found\"),\n\t}, nil\n}", "func NewID(typ string) string {\n\treturn typ + \"_\" + NewBareID(16)\n}", "func NewResource(init ...*Resource) *Resource {\n\tvar o *Resource\n\tif len(init) == 1 {\n\t\to = init[0]\n\t} else {\n\t\to = new(Resource)\n\t}\n\treturn o.Init()\n}", "func NewID() string {\n\treturn ksuid.New().String()\n}", "func newImageResource(name string, width, height int, bitperComponent int, data []byte) *ImageResource {\n\treturn &ImageResource{\n\t\tname: name,\n\t\twidth: width,\n\t\theight: height,\n\t\tcolorSpace: colorSpaceDeviceGray,\n\t\tbitsPerComponent: bitperComponent,\n\t\tdata: data,\n\t}\n}", "func NewRequestID() (string, error) {\n\treturn strings.Replace(util.UniqueID(), \"-\", \"\", -1), nil\n}", "func NewRequestID() (string, error) {\n\treturn strings.Replace(util.UniqueID(), \"-\", \"\", -1), nil\n}", "func (h *ResourceHeader) SetResourceID(id int64) {\n\th.Metadata.ID = id\n}", "func NewIDRing(min uint64, max uint64, locker sync.Locker) *IDRing {\n\tr := Range{Min: min,\n\t\tMax: max,\n\t}\n\tidRing := IDRing{Ranges: []Range{r},\n\t\tlocker: locker,\n\t\tOrigMin: min,\n\t\tOrigMax: max,\n\t}\n\treturn &idRing\n}", "func NewResource(name string) *Resource {\n\tresource := &Resource{Name: name}\n\treturn resource\n}", "func (d *Dao) NewRepoResource(context data.Map, URI string) (*url.Resource, error) {\n\tvar localResourceURL = fmt.Sprintf(d.localResourceRepo, URI)\n\tvar localResource = url.NewResource(localResourceURL)\n\tvar localService, err = storage.NewServiceForURL(localResourceURL, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif path.Ext(localResource.URL) == \"\" {\n\t\tfor _, ext := range commonResourceExtensions {\n\t\t\tif exists, _ := localService.Exists(localResource.URL + ext); exists {\n\t\t\t\treturn url.NewResource(localResource.URL + ext), nil\n\t\t\t}\n\t\t}\n\t}\n\tif exits, _ := localService.Exists(localResource.URL); exits {\n\t\treturn url.NewResource(localResourceURL), nil\n\t}\n\tvar remoteResourceURL = fmt.Sprintf(d.remoteResourceRepo, URI)\n\tremoteService, err := storage.NewServiceForURL(remoteResourceURL, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = storage.Copy(remoteService, remoteResourceURL, localService, localResourceURL, nil, nil)\n\treturn localResource, err\n}", "func NewID(zone, node int) ID {\n\tif zone < 0 {\n\t\tzone = -zone\n\t}\n\tif node < 0 {\n\t\tnode = -node\n\t}\n\t// return ID(fmt.Sprintf(\"%d.%d\", zone, node))\n\treturn ID(strconv.Itoa(zone) + \".\" + strconv.Itoa(node))\n}", "func New() ID {\n\tvar id ID\n\t// Timestamp, 4 bytes, big endian\n\tbinary.BigEndian.PutUint32(id[:], uint32(time.Now().Unix()))\n\t// Machine, first 3 bytes of md5(hostname)\n\tid[4] = machineID[0]\n\tid[5] = machineID[1]\n\tid[6] = machineID[2]\n\t// Pid, 2 bytes, specs don't specify endianness, but we use big endian.\n\tpid := os.Getpid()\n\tid[7] = byte(pid >> 8)\n\tid[8] = byte(pid)\n\t// Increment, 3 bytes, big endian\n\ti := atomic.AddUint32(&objectIDCounter, 1)\n\tid[9] = byte(i >> 16)\n\tid[10] = byte(i >> 8)\n\tid[11] = byte(i)\n\treturn id\n}", "func NewStudentResource(e *gin.Engine) {\n\tu := StudentResource{}\n\n\t// Setup Routes\n\te.GET(\"/student\", u.getAllStudents)\n\te.GET(\"/student/:id\", u.getStudentByID)\n}", "func (o VpcNetworkAclAttachmentOutput) ResourceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *VpcNetworkAclAttachment) pulumi.StringOutput { return v.ResourceId }).(pulumi.StringOutput)\n}", "func identityResourceID(t *testing.T, identityName string) string {\n\tt.Helper()\n\treturn fmt.Sprintf(\"/subscriptions/sub-id/resourceGroups/group-name/providers/Microsoft.ManagedIdentity/userAssignedIdentities/%s\", identityName)\n}", "func New(i interface{}) *Resource {\n\tr := &Resource{}\n\tr.geth = mustMakeRpc(i, \"Get\")\n\tr.posth = mustMakeRpc(i, \"Post\")\n\tr.puth = mustMakeRpc(i, \"Put\")\n\tr.deleteh = mustMakeRpc(i, \"Delete\")\n\n\t// println(\"[debug]\", r.geth, r.posth, r.puth, r.deleteh)\n\treturn r\n}", "func (opts resourceOptions) newResource() *resource.Resource {\n\treturn &resource.Resource{\n\t\tGVK: resource.GVK{ // Remove whitespaces to prevent values like \" \" pass validation\n\t\t\tGroup: strings.TrimSpace(opts.Group),\n\t\t\tDomain: strings.TrimSpace(opts.Domain),\n\t\t\tVersion: strings.TrimSpace(opts.Version),\n\t\t\tKind: strings.TrimSpace(opts.Kind),\n\t\t},\n\t\tPlural: resource.RegularPlural(opts.Kind),\n\t\tAPI: &resource.API{},\n\t\tWebhooks: &resource.Webhooks{},\n\t}\n}", "func (o ServicePrincipalDelegatedPermissionGrantOutput) ResourceServicePrincipalObjectId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ServicePrincipalDelegatedPermissionGrant) pulumi.StringOutput {\n\t\treturn v.ResourceServicePrincipalObjectId\n\t}).(pulumi.StringOutput)\n}", "func newID() string {\n\treturn \"_\" + uuid.New().String()\n}", "func (r *RID) GetID() int64 {\n\treturn int64(C.godot_rid_get_id(r.rid))\n}", "func NewResourceVersion() string {\n\tvar randBytes = make([]byte, 32)\n\t_, err := rand.Read(randBytes)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\tver := make([]byte, base64.StdEncoding.EncodedLen(len(randBytes)))\n\tbase64.StdEncoding.Encode(ver, randBytes)\n\n\treturn string(ver[:16])\n}", "func (c *IDClient) GetResource(ctx context.Context, id gomanifold.ID) (*Resource, error) {\n\tidBytes, err := id.MarshalText()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := fmt.Sprintf(\"/id/resource/%s\", string(idBytes))\n\n\treq, err := c.backend.NewRequest(http.MethodGet, p, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp Resource\n\t_, err = c.backend.Do(ctx, req, &resp, func(code int) error {\n\t\tswitch code {\n\t\tcase 400, 404, 500:\n\t\t\treturn &Error{}\n\t\tdefault:\n\t\t\treturn nil\n\t\t}\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &resp, nil\n}", "func NewResource[GA any, Alpha any, Beta any](\n\tresourceID *cloud.ResourceID,\n\ttypeTrait TypeTrait[GA, Alpha, Beta],\n) *mutableResource[GA, Alpha, Beta] {\n\tif typeTrait == nil {\n\t\ttypeTrait = &BaseTypeTrait[GA, Alpha, Beta]{}\n\t}\n\n\tobj := &mutableResource[GA, Alpha, Beta]{\n\t\ttypeTrait: typeTrait,\n\t\tresourceID: resourceID,\n\t}\n\n\t// Set .Name from the ResourceID.\n\tsetName := func(v reflect.Value) {\n\t\tif ft, ok := v.Type().FieldByName(\"Name\"); !ok || ft.Type.Kind() != reflect.String {\n\t\t\treturn\n\t\t}\n\t\tf := v.FieldByName(\"Name\")\n\t\tif !f.IsValid() {\n\t\t\tpanic(fmt.Sprintf(\"type does not have .Name (%T)\", v.Type()))\n\t\t}\n\t\tf.Set(reflect.ValueOf(resourceID.Key.Name))\n\t}\n\tsetName(reflect.ValueOf(&obj.ga).Elem())\n\tsetName(reflect.ValueOf(&obj.alpha).Elem())\n\tsetName(reflect.ValueOf(&obj.beta).Elem())\n\n\treturn obj\n}", "func createProviderResource(ctx *Context, ref string) (ProviderResource, error) {\n\t// Parse the URN and ID out of the provider reference.\n\tlastSep := strings.LastIndex(ref, \"::\")\n\tif lastSep == -1 {\n\t\treturn nil, errors.Errorf(\"expected '::' in provider reference %s\", ref)\n\t}\n\turn := ref[0:lastSep]\n\tid := ref[lastSep+2:]\n\n\t// Unmarshal the provider resource as a resource reference so we get back\n\t// the intended provider type with its state, if it's been registered.\n\tresource, err := unmarshalResourceReference(ctx, resource.ResourceReference{\n\t\tURN: resource.URN(urn),\n\t\tID: resource.NewStringProperty(id),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resource.(ProviderResource), nil\n}", "func NewResourceInfo(ctx *middleware.Context, handler ResourceInfoHandler) *ResourceInfo {\n\treturn &ResourceInfo{Context: ctx, Handler: handler}\n}", "func (r *Reconciler) createResource(ctx context.Context, resourceName string, serverClient k8sclient.Client) (runtime.Object, error) {\n\tif r.extraParams == nil {\n\t\tr.extraParams = map[string]string{}\n\t}\n\tr.extraParams[\"MonitoringKey\"] = r.Config.GetLabelSelector()\n\tr.extraParams[\"Namespace\"] = r.Config.GetOperatorNamespace()\n\n\ttemplateHelper := NewTemplateHelper(r.extraParams)\n\tresource, err := templateHelper.CreateResource(resourceName)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"createResource failed: %w\", err)\n\t}\n\n\tmetaObj, err := meta.Accessor(resource)\n\tif err == nil {\n\t\towner.AddIntegreatlyOwnerAnnotations(metaObj, r.installation)\n\t}\n\n\terr = serverClient.Create(ctx, resource)\n\tif err != nil {\n\t\tif !k8serr.IsAlreadyExists(err) {\n\t\t\treturn nil, fmt.Errorf(\"error creating resource: %w\", err)\n\t\t}\n\t}\n\n\treturn resource, nil\n}", "func (o *VectorThumbnailParams) SetResourceID(resourceID string) {\n\to.ResourceID = resourceID\n}" ]
[ "0.63875914", "0.616201", "0.61475265", "0.5857147", "0.5740129", "0.53800994", "0.5263573", "0.520753", "0.51522803", "0.5073041", "0.5050602", "0.50410986", "0.50392437", "0.5027193", "0.50103694", "0.50030994", "0.49800336", "0.49399593", "0.4923073", "0.49156407", "0.49127638", "0.491212", "0.48806322", "0.4878379", "0.48642302", "0.485171", "0.48273245", "0.48152968", "0.47967917", "0.47952256", "0.479498", "0.4776456", "0.47668555", "0.4750326", "0.47460946", "0.47324347", "0.47108388", "0.46843287", "0.46797547", "0.46644017", "0.46636504", "0.46591938", "0.46542254", "0.46468666", "0.46407804", "0.46354342", "0.46337444", "0.46329904", "0.46282727", "0.46258944", "0.46223783", "0.46217588", "0.46181417", "0.46150878", "0.46021888", "0.45812035", "0.4575272", "0.45737338", "0.45691407", "0.45661503", "0.4559028", "0.455031", "0.4530445", "0.4527717", "0.4505604", "0.4493288", "0.4491983", "0.44793707", "0.44774067", "0.44525868", "0.44513062", "0.4448134", "0.4433319", "0.44315735", "0.4416435", "0.4411381", "0.44055882", "0.440023", "0.440023", "0.4396077", "0.43949372", "0.4393442", "0.43907958", "0.43852335", "0.4382153", "0.43800944", "0.43778446", "0.43767953", "0.43691766", "0.43587852", "0.43576783", "0.4353796", "0.435061", "0.43153077", "0.42966518", "0.42850965", "0.42772907", "0.4272926", "0.42677438", "0.42619106" ]
0.7876309
0
GetID returns the godot resource ID
func (r *RID) GetID() int64 { return int64(C.godot_rid_get_id(r.rid)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetGoID() int64", "func (d *ImageDoc) GetID() string { return d.ID }", "func (instance *cache) GetID() string {\n\treturn instance.name.Load().(string)\n}", "func (r Resource) ID() string {\n\treturn r.id\n}", "func (swagger *MgwSwagger) GetID() string {\n\treturn swagger.id\n}", "func (i *Resource) Id() string {\n\treturn i.data.Id\n}", "func getKindRefID(params GetResourceParams) (string, error) {\n\tres, err := Get(params.GetParams)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar refID string\n\tswitch params.Kind {\n\tcase util.Apm:\n\t\tfor _, resource := range res.Resources.Apm {\n\t\t\trefID = *resource.RefID\n\t\t}\n\tcase util.Kibana:\n\t\tfor _, resource := range res.Resources.Kibana {\n\t\t\trefID = *resource.RefID\n\t\t}\n\tcase util.Elasticsearch:\n\t\tfor _, resource := range res.Resources.Elasticsearch {\n\t\t\trefID = *resource.RefID\n\t\t}\n\tcase util.Appsearch:\n\t\tfor _, resource := range res.Resources.Appsearch {\n\t\t\trefID = *resource.RefID\n\t\t}\n\tcase util.EnterpriseSearch:\n\t\tfor _, resource := range res.Resources.EnterpriseSearch {\n\t\t\trefID = *resource.RefID\n\t\t}\n\t}\n\n\tif refID == \"\" {\n\t\treturn \"\", fmt.Errorf(\"deployment get: resource kind %s is not available\", params.Kind)\n\t}\n\n\treturn refID, nil\n}", "func (t tag) GetId() string {\n return t.GetAttr(\"id\")\n}", "func (packet *UpdateResourcePacket) GetID() int64 {\n\treturn packet.ID\n}", "func (t *touch) GetID() int {\n\treturn t.Call(\"getID\").Int()\n}", "func (e ENGChartItem) GetID() string {\n\treturn strings.TrimSuffix(filepath.Base(e.URL), \".html\")\n}", "func (r ManagedResource) id() ReferenceID { return r.ID }", "func (wlt Wallet) GetID() string {\n\treturn wlt.Meta[\"filename\"]\n}", "func (a HassEntity) GetID() string { return a.ID }", "func (PinaGoladaInterface) GetIdentifier() string {\n\treturn \"pgl\"\n}", "func (doc *Document) ID() string {\n\treturn stringEntry((*doc)[jsonldID])\n}", "func (w *wrapper) GetID() string {\n\treturn w.ID\n}", "func (fe *BaseFrontEnd) GetId(p string) (id string, err error) {\n\t// Given an absolute path, make it relative to project\n\tif path.IsAbs(p) {\n\t\tp, err = filepath.Rel(fe.ProjectDir, p)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tp = strings.Replace(p, string(os.PathSeparator), \"-\", -1)\n\n\t// Remove extention\n\tid = strings.TrimSuffix(p, filepath.Ext(p))\n\n\treturn id, nil\n}", "func (t *RestControllerDescriptor) GetByID() *ggt.MethodDescriptor { return t.methodGetByID }", "func (l Like) GetID() string {\n\treturn l.ID.Hex()\n}", "func (cfg *Static) GetID() string {\n\treturn cfg.JobName\n}", "func (m *Command) ID() string { return m.API.Node().ID }", "func (r Resource) DOTID() string {\n\treturn r.dotid\n}", "func (o GremlinGraphResourceOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GremlinGraphResource) string { return v.Id }).(pulumi.StringOutput)\n}", "func GetResourceID(obj ARMMetaObject) (string, bool) {\n\tresult, ok := obj.GetAnnotations()[ResourceIDAnnotation]\n\treturn result, ok\n}", "func (s *AppServerV3) GetResourceID() int64 {\n\treturn s.Metadata.ID\n}", "func (w *W) ID() string {\n\treturn w.Config.URL\n}", "func (o GremlinDatabaseResourceOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GremlinDatabaseResource) string { return v.Id }).(pulumi.StringOutput)\n}", "func (n *Namespace) GetResourceID() int64 {\n\treturn n.Metadata.ID\n}", "func GetID(r *http.Request, param string) (primitive.ObjectID, error) {\n\tid := mux.Vars(r)[param]\n\treturn primitive.ObjectIDFromHex(id)\n}", "func (s *DatabaseServerV3) GetResourceID() int64 {\n\treturn s.Metadata.ID\n}", "func (c Client) GetIdentifier() network.Identifier { return c.identify }", "func (r *Response) ID() string { return r.id }", "func (r *Response) ID() string { return r.id }", "func hostGetObjectId(objId int32, keyId int32, typeId int32) int32", "func (s *Operation) getID() int {\n\treturn s.ID\n}", "func (s *Store) GetID(url string) (string, error) {\n\tconn := s.pool.Get()\n\tdefer conn.Close()\n\tv, err := redis.String(conn.Do(\"GET\", s.urlKey(url)))\n\tif err == redis.ErrNil {\n\t\treturn \"\", store.ErrNotFound\n\t} else if err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v, nil\n}", "func (r *Request) ID() string { return string(r.id) }", "func (r *Request) ID() string { return string(r.id) }", "func (game Game) GetID() int64 {\n\treturn game.id\n}", "func (n *resPool) ID() string {\n\treturn n.id\n}", "func (o GremlinDatabaseResourcePtrOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GremlinDatabaseResource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Id\n\t}).(pulumi.StringPtrOutput)\n}", "func (p *NoteStoreClient) GetResource(ctx context.Context, authenticationToken string, guid GUID, withData bool, withRecognition bool, withAttributes bool, withAlternateData bool) (r *Resource, err error) {\n var _args135 NoteStoreGetResourceArgs\n _args135.AuthenticationToken = authenticationToken\n _args135.GUID = guid\n _args135.WithData = withData\n _args135.WithRecognition = withRecognition\n _args135.WithAttributes = withAttributes\n _args135.WithAlternateData = withAlternateData\n var _result136 NoteStoreGetResourceResult\n if err = p.Client_().Call(ctx, \"getResource\", &_args135, &_result136); err != nil {\n return\n }\n switch {\n case _result136.UserException!= nil:\n return r, _result136.UserException\n case _result136.SystemException!= nil:\n return r, _result136.SystemException\n case _result136.NotFoundException!= nil:\n return r, _result136.NotFoundException\n }\n\n return _result136.GetSuccess(), nil\n}", "func (a *App) ID() string { return a.opts.id }", "func (o GremlinGraphResourcePtrOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GremlinGraphResource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Id\n\t}).(pulumi.StringPtrOutput)\n}", "func (s *Service) ID() interface{} {\n\treturn (*s)[jsonldID]\n}", "func (f *FFS) ID(ctx context.Context) (ffs.APIID, error) {\n\tresp, err := f.client.ID(ctx, &rpc.IDRequest{})\n\tif err != nil {\n\t\treturn ffs.EmptyInstanceID, err\n\t}\n\treturn ffs.APIID(resp.Id), nil\n}", "func (c *IDClient) GetResource(ctx context.Context, id gomanifold.ID) (*Resource, error) {\n\tidBytes, err := id.MarshalText()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := fmt.Sprintf(\"/id/resource/%s\", string(idBytes))\n\n\treq, err := c.backend.NewRequest(http.MethodGet, p, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp Resource\n\t_, err = c.backend.Do(ctx, req, &resp, func(code int) error {\n\t\tswitch code {\n\t\tcase 400, 404, 500:\n\t\t\treturn &Error{}\n\t\tdefault:\n\t\t\treturn nil\n\t\t}\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &resp, nil\n}", "func (r Result) GetIdentifier() string {\n\tsuffix := \"\"\n\tif r.Resource.UID != \"\" {\n\t\tsuffix = \"__\" + r.Resource.UID\n\t}\n\n\treturn fmt.Sprintf(\"%s__%s__%s%s\", r.Policy, r.Rule, r.Status, suffix)\n}", "func (o MongoDBDatabaseResourceOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MongoDBDatabaseResource) string { return v.Id }).(pulumi.StringOutput)\n}", "func (c *client) ID(ctx context.Context) (IDInfo, error) {\n\turl := c.createURL(\"/id\", nil)\n\n\tvar result IDInfo\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn IDInfo{}, maskAny(err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn IDInfo{}, maskAny(err)\n\t}\n\tif err := c.handleResponse(resp, \"GET\", url, &result); err != nil {\n\t\treturn IDInfo{}, maskAny(err)\n\t}\n\n\treturn result, nil\n}", "func (self *Secret) GetIdentifier(key string) string {\n\tif key == \"uri\" {\n\t\treturn self.uri\n\t} else if strings.HasPrefix(key, \"tags.\") {\n\t\tname := strings.ToLower(key[5:])\n\t\tfor _, tag := range self.tags {\n\t\t\tif strings.ToLower(tag.Name) == name {\n\t\t\t\treturn tag.Value\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\"\n}", "func (PinaGoladaMethod) GetIdentifier() string {\n\treturn \"pgl\"\n}", "func GetID(w http.ResponseWriter, r *http.Request) {\n\tdata := Data{\n\t\tParam: &Param{\n\t\t\tID: chi.URLParam(r, \"id\"),\n\t\t\tName: r.URL.Query()[\"name\"][0],\n\t\t},\n\t}\n\n\tjsonData, err := json.Marshal(data)\n\tif err != nil {\n\t\tlog.Println(\"error while marshaling: \", err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(jsonData)\n}", "func (p *Plugin) GetID() string {\n\tp.mu.RLock()\n\tdefer p.mu.RUnlock()\n\n\treturn p.PluginObj.ID\n}", "func prnGetID(prn string) string {\n\tidx := strings.Index(prn, \"/\")\n\treturn prn[idx+1:]\n}", "func (s *Ingrediant) getID() int {\n\treturn s.ID\n}", "func (w *deviceWrapper) GetID() string {\n\tif w.ID == \"\" {\n\t\tw.ID = fmt.Sprintf(\"%s.%s.%s\", utils.NormalizeDeviceName(w.Ctor.DeviceConfigName),\n\t\t\tutils.NormalizeDeviceName(w.Ctor.DeviceType.String()),\n\t\t\tutils.NormalizeDeviceName(w.Ctor.DeviceInterface.(device.IDevice).GetName()))\n\t}\n\treturn w.ID\n}", "func getRDSResourceID(db types.Database) string {\n\tswitch db.GetType() {\n\tcase types.DatabaseTypeRDS:\n\t\treturn db.GetAWS().RDS.ResourceID\n\tcase types.DatabaseTypeRDSProxy:\n\t\treturn db.GetAWS().RDSProxy.ResourceID\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "func (serv *AppServer) GetID(list string, val int) int {\n\tret, _ := strconv.Atoi(serv.ServerRequest([]string{\"GetID\", list, strconv.Itoa(val)}))\n\treturn ret\n}", "func (o *Object) ID() string {\n\treturn o.id\n}", "func (o *Object) ID() string {\n\treturn o.id\n}", "func (q *HTTP) GetID() uint64 {\n\treturn q.id\n}", "func (workItemType WorkItemType) GetID() string {\n return workItemType.ID.Hex()\n}", "func (r *Thing) ID() pulumi.IDOutput {\n\treturn r.s.ID()\n}", "func ID() int {\n\treturn id\n}", "func (c VpnCredential) GetID() string { return c.ID }", "func (g *Gist) GetID() string {\n\tif g == nil || g.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *g.ID\n}", "func getModelID(modelName string) string {\n\tif modelName == \"General\" {\n\t\treturn \"aaa03c23b3724a16a56b629203edc62c\"\n\t}\n\treturn \"null\"\n}", "func (h *ResourceHeader) GetResourceID() int64 {\n\treturn h.Metadata.ID\n}", "func (g Group) GetID() string {\n\tl := strings.SplitN(g.URI, \"/\", -1)\n\tid := l[len(l)-1]\n\treturn id\n}", "func (p *capacityManilaPlugin) ID() string {\n\treturn \"manila\"\n}", "func (clgCtl *CatalogueController) GetByID(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tcode := params[\"id\"]\n\n\tlog.Printf(\"Retrieving Catalogue '%v'.\\n\", code)\n\n\tclgRepo := cataloguerepository.NewCatalogueRepository()\n\tresult, err := clgRepo.GetByID(r.Context(), code)\n\tif err != nil {\n\t\tclgCtl.WriteResponse(w, http.StatusInternalServerError, false, nil, err.Error())\n\t\treturn\n\t}\n\n\tclgCtl.WriteResponse(w, http.StatusOK, true, result, \"\")\n}", "func (t *Link) GetId() (v *url.URL) {\n\treturn t.id\n\n}", "func (d Disk) GetID() string {\n\treturn d.Serial\n}", "func getID(w http.ResponseWriter, ps httprouter.Params) (int, bool) {\n\tid, err := strconv.Atoi(ps.ByName(\"id\"))\n\tif err != nil {\n\t\tw.WriteHeader(400)\n\t\treturn 0, false\n\t}\n\treturn id, true\n}", "func (j *Job) GetIDShort() string { x, _ := hex.DecodeString(j.ID); return hex.EncodeToString(x[:8]) }", "func (b Blade) GetID() string {\n\treturn b.Serial\n}", "func ID() string {\n\treturn appid\n}", "func (p *Process) CmdGetID(pac teoapi.Packet) (err error) {\n\tdata := pac.RemoveTrailingZero(pac.Data())\n\trequest := cdb.KeyValue{Cmd: pac.Cmd()}\n\tif err = request.UnmarshalText(data); err != nil {\n\t\treturn\n\t}\n\t// Return only Value for text requests and all fields for json\n\tresponce := request\n\tif responce.Value, err = p.tcdb.GetID(request.Key); err != nil {\n\t\treturn\n\t} else if !request.RequestInJSON {\n\t\t_, err = p.tcdb.con.SendAnswer(pac, pac.Cmd(), responce.Value)\n\t} else if retdata, err := responce.MarshalText(); err == nil {\n\t\t_, err = p.tcdb.con.SendAnswer(pac, pac.Cmd(), retdata)\n\t}\n\treturn\n}", "func (obj *SObject) ID() string {\n\treturn obj.StringField(sobjectIDKey)\n}", "func (p *ResourcePool) ID() string {\n\treturn fmt.Sprintf(\"resourcepool(%s)\", p.manager.Name())\n}", "func (ds DefaultState) GetID() string {\n\treturn string(ds)\n}", "func getID(r *http.Request) (int64, error) {\n\tvars := mux.Vars(r)\n\treturn strconv.ParseInt(vars[\"id\"], 10, 64)\n}", "func (g genericPlugin) Get(resource helm.KubernetesResource,\n\tnamespace string, client plugin.KubernetesConnector) (string, error) {\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\tdynClient := client.GetDynamicClient()\n\tmapper := client.GetMapper()\n\n\tmapping, err := mapper.RESTMapping(schema.GroupKind{\n\t\tGroup: resource.GVK.Group,\n\t\tKind: resource.GVK.Kind,\n\t}, resource.GVK.Version)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Mapping kind to resource error\")\n\t}\n\n\tgvr := mapping.Resource\n\topts := metav1.GetOptions{}\n\tvar unstruct *unstructured.Unstructured\n\tswitch mapping.Scope.Name() {\n\tcase meta.RESTScopeNameNamespace:\n\t\tunstruct, err = dynClient.Resource(gvr).Namespace(namespace).Get(resource.Name, opts)\n\tcase meta.RESTScopeNameRoot:\n\t\tunstruct, err = dynClient.Resource(gvr).Get(resource.Name, opts)\n\tdefault:\n\t\treturn \"\", pkgerrors.New(\"Got an unknown RESTSCopeName for mapping: \" + resource.GVK.String())\n\t}\n\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Delete object error\")\n\t}\n\n\treturn unstruct.GetName(), nil\n}", "func (o MongoDBDatabaseResourcePtrOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MongoDBDatabaseResource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Id\n\t}).(pulumi.StringPtrOutput)\n}", "func (a Aunt) GetID() int {\n\treturn a.id\n}", "func (l *Library) ID() int { return l.Library.LibraryID }", "func (a *Exp_photosHandler) GetByID(c echo.Context) error {\n\tid := c.Param(\"id\")\n\n\tctx := c.Request().Context()\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\n\tart, err := a.Exp_photosUsecase.GetByExperienceID(ctx, id)\n\tif err != nil {\n\t\treturn c.JSON(getStatusCode(err), ResponseError{Message: err.Error()})\n\t}\n\treturn c.JSON(http.StatusOK, art)\n}", "func (t *Target) GetID() string {\n\treturn t.Namespace + \"_\" + t.Pod + \"_\" + t.Container\n}", "func (resolver nameResolver) GetResourceName(id string) string {\n\treturn resolver.resourceNamePrefix + id\n}", "func (d *MagnetDownloadable) GetID() string {\n\treturn d.Infohash\n}", "func GetByID(ctx *routing.Context) error {\n\tlogger := logger.GetLogInstance(\"\", \"\")\n\tdb := ctx.Get(\"db\").(*gorm.DB)\n\n\timg := []models.ImageModel{}\n\n\tif err := db.Model(&dbmodels.Image{}).Where(\"id = ?\", ctx.Param(\"id\")).Scan(&img).Error; err != nil {\n\t\tlogger.Error(err)\n\t\tctx.Response.SetStatusCode(404)\n\t\tres := models.NewResponse(false, nil, \"not found\")\n\t\treturn ctx.WriteData(res.MustMarshal())\n\t}\n\tres := models.NewResponse(true, img, \"OK\")\n\treturn ctx.WriteData(res.MustMarshal())\n}", "func getInstanceID(providerID string) string {\n\tproviderTokens := strings.Split(providerID, \"/\")\n\treturn providerTokens[len(providerTokens)-1]\n}", "func getInstanceID(providerID string) string {\n\tproviderTokens := strings.Split(providerID, \"/\")\n\treturn providerTokens[len(providerTokens)-1]\n}", "func (mf *MongoFiles) handleGetID(gfs *mgo.GridFS) (string, error) {\n\tid, err := mf.parseID()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// with the parsed _id, grab the file and write it to disk\n\tgFile, err := gfs.OpenId(id)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error opening GridFS file with _id %s: %v\", mf.Id, err)\n\t}\n\tdefer gFile.Close()\n\tif err = mf.writeFile(gFile); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn fmt.Sprintf(\"finished writing to: %s\\n\", mf.getLocalFileName(gFile)), nil\n}", "func (a *Action) ID() common.ID {\n\tdata := a.ActionName + \":\" + a.ResourceLocation\n\tid := base64.StdEncoding.EncodeToString([]byte(data))\n\treturn common.IDString(id)\n}", "func (o *Handoff) GetID() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&2 != 0\n\tif ok {\n\t\tvalue = o.id\n\t}\n\treturn\n}", "func (c Node) GetID() string {\n\treturn c.id\n}", "func (c *localComponent) ID() dependency.Instance {\n\treturn dependency.PolicyBackend\n}", "func (ch *CertHandler) GetID() string {\n\t// TODO: implement\n\treturn \"id1\"\n}" ]
[ "0.65013576", "0.6489582", "0.6332071", "0.63063824", "0.60851926", "0.6028125", "0.6011213", "0.5952932", "0.59155536", "0.5880637", "0.5876924", "0.58590716", "0.5845074", "0.58345807", "0.5832541", "0.5823344", "0.58074063", "0.5780782", "0.5761846", "0.57171255", "0.5708307", "0.5691175", "0.5673374", "0.5660668", "0.56549615", "0.5648749", "0.5648079", "0.56476706", "0.562993", "0.56267005", "0.56067514", "0.55991787", "0.5598865", "0.5598865", "0.55977756", "0.558997", "0.55896467", "0.5556185", "0.5556185", "0.55532753", "0.55477095", "0.55421007", "0.5538364", "0.5535359", "0.5524053", "0.5521433", "0.5513715", "0.5508526", "0.5506165", "0.5504332", "0.5499511", "0.54969627", "0.549588", "0.5493822", "0.54936343", "0.54864264", "0.54843277", "0.54780704", "0.5474554", "0.54703224", "0.54370546", "0.54370546", "0.5432245", "0.5421271", "0.5413567", "0.5411225", "0.5393104", "0.5390133", "0.5386434", "0.5379754", "0.5378788", "0.5369452", "0.53430384", "0.5319382", "0.53167033", "0.53155446", "0.53144383", "0.53144026", "0.53074366", "0.53052527", "0.53036577", "0.53019845", "0.5299271", "0.5297825", "0.5295566", "0.5291227", "0.52842754", "0.527645", "0.5266626", "0.5262601", "0.5250259", "0.52463645", "0.52446246", "0.524285", "0.524285", "0.52398753", "0.52383834", "0.5236958", "0.5236244", "0.5234029", "0.52256864" ]
0.0
-1
OperatorEqual returns true if r.rid == rid.rid
func (r *RID) OperatorEqual(rid *RID) bool { return bool(C.godot_rid_operator_equal(r.rid, rid.rid)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (oi ObjectIdentifier) Equal(other ObjectIdentifier) bool {}", "func (op RollupOp) Equal(other RollupOp) bool {\n\treturn op.AggregationID == other.AggregationID && bytes.Equal(op.ID, other.ID)\n}", "func (r Representative) Equal(a, b uint64) bool {\n\tif r == nil {\n\t\treturn Equal(a, b)\n\t}\n\treturn r(a) == r(b)\n}", "func equalRdata(a, b dns.RR) bool {\n\tswitch x := a.(type) {\n\t// TODO(miek): more types, i.e. all types.\n\tcase *dns.A:\n\t\treturn x.A.Equal(b.(*dns.A).A)\n\tcase *dns.AAAA:\n\t\treturn x.AAAA.Equal(b.(*dns.AAAA).AAAA)\n\tcase *dns.MX:\n\t\tif x.Mx == b.(*dns.MX).Mx && x.Preference == b.(*dns.MX).Preference {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (r *RegexpObject) equal(e *RegexpObject) bool {\n\treturn r.ToString() == r.ToString()\n}", "func (r Record) Equal(rr Record) bool {\n\treturn cmp.Equal(r.GetAnswers(), rr.GetAnswers())\n}", "func (v OperationIdentifier) Equal(o OperationIdentifier) bool {\n\treturn v.Index == o.Index &&\n\t\tv.NetworkIndex.Value == o.NetworkIndex.Value &&\n\t\tv.NetworkIndex.Set == o.NetworkIndex.Set\n}", "func EqualOperators(f Operator, another Operator) bool {\n\treturn f.GetId() == another.GetId()\n}", "func (r *Rule) Equal(other *Rule) bool {\n\treturn r.rptr == other.rptr\n}", "func (r *RID) OperatorLess(rid *RID) bool {\n\treturn bool(C.godot_rid_operator_less(r.rid, rid.rid))\n}", "func (c *Conn) MatchesRID(ep naming.Endpoint) bool {\n\treturn ep.RoutingID == naming.NullRoutingID ||\n\t\tc.remote.RoutingID == ep.RoutingID\n}", "func (r Result) Equal() bool {\n\treturn r.flags&(reportEqual|reportByIgnore) != 0\n}", "func (r RawRecord) Equals(other RawRecord) bool {\n\treturn reflect.ValueOf(r).Pointer() == reflect.ValueOf(other).Pointer()\n}", "func (l Integer) Equal(r Value) bool {\n\tif r, ok := r.(Integer); ok {\n\t\treturn l == r\n\t}\n\treturn false\n}", "func eqri(a, b, c int, r register) register {\n\tif r[a] == b {\n\t\tr[c] = 1\n\t} else {\n\t\tr[c] = 0\n\t}\n\treturn r\n}", "func (r *Registry) Equal(rr *Registry) bool {\n\n\tif r.portMin != rr.portMin ||\n\t\tr.portMax != rr.portMax ||\n\t\tr.portNext != rr.portNext ||\n\t\tlen(r.byport) != len(rr.byport) ||\n\t\tlen(r.byname) != len(rr.byname) {\n\n\t\treturn false\n\t}\n\n\tfor p, s := range r.byport {\n\t\tsr, ok := rr.byport[p]\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t\tif !s.equal(sr) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tfor n, s := range r.byname {\n\t\tsr, ok := rr.byname[n]\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t\tif !s.equal(sr) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (m MatcherWithoutLogicalOperator) Equal(n Matcher) bool {\n\tmm, ok := n.(MatcherWithoutLogicalOperator)\n\treturn ok &&\n\t\tm.LeftOperand == mm.LeftOperand &&\n\t\tm.Operator == mm.Operator &&\n\t\tm.RightOperand == mm.RightOperand\n}", "func eqrr(a, b, c int, r register) register {\n\tif r[a] == r[b] {\n\t\tr[c] = 1\n\t} else {\n\t\tr[c] = 0\n\t}\n\treturn r\n}", "func JEQ(r operand.Op) { ctx.JEQ(r) }", "func (r Rule) Equal(r2 Rule) bool {\n\tif !(r.ObjectID == r2.ObjectID &&\n\t\tr.Description == r2.Description &&\n\t\tr.Enabled.Equal(r2.Enabled) &&\n\t\tlen(r.Validity) == len(r2.Validity) &&\n\t\treflect.DeepEqual(r.Condition, r2.Condition) &&\n\t\treflect.DeepEqual(r.Consequence, r2.Consequence)) {\n\t\treturn false\n\t}\n\n\tfor i, r := range r.Validity {\n\t\tif !r.Equal(r2.Validity[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func eqir(a, b, c int, r register) register {\n\tif a == r[b] {\n\t\tr[c] = 1\n\t} else {\n\t\tr[c] = 0\n\t}\n\treturn r\n}", "func (j JID) Equal(j2 JID) bool {\n\tif len(j.data) != len(j2.data) {\n\t\treturn false\n\t}\n\tfor i := 0; i < len(j.data); i++ {\n\t\tif j.data[i] != j2.data[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn j.locallen == j2.locallen && j.domainlen == j2.domainlen\n}", "func equal(lhs, rhs semantic.Expression) semantic.Expression {\n\treturn &semantic.BinaryOp{Type: semantic.BoolType, LHS: lhs, Operator: ast.OpEQ, RHS: rhs}\n}", "func (rsk *ResourceStateKey) Equal(other *ResourceStateKey) bool {\n\tif rsk == nil || other == nil {\n\t\treturn false\n\t}\n\tif rsk.Mode != other.Mode {\n\t\treturn false\n\t}\n\tif rsk.Type != other.Type {\n\t\treturn false\n\t}\n\tif rsk.Name != other.Name {\n\t\treturn false\n\t}\n\tif rsk.Index != other.Index {\n\t\treturn false\n\t}\n\treturn true\n}", "func (m MatcherWithLogicalOperator) Equal(n Matcher) bool {\n\tmm, ok := n.(MatcherWithLogicalOperator)\n\treturn ok &&\n\t\tm.LeftMatcher.Equal(mm.LeftMatcher) &&\n\t\tm.Operator == mm.Operator &&\n\t\tm.RightMatcher.Equal(mm.RightMatcher)\n}", "func Eql(v1, v2 Vect) bool { return v1.X == v2.X && v1.Y == v2.Y }", "func (l *Label) Equal(r *Label) bool {\n\treturn l == r || l.key == r.key\n}", "func (s Reload) Equal(t Reload, opts ...Options) bool {\n\tif s.ID != t.ID {\n\t\treturn false\n\t}\n\n\tif s.ReloadTimestamp != t.ReloadTimestamp {\n\t\treturn false\n\t}\n\n\tif s.Response != t.Response {\n\t\treturn false\n\t}\n\n\tif s.Status != t.Status {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (r *Rank) Equals(other Rank) bool {\n\tif r == nil {\n\t\treturn other.Equals(NilRank)\n\t}\n\treturn *r == other\n}", "func (r *Rank) Equals(other Rank) bool {\n\tif r == nil {\n\t\treturn other.Equals(NilRank)\n\t}\n\treturn *r == other\n}", "func ResultsEqual(r1, r2 []Result) bool {\n\tif len(r1) != len(r2) {\n\t\treturn false\n\t}\n\tfor i, r := range r1 {\n\t\tif !r.Equal(&r2[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (n NodeID) Equal(other NodeID) bool {\n\treturn bytes.Equal(n.bytes(), other.bytes())\n}", "func (n Name) Equal(r Name) bool {\n\tif len(n) != len(r) {\n\t\treturn false\n\t}\n\tfor i := range n {\n\t\tif !n[i].Equal(r[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (r *RID) OperatorGreater(rid *RID) bool {\n\tif !r.OperatorEqual(rid) && !r.OperatorLess(rid) {\n\t\treturn true\n\t}\n\treturn false\n}", "func EqualsRefOfBinaryExpr(a, b *BinaryExpr) bool {\n\tif a == b {\n\t\treturn true\n\t}\n\tif a == nil || b == nil {\n\t\treturn false\n\t}\n\treturn a.Operator == b.Operator &&\n\t\tEqualsExpr(a.Left, b.Left) &&\n\t\tEqualsExpr(a.Right, b.Right)\n}", "func (result *Result) Equal(other *Result) bool {\n\t// Check for nil cases\n\tif result == nil {\n\t\treturn other == nil\n\t}\n\tif other == nil {\n\t\treturn false\n\t}\n\n\t// Compare Fields, RowsAffected, InsertID, Rows.\n\treturn FieldsEqual(result.Fields, other.Fields) &&\n\t\tresult.RowsAffected == other.RowsAffected &&\n\t\tresult.InsertID == other.InsertID &&\n\t\treflect.DeepEqual(result.Rows, other.Rows)\n}", "func (irm InterestRateModel) Equal(irmCompareTo InterestRateModel) bool {\n\tif !irm.BaseRateAPY.Equal(irmCompareTo.BaseRateAPY) {\n\t\treturn false\n\t}\n\tif !irm.BaseMultiplier.Equal(irmCompareTo.BaseMultiplier) {\n\t\treturn false\n\t}\n\tif !irm.Kink.Equal(irmCompareTo.Kink) {\n\t\treturn false\n\t}\n\tif !irm.JumpMultiplier.Equal(irmCompareTo.JumpMultiplier) {\n\t\treturn false\n\t}\n\treturn true\n}", "func (v SubNetworkIdentifier) Equal(o SubNetworkIdentifier) bool {\n\treturn string(v.Metadata) == string(o.Metadata) &&\n\t\tv.Network == o.Network\n}", "func (recv *SignalQuery) Equals(other *SignalQuery) bool {\n\treturn other.ToC() == recv.ToC()\n}", "func (b *BooleanObject) equal(e *BooleanObject) bool {\n\treturn b.value == e.value\n}", "func (r *rankImpl) Equal(a, b string) bool {\n\treturn strings.TrimRight(a, RANK_MIN) == strings.TrimRight(b, RANK_MIN)\n}", "func (vm *VM) opEq(instr []uint16) int {\n\ta, b, c := vm.getAbc(instr)\n\n\tif b == c {\n\t\tvm.registers[a] = 1\n\t} else {\n\t\tvm.registers[a] = 0\n\t}\n\t//println(\"eq:\", b, c, \"->\", a)\n\treturn 4\n}", "func (n *Node) Equals(x int64) bool {\n\tif n.Operation == OperationNotation {\n\t\ta := big.NewInt(0)\n\t\ta.SetString(n.Left.Value, 10)\n\t\tb := big.NewInt(10)\n\t\tc := big.NewInt(0)\n\t\tc.SetString(n.Right.Value, 10)\n\t\tb.Exp(b, c, nil)\n\t\ta.Mul(a, b)\n\t\treturn a.Cmp(big.NewInt(x)) == 0\n\t}\n\tvalue := big.NewInt(0)\n\tvalue.SetString(n.Value, 10)\n\treturn value.Cmp(big.NewInt(x)) == 0\n}", "func (n *Expr) Eq(o *Expr) bool {\n\tif n == o {\n\t\treturn true\n\t}\n\tif n == nil || o == nil {\n\t\treturn false\n\t}\n\tif n.constValue != nil && o.constValue != nil {\n\t\treturn n.constValue.Cmp(o.constValue) == 0\n\t}\n\n\tif n.flags != o.flags || n.id0 != o.id0 || n.id1 != o.id1 || n.id2 != o.id2 {\n\t\treturn false\n\t}\n\tif !n.lhs.AsExpr().Eq(o.lhs.AsExpr()) {\n\t\treturn false\n\t}\n\tif !n.mhs.AsExpr().Eq(o.mhs.AsExpr()) {\n\t\treturn false\n\t}\n\n\tif n.id0 == t.IDXBinaryAs {\n\t\tif !n.rhs.AsTypeExpr().Eq(o.rhs.AsTypeExpr()) {\n\t\t\treturn false\n\t\t}\n\t} else if !n.rhs.AsExpr().Eq(o.rhs.AsExpr()) {\n\t\treturn false\n\t}\n\n\tif len(n.list0) != len(o.list0) {\n\t\treturn false\n\t}\n\tfor i, x := range n.list0 {\n\t\tif !x.AsExpr().Eq(o.list0[i].AsExpr()) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (u OpUnion) Equal(other OpUnion) bool {\n\t// keep in sync with Pipeline.Equal as go is terrible at inlining anything with a loop\n\tif u.Type != other.Type {\n\t\treturn false\n\t}\n\n\tif u.Type == pipeline.RollupOpType {\n\t\treturn u.Rollup.Equal(other.Rollup)\n\t}\n\n\treturn u.Transformation.Type == other.Transformation.Type\n}", "func Equal(a *ROBDD, b *ROBDD) (bool, error) {\n\tif !reflect.DeepEqual(a.Vocabulary, b.Vocabulary) {\n\t\treturn false, fmt.Errorf(\"Mismatched vocabularies in GraphEqual: %v, %v\", a.Vocabulary, b.Vocabulary)\n\t}\n\treturn seq.Equal(a.Node, b.Node)\n}", "func (iter *RbTreeIterator) Equal(other iterator.ConstIterator) bool {\n\totherIter, ok := other.(*RbTreeIterator)\n\tif !ok {\n\t\treturn false\n\t}\n\tif otherIter.node == iter.node {\n\t\treturn true\n\t}\n\treturn false\n}", "func (n *Expr) Equals(m *Expr) bool {\n\tif n.Operand.Type != m.Operand.Type || n.Operand.Value != m.Operand.Value || !n.isSideEffectsFree() || !m.isSideEffectsFree() {\n\t\treturn false\n\t}\n\n\tif n.Case != m.Case {\n\t\tswitch {\n\t\tcase n.Case == ExprPExprList:\n\t\t\treturn n.ExprList.equals2(m)\n\t\tcase m.Case == ExprPExprList:\n\t\t\treturn m.ExprList.equals2(n)\n\t\t}\n\t\treturn false\n\t}\n\n\tswitch n.Case {\n\tcase\n\t\tExprPSelect, // Expr \"->\" IDENTIFIER\n\t\tExprSelect: // Expr '.' IDENTIFIER\n\n\t\treturn n.Expr.Equals(m.Expr) && n.Token.Val == m.Token.Val && n.Token2.Val == m.Token2.Val\n\tcase ExprIdent: // IDENTIFIER\n\t\treturn n.Token.Val == m.Token.Val\n\tcase ExprPExprList: // '(' ExprList ')'\n\t\treturn n.ExprList.equals(m.ExprList)\n\tcase ExprInt: // INTCONST\n\t\treturn true\n\tcase // unary\n\t\tExprCast, // '(' TypeName ')' Expr\n\t\tExprCpl, // '~' Expr\n\t\tExprDeref, // '*' Expr\n\t\tExprNot, // '!' Expr\n\t\tExprUnaryPlus: // '+' Expr\n\n\t\treturn n.Expr.Equals(m.Expr)\n\tcase ExprIndex: // Expr '[' ExprList ']'\n\t\treturn n.Expr.Equals(m.Expr) && n.ExprList.equals(m.ExprList)\n\tcase // binary commutative\n\t\tExprAdd, // Expr '+' Expr\n\t\tExprAnd, // Expr '&' Expr\n\t\tExprEq, // Expr \"==\" Expr\n\t\tExprGe, // Expr \"==\" Expr\n\t\tExprLe, // Expr \"==\" Expr\n\t\tExprLt, // Expr \"==\" Expr\n\t\tExprMul, // Expr '*' Expr\n\t\tExprNe, // Expr \"==\" Expr\n\t\tExprOr, // Expr '|' Expr\n\t\tExprXor: // Expr '^' Expr\n\n\t\treturn n.Expr.Equals(m.Expr) && n.Expr2.Equals(m.Expr2) || n.Expr.Equals(m.Expr2) && n.Expr2.Equals(m.Expr)\n\tcase // binary\n\t\tExprDiv, // Expr '/' Expr\n\t\tExprGt, // Expr '>' Expr\n\t\tExprLAnd, // Expr \"&&\" Expr\n\t\tExprLOr, // Expr \"||\" Expr\n\t\tExprLsh, // Expr \"<<\" Expr\n\t\tExprMod, // Expr '%' Expr\n\t\tExprRsh, // Expr \">>\" Expr\n\t\tExprSub: // Expr '-' Expr\n\n\t\treturn n.Expr.Equals(m.Expr) && n.Expr2.Equals(m.Expr2)\n\tcase ExprCall: // Expr '(' ArgumentExprListOpt ')'\n\t\tif !n.Expr.Equals(m.Expr) {\n\t\t\treturn false\n\t\t}\n\n\t\tif (n.ArgumentExprListOpt == nil) != (m.ArgumentExprListOpt == nil) {\n\t\t\treturn false\n\t\t}\n\n\t\tif n.ArgumentExprListOpt == nil {\n\t\t\treturn true\n\t\t}\n\n\t\tfor l, k := n.ArgumentExprListOpt.ArgumentExprList, m.ArgumentExprListOpt.ArgumentExprList; l != nil; l, k = l.ArgumentExprList, k.ArgumentExprList {\n\t\t\tif (l.ArgumentExprList == nil) != (k.ArgumentExprList == nil) || !l.Expr.Equals(k.Expr) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tdefault:\n\t\tpanic(fmt.Errorf(\"%T.Equal %v\", n, n.Case))\n\t}\n}", "func (r Range) Equal(r1 Range) bool {\n\treturn r[0] == r1[0] && r[1] == r1[1]\n}", "func (r ShardResults) Equal(other ShardResults) bool {\n\tfor shard, result := range r {\n\t\totherResult, ok := r[shard]\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t\tallSeries := result.AllSeries()\n\t\totherAllSeries := otherResult.AllSeries()\n\t\tif len(allSeries) != len(otherAllSeries) {\n\t\t\treturn false\n\t\t}\n\t\tfor id, series := range allSeries {\n\t\t\totherSeries, ok := otherAllSeries[id]\n\t\t\tif !ok {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tallBlocks := series.Blocks.AllBlocks()\n\t\t\totherAllBlocks := otherSeries.Blocks.AllBlocks()\n\t\t\tif len(allBlocks) != len(otherAllBlocks) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfor start, block := range allBlocks {\n\t\t\t\totherBlock, ok := otherAllBlocks[start]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\t// Just performing shallow equals so simply compare block addresses\n\t\t\t\tif block != otherBlock {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "func (r *Record) Eq(other *Record) bool {\n\n\t// We disregard leader in equality tests, since LineMARC doesn't have one,\n\t// and it will be generated by decoders and encoder.\n\t/*\n\t\t// Leader equal?\n\t\tif r.Leader != other.Leader {\n\t\t\treturn false\n\t\t}\n\t*/\n\n\t// Control Fields equal?\n\tif len(r.CtrlFields) != len(other.CtrlFields) {\n\t\treturn false\n\t}\n\n\tsort.Sort(r.CtrlFields)\n\tsort.Sort(other.CtrlFields)\n\n\tfor i, f := range r.CtrlFields {\n\t\tif other.CtrlFields[i] != f {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Data Fields equal?\n\tif len(r.DataFields) != len(other.DataFields) {\n\t\treturn false\n\t}\n\n\tsort.Sort(r.DataFields)\n\tsort.Sort(other.DataFields)\n\n\tfor i, f := range r.DataFields {\n\t\tif o := other.DataFields[i]; o.Tag != f.Tag || o.Ind1 != f.Ind1 || o.Ind2 != f.Ind2 {\n\t\t\treturn false\n\t\t}\n\t\t// SubFields equal?\n\t\tif len(f.SubFields) != len(other.DataFields[i].SubFields) {\n\t\t\treturn false\n\t\t}\n\n\t\tsort.Sort(f.SubFields)\n\t\tsort.Sort(other.DataFields[i].SubFields)\n\n\t\tfor j, s := range f.SubFields {\n\t\t\tif other.DataFields[i].SubFields[j] != s {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\t// All fields equal\n\treturn true\n}", "func equals(p1, p2 *node) bool {\n\treturn p1.x == p2.x && p1.y == p2.y\n}", "func CMOVQEQ(mr, r operand.Op) { ctx.CMOVQEQ(mr, r) }", "func Equal(a, b uint64) bool {\n\treturn a == b\n}", "func (r Ref) Equal(other Value) bool {\n\tswitch other := other.(type) {\n\tcase Ref:\n\t\treturn r.Compare(other) == 0\n\tdefault:\n\t\treturn false\n\t}\n}", "func (ns NodeMini) Equal(other NodeMini) bool {\n\treturn (ns.ID == other.ID) &&\n\t\t(ns.Hostname == other.Hostname) &&\n\t\t(ns.State == other.State) &&\n\t\t(ns.Addr == other.Addr) &&\n\t\tEqualMapStringString(ns.NodeLabels, other.NodeLabels) &&\n\t\tEqualMapStringString(ns.EngineLabels, other.EngineLabels) &&\n\t\t(ns.Role == other.Role) &&\n\t\t(ns.Availability == other.Availability)\n}", "func (e *Expr) Equal(f *Expr) bool {\n\tif e.Kind == ExprError {\n\t\treturn false\n\t}\n\tif e.Kind != f.Kind {\n\t\treturn false\n\t}\n\tswitch e.Kind {\n\tdefault:\n\t\tpanic(\"error\")\n\tcase ExprIdent:\n\t\treturn e.Ident == f.Ident\n\tcase ExprBinop:\n\t\treturn e.Left.Equal(f.Left) && e.Right.Equal(f.Right)\n\tcase ExprUnop:\n\t\treturn e.Left.Equal(f.Left)\n\tcase ExprLit:\n\t\treturn e.Type.Equal(f.Type) && values.Equal(e.Val, f.Val)\n\tcase ExprAscribe:\n\t\treturn e.Left.Equal(f.Left) && e.Type.Equal(f.Type)\n\tcase ExprBlock:\n\t\tif len(e.Decls) != len(f.Decls) {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range e.Decls {\n\t\t\tif !e.Decls[i].Equal(f.Decls[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn e.Left.Equal(f.Left)\n\tcase ExprFunc:\n\t\tif len(e.Args) != len(f.Args) {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range e.Args {\n\t\t\tif !e.Args[i].Equal(f.Args[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn e.Left.Equal(f.Left)\n\tcase ExprList:\n\t\tif len(e.List) != len(f.List) {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range e.List {\n\t\t\tif !e.List[i].Equal(f.List[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tcase ExprTuple:\n\t\tif len(e.Fields) != len(f.Fields) {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range e.Fields {\n\t\t\tif !e.Fields[i].Expr.Equal(f.Fields[i].Expr) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tcase ExprStruct:\n\t\tif len(e.Fields) != len(f.Fields) {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range e.Fields {\n\t\t\tif !e.Fields[i].Equal(f.Fields[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tcase ExprMap:\n\t\tif len(e.Map) != len(f.Map) {\n\t\t\treturn false\n\t\t}\n\t\t// TODO(marius: This is really ugly (and quadratic!);\n\t\t// it suggests we should store map literals differently.\n\t\tfor ek, ev := range e.Map {\n\t\t\tvar fk, fv *Expr\n\t\t\tfor k, v := range f.Map {\n\t\t\t\tif ek.Equal(k) {\n\t\t\t\t\tfk, fv = k, v\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif fk == nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif !ev.Equal(fv) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tcase ExprVariant:\n\t\tswitch {\n\t\tcase e.Ident != f.Ident:\n\t\t\treturn false\n\t\tcase e.Left == nil && f.Left == nil:\n\t\t\treturn true\n\t\tcase e.Left == nil || f.Left == nil:\n\t\t\t// One is nil, but the other is not, so they're not equal.\n\t\t\treturn false\n\t\tdefault:\n\t\t\treturn e.Left.Equal(f.Left)\n\t\t}\n\tcase ExprExec:\n\t\tif len(e.Decls) != len(f.Decls) {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range e.Decls {\n\t\t\tif !e.Decls[i].Equal(f.Decls[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tif !e.Type.Equal(f.Type) {\n\t\t\treturn false\n\t\t}\n\t\treturn e.Template == f.Template\n\tcase ExprCond:\n\t\treturn e.Cond.Equal(f.Cond) && e.Left.Equal(f.Left) && e.Right.Equal(f.Right)\n\tcase ExprSwitch:\n\t\tif !e.Left.Equal(f.Left) {\n\t\t\treturn false\n\t\t}\n\t\tif len(e.CaseClauses) != len(f.CaseClauses) {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range e.CaseClauses {\n\t\t\tif !e.CaseClauses[i].Equal(f.CaseClauses[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n}", "func (chatRoom *ChatRoom) equals(cr *ChatRoom) bool {\n if chatRoom.name != cr.name {\n return false\n } else if chatRoom.connectionCount != cr.connectionCount {\n return false\n }\n for guestKey , guestsValue := range chatRoom.guests {\n guest := cr.guests[guestKey]\n if !guest.equals(&guestsValue) {\n return false\n }\n }\n return true\n}", "func (as RomSlice) Equals(bs RomSlice) bool {\n\tif len(as) != len(bs) {\n\t\treturn false\n\t}\n\n\tfor i, ag := range as {\n\t\tif !bs[i].Equals(ag) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (recv *ParamSpecUChar) Equals(other *ParamSpecUChar) bool {\n\treturn other.ToC() == recv.ToC()\n}", "func (rs Ranges) Equal(bs Ranges) bool {\n\tif len(rs) != len(bs) {\n\t\treturn false\n\t}\n\tif rs == nil || bs == nil {\n\t\treturn true\n\t}\n\tfor i := range rs {\n\t\tif rs[i] != bs[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (t Token) Equal(v Token) bool {\n\treturn t.ID == v.ID &&\n\t\tt.Class == v.Class &&\n\t\tt.Surface == v.Surface\n}", "func (l *BigInt) Equal(r Value) bool {\n\tif r, ok := r.(*BigInt); ok {\n\t\tlb := (*big.Int)(l)\n\t\trb := (*big.Int)(r)\n\t\treturn lb.Cmp(rb) == 0\n\t}\n\treturn false\n}", "func (gdt *Vector3) OperatorEqual(b Vector3) Bool {\n\targ0 := gdt.getBase()\n\targ1 := b.getBase()\n\n\tret := C.go_godot_vector3_operator_equal(GDNative.api, arg0, arg1)\n\n\treturn Bool(ret)\n}", "func (rm fakeRESTMapper) Equal(other fakeRESTMapper) bool {\n\treturn cmp.Equal(rm.defaultGroupVersions, other.defaultGroupVersions)\n}", "func (r Resource) Equal(other Resource) bool {\n\tswitch {\n\tcase r.ID != other.ID,\n\t\tr.Status != other.Status,\n\t\t!r.Since.Equal(other.Since):\n\t\treturn false\n\tdefault:\n\t\treturn true\n\t}\n}", "func (r RoleARN) Equals(other RoleARN) bool {\n\treturn r.value == other.value\n}", "func (p Pipeline) Equal(other Pipeline) bool {\n\t// keep in sync with OpUnion.Equal as go is terrible at inlining anything with a loop\n\tif len(p.Operations) != len(other.Operations) {\n\t\treturn false\n\t}\n\n\tfor i := 0; i < len(p.Operations); i++ {\n\t\tif p.Operations[i].Type != other.Operations[i].Type {\n\t\t\treturn false\n\t\t}\n\t\t//nolint:exhaustive\n\t\tswitch p.Operations[i].Type {\n\t\tcase pipeline.RollupOpType:\n\t\t\tif !p.Operations[i].Rollup.Equal(other.Operations[i].Rollup) {\n\t\t\t\treturn false\n\t\t\t}\n\t\tcase pipeline.TransformationOpType:\n\t\t\tif p.Operations[i].Transformation.Type != other.Operations[i].Transformation.Type {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true\n}", "func (expr *Expr) Equal(other *Expr) bool {\n\treturn expr.Compare(other) == 0\n}", "func (s *User) Equal(r *User) bool {\n\tif s.ID != r.ID {\n\t\treturn false\n\t}\n\tif s.Name != r.Name {\n\t\treturn false\n\t}\n\tif s.EMail != r.EMail {\n\t\treturn false\n\t}\n\tif len(s.Group) != len(r.Group) {\n\t\treturn false\n\t}\n\n\tfor idx := 0; idx < len(s.Group); idx++ {\n\t\tl := s.Group[idx]\n\t\tr := r.Group[idx]\n\t\tif !l.Equal(r) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func Equal(left, right *big.Int) bool { return left.Cmp(right) == 0 }", "func RoutesEqual(r1, r2 *Route) bool {\n\tif r1 == nil || r2 == nil {\n\t\treturn (r1 == nil) == (r2 == nil)\n\t}\n\tif r1.Protocol != r2.Protocol {\n\t\treturn false\n\t}\n\t// Convert addresses to ensure canonical representation\n\t_, dst1, err := net.ParseCIDR(r1.Dst)\n\tif err != nil {\n\t\treturn false\n\t}\n\t_, dst2, err := net.ParseCIDR(r2.Dst)\n\tif err != nil {\n\t\treturn false\n\t}\n\t// (I am sure there is a faster way)\n\tif dst1.String() != dst2.String() {\n\t\treturn false\n\t}\n\tgw1 := net.ParseIP(r1.Gateway)\n\tif gw1 == nil {\n\t\treturn false\n\t}\n\treturn gw1.Equal(net.ParseIP(r2.Gateway))\n}", "func CompareRType(pos src.XPos, n *ir.BinaryExpr) ir.Node {\n\tassertOp2(n, ir.OEQ, ir.ONE)\n\tbase.AssertfAt(n.X.Type().IsInterface() != n.Y.Type().IsInterface(), n.Pos(), \"expect mixed interface and non-interface, have %L and %L\", n.X, n.Y)\n\tif hasRType(n, n.RType, \"RType\") {\n\t\treturn n.RType\n\t}\n\ttyp := n.X.Type()\n\tif typ.IsInterface() {\n\t\ttyp = n.Y.Type()\n\t}\n\treturn concreteRType(pos, typ)\n}", "func EqScanOp(op *ScanOp) gomock.Matcher {\n\tfields := make(map[string]bool, len(op.fieldsToRead))\n\tfor _, field := range op.fieldsToRead {\n\t\tfields[field] = true\n\t}\n\n\treturn scanOpMatcher{\n\t\tlimit: op.limit,\n\t\ttoken: op.token,\n\t\tfields: fields,\n\t\ttyp: reflect.TypeOf(op.object).Elem(),\n\t}\n}", "func (res *Result) Equal(expected [][]interface{}) bool {\n\tresBuff := bytes.NewBufferString(\"\")\n\tfor _, row := range res.rows {\n\t\t_, _ = fmt.Fprintf(resBuff, \"%s\\n\", row)\n\t}\n\n\tneedBuff := bytes.NewBufferString(\"\")\n\tfor _, row := range expected {\n\t\t_, _ = fmt.Fprintf(needBuff, \"%s\\n\", row)\n\t}\n\n\treturn bytes.Equal(needBuff.Bytes(), resBuff.Bytes())\n}", "func (c *cell) equivalent(other *cell) bool {\n\treturn c.path == other.path &&\n\t\tc.subdom == other.subdom &&\n\t\tc.proto == other.proto\n}", "func (row Location) Equals(rhs Location) bool {\n\tif row.DatasetID != rhs.DatasetID {\n\t\treturn false\n\t}\n\tif row.LocationHash != rhs.LocationHash {\n\t\treturn false\n\t}\n\tif row.LocationString != rhs.LocationString {\n\t\treturn false\n\t}\n\tif row.ParsedCountryCode != rhs.ParsedCountryCode {\n\t\treturn false\n\t}\n\tif row.ParsedPostalCode != rhs.ParsedPostalCode {\n\t\treturn false\n\t}\n\tif !bytes.Equal(row.GeonamesPostalCodes, rhs.GeonamesPostalCodes) {\n\t\treturn false\n\t}\n\n\tif row.GeonameID != nil || rhs.GeonameID != nil {\n\t\tif row.GeonameID == nil || rhs.GeonameID == nil {\n\t\t\treturn false\n\t\t}\n\t\tif *row.GeonameID != *rhs.GeonameID {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif !bytes.Equal(row.GeonamesHierarchy, rhs.GeonamesHierarchy) {\n\t\treturn false\n\t}\n\n\tif row.Approved != nil || rhs.Approved != nil {\n\t\tif row.Approved == nil || rhs.Approved == nil {\n\t\t\treturn false\n\t\t}\n\t\tif *row.Approved != *rhs.Approved {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif !row.CreatedAt.Equal(rhs.CreatedAt) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (route *Route) Equal(otherRoute Route) bool {\n switch {\n case route.Id != otherRoute.Id:\n return false\n case route.Pattern != otherRoute.Pattern:\n return false\n case len(route.Handlers) != len(otherRoute.Handlers):\n return false\n default:\n for key, value := range route.Handlers {\n if otherValue, found := otherRoute.Handlers[key]; found {\n if value != otherValue {\n return false\n }\n } else {\n return false\n }\n }\n\n return true\n }\n}", "func eq(o1, o2 interface{}) bool {\n\n\tf1, ok1 := ToFloat(o1)\n\tf2, ok2 := ToFloat(o2)\n\tif ok1 && ok2 {\n\t\treturn f1 == f2\n\t}\n\n\tb1, ok1 := ToBool(o1)\n\tb2, ok1 := ToBool(o2)\n\tif ok1 && ok2 {\n\t\treturn b1 == b2\n\t}\n\n\treturn o1 == o2\n}", "func (lhs ModuleID) Equals(rhs ModuleID) bool {\n\treturn ((int32)(lhs) == (int32)(rhs))\n}", "func equalClosed(ctx *OpContext, x, y *Vertex, flags Flag) bool {\n\treturn verifyStructs(x, y, flags) && verifyStructs(y, x, flags)\n}", "func (n *CommandNode) IsEqual(other Node) bool {\n\tif !n.equal(n, other) {\n\t\treturn false\n\t}\n\n\to, ok := other.(*CommandNode)\n\n\tif !ok {\n\t\tdebug(\"Failed to convert to CommandNode\")\n\t\treturn false\n\t}\n\n\tif n.multi != o.multi {\n\t\tdebug(\"Command multiline differs.\")\n\t\treturn false\n\t}\n\n\tif len(n.args) != len(o.args) {\n\t\tdebug(\"Command argument length differs: %d (%+v) != %d (%+v)\",\n\t\t\tlen(n.args), n.args, len(o.args), o.args)\n\t\treturn false\n\t}\n\n\tfor i := 0; i < len(n.args); i++ {\n\t\tif !n.args[i].IsEqual(o.args[i]) {\n\t\t\tdebug(\"Argument %d differs. '%s' != '%s'\", i, n.args[i],\n\t\t\t\to.args[i])\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif len(n.redirs) != len(o.redirs) {\n\t\tdebug(\"Number of redirects differs. %d != %d\", len(n.redirs),\n\t\t\tlen(o.redirs))\n\t\treturn false\n\t}\n\n\tfor i := 0; i < len(n.redirs); i++ {\n\t\tif n.redirs[i] == o.redirs[i] {\n\t\t\tcontinue\n\t\t} else if n.redirs[i] != nil &&\n\t\t\t!n.redirs[i].IsEqual(o.redirs[i]) {\n\t\t\tdebug(\"Redirect differs... %s != %s\", n.redirs[i],\n\t\t\t\to.redirs[i])\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn n.name == o.name\n}", "func (p Pair) EqualIncludeReciprocal(cPair Pair) bool {\n\tif p.Base.Item == cPair.Base.Item &&\n\t\tp.Quote.Item == cPair.Quote.Item ||\n\t\tp.Base.Item == cPair.Quote.Item &&\n\t\t\tp.Quote.Item == cPair.Base.Item {\n\t\treturn true\n\t}\n\treturn false\n}", "func (b Bytes64) Equal(o Bytes64) bool { return bytes.Equal(b.Bytes(), o.Bytes()) }", "func (reader *Reader) IsEqual(other *Reader) bool {\n\tif reader == other {\n\t\treturn true\n\t}\n\tif reader.Input != other.Input {\n\t\treturn false\n\t}\n\n\tl, r := len(reader.InputMetadata), len(other.InputMetadata)\n\n\tif l != r {\n\t\treturn false\n\t}\n\n\tfor a := 0; a < l; a++ {\n\t\tif !reader.InputMetadata[a].IsEqual(&other.InputMetadata[a]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (n *Node) IsEqual(n2 *Node) bool {\n\treturn n.ID == n2.ID\n}", "func (fOpenCfg *FileOpenConfig) Equal(fOpStat2 *FileOpenConfig) bool {\n\n if fOpenCfg.fileOpenModes == nil {\n fOpenCfg.fileOpenModes = make([]FileOpenMode, 0)\n }\n\n if fOpStat2.fileOpenModes == nil {\n fOpStat2.fileOpenModes = make([]FileOpenMode, 0)\n }\n\n if fOpenCfg.isInitialized != fOpStat2.isInitialized {\n return false\n }\n\n lenfOpStat1 := len(fOpenCfg.fileOpenModes)\n\n lenfOpStat2 := len(fOpStat2.fileOpenModes)\n\n if lenfOpStat1 != lenfOpStat2 {\n return false\n }\n\n if fOpenCfg.fileOpenType != fOpStat2.fileOpenType {\n return false\n }\n\n for i := 0; i < lenfOpStat1; i++ {\n isFound := false\n\n for j := 0; j < lenfOpStat1; j++ {\n if fOpStat2.fileOpenModes[j] == fOpenCfg.fileOpenModes[i] {\n isFound = true\n }\n }\n\n if !isFound {\n return false\n }\n }\n\n return true\n}", "func (id ArrayNodeID) Equals(other NodeID) bool {\n\tif id.Base() != other.Base() || id.Length() != other.Length() {\n\t\treturn false\n\t}\n\tswitch otherId := other.(type) {\n\tcase ArrayNodeID:\n\t\treturn bytes.Equal(id.id, otherId.id)\n\tdefault:\n\t\tfor i := 0; i < id.Length(); i++ {\n\t\t\tif id.GetDigit(i) != other.GetDigit(i) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n}", "func (m Mat2f) Equal(other Mat2f) bool {\n\treturn m.EqualEps(other, Epsilon)\n}", "func EqualsRefOfUnaryExpr(a, b *UnaryExpr) bool {\n\tif a == b {\n\t\treturn true\n\t}\n\tif a == nil || b == nil {\n\t\treturn false\n\t}\n\treturn a.Operator == b.Operator &&\n\t\tEqualsExpr(a.Expr, b.Expr)\n}", "func opUI64Eq(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\toutV0 := ReadUI64(fp, expr.Inputs[0]) == ReadUI64(fp, expr.Inputs[1])\n\tWriteBool(GetFinalOffset(fp, expr.Outputs[0]), outV0)\n}", "func (c Cell) Equal(other Elem) bool {\n\tif o, ok := other.(Cell); ok {\n\t\tif c == Nil || o == Nil {\n\t\t\treturn c == o\n\t\t}\n\n\t\tif !c.car.Equal(o.car) {\n\t\t\treturn false\n\t\t}\n\n\t\t// If this cell is equal, then continue to compare cdrs\n\t\treturn c.cdr.Equal(o.cdr)\n\t}\n\treturn false\n}", "func EqualsRefOfComparisonExpr(a, b *ComparisonExpr) bool {\n\tif a == b {\n\t\treturn true\n\t}\n\tif a == nil || b == nil {\n\t\treturn false\n\t}\n\treturn a.Operator == b.Operator &&\n\t\tEqualsExpr(a.Left, b.Left) &&\n\t\tEqualsExpr(a.Right, b.Right) &&\n\t\tEqualsExpr(a.Escape, b.Escape)\n}", "func (v Operation) Equal(o Operation) bool {\n\treturn v.Account.Value.Equal(o.Account.Value) &&\n\t\tv.Account.Set == o.Account.Set &&\n\t\tv.Amount.Value.Equal(o.Amount.Value) &&\n\t\tv.Amount.Set == o.Amount.Set &&\n\t\tv.CoinChange.Value.Equal(o.CoinChange.Value) &&\n\t\tv.CoinChange.Set == o.CoinChange.Set &&\n\t\tstring(v.Metadata) == string(o.Metadata) &&\n\t\tv.OperationIdentifier.Equal(o.OperationIdentifier) &&\n\t\tlen(v.RelatedOperations) == len(o.RelatedOperations) &&\n\t\toperationIdentifierSliceEqual(v.RelatedOperations, o.RelatedOperations) &&\n\t\tv.Status.Value == o.Status.Value &&\n\t\tv.Status.Set == o.Status.Set &&\n\t\tv.Type == o.Type\n}", "func RORB(ci, mr operand.Op) { ctx.RORB(ci, mr) }", "func TestEquals(t *testing.T) {\n\tt.Parallel()\n\tfor ti, tt := range []struct {\n\t\tm1, m2 MatrixExp\n\t\teq bool\n\t}{\n\t\t{\n\t\t\tm1: GeneralZeros(1, 1),\n\t\t\tm2: GeneralZeros(1, 1),\n\t\t\teq: true,\n\t\t},\n\t\t{\n\t\t\tm1: GeneralZeros(1, 1),\n\t\t\tm2: GeneralZeros(1, 10),\n\t\t\teq: false,\n\t\t},\n\t\t{\n\t\t\tm1: GeneralZeros(10, 1),\n\t\t\tm2: GeneralZeros(1, 1),\n\t\t\teq: false,\n\t\t},\n\t\t{\n\t\t\tm1: GeneralZeros(1, 1),\n\t\t\tm2: GeneralOnes(1, 1),\n\t\t\teq: false,\n\t\t},\n\t} {\n\t\tif v := Equals(tt.m1, tt.m2); v != tt.eq {\n\t\t\tt.Errorf(\"%d: Equals(%v,%v) equals %v, want %v\", ti, tt.m1, tt.m2, v, tt.eq)\n\t\t}\n\t}\n}", "func (f FlowRef) Equal(g FlowRef) bool {\n\treturn f.ID == g.ID && f.Ver == g.Ver\n}", "func (g *Group) Equal(o Owner) bool {\n\tif o == nil {\n\t\treturn false\n\t}\n\treturn g.ID.Equal(o.GetID())\n}", "func (d Position2D) Equals(cmpPos Position2D) bool {\n\treturn d.Row == cmpPos.Row && d.Col == cmpPos.Col\n}", "func (r1 *Route) Equal(r2 *Route) bool {\n\treturn reflect.DeepEqual(r1.Route, r2.Route)\n}" ]
[ "0.6024407", "0.6018192", "0.59420806", "0.5870053", "0.58479685", "0.58146304", "0.57837284", "0.5697854", "0.56931776", "0.5664537", "0.56488144", "0.56458926", "0.55861634", "0.5536329", "0.55293554", "0.54954296", "0.5491323", "0.54790765", "0.54730564", "0.5438022", "0.53518707", "0.5339331", "0.53250754", "0.5321633", "0.53074443", "0.5280798", "0.52597815", "0.52565587", "0.52289546", "0.52289546", "0.5224366", "0.5211172", "0.52008885", "0.51766354", "0.5153288", "0.5140231", "0.5124934", "0.51238775", "0.51224744", "0.5120818", "0.5114865", "0.51018316", "0.50960773", "0.5089486", "0.5070763", "0.50624806", "0.5051443", "0.5049902", "0.5041033", "0.5010225", "0.50067997", "0.50050706", "0.50005156", "0.49993917", "0.49921745", "0.4985486", "0.49558505", "0.49527335", "0.49436203", "0.4939223", "0.4932987", "0.4911392", "0.49058273", "0.4896894", "0.48920637", "0.48905993", "0.48899803", "0.48743895", "0.48695385", "0.48629135", "0.48599494", "0.4858157", "0.48578852", "0.48530543", "0.48468506", "0.48387066", "0.4821378", "0.48122844", "0.48011026", "0.48007542", "0.48006746", "0.4797593", "0.47965595", "0.47953486", "0.47950277", "0.47948056", "0.47913277", "0.4780056", "0.47787705", "0.4776474", "0.4775733", "0.47750193", "0.477403", "0.4769298", "0.47685912", "0.47593728", "0.47575212", "0.4752178", "0.4751635", "0.47505894" ]
0.8562991
0
OperatorGreater returns true if r.rid > rid.rid
func (r *RID) OperatorGreater(rid *RID) bool { if !r.OperatorEqual(rid) && !r.OperatorLess(rid) { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RID) OperatorLess(rid *RID) bool {\n\treturn bool(C.godot_rid_operator_less(r.rid, rid.rid))\n}", "func (r *RID) OperatorEqual(rid *RID) bool {\n\treturn bool(C.godot_rid_operator_equal(r.rid, rid.rid))\n}", "func (r *rankImpl) Greater(a, b string) bool {\n\treturn !r.Equal(a, b) && !r.Less(a, b)\n}", "func (qo *QueryOperator) gt(field string, expr interface{}) func(Object) bool {\n\treturn func(obj Object) bool {\n\t\tval := resolve(obj, field)\n\n\t\tswitch val.(type) {\n\t\tcase int:\n\t\t\treturn reflect.TypeOf(val) == reflect.TypeOf(expr) && val.(int) > expr.(int)\n\t\tcase float32:\n\t\t\treturn reflect.TypeOf(val) == reflect.TypeOf(expr) && val.(float32) > expr.(float32)\n\t\t}\n\t\treturn false\n\t}\n}", "func (receiver StringResult) GreaterThan(right Result) (Result, error) {\n\tif rightStr, ok := convertToString(right); ok {\n\t\treturn BoolResult(string(receiver) > rightStr), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"Cannot determine %T > %T\", receiver, right)\n}", "func AddOpGreaterEqual(jl *JSONLogic) {\n\tjl.AddOperation(string(GE), opCompare(GE))\n}", "func Greater(lhs, rhs Expression) Expression {\n\treturn NewCall(\"greater\", []Expression{lhs, rhs}, nil)\n}", "func AddOpGreaterThan(jl *JSONLogic) {\n\tjl.AddOperation(string(GT), opCompare(GT))\n}", "func JGE(r operand.Op) { ctx.JGE(r) }", "func (z ByRR) Less(i, j int) bool {\n\treturn z.Compare(i, j) < 0\n}", "func (v *RelaxedVersion) GreaterThan(u *RelaxedVersion) bool {\n\treturn v.CompareTo(u) > 0\n}", "func (s *GoSort) GreaterThan(i, j int) bool {\n return s.comparator(s.values[i], s.values[j]) == 1\n}", "func Greater(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Greater\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (id ID) GreaterThan(other ID) bool {\n\treturn !id.LesserThan(other)\n}", "func umodeGreaterThan(l modes.Mode, r modes.Mode) bool {\n\tfor _, mode := range modes.ChannelUserModes {\n\t\tif l == mode && r != mode {\n\t\t\treturn true\n\t\t} else if r == mode {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}", "func RatCmp(x *big.Rat, y *big.Rat,) int", "func (receiver StringResult) GreaterThanEqual(right Result) (Result, error) {\n\tif rightStr, ok := convertToString(right); ok {\n\t\treturn BoolResult(string(receiver) >= rightStr), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"Cannot determine %T >= %T\", receiver, right)\n}", "func (a Vec2) Greater(b Vec2) bool {\n\treturn a.X > b.X && a.Y > b.Y\n}", "func (s *GoSort) GreaterEqualsThan(i, j int) bool {\n return (s.comparator(s.values[i], s.values[j]) == 1 || s.comparator(s.values[i], s.values[j]) == 0)\n}", "func (g *GreaterThanOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tif out, err := g.IsTrue(left, right); err != nil || !out {\n\t\treturn resultFalse, err\n\t}\n\treturn resultTrue, nil\n}", "func (q *Query) Greater(field_name string, val interface{}) *Query {\n\treturn q.addCondition(field_name, query.OpGreater, val)\n}", "func gt(lhs, rhs semantic.Expression) semantic.Expression {\n\treturn &semantic.BinaryOp{Type: semantic.BoolType, LHS: lhs, Operator: ast.OpGT, RHS: rhs}\n}", "func GT(x float64, y float64) bool {\n\treturn (x > y+e)\n}", "func gtir(a, b, c int, r register) register {\n\tif a > r[b] {\n\t\tr[c] = 1\n\t} else {\n\t\tr[c] = 0\n\t}\n\treturn r\n}", "func GreaterThan(x interface{}, y interface{}) (bool, error) {\n\trx := reflect.ValueOf(x)\n\try := reflect.ValueOf(y)\n\t// if reflect.TypeOf(x).Kind() != reflect.TypeOf(y).Kind() {\n\t// \treturn false, fmt.Errorf(\"mismatch %s <-> %s\", rx.Kind(), ry.Kind())\n\t// }\n\tswitch rx.Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn rx.Int() > ry.Convert(rx.Type()).Int(), nil\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\treturn rx.Uint() > ry.Convert(rx.Type()).Uint(), nil\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn rx.Float() > ry.Convert(rx.Type()).Float(), nil\n\tcase reflect.String:\n\t\treturn rx.String() > ry.Convert(rx.Type()).String(), nil\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unexpected %s\", rx.Kind())\n\t}\n}", "func (me Int64Key) GreaterThan(other binarytree.Comparable) bool {\n\treturn me > other.(Int64Key)\n}", "func (v *Version) GreaterThan(o *Version) bool {\n\tswitch {\n\tcase v.Major > o.Major:\n\t\treturn true\n\tcase v.Major < o.Major:\n\t\treturn false\n\tcase v.Minor > o.Minor:\n\t\treturn true\n\tcase v.Minor < o.Minor:\n\t\treturn false\n\t}\n\treturn false\n}", "func JNGE(r operand.Op) { ctx.JNGE(r) }", "func Command_Gt(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 2 {\n\t\trex.ErrorParamCount(\"float:gt\", \"2\")\n\t}\n\n\tresult := params[0].Float64() > params[1].Float64()\n\tif result {\n\t\tscript.RetVal = rex.NewValueBool(true)\n\t\treturn\n\t}\n\tscript.RetVal = rex.NewValueBool(false)\n}", "func (i Int) GT(i2 Int) bool {\n\treturn gt(i.i, i2.i)\n}", "func (n *Node) isGreaterThan(other *Node) bool {\n\treturn n.val.IsGreaterThan(other.val)\n}", "func GT(val interface{}) Q {\n\treturn Q{\"$gt\": val}\n}", "func (g *GreaterEqualOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tif out, err := g.IsTrue(left, right); err != nil || !out {\n\t\treturn resultFalse, err\n\t}\n\treturn resultTrue, nil\n}", "func (GoVersion) GreaterEqThan(version string) bool { return boolResult }", "func GreaterEqual(lhs, rhs Expression) Expression {\n\treturn NewCall(\"greater_equal\", []Expression{lhs, rhs}, nil)\n}", "func JGT(r operand.Op) { ctx.JGT(r) }", "func (p Protocol) Greater(then *Version) bool {\n\treturn p > then.Protocol\n}", "func greaterThan(x1, x2, y1, y2 Word) bool {\n\treturn x1 > y1 || x1 == y1 && x2 > y2\n}", "func (me TComparator) IsGreaterThan() bool { return me.String() == \"GreaterThan\" }", "func (ver *Version) GreaterThan(otherVer *Version) bool {\n if ver.Major > otherVer.Major {\n return true\n }\n if ver.Major < otherVer.Major {\n return false\n }\n\n /* same major */\n if ver.Minor > otherVer.Minor {\n return true\n }\n if ver.Minor < otherVer.Minor {\n return false\n }\n\n /* same minor */\n return ver.Patch > otherVer.Patch\n}", "func (p *BQLoadJobQueryProperty) GreaterThan(value interface{}) *BQLoadJobQueryBuilder {\n\tp.bldr.q = p.bldr.q.Filter(p.name+\" >\", value)\n\tif p.bldr.plugin != nil {\n\t\tp.bldr.plugin.Filter(p.name, \">\", value)\n\t}\n\treturn p.bldr\n}", "func gt(o1, o2 interface{}) (bool, bool) {\n\n\tf1, ok := ToFloat(o1)\n\tif !ok {\n\t\treturn false, false\n\t}\n\n\tf2, ok := ToFloat(o2)\n\tif !ok {\n\t\treturn false, false\n\t}\n\n\treturn f1 > f2, true\n}", "func (GoVersion) GreaterThan(version string) bool { return boolResult }", "func GreaterThan[\n\tValueT typecons.Ordered,\n](refValue ValueT) OrderedConstraint[ValueT] {\n\treturn &relOpConstraint[ValueT]{ref: refValue, op: relOpGreater}\n}", "func (v *APIVersion) GreaterOrEquals(other APIVersion) bool {\n\tif v.Major < other.Major {\n\t\treturn false\n\t}\n\treturn v.Major > other.Major || v.Minor >= other.Minor\n}", "func GreaterEqual(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"GreaterEqual\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (u UUID) GreaterThan(n UUID) bool {\n\tif u.Equal(n) {\n\t\treturn u.Tick > n.Tick\n\t}\n\n\treturn false\n}", "func Compare(x Value, op token.Token, y Value) bool {\n\tif vx, ok := x.(*ratVal); ok {\n\t\tx = vx.Value\n\t}\n\tif vy, ok := y.(*ratVal); ok {\n\t\ty = vy.Value\n\t}\n\treturn constant.Compare(x, gotoken.Token(op), y)\n}", "func CMPXCHGB(r, mr operand.Op) { ctx.CMPXCHGB(r, mr) }", "func RentIDGT(v string) predicate.Rent {\n\treturn predicate.Rent(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRentID), v))\n\t})\n}", "func (b *Bucket) less(r *Bucket) bool {\n\tif b.First || r.First {\n\t\treturn b.First\n\t}\n\treturn b.Signature.less(&r.Signature)\n}", "func OpTimeGreaterThan(lhs OpTime, rhs OpTime) bool {\n\tif lhs.Term != nil && rhs.Term != nil {\n\t\tif *lhs.Term == *rhs.Term {\n\t\t\treturn util.TimestampGreaterThan(lhs.Timestamp, rhs.Timestamp)\n\t\t}\n\t\treturn *lhs.Term > *rhs.Term\n\t}\n\n\treturn util.TimestampGreaterThan(lhs.Timestamp, rhs.Timestamp)\n}", "func (qo *QueryOperator) gte(field string, expr interface{}) func(Object) bool {\n\treturn func(obj Object) bool {\n\t\tval := resolve(obj, field)\n\n\t\tswitch val.(type) {\n\t\tcase int:\n\t\t\treturn reflect.TypeOf(val) == reflect.TypeOf(expr) && val.(int) >= expr.(int)\n\t\tcase float32:\n\t\t\treturn reflect.TypeOf(val) == reflect.TypeOf(expr) && val.(float32) >= expr.(float32)\n\t\t}\n\t\treturn false\n\t}\n}", "func GreaterThanEqual(x interface{}, y interface{}) (bool, error) {\n\trx := reflect.ValueOf(x)\n\try := reflect.ValueOf(y)\n\n\tswitch rx.Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn rx.Int() >= ry.Convert(rx.Type()).Int(), nil\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\treturn rx.Uint() >= ry.Convert(rx.Type()).Uint(), nil\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn rx.Float() >= ry.Convert(rx.Type()).Float(), nil\n\tcase reflect.String:\n\t\treturn rx.String() >= ry.Convert(rx.Type()).String(), nil\n\tcase reflect.Bool:\n\t\treturn rx.Bool() == ry.Convert(rx.Type()).Bool(), nil\n\tdefault:\n\t\treturn reflect.DeepEqual(rx, ry), nil\n\t}\n}", "func (o *FloatObject) Lt(r Object) (bool) {\n return o.Value < r.AsFloat()\n}", "func (eps Accuracy) Greater(a, b float64) bool {\n\treturn math.Max(a, b) == a && math.Abs(a-b) > eps()\n}", "func opI64Gt(expr *CXExpression, fp int) {\n\tvar outB0 bool = (ReadI64(fp, expr.Inputs[0]) > ReadI64(fp, expr.Inputs[1]))\n\tWriteBool(GetOffset_bool(fp, expr.Outputs[0]), outB0)\n}", "func CMPB(amr, imr operand.Op) { ctx.CMPB(amr, imr) }", "func Greater(fieldPtr interface{}, value interface{}) Filter {\n\treturn &ComparisonFilter{\n\t\tLeft: fieldPtr,\n\t\tComparison: \">\",\n\t\tRight: value,\n\t}\n}", "func (c *Comparison) IsBigger() bool {\n\treturn (c.First.Start.Before(c.Second.Start) && c.First.End.After(c.Second.End)) || (c.First.Start.Equal(c.Second.Start) && c.First.End.After(c.Second.End)) || (c.First.Start.Before(c.Second.Start) && c.First.End.Equal(c.Second.End))\n}", "func opUI64Gt(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\toutV0 := ReadUI64(fp, expr.Inputs[0]) > ReadUI64(fp, expr.Inputs[1])\n\tWriteBool(GetFinalOffset(fp, expr.Outputs[0]), outV0)\n}", "func IDGT(id int) predicate.RoomStatus {\n\treturn predicate.RoomStatus(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldID), id))\n\t})\n}", "func RankGT(v int) predicate.Transactionfactoritemtmp {\n\treturn predicate.Transactionfactoritemtmp(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRank), v))\n\t})\n}", "func (r Records) Less(i, j int) bool { return r[i].ID < r[j].ID }", "func Greater(v1, v2 string) (bool, error) {\n\tif v1 == \"\" && v2 != \"\" {\n\t\treturn false, nil\n\t}\n\tif v1 != \"\" && v2 == \"\" {\n\t\treturn false, nil\n\t}\n\tsv1, err := semver.Make(v1)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tsv2, err := semver.Make(v2)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn sv1.GTE(sv2), nil\n}", "func (bi Int) GreaterThan(o Int) bool {\n\treturn Cmp(bi, o) > 0\n}", "func GreaterThan(a cty.Value, b cty.Value) (cty.Value, error) {\n\treturn GreaterThanFunc.Call([]cty.Value{a, b})\n}", "func (p *BQLoadJobQueryProperty) GreaterThanOrEqual(value interface{}) *BQLoadJobQueryBuilder {\n\tp.bldr.q = p.bldr.q.Filter(p.name+\" >=\", value)\n\tif p.bldr.plugin != nil {\n\t\tp.bldr.plugin.Filter(p.name, \">=\", value)\n\t}\n\treturn p.bldr\n}", "func (op Operator) Compare(expected, actual interface{}) bool {\n\tswitch op {\n\tcase Eq:\n\t\treturn expected == actual\n\tcase Neq:\n\t\treturn expected != actual\n\tcase Lt:\n\t\treturn expected.(float64) < actual.(float64)\n\tcase Lte:\n\t\treturn expected.(float64) <= actual.(float64)\n\tcase Gt:\n\t\treturn expected.(float64) > actual.(float64)\n\tcase Gte:\n\t\treturn expected.(float64) >= actual.(float64)\n\tcase Btw:\n\t\tvalue := actual.(float64)\n\t\tex := expected.(Range)\n\t\treturn ex.From <= value && value <= ex.To\n\t}\n\n\treturn false\n}", "func (ins *GreaterThanNumber) Execute(registers map[string]*ast.Literal, _ *int, _ *VM) error {\n\tregisters[ins.Result] = asttest.NewLiteralBool(number.Cmp(\n\t\tnumber.NewNumber(registers[ins.Left].Value),\n\t\tnumber.NewNumber(registers[ins.Right].Value),\n\t) > 0)\n\n\treturn nil\n}", "func (pr *ProposerRound) Compare(opr ProposerRound) int {\n\tif pr.Rnd == opr.Rnd {\n\t\treturn pr.ID.CompareTo(opr.ID)\n\t} else if pr.Rnd < opr.Rnd {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func RemoteIDGT(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRemoteID), v))\n\t})\n}", "func gtrr(a, b, c int, r register) register {\n\tif r[a] > r[b] {\n\t\tr[c] = 1\n\t} else {\n\t\tr[c] = 0\n\t}\n\treturn r\n}", "func (me TComparator) IsGreaterThanOrEqualTo() bool { return me.String() == \"GreaterThanOrEqualTo\" }", "func JLT(r operand.Op) { ctx.JLT(r) }", "func (bi Int) GreaterThanEqual(o Int) bool {\n\treturn bi.GreaterThan(o) || bi.Equals(o)\n}", "func greaterThanOrEqual(expected float64, actual float64) assert.Comparison {\n\treturn assert.Comparison(func () bool {\n\t\treturn actual >= expected\n\t})\n}", "func (self *FieldValue) GreaterOrEqual(other *FieldValue) bool {\n\tif self.BoolValue != nil {\n\t\tif other.BoolValue == nil {\n\t\t\treturn false\n\t\t}\n\t\t// true >= false, false >= false\n\t\treturn *self.BoolValue || !*other.BoolValue\n\t}\n\tif self.Int64Value != nil {\n\t\tif other.Int64Value == nil {\n\t\t\treturn other.BoolValue != nil\n\t\t}\n\t\treturn *self.Int64Value >= *other.Int64Value\n\t}\n\tif self.DoubleValue != nil {\n\t\tif other.DoubleValue == nil {\n\t\t\treturn other.BoolValue != nil || other.Int64Value != nil\n\t\t}\n\t\treturn *self.DoubleValue >= *other.DoubleValue\n\t}\n\tif self.StringValue != nil {\n\t\tif other.StringValue == nil {\n\t\t\treturn other.BoolValue != nil || other.Int64Value != nil || other.DoubleValue != nil\n\t\t}\n\t\treturn *self.StringValue >= *other.StringValue\n\t}\n\treturn true\n}", "func greaterThan(expected float64, actual float64) assert.Comparison {\n\treturn assert.Comparison(func () bool {\n\t\treturn actual > expected\n\t})\n}", "func (o FilterFindingCriteriaCriterionOutput) GreaterThan() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FilterFindingCriteriaCriterion) *string { return v.GreaterThan }).(pulumi.StringPtrOutput)\n}", "func RoomNoGT(v string) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRoomNo), v))\n\t})\n}", "func JNLE(r operand.Op) { ctx.JNLE(r) }", "func (r ResultSlice) Less(i, j int) bool {\n\treturn r[i].Calls < r[j].Calls\n}", "func lexGreaterThan(lx *Lexer) stateFn {\n\tif lx.accept(\"=\") {\n\t\tlx.emit(token.GTE)\n\t\treturn lexCode\n\t}\n\n\tlx.emit(token.GTR)\n\treturn lexCode\n}", "func (r ReverseSorter) Less(i, j int) bool {\n\treturn r.Interface.Less(j, i)\n}", "func rcGt(p *TCompiler, code *TCode) (*value.Value, error) {\n\tv := value.Gt(p.regGet(code.B), p.regGet(code.C))\n\tp.regSet(code.A, v)\n\tp.moveNext()\n\treturn v, nil\n}", "func CompareRType(pos src.XPos, n *ir.BinaryExpr) ir.Node {\n\tassertOp2(n, ir.OEQ, ir.ONE)\n\tbase.AssertfAt(n.X.Type().IsInterface() != n.Y.Type().IsInterface(), n.Pos(), \"expect mixed interface and non-interface, have %L and %L\", n.X, n.Y)\n\tif hasRType(n, n.RType, \"RType\") {\n\t\treturn n.RType\n\t}\n\ttyp := n.X.Type()\n\tif typ.IsInterface() {\n\t\ttyp = n.Y.Type()\n\t}\n\treturn concreteRType(pos, typ)\n}", "func resOfCmp(res int, op opcode.Op) int64 {\n\tvar ret bool\n\tswitch op {\n\tcase opcode.LT:\n\t\tret = res < 0\n\tcase opcode.LE:\n\t\tret = res <= 0\n\tcase opcode.EQ, opcode.NullEQ:\n\t\tret = res == 0\n\tcase opcode.GT:\n\t\tret = res > 0\n\tcase opcode.GE:\n\t\tret = res >= 0\n\tcase opcode.NE:\n\t\tret = res != 0\n\tdefault:\n\t\treturn -1\n\t}\n\tres = 1\n\tif !ret {\n\t\tres = 0\n\t}\n\treturn int64(res)\n}", "func op_f64_gt(expr *CXExpression, fp int) {\n\tinp1, inp2, out1 := expr.Inputs[0], expr.Inputs[1], expr.Outputs[0]\n\toutB1 := FromBool(ReadF64(fp, inp1) > ReadF64(fp, inp2))\n\tWriteMemory(GetFinalOffset(fp, out1), outB1)\n}", "func JLE(r operand.Op) { ctx.JLE(r) }", "func (v Version) EqualOrGreater(major, minor int) bool {\n\tif v.Major == major {\n\t\treturn v.Minor >= minor\n\t}\n\n\treturn v.Major > major\n}", "func (vm *VM) opGt(instr []uint16) int {\n\ta, b, c := vm.getAbc(instr)\n\n\tif b > c {\n\t\tvm.registers[a] = 1\n\t} else {\n\t\tvm.registers[a] = 0\n\t}\n\treturn 4\n}", "func CMPXCHGL(r, mr operand.Op) { ctx.CMPXCHGL(r, mr) }", "func (id *ViewId) CompareTo(o *ViewId) int{\n if id.id > o.id {\n return 1\n }else if id.id < o.id {\n reutrn -1\n }else if id.id == o.id {\n return id.createor.CompareTo(o.creator)\n }\n return 0\n}", "func Int64Greater(s []int64, value int64, orEqual bool) Predicate {\n\treturn func(i int) bool {\n\t\tif orEqual {\n\t\t\treturn s[i] >= value\n\t\t}\n\t\treturn s[i] > value\n\t}\n}", "func (v *RelaxedVersion) GreaterThanOrEqual(u *RelaxedVersion) bool {\n\treturn v.CompareTo(u) >= 0\n}", "func CMPQ(mr, imr operand.Op) { ctx.CMPQ(mr, imr) }", "func Greater(first *Message, second *Message) bool {\n\treturn first.DeliveryTime > second.DeliveryTime\n}", "func GreaterThanOrEquals(v1, v2 string) bool {\n\treturn GreaterThan(v1, v2) || Equals(v1, v2)\n}", "func (a Value) Compare(b Value) int {\n\treturn a.Rat().Cmp(b.Rat())\n}" ]
[ "0.68863314", "0.65259564", "0.62530667", "0.5924598", "0.57535017", "0.57462764", "0.57449675", "0.5671612", "0.5662573", "0.565414", "0.56359875", "0.56218874", "0.5611176", "0.5609513", "0.56081253", "0.5581317", "0.5559321", "0.5551074", "0.5532905", "0.5520301", "0.551379", "0.5511573", "0.54943025", "0.54877055", "0.54830366", "0.5479928", "0.5420481", "0.5417343", "0.54118675", "0.5397612", "0.5397263", "0.5395675", "0.5378268", "0.5345867", "0.53426707", "0.53326297", "0.53300637", "0.5309049", "0.52908945", "0.52858216", "0.5281704", "0.52728355", "0.5254545", "0.5254339", "0.52521896", "0.52317876", "0.52193326", "0.52119374", "0.5182801", "0.5147211", "0.51428235", "0.5141719", "0.5138943", "0.5126665", "0.5118439", "0.5117867", "0.51173925", "0.5105187", "0.50913405", "0.5087645", "0.5083017", "0.5081691", "0.5080059", "0.50754464", "0.50620395", "0.5059707", "0.50502604", "0.50274837", "0.5014461", "0.5012616", "0.50054187", "0.5003529", "0.49990138", "0.49974015", "0.498412", "0.49777412", "0.49744546", "0.49666515", "0.49637", "0.49636176", "0.4963109", "0.49566677", "0.49551588", "0.49499238", "0.49424532", "0.49385104", "0.49378082", "0.49331725", "0.49317622", "0.4924596", "0.49217072", "0.49205756", "0.49178147", "0.4912382", "0.49078006", "0.49035326", "0.490266", "0.48946762", "0.4887946", "0.48842925" ]
0.8325795
0
OperatorGreater returns true if r.rid < rid.rid
func (r *RID) OperatorLess(rid *RID) bool { return bool(C.godot_rid_operator_less(r.rid, rid.rid)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RID) OperatorGreater(rid *RID) bool {\n\tif !r.OperatorEqual(rid) && !r.OperatorLess(rid) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (r *RID) OperatorEqual(rid *RID) bool {\n\treturn bool(C.godot_rid_operator_equal(r.rid, rid.rid))\n}", "func (r *rankImpl) Greater(a, b string) bool {\n\treturn !r.Equal(a, b) && !r.Less(a, b)\n}", "func (z ByRR) Less(i, j int) bool {\n\treturn z.Compare(i, j) < 0\n}", "func JGE(r operand.Op) { ctx.JGE(r) }", "func (qo *QueryOperator) gt(field string, expr interface{}) func(Object) bool {\n\treturn func(obj Object) bool {\n\t\tval := resolve(obj, field)\n\n\t\tswitch val.(type) {\n\t\tcase int:\n\t\t\treturn reflect.TypeOf(val) == reflect.TypeOf(expr) && val.(int) > expr.(int)\n\t\tcase float32:\n\t\t\treturn reflect.TypeOf(val) == reflect.TypeOf(expr) && val.(float32) > expr.(float32)\n\t\t}\n\t\treturn false\n\t}\n}", "func RatCmp(x *big.Rat, y *big.Rat,) int", "func AddOpGreaterEqual(jl *JSONLogic) {\n\tjl.AddOperation(string(GE), opCompare(GE))\n}", "func umodeGreaterThan(l modes.Mode, r modes.Mode) bool {\n\tfor _, mode := range modes.ChannelUserModes {\n\t\tif l == mode && r != mode {\n\t\t\treturn true\n\t\t} else if r == mode {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}", "func AddOpGreaterThan(jl *JSONLogic) {\n\tjl.AddOperation(string(GT), opCompare(GT))\n}", "func GT(x float64, y float64) bool {\n\treturn (x > y+e)\n}", "func (v *RelaxedVersion) GreaterThan(u *RelaxedVersion) bool {\n\treturn v.CompareTo(u) > 0\n}", "func (s *GoSort) GreaterThan(i, j int) bool {\n return s.comparator(s.values[i], s.values[j]) == 1\n}", "func Greater(lhs, rhs Expression) Expression {\n\treturn NewCall(\"greater\", []Expression{lhs, rhs}, nil)\n}", "func JNGE(r operand.Op) { ctx.JNGE(r) }", "func (b *Bucket) less(r *Bucket) bool {\n\tif b.First || r.First {\n\t\treturn b.First\n\t}\n\treturn b.Signature.less(&r.Signature)\n}", "func gtir(a, b, c int, r register) register {\n\tif a > r[b] {\n\t\tr[c] = 1\n\t} else {\n\t\tr[c] = 0\n\t}\n\treturn r\n}", "func (receiver StringResult) GreaterThan(right Result) (Result, error) {\n\tif rightStr, ok := convertToString(right); ok {\n\t\treturn BoolResult(string(receiver) > rightStr), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"Cannot determine %T > %T\", receiver, right)\n}", "func (g *GreaterThanOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tif out, err := g.IsTrue(left, right); err != nil || !out {\n\t\treturn resultFalse, err\n\t}\n\treturn resultTrue, nil\n}", "func (a Vec2) Greater(b Vec2) bool {\n\treturn a.X > b.X && a.Y > b.Y\n}", "func (id ID) GreaterThan(other ID) bool {\n\treturn !id.LesserThan(other)\n}", "func (s *GoSort) GreaterEqualsThan(i, j int) bool {\n return (s.comparator(s.values[i], s.values[j]) == 1 || s.comparator(s.values[i], s.values[j]) == 0)\n}", "func (r Records) Less(i, j int) bool { return r[i].ID < r[j].ID }", "func (i Int) GT(i2 Int) bool {\n\treturn gt(i.i, i2.i)\n}", "func gt(lhs, rhs semantic.Expression) semantic.Expression {\n\treturn &semantic.BinaryOp{Type: semantic.BoolType, LHS: lhs, Operator: ast.OpGT, RHS: rhs}\n}", "func (me Int64Key) GreaterThan(other binarytree.Comparable) bool {\n\treturn me > other.(Int64Key)\n}", "func (g *GreaterEqualOp) Evaluate(left, right EvalResult) (EvalResult, error) {\n\tif out, err := g.IsTrue(left, right); err != nil || !out {\n\t\treturn resultFalse, err\n\t}\n\treturn resultTrue, nil\n}", "func (receiver StringResult) GreaterThanEqual(right Result) (Result, error) {\n\tif rightStr, ok := convertToString(right); ok {\n\t\treturn BoolResult(string(receiver) >= rightStr), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"Cannot determine %T >= %T\", receiver, right)\n}", "func Greater(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Greater\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func Compare(x Value, op token.Token, y Value) bool {\n\tif vx, ok := x.(*ratVal); ok {\n\t\tx = vx.Value\n\t}\n\tif vy, ok := y.(*ratVal); ok {\n\t\ty = vy.Value\n\t}\n\treturn constant.Compare(x, gotoken.Token(op), y)\n}", "func Command_Gt(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 2 {\n\t\trex.ErrorParamCount(\"float:gt\", \"2\")\n\t}\n\n\tresult := params[0].Float64() > params[1].Float64()\n\tif result {\n\t\tscript.RetVal = rex.NewValueBool(true)\n\t\treturn\n\t}\n\tscript.RetVal = rex.NewValueBool(false)\n}", "func (v *Version) GreaterThan(o *Version) bool {\n\tswitch {\n\tcase v.Major > o.Major:\n\t\treturn true\n\tcase v.Major < o.Major:\n\t\treturn false\n\tcase v.Minor > o.Minor:\n\t\treturn true\n\tcase v.Minor < o.Minor:\n\t\treturn false\n\t}\n\treturn false\n}", "func (o *FloatObject) Lt(r Object) (bool) {\n return o.Value < r.AsFloat()\n}", "func JLT(r operand.Op) { ctx.JLT(r) }", "func GreaterThan(x interface{}, y interface{}) (bool, error) {\n\trx := reflect.ValueOf(x)\n\try := reflect.ValueOf(y)\n\t// if reflect.TypeOf(x).Kind() != reflect.TypeOf(y).Kind() {\n\t// \treturn false, fmt.Errorf(\"mismatch %s <-> %s\", rx.Kind(), ry.Kind())\n\t// }\n\tswitch rx.Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn rx.Int() > ry.Convert(rx.Type()).Int(), nil\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\treturn rx.Uint() > ry.Convert(rx.Type()).Uint(), nil\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn rx.Float() > ry.Convert(rx.Type()).Float(), nil\n\tcase reflect.String:\n\t\treturn rx.String() > ry.Convert(rx.Type()).String(), nil\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unexpected %s\", rx.Kind())\n\t}\n}", "func (r ResultSlice) Less(i, j int) bool {\n\treturn r[i].Calls < r[j].Calls\n}", "func (n *Node) isGreaterThan(other *Node) bool {\n\treturn n.val.IsGreaterThan(other.val)\n}", "func CMPXCHGB(r, mr operand.Op) { ctx.CMPXCHGB(r, mr) }", "func greaterThan(x1, x2, y1, y2 Word) bool {\n\treturn x1 > y1 || x1 == y1 && x2 > y2\n}", "func GT(val interface{}) Q {\n\treturn Q{\"$gt\": val}\n}", "func (v *APIVersion) GreaterOrEquals(other APIVersion) bool {\n\tif v.Major < other.Major {\n\t\treturn false\n\t}\n\treturn v.Major > other.Major || v.Minor >= other.Minor\n}", "func (q *Query) Greater(field_name string, val interface{}) *Query {\n\treturn q.addCondition(field_name, query.OpGreater, val)\n}", "func (pr *ProposerRound) Compare(opr ProposerRound) int {\n\tif pr.Rnd == opr.Rnd {\n\t\treturn pr.ID.CompareTo(opr.ID)\n\t} else if pr.Rnd < opr.Rnd {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (qo *QueryOperator) gte(field string, expr interface{}) func(Object) bool {\n\treturn func(obj Object) bool {\n\t\tval := resolve(obj, field)\n\n\t\tswitch val.(type) {\n\t\tcase int:\n\t\t\treturn reflect.TypeOf(val) == reflect.TypeOf(expr) && val.(int) >= expr.(int)\n\t\tcase float32:\n\t\t\treturn reflect.TypeOf(val) == reflect.TypeOf(expr) && val.(float32) >= expr.(float32)\n\t\t}\n\t\treturn false\n\t}\n}", "func JGT(r operand.Op) { ctx.JGT(r) }", "func (p Protocol) Greater(then *Version) bool {\n\treturn p > then.Protocol\n}", "func (me TComparator) IsGreaterThan() bool { return me.String() == \"GreaterThan\" }", "func (c *Comparison) IsBigger() bool {\n\treturn (c.First.Start.Before(c.Second.Start) && c.First.End.After(c.Second.End)) || (c.First.Start.Equal(c.Second.Start) && c.First.End.After(c.Second.End)) || (c.First.Start.Before(c.Second.Start) && c.First.End.Equal(c.Second.End))\n}", "func (GoVersion) GreaterEqThan(version string) bool { return boolResult }", "func (ver *Version) GreaterThan(otherVer *Version) bool {\n if ver.Major > otherVer.Major {\n return true\n }\n if ver.Major < otherVer.Major {\n return false\n }\n\n /* same major */\n if ver.Minor > otherVer.Minor {\n return true\n }\n if ver.Minor < otherVer.Minor {\n return false\n }\n\n /* same minor */\n return ver.Patch > otherVer.Patch\n}", "func (r ReverseSorter) Less(i, j int) bool {\n\treturn r.Interface.Less(j, i)\n}", "func CMPB(amr, imr operand.Op) { ctx.CMPB(amr, imr) }", "func GE(x,y string) string {\n\treturn x + ` >= ` + y\n}", "func (op Operator) Compare(expected, actual interface{}) bool {\n\tswitch op {\n\tcase Eq:\n\t\treturn expected == actual\n\tcase Neq:\n\t\treturn expected != actual\n\tcase Lt:\n\t\treturn expected.(float64) < actual.(float64)\n\tcase Lte:\n\t\treturn expected.(float64) <= actual.(float64)\n\tcase Gt:\n\t\treturn expected.(float64) > actual.(float64)\n\tcase Gte:\n\t\treturn expected.(float64) >= actual.(float64)\n\tcase Btw:\n\t\tvalue := actual.(float64)\n\t\tex := expected.(Range)\n\t\treturn ex.From <= value && value <= ex.To\n\t}\n\n\treturn false\n}", "func JNLE(r operand.Op) { ctx.JNLE(r) }", "func (i1 Int) Less(i2 freetree.Comparable) bool { return i1 < i2.(Int) }", "func GreaterEqual(lhs, rhs Expression) Expression {\n\treturn NewCall(\"greater_equal\", []Expression{lhs, rhs}, nil)\n}", "func gt(o1, o2 interface{}) (bool, bool) {\n\n\tf1, ok := ToFloat(o1)\n\tif !ok {\n\t\treturn false, false\n\t}\n\n\tf2, ok := ToFloat(o2)\n\tif !ok {\n\t\treturn false, false\n\t}\n\n\treturn f1 > f2, true\n}", "func resOfCmp(res int, op opcode.Op) int64 {\n\tvar ret bool\n\tswitch op {\n\tcase opcode.LT:\n\t\tret = res < 0\n\tcase opcode.LE:\n\t\tret = res <= 0\n\tcase opcode.EQ, opcode.NullEQ:\n\t\tret = res == 0\n\tcase opcode.GT:\n\t\tret = res > 0\n\tcase opcode.GE:\n\t\tret = res >= 0\n\tcase opcode.NE:\n\t\tret = res != 0\n\tdefault:\n\t\treturn -1\n\t}\n\tres = 1\n\tif !ret {\n\t\tres = 0\n\t}\n\treturn int64(res)\n}", "func RentIDGT(v string) predicate.Rent {\n\treturn predicate.Rent(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRentID), v))\n\t})\n}", "func (a Uint64) Less(b btree.Item) bool {\n\treturn a < b.(Uint64)\n}", "func (p *BQLoadJobQueryProperty) GreaterThan(value interface{}) *BQLoadJobQueryBuilder {\n\tp.bldr.q = p.bldr.q.Filter(p.name+\" >\", value)\n\tif p.bldr.plugin != nil {\n\t\tp.bldr.plugin.Filter(p.name, \">\", value)\n\t}\n\treturn p.bldr\n}", "func (v ResourceNodes) Less(i, j int) bool {\n\treturn v[i].Tokens.LT(v[j].Tokens)\n}", "func gtrr(a, b, c int, r register) register {\n\tif r[a] > r[b] {\n\t\tr[c] = 1\n\t} else {\n\t\tr[c] = 0\n\t}\n\treturn r\n}", "func (d Drones) Less(i, j int) bool {\n\treturn d[i].AvailableIn() < d[j].AvailableIn()\n}", "func JLE(r operand.Op) { ctx.JLE(r) }", "func (GoVersion) GreaterThan(version string) bool { return boolResult }", "func (u UUID) GreaterThan(n UUID) bool {\n\tif u.Equal(n) {\n\t\treturn u.Tick > n.Tick\n\t}\n\n\treturn false\n}", "func opUI64Gt(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\toutV0 := ReadUI64(fp, expr.Inputs[0]) > ReadUI64(fp, expr.Inputs[1])\n\tWriteBool(GetFinalOffset(fp, expr.Outputs[0]), outV0)\n}", "func (sr ScoredRange) Less(i, j int) bool { return sr[i].Score < sr[j].Score }", "func opI64Gt(expr *CXExpression, fp int) {\n\tvar outB0 bool = (ReadI64(fp, expr.Inputs[0]) > ReadI64(fp, expr.Inputs[1]))\n\tWriteBool(GetOffset_bool(fp, expr.Outputs[0]), outB0)\n}", "func Command_Lt(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 2 {\n\t\trex.ErrorParamCount(\"float:lt\", \"2\")\n\t}\n\n\tresult := params[0].Float64() < params[1].Float64()\n\tif result {\n\t\tscript.RetVal = rex.NewValueBool(true)\n\t\treturn\n\t}\n\tscript.RetVal = rex.NewValueBool(false)\n}", "func (m *Multi) Less(i, j int) bool {\n\tp, q := m.Rows[i], m.Rows[j]\n\t// Try all but the last comparison.\n\tvar k int\n\tfor k = 0; k < len(m.Indices)-1; k++ {\n\t\tindex, reverse := getReverse(m.Indices[k])\n\t\tswitch {\n\t\tcase get(p, index) < get(q, index):\n\t\t\t// p < q, so we have a decision.\n\t\t\treturn !reverse\n\t\tcase get(q, index) < get(p, index):\n\t\t\t// p > q, so we have a decision.\n\t\t\treturn reverse\n\t\t}\n\t\t// p == q; try the next comparison.\n\t}\n\t// All comparisons to here said \"equal\", so just return\n\t// whatever the final comparison reports.\n\tindex, reverse := getReverse(m.Indices[k])\n\tif get(p, index) < get(q, index) {\n\t\treturn !reverse\n\t}\n\treturn reverse\n}", "func (eps Accuracy) Greater(a, b float64) bool {\n\treturn math.Max(a, b) == a && math.Abs(a-b) > eps()\n}", "func (qo *QueryOperator) lte(field string, expr interface{}) func(Object) bool {\n\treturn func(obj Object) bool {\n\t\tval := resolve(obj, field)\n\n\t\tswitch val.(type) {\n\t\tcase int:\n\t\t\treturn reflect.TypeOf(val) == reflect.TypeOf(expr) && val.(int) <= expr.(int)\n\t\tcase float32:\n\t\t\treturn reflect.TypeOf(val) == reflect.TypeOf(expr) && val.(float32) <= expr.(float32)\n\t\t}\n\t\treturn false\n\t}\n}", "func (v *RelaxedVersion) GreaterThanOrEqual(u *RelaxedVersion) bool {\n\treturn v.CompareTo(u) >= 0\n}", "func (p *BQLoadJobQueryProperty) GreaterThanOrEqual(value interface{}) *BQLoadJobQueryBuilder {\n\tp.bldr.q = p.bldr.q.Filter(p.name+\" >=\", value)\n\tif p.bldr.plugin != nil {\n\t\tp.bldr.plugin.Filter(p.name, \">=\", value)\n\t}\n\treturn p.bldr\n}", "func (r RuneList) Less(i int, j int) bool {\n\treturn r[i] < r[j]\n}", "func IDGT(id int) predicate.RoomStatus {\n\treturn predicate.RoomStatus(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldID), id))\n\t})\n}", "func (self *FieldValue) GreaterOrEqual(other *FieldValue) bool {\n\tif self.BoolValue != nil {\n\t\tif other.BoolValue == nil {\n\t\t\treturn false\n\t\t}\n\t\t// true >= false, false >= false\n\t\treturn *self.BoolValue || !*other.BoolValue\n\t}\n\tif self.Int64Value != nil {\n\t\tif other.Int64Value == nil {\n\t\t\treturn other.BoolValue != nil\n\t\t}\n\t\treturn *self.Int64Value >= *other.Int64Value\n\t}\n\tif self.DoubleValue != nil {\n\t\tif other.DoubleValue == nil {\n\t\t\treturn other.BoolValue != nil || other.Int64Value != nil\n\t\t}\n\t\treturn *self.DoubleValue >= *other.DoubleValue\n\t}\n\tif self.StringValue != nil {\n\t\tif other.StringValue == nil {\n\t\t\treturn other.BoolValue != nil || other.Int64Value != nil || other.DoubleValue != nil\n\t\t}\n\t\treturn *self.StringValue >= *other.StringValue\n\t}\n\treturn true\n}", "func (r *aggloSorter) Less(i, j int) bool {\n\treturn r.lambda[r.perm[i]] < r.lambda[r.perm[j]]\n}", "func (id *ViewId) CompareTo(o *ViewId) int{\n if id.id > o.id {\n return 1\n }else if id.id < o.id {\n reutrn -1\n }else if id.id == o.id {\n return id.createor.CompareTo(o.creator)\n }\n return 0\n}", "func RankGT(v int) predicate.Transactionfactoritemtmp {\n\treturn predicate.Transactionfactoritemtmp(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRank), v))\n\t})\n}", "func OpTimeGreaterThan(lhs OpTime, rhs OpTime) bool {\n\tif lhs.Term != nil && rhs.Term != nil {\n\t\tif *lhs.Term == *rhs.Term {\n\t\t\treturn util.TimestampGreaterThan(lhs.Timestamp, rhs.Timestamp)\n\t\t}\n\t\treturn *lhs.Term > *rhs.Term\n\t}\n\n\treturn util.TimestampGreaterThan(lhs.Timestamp, rhs.Timestamp)\n}", "func CMPXCHGL(r, mr operand.Op) { ctx.CMPXCHGL(r, mr) }", "func RoomNoGT(v string) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRoomNo), v))\n\t})\n}", "func (cur *cursor) compare(other *cursor) int {\n\treturn compareCursors(cur, other)\n}", "func GreaterThan[\n\tValueT typecons.Ordered,\n](refValue ValueT) OrderedConstraint[ValueT] {\n\treturn &relOpConstraint[ValueT]{ref: refValue, op: relOpGreater}\n}", "func (br byRevision) Less(i, j int) bool {\n\tif br[i].Revision == br[j].Revision {\n\t\tif br[j].CreationTimestamp.Equal(&br[i].CreationTimestamp) {\n\t\t\treturn br[i].Name < br[j].Name\n\t\t}\n\t\treturn br[j].CreationTimestamp.After(br[i].CreationTimestamp.Time)\n\t}\n\treturn br[i].Revision < br[j].Revision\n}", "func (bi Int) GreaterThan(o Int) bool {\n\treturn Cmp(bi, o) > 0\n}", "func (sv *sorterValues) RowLess(ri, rj sqlbase.EncDatumRow) bool {\n\tcmp, err := ri.Compare(&sv.alloc, sv.ordering, rj)\n\tif err != nil {\n\t\tsv.err = err\n\t\treturn false\n\t}\n\n\treturn cmp < 0\n}", "func (me TComparator) IsGreaterThanOrEqualTo() bool { return me.String() == \"GreaterThanOrEqualTo\" }", "func (a Value) Compare(b Value) int {\n\treturn a.Rat().Cmp(b.Rat())\n}", "func GreaterEqual(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"GreaterEqual\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (ins *GreaterThanNumber) Execute(registers map[string]*ast.Literal, _ *int, _ *VM) error {\n\tregisters[ins.Result] = asttest.NewLiteralBool(number.Cmp(\n\t\tnumber.NewNumber(registers[ins.Left].Value),\n\t\tnumber.NewNumber(registers[ins.Right].Value),\n\t) > 0)\n\n\treturn nil\n}", "func Int64Greater(s []int64, value int64, orEqual bool) Predicate {\n\treturn func(i int) bool {\n\t\tif orEqual {\n\t\t\treturn s[i] >= value\n\t\t}\n\t\treturn s[i] > value\n\t}\n}", "func CMPQ(mr, imr operand.Op) { ctx.CMPQ(mr, imr) }", "func (o *Range) IsGreaterAllowed() gdnative.Bool {\n\t//log.Println(\"Calling Range.IsGreaterAllowed()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"Range\", \"is_greater_allowed\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func CompareRType(pos src.XPos, n *ir.BinaryExpr) ir.Node {\n\tassertOp2(n, ir.OEQ, ir.ONE)\n\tbase.AssertfAt(n.X.Type().IsInterface() != n.Y.Type().IsInterface(), n.Pos(), \"expect mixed interface and non-interface, have %L and %L\", n.X, n.Y)\n\tif hasRType(n, n.RType, \"RType\") {\n\t\treturn n.RType\n\t}\n\ttyp := n.X.Type()\n\tif typ.IsInterface() {\n\t\ttyp = n.Y.Type()\n\t}\n\treturn concreteRType(pos, typ)\n}", "func greaterThanOrEqual(expected float64, actual float64) assert.Comparison {\n\treturn assert.Comparison(func () bool {\n\t\treturn actual >= expected\n\t})\n}" ]
[ "0.8168883", "0.6583049", "0.6038422", "0.5917402", "0.5654049", "0.5653403", "0.56046444", "0.56041455", "0.55115986", "0.5439228", "0.5436003", "0.54258037", "0.54186887", "0.5414038", "0.5408929", "0.54033864", "0.53972954", "0.53963655", "0.5390123", "0.538818", "0.5383841", "0.5348096", "0.52947", "0.5292669", "0.52896965", "0.52875113", "0.5282016", "0.5275854", "0.5268215", "0.5216432", "0.520813", "0.519638", "0.51962274", "0.5192674", "0.5178659", "0.5158324", "0.5154925", "0.5150581", "0.514122", "0.5132013", "0.51297045", "0.5125221", "0.5120822", "0.51122266", "0.51009035", "0.51004905", "0.5097808", "0.50948846", "0.5087828", "0.5084181", "0.50685185", "0.50605", "0.50550455", "0.5054662", "0.5053628", "0.50511825", "0.5050877", "0.5048905", "0.50359786", "0.5023969", "0.5020632", "0.501519", "0.5014072", "0.5013713", "0.50120854", "0.5004802", "0.50002617", "0.49880764", "0.496858", "0.49652123", "0.4965206", "0.49532205", "0.49450985", "0.4938314", "0.49343717", "0.4931389", "0.4929466", "0.49280185", "0.49241155", "0.4923121", "0.49224272", "0.49219713", "0.49151242", "0.49137118", "0.49069354", "0.49054432", "0.49049962", "0.48957136", "0.48923677", "0.4887919", "0.4886557", "0.48823315", "0.48789406", "0.48740157", "0.48719105", "0.48710755", "0.48650602", "0.48650062", "0.48575976", "0.48508948" ]
0.7223927
1
GroupsWithConfig applies cfg to the root flagset
func GroupsWithConfig(cfg *config.Config) []cli.Flag { flags := []cli.Flag{ // debug ports are the odd ports &cli.StringFlag{ Name: "debug-addr", Value: flags.OverrideDefaultString(cfg.Reva.Groups.DebugAddr, "0.0.0.0:9161"), Usage: "Address to bind debug server", EnvVars: []string{"STORAGE_GROUPPROVIDER_DEBUG_ADDR"}, Destination: &cfg.Reva.Groups.DebugAddr, }, // Services // Groupprovider &cli.StringFlag{ Name: "network", Value: flags.OverrideDefaultString(cfg.Reva.Groups.GRPCNetwork, "tcp"), Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'", EnvVars: []string{"STORAGE_GROUPPROVIDER_NETWORK"}, Destination: &cfg.Reva.Groups.GRPCNetwork, }, &cli.StringFlag{ Name: "addr", Value: flags.OverrideDefaultString(cfg.Reva.Groups.GRPCAddr, "0.0.0.0:9160"), Usage: "Address to bind storage service", EnvVars: []string{"STORAGE_GROUPPROVIDER_ADDR"}, Destination: &cfg.Reva.Groups.GRPCAddr, }, &cli.StringFlag{ Name: "endpoint", Value: flags.OverrideDefaultString(cfg.Reva.Groups.Endpoint, "localhost:9160"), Usage: "URL to use for the storage service", EnvVars: []string{"STORAGE_GROUPPROVIDER_ENDPOINT"}, Destination: &cfg.Reva.Groups.Endpoint, }, &cli.StringSliceFlag{ Name: "service", Value: cli.NewStringSlice("groupprovider"), // TODO preferences Usage: "--service groupprovider [--service otherservice]", EnvVars: []string{"STORAGE_GROUPPROVIDER_SERVICES"}, }, &cli.StringFlag{ Name: "driver", Value: flags.OverrideDefaultString(cfg.Reva.Groups.Driver, "ldap"), Usage: "group driver: 'json', 'ldap', or 'rest'", EnvVars: []string{"STORAGE_GROUPPROVIDER_DRIVER"}, Destination: &cfg.Reva.Groups.Driver, }, &cli.StringFlag{ Name: "json-config", Value: flags.OverrideDefaultString(cfg.Reva.Groups.JSON, ""), Usage: "Path to groups.json file", EnvVars: []string{"STORAGE_GROUPPROVIDER_JSON"}, Destination: &cfg.Reva.Groups.JSON, }, &cli.IntFlag{ Name: "group-members-cache-expiration", Value: flags.OverrideDefaultInt(cfg.Reva.Groups.GroupMembersCacheExpiration, 5), Usage: "Time in minutes for redis cache expiration.", EnvVars: []string{"STORAGE_GROUP_CACHE_EXPIRATION"}, Destination: &cfg.Reva.Groups.GroupMembersCacheExpiration, }, } flags = append(flags, TracingWithConfig(cfg)...) flags = append(flags, DebugWithConfig(cfg)...) flags = append(flags, SecretWithConfig(cfg)...) flags = append(flags, LDAPWithConfig(cfg)...) flags = append(flags, RestWithConfig(cfg)...) return flags }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GroupsConfigFromStruct(cfg *config.Config) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"core\": map[string]interface{}{\n\t\t\t\"tracing_enabled\": cfg.Tracing.Enabled,\n\t\t\t\"tracing_exporter\": cfg.Tracing.Type,\n\t\t\t\"tracing_endpoint\": cfg.Tracing.Endpoint,\n\t\t\t\"tracing_collector\": cfg.Tracing.Collector,\n\t\t\t\"tracing_service_name\": cfg.Service.Name,\n\t\t},\n\t\t\"shared\": map[string]interface{}{\n\t\t\t\"jwt_secret\": cfg.TokenManager.JWTSecret,\n\t\t\t\"gatewaysvc\": cfg.Reva.Address,\n\t\t\t\"skip_user_groups_in_token\": cfg.SkipUserGroupsInToken,\n\t\t\t\"grpc_client_options\": cfg.Reva.GetGRPCClientConfig(),\n\t\t},\n\t\t\"grpc\": map[string]interface{}{\n\t\t\t\"network\": cfg.GRPC.Protocol,\n\t\t\t\"address\": cfg.GRPC.Addr,\n\t\t\t\"tls_settings\": map[string]interface{}{\n\t\t\t\t\"enabled\": cfg.GRPC.TLS.Enabled,\n\t\t\t\t\"certificate\": cfg.GRPC.TLS.Cert,\n\t\t\t\t\"key\": cfg.GRPC.TLS.Key,\n\t\t\t},\n\t\t\t// TODO build services dynamically\n\t\t\t\"services\": map[string]interface{}{\n\t\t\t\t\"groupprovider\": map[string]interface{}{\n\t\t\t\t\t\"driver\": cfg.Driver,\n\t\t\t\t\t\"drivers\": map[string]interface{}{\n\t\t\t\t\t\t\"json\": map[string]interface{}{\n\t\t\t\t\t\t\t\"groups\": cfg.Drivers.JSON.File,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"ldap\": ldapConfigFromString(cfg.Drivers.LDAP),\n\t\t\t\t\t\t\"rest\": map[string]interface{}{\n\t\t\t\t\t\t\t\"client_id\": cfg.Drivers.REST.ClientID,\n\t\t\t\t\t\t\t\"client_secret\": cfg.Drivers.REST.ClientSecret,\n\t\t\t\t\t\t\t\"redis_address\": cfg.Drivers.REST.RedisAddr,\n\t\t\t\t\t\t\t\"redis_username\": cfg.Drivers.REST.RedisUsername,\n\t\t\t\t\t\t\t\"redis_password\": cfg.Drivers.REST.RedisPassword,\n\t\t\t\t\t\t\t\"id_provider\": cfg.Drivers.REST.IDProvider,\n\t\t\t\t\t\t\t\"api_base_url\": cfg.Drivers.REST.APIBaseURL,\n\t\t\t\t\t\t\t\"oidc_token_endpoint\": cfg.Drivers.REST.OIDCTokenEndpoint,\n\t\t\t\t\t\t\t\"target_api\": cfg.Drivers.REST.TargetAPI,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"interceptors\": map[string]interface{}{\n\t\t\t\t\"prometheus\": map[string]interface{}{\n\t\t\t\t\t\"namespace\": \"ocis\",\n\t\t\t\t\t\"subsystem\": \"groups\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func configureFlags(api *operations.KubernikusAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func configureFlags(api *operations.ConfigManagerAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func configureFlags(api *operations.MonocularAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func RootWithConfig(cfg *config.Config) []cli.Flag {\n\treturn []cli.Flag{\n\t\t&cli.StringFlag{\n\t\t\tName: \"config-file\",\n\t\t\tValue: \"\",\n\t\t\tUsage: \"Path to config file\",\n\t\t\tEnvVars: []string{\"THUMBNAILS_CONFIG_FILE\"},\n\t\t\tDestination: &cfg.File,\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: \"log-level\",\n\t\t\tValue: \"info\",\n\t\t\tUsage: \"Set logging level\",\n\t\t\tEnvVars: []string{\"THUMBNAILS_LOG_LEVEL\"},\n\t\t\tDestination: &cfg.Log.Level,\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"log-pretty\",\n\t\t\tValue: true,\n\t\t\tUsage: \"Enable pretty logging\",\n\t\t\tEnvVars: []string{\"THUMBNAILS_LOG_PRETTY\"},\n\t\t\tDestination: &cfg.Log.Pretty,\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"log-color\",\n\t\t\tValue: true,\n\t\t\tUsage: \"Enable colored logging\",\n\t\t\tEnvVars: []string{\"THUMBNAILS_LOG_COLOR\"},\n\t\t\tDestination: &cfg.Log.Color,\n\t\t},\n\t}\n}", "func configureFlags(api *operations.ConfigServerAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func (b builder) AddConfigGroups() Builder {\n\tb.cmd.AddCommand(NewCmdConfigDelete())\n\tb.cmd.AddCommand(NewCmdConfigUpdate())\n\tb.cmd.AddCommand(NewCmdConfigInit())\n\treturn b\n}", "func configureFlags(api *operations.ControlAsistenciaAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func putConfigGroups(ctx context.Context, cfg *cfgpb.Config, project, hash string) error {\n\tcgLen := len(cfg.GetConfigGroups())\n\tif cgLen == 0 {\n\t\treturn nil\n\t}\n\n\t// Check if there are any existing entities with the current schema version\n\t// such that we can skip updating them.\n\tprojKey := prjcfg.ProjectConfigKey(ctx, project)\n\tentities := make([]*prjcfg.ConfigGroup, cgLen)\n\tfor i, cg := range cfg.GetConfigGroups() {\n\t\tentities[i] = &prjcfg.ConfigGroup{\n\t\t\tID: prjcfg.MakeConfigGroupID(hash, cg.GetName()),\n\t\t\tProject: projKey,\n\t\t}\n\t}\n\terr := datastore.Get(ctx, entities)\n\terrs, ok := err.(errors.MultiError)\n\tswitch {\n\tcase err != nil && !ok:\n\t\treturn errors.Annotate(err, \"failed to check the existence of ConfigGroups\").Tag(transient.Tag).Err()\n\tcase err == nil:\n\t\terrs = make(errors.MultiError, cgLen)\n\t}\n\ttoPut := entities[:0] // re-use the slice\n\tfor i, err := range errs {\n\t\tent := entities[i]\n\t\tswitch {\n\t\tcase err == datastore.ErrNoSuchEntity:\n\t\t\t// proceed to put below.\n\t\tcase err != nil:\n\t\t\treturn errors.Annotate(err, \"failed to check the existence of one of ConfigGroups\").Tag(transient.Tag).Err()\n\t\tcase ent.SchemaVersion != prjcfg.SchemaVersion:\n\t\t\t// Intentionally using != here s.t. rollbacks result in downgrading\n\t\t\t// of the schema. Given that project configs are checked and\n\t\t\t// potentially updated every ~1 minute, this if OK.\n\t\tdefault:\n\t\t\tcontinue // up to date\n\t\t}\n\t\tent.SchemaVersion = prjcfg.SchemaVersion\n\t\tent.DrainingStartTime = cfg.GetDrainingStartTime()\n\t\tent.SubmitOptions = cfg.GetSubmitOptions()\n\t\tent.Content = cfg.GetConfigGroups()[i]\n\t\tent.CQStatusHost = cfg.GetCqStatusHost()\n\t\ttoPut = append(toPut, ent)\n\t}\n\n\tif err := datastore.Put(ctx, toPut); err != nil {\n\t\treturn errors.Annotate(err, \"failed to put ConfigGroups\").Tag(transient.Tag).Err()\n\t}\n\treturn nil\n}", "func configureFlags(api *operations.CalculatorAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func (g *Group) RegisterFlags() *FlagSet {\n\t// run configuration stage\n\tg.f = NewFlagSet(g.name)\n\tg.f.SortFlags = false // keep order of flag registration\n\tg.f.Usage = func() {\n\t\tfmt.Printf(\"Flags:\\n\")\n\t\tg.f.PrintDefaults()\n\t}\n\n\tgFS := NewFlagSet(\"Common Service options\")\n\tgFS.SortFlags = false\n\tgFS.StringVarP(&g.name, \"name\", \"n\", g.name, `name of this service`)\n\tgFS.BoolVar(&g.showRunGroup, \"show-rungroup-units\", false, \"show rungroup units\")\n\tg.f.AddFlagSet(gFS.FlagSet)\n\n\t// register flags from attached Config objects\n\tfs := make([]*FlagSet, len(g.c))\n\tfor idx := range g.c {\n\t\t// a Namer might have been deregistered\n\t\tif g.c[idx] == nil {\n\t\t\tcontinue\n\t\t}\n\t\tg.log.Debug().Str(\"name\", g.c[idx].Name()).Uint32(\"registered\", uint32(idx+1)).Uint32(\"total\", uint32(len(g.c))).Msg(\"register flags\")\n\t\tfs[idx] = g.c[idx].FlagSet()\n\t\tif fs[idx] == nil {\n\t\t\t// no FlagSet returned\n\t\t\tg.log.Debug().Str(\"name\", g.c[idx].Name()).Msg(\"config object did not return a flagset\")\n\t\t\tcontinue\n\t\t}\n\t\tfs[idx].VisitAll(func(f *pflag.Flag) {\n\t\t\tif g.f.Lookup(f.Name) != nil {\n\t\t\t\t// log duplicate flag\n\t\t\t\tg.log.Warn().Str(\"name\", f.Name).Uint32(\"registered\", uint32(idx+1)).Msg(\"ignoring duplicate flag\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tg.f.AddFlag(f)\n\t\t})\n\t}\n\treturn g.f\n}", "func configureFlags(api *operations.JiliAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func configureFlags(api *operations.LolchestWinAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func configureFlags(api *operations.RosterAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func configureFlags(api *operations.OpenPitrixAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func (f flags) Merge(config Config) Config {\n\tif len(f.IncludePkgs) > 0 {\n\t\tconfig.IncludePkgs = f.IncludePkgs\n\t}\n\n\tif len(f.RuleNames) > 0 {\n\t\tfor _, ruleName := range f.RuleNames {\n\t\t\tconfig.Rules = append(config.Rules, Rule{\n\t\t\t\tRuleName: ruleName,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn config\n}", "func SetConfig(config *Config, name ...string) {\n\tgroup := DefaultGroupName\n\tif len(name) > 0 {\n\t\tgroup = name[0]\n\t}\n\tconfigs.Set(group, config)\n\tinstances.Remove(group)\n\n\tintlog.Printf(`SetConfig for group \"%s\": %+v`, group, config)\n}", "func configureFlags(api *operations.OpenMockAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func configureFlags(api *operations.SwaggertestAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func (c *Config) Add(filename string, enable int) (group Group, err error) {\n\tc.init()\n\tfilename, err = filepath.Abs(filename)\n\tif err != nil {\n\t\treturn\n\t}\n\tgroup = Group{}\n\terr = unmarshal(filename, &group)\n\tif err != nil {\n\t\treturn\n\t}\n\tgroup.Filename = filename\n\tgroup.Enable = enable\n\told, ok := c.Groups[group.Name]\n\tif ok {\n\t\terr = fmt.Errorf(\"group %v is exists from %v\", group.Name, old.Filename)\n\t\treturn\n\t}\n\tif len(group.Services) < 1 {\n\t\terr = fmt.Errorf(\"group %v services is empty from %v\", group.Name, group.Filename)\n\t\treturn\n\t}\n\tfor index, service := range group.Services {\n\t\tif len(service.Name) < 1 || len(service.Path) < 1 {\n\t\t\terr = fmt.Errorf(\"group %v %v service name/path is required\", group.Name, index)\n\t\t\treturn\n\t\t}\n\t}\n\tcopy := c.copy()\n\tcopy.Includes[filename] = enable\n\terr = copy.Save()\n\tif err == nil {\n\t\tc.Includes[filename] = enable\n\t\tc.Groups[group.Name] = group\n\t}\n\treturn\n}", "func getFlagsGroup() []cli.Flag {\n\treturn []cli.Flag{\n\t\t&cli.StringFlag{\n\t\t\tName: \"use\",\n\t\t\tAliases: []string{\"u\"},\n\t\t\tUsage: \"set default engine [gin|http]\",\n\t\t\tValue: \"gin\",\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: \"path\",\n\t\t\tAliases: []string{\"p\", \"static\"},\n\t\t\tUsage: \"set default static file path\",\n\t\t\tValue: \".\",\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: \"index\",\n\t\t\tAliases: []string{\"i\", \"index_file\"},\n\t\t\tUsage: \"set default index file\",\n\t\t\tValue: \"index.html\",\n\t\t},\n\t\t&cli.IntFlag{\n\t\t\tName: \"port\",\n\t\t\tAliases: []string{\"po\"},\n\t\t\tUsage: \"set default listen port\",\n\t\t\tValue: 5000,\n\t\t},\n\t\t&cli.StringFlag{\n\t\t\tName: \"log\",\n\t\t\tAliases: []string{\"l\", \"logfile\"},\n\t\t\tUsage: \"set default logfile\",\n\t\t\tValue: \"\",\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"withtime\",\n\t\t\tAliases: []string{\"enable\", \"time\"},\n\t\t\tUsage: \"log with current time\",\n\t\t\tValue: false,\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"test\",\n\t\t\tAliases: []string{\"t\", \"testit\"},\n\t\t\tUsage: \"run in a test mode\",\n\t\t\tValue: false,\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"try\",\n\t\t\tAliases: []string{\"tryfile\"},\n\t\t\tUsage: \"run in a try file mode\",\n\t\t\tValue: false,\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"daemon\",\n\t\t\tAliases: []string{\"d\"},\n\t\t\tUsage: \"run in a daemon mode\",\n\t\t\tValue: false,\n\t\t},\n\t}\n}", "func configureFlags(api *operations.EsiAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func configureFlags(api *operations.ReservoirAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func (c *Config) getCfg(gCfg interface{}) error {\n\treturn eachSubField(gCfg, func(parent reflect.Value, subFieldName string, crumbs []string) error {\n\t\tp := strings.Join(crumbs, \"\")\n\t\tenvStr := envString(p, subFieldName)\n\t\tflagStr := flagString(p, subFieldName)\n\n\t\t// eachSubField only calls this function if subFieldName exists\n\t\t// and can be set\n\t\tsubField := parent.FieldByName(subFieldName)\n\t\tstr := \"\"\n\t\tif v := c.Viper.Get(envStr); v != nil {\n\t\t\tstr = envStr\n\t\t} else if c.Viper.Get(flagStr) != nil {\n\t\t\tstr = flagStr\n\t\t}\n\t\tvar v, ogV string\n\t\tlup := c.Cmd.PersistentFlags().Lookup(strings.ToLower(str))\n\t\tif lup != nil {\n\t\t\tv = lup.Value.String()\n\t\t\togV = v\n\t\t}\n\t\tsubFieldAsString := fmt.Sprintf(\"%v\", subField)\n\t\t// If the struct has a value filled in that wasn't provided\n\t\t// as a flag, then set it as the flag value.\n\t\t// This allows the required check to pass.\n\t\tif subField.Type().Kind() != reflect.Bool && lup != nil {\n\t\t\tif !isZero(subField) && isZeroStr(v) {\n\t\t\t\tv = subFieldAsString\n\t\t\t\tlup.Value.Set(v)\n\t\t\t}\n\t\t}\n\n\t\t// AHHHHHHHHHHHHHH. This line next line took forever.\n\t\t// Don't \"reset\" the default value if it's been specified differently.\n\t\tif lup != nil && lup.DefValue == ogV && ogV != \"\" && !isZeroStr(subFieldAsString) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif len(str) != 0 && subField.CanSet() {\n\t\t\tswitch subField.Type().Kind() {\n\t\t\tcase reflect.Bool:\n\t\t\t\tv := c.Viper.GetBool(str)\n\t\t\t\tsubField.SetBool(v || subField.Bool()) // IsSet is broken with bools, see NOTE above ^^^\n\t\t\tcase reflect.Int:\n\t\t\t\tv := c.Viper.GetInt(str)\n\t\t\t\tif v == 0 {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tsubField.SetInt(int64(v))\n\t\t\tcase reflect.Int64:\n\t\t\t\tv := c.Viper.GetInt64(str)\n\t\t\t\tif v == 0 {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tsubField.SetInt(v)\n\t\t\tcase reflect.String:\n\t\t\t\tv = c.Viper.GetString(str)\n\t\t\t\tif len(v) == 0 {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tsubField.SetString(v)\n\t\t\tcase reflect.Float64:\n\t\t\t\tv := c.Viper.GetFloat64(str)\n\t\t\t\tif v == 0 {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tsubField.SetFloat(v)\n\t\t\tcase reflect.Float32:\n\t\t\t\tv := c.Viper.GetFloat64(str)\n\t\t\t\tif v == 0 {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tsubField.SetFloat(v)\n\t\t\tcase reflect.Slice:\n\t\t\t\tv := c.Viper.GetStringSlice(str)\n\t\t\t\tif len(v) == 0 || len(v[0]) == 0 || v[0] == \"[]\" {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tsubField.Set(reflect.Zero(reflect.TypeOf(v)))\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"%s is unsupported by config @ %s.%s\", subField.Type().String(), p, subFieldName)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "func (c ConsumerConfig) Apply(kafkaConf *kafkalib.ConfigMap) {\n\tif id := c.GroupID; id != \"\" {\n\t\t_ = kafkaConf.SetKey(\"group.id\", id)\n\t}\n}", "func buildConfigRecursive(cfgPath string, cascadeDir CascadeDirection, cfg *Config) error {\n\tcfgPath, err := filepath.Abs(cfgPath)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tcurrentCfg, err := ReadConfigFile(cfgPath)\n\tif err == nil {\n\t\t// Add the non-tenet properties - always when cascading down, otherwise\n\t\t// only if not already specified\n\t\t// TODO: Use reflection here to avoid forgotten values?\n\t\tif cascadeDir == CascadeDown || cfg.Include == \"\" {\n\t\t\tcfg.Include = currentCfg.Include\n\t\t}\n\t\tif cascadeDir == CascadeDown || cfg.Template == \"\" {\n\t\t\tcfg.Template = currentCfg.Template\n\t\t}\n\n\t\t// DEMOWARE: Need a better way to assign tenets to groups without duplication\n\t\tfor _, g := range currentCfg.TenetGroups {\n\t\tDupeCheck:\n\t\t\tfor _, t := range g.Tenets {\n\t\t\t\tfor _, e := range cfg.allTenets {\n\t\t\t\t\tif e.Name == t.Name {\n\t\t\t\t\t\tcontinue DupeCheck\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcfg.AddTenet(t, g.Name)\n\t\t\t\tcfg.allTenets = append(cfg.allTenets, t)\n\t\t\t}\n\t\t}\n\t\t// Asign group properties\n\t\tfor _, g := range currentCfg.TenetGroups {\n\t\t\tfor i, cg := range cfg.TenetGroups {\n\t\t\t\tif cg.Name == g.Name {\n\t\t\t\t\tif g.Template != \"\" {\n\t\t\t\t\t\tcfg.TenetGroups[i].Template = g.Template\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if !os.IsNotExist(err) {\n\t\t// Just leave the current state of cfg on encountering an error\n\t\tlog.Println(\"error reading file: %s\", cfgPath)\n\t\treturn nil\n\t}\n\n\tcurrentDir, filename := path.Split(cfgPath)\n\tswitch cascadeDir {\n\tcase CascadeUp:\n\t\tif currentDir == \"/\" || (currentCfg != nil && !currentCfg.Cascade) {\n\t\t\treturn nil\n\t\t}\n\n\t\tparent := path.Dir(path.Dir(currentDir))\n\n\t\tif err := buildConfigRecursive(path.Join(parent, filename), cascadeDir, cfg); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase CascadeDown:\n\t\tfiles, err := filepath.Glob(path.Join(currentDir, \"*\"))\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, f := range files {\n\t\t\tfile, err := os.Open(f)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"error reading file: %s\", file)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tdefer file.Close()\n\t\t\tif fi, err := file.Stat(); err == nil && fi.IsDir() {\n\t\t\t\tif err := buildConfigRecursive(path.Join(f, filename), cascadeDir, cfg); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tdefault:\n\t\treturn errors.New(\"invalid cascade direction\")\n\t}\n\treturn nil\n}", "func addConfigs() error {\n\tconst template = `apiVersion: hnc.x-k8s.io/v1alpha2\nkind: HierarchyConfiguration\nmetadata:\n name: hierarchy\n namespace: %s\n annotations:\n config.kubernetes.io/path: %s\nspec:\n parent: %s`\n\n\tfor nm, ns := range forest {\n\t\tif ns.hasConfig || ns.parent == \"\"{\n\t\t\t// Don't generate configs if one already exists or for roots\n\t\t\tcontinue\n\t\t}\n\n\t\t// Build the filepath for this new yaml object based on its hierarchical path\n\t\tpath := nm + \"/hierarchyconfiguration.yaml\"\n\t\tpnm := ns.parent\n\t\tfor pnm != \"\" {\n\t\t\tpath = pnm + \"/\" + path\n\t\t\tpnm = forest[pnm].parent\n\t\t}\n\t\tpath = \"namespaces/\" + path\n\n\t\t// Generate the config from the template\n\t\tconfig := fmt.Sprintf(template, nm, path, ns.parent)\n\t\tn, err := yaml.Parse(config)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"HC config was:\\n%s\\n\", config)\n\t\t\treturn fmt.Errorf(\"couldn't generate hierarchy config for %q: %s\\n\", nm, err)\n\t\t}\n\t\tfmt.Fprintf(os.Stderr, \"Generating %q\\n\", path)\n\t\tresourceList.Items = append(resourceList.Items, n)\n\t}\n\n\treturn nil\n}", "func (sm *ShardMaster) addToConfigs(json JSONConfig){\n\tvar config Config = Config{Num: json.Num, Shards: json.Shards}\n\tgrps := make(map[int64][]string)\n\n\tfor grpString, vals := range json.Groups {\n\t\tgid, _ := strconv.ParseInt(grpString, 10, 64)\n\t\tgrps[gid] = vals\n\t}\n\n\tconfig.Groups = grps\n\tsm.configs = append(sm.configs, config)\n}", "func ApplyProjectConfigDefaults(mod Module, cfgs ...config.AllProvider) error {\n\n\tmoda := mod.(*moduleAdapter)\n\n\t// To bridge between old and new configuration format we need\n\t// a way to make sure all of the core components are configured on\n\t// the basic level.\n\tcomponentsConfigured := make(map[string]bool)\n\tfor _, mnt := range moda.mounts {\n\t\tif !strings.HasPrefix(mnt.Target, files.JsConfigFolderMountPrefix) {\n\t\t\tcomponentsConfigured[mnt.Component()] = true\n\t\t}\n\t}\n\n\tvar mounts []Mount\n\n\tfor _, component := range []string{\n\t\tfiles.ComponentFolderContent,\n\t\tfiles.ComponentFolderData,\n\t\tfiles.ComponentFolderLayouts,\n\t\tfiles.ComponentFolderI18n,\n\t\tfiles.ComponentFolderArchetypes,\n\t\tfiles.ComponentFolderAssets,\n\t\tfiles.ComponentFolderStatic,\n\t} {\n\t\tif componentsConfigured[component] {\n\t\t\tcontinue\n\t\t}\n\n\t\tfirst := cfgs[0]\n\t\tdirsBase := first.DirsBase()\n\t\tisMultiHost := first.IsMultihost()\n\n\t\tfor i, cfg := range cfgs {\n\t\t\tdirs := cfg.Dirs()\n\t\t\tvar dir string\n\t\t\tvar dropLang bool\n\t\t\tswitch component {\n\t\t\tcase files.ComponentFolderContent:\n\t\t\t\tdir = dirs.ContentDir\n\t\t\t\tdropLang = dir == dirsBase.ContentDir\n\t\t\tcase files.ComponentFolderData:\n\t\t\t\tdir = dirs.DataDir\n\t\t\tcase files.ComponentFolderLayouts:\n\t\t\t\tdir = dirs.LayoutDir\n\t\t\tcase files.ComponentFolderI18n:\n\t\t\t\tdir = dirs.I18nDir\n\t\t\tcase files.ComponentFolderArchetypes:\n\t\t\t\tdir = dirs.ArcheTypeDir\n\t\t\tcase files.ComponentFolderAssets:\n\t\t\t\tdir = dirs.AssetDir\n\t\t\tcase files.ComponentFolderStatic:\n\t\t\t\t// For static dirs, we only care about the language in multihost setups.\n\t\t\t\tdropLang = !isMultiHost\n\t\t\t}\n\n\t\t\tvar perLang bool\n\t\t\tswitch component {\n\t\t\tcase files.ComponentFolderContent, files.ComponentFolderStatic:\n\t\t\t\tperLang = true\n\t\t\tdefault:\n\t\t\t}\n\t\t\tif i > 0 && !perLang {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar lang string\n\t\t\tif perLang && !dropLang {\n\t\t\t\tlang = cfg.Language().Lang\n\t\t\t}\n\n\t\t\t// Static mounts are a little special.\n\t\t\tif component == files.ComponentFolderStatic {\n\t\t\t\tstaticDirs := cfg.StaticDirs()\n\t\t\t\tfor _, dir := range staticDirs {\n\t\t\t\t\tmounts = append(mounts, Mount{Lang: lang, Source: dir, Target: component})\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif dir != \"\" {\n\t\t\t\tmounts = append(mounts, Mount{Lang: lang, Source: dir, Target: component})\n\t\t\t}\n\t\t}\n\t}\n\n\tmoda.mounts = append(moda.mounts, mounts...)\n\n\t// Temporary: Remove duplicates.\n\tseen := make(map[string]bool)\n\tvar newMounts []Mount\n\tfor _, m := range moda.mounts {\n\t\tkey := m.Source + m.Target + m.Lang\n\t\tif seen[key] {\n\t\t\tcontinue\n\t\t}\n\t\tseen[key] = true\n\t\tnewMounts = append(newMounts, m)\n\t}\n\tmoda.mounts = newMounts\n\n\treturn nil\n}", "func configureFlags(api *operations.LoongTokenAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func ParseGroupConfig(file string) error {\n\tcf, err := os.Open(file)\n\tif os.IsNotExist(err) {\n\t\tgroupConfig.n = 1\n\t\treturn nil\n\t}\n\tx.Check(err)\n\tif err = parseConfig(cf); err != nil {\n\t\treturn err\n\t}\n\tif groupConfig.n == 0 {\n\t\treturn fmt.Errorf(\"Cant take modulo 0.\")\n\t}\n\treturn nil\n}", "func (i *Installation) MergeWithGroup(group *Group, includeOverrides bool) {\n\tif i.ConfigMergedWithGroup() {\n\t\treturn\n\t}\n\tif group == nil {\n\t\treturn\n\t}\n\n\ti.configMergedWithGroup = true\n\ti.configMergeGroupSequence = group.Sequence\n\n\ti.GroupOverrides = make(map[string]string)\n\tif group.MattermostEnv != nil && i.MattermostEnv == nil {\n\t\ti.MattermostEnv = make(EnvVarMap)\n\t}\n\n\tif len(group.Version) != 0 && i.Version != group.Version {\n\t\tif includeOverrides {\n\t\t\ti.GroupOverrides[\"Installation Version\"] = i.Version\n\t\t\ti.GroupOverrides[\"Group Version\"] = group.Version\n\t\t}\n\t\ti.Version = group.Version\n\t}\n\tif len(group.Image) != 0 && i.Image != group.Image {\n\t\tif includeOverrides {\n\t\t\ti.GroupOverrides[\"Installation Image\"] = i.Image\n\t\t\ti.GroupOverrides[\"Group Image\"] = group.Image\n\t\t}\n\t\ti.Image = group.Image\n\t}\n\tfor key, value := range group.MattermostEnv {\n\t\tif includeOverrides {\n\t\t\tif _, ok := i.MattermostEnv[key]; ok {\n\t\t\t\ti.GroupOverrides[fmt.Sprintf(\"Installation MattermostEnv[%s]\", key)] = i.MattermostEnv[key].Value\n\t\t\t\ti.GroupOverrides[fmt.Sprintf(\"Group MattermostEnv[%s]\", key)] = value.Value\n\t\t\t}\n\t\t}\n\t\ti.MattermostEnv[key] = value\n\t}\n}", "func (g *Group) RunConfig() (interrupted bool, err error) {\n\tg.log = logger.GetLogger(g.name)\n\tg.configured = true\n\n\tif g.name == \"\" {\n\t\t// use the binary name if custom name has not been provided\n\t\tg.name = path.Base(os.Args[0])\n\t}\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tg.log.Error().Err(err).Msg(\"unexpected exit\")\n\t\t}\n\t}()\n\n\t// Load config from env and file\n\tif err = config.Load(g.f.Name, g.f.FlagSet); err != nil {\n\t\treturn false, errors.Wrapf(err, \"%s fails to load config\", g.f.Name)\n\t}\n\n\t// bail early on help or version requests\n\tswitch {\n\tcase g.showRunGroup:\n\t\tfmt.Println(g.ListUnits())\n\t\treturn true, nil\n\t}\n\n\t// Validate Config inputs\n\tfor idx := range g.c {\n\t\t// a Config might have been deregistered during Run\n\t\tif g.c[idx] == nil {\n\t\t\tg.log.Debug().Uint32(\"ran\", uint32(idx+1)).Msg(\"skipping validate\")\n\t\t\tcontinue\n\t\t}\n\t\tg.log.Debug().Str(\"name\", g.c[idx].Name()).Uint32(\"ran\", uint32(idx+1)).Uint32(\"total\", uint32(len(g.c))).Msg(\"validate config\")\n\t\tif vErr := g.c[idx].Validate(); vErr != nil {\n\t\t\terr = multierr.Append(err, vErr)\n\t\t}\n\t}\n\n\t// exit on at least one Validate error\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// log binary name and version\n\tg.log.Info().Msg(\"started\")\n\n\treturn false, nil\n}", "func (i *Installation) ConfigMergedWithGroup() bool {\n\treturn i.configMergedWithGroup\n}", "func (s *ServerGroup) ApplyConfig(cfg *Config) error {\n\ts.Cfg = cfg\n\n\t// Copy/paste from upstream prometheus/common until https://github.com/prometheus/common/issues/144 is resolved\n\ttlsConfig, err := config_util.NewTLSConfig(&cfg.HTTPConfig.HTTPConfig.TLSConfig)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error loading TLS client config\")\n\t}\n\t// The only timeout we care about is the configured scrape timeout.\n\t// It is applied on request. So we leave out any timings here.\n\tvar rt http.RoundTripper = &http.Transport{\n\t\tProxy: http.ProxyURL(cfg.HTTPConfig.HTTPConfig.ProxyURL.URL),\n\t\tMaxIdleConns: 20000,\n\t\tMaxIdleConnsPerHost: 1000, // see https://github.com/golang/go/issues/13801\n\t\tDisableKeepAlives: false,\n\t\tTLSClientConfig: tlsConfig,\n\t\t// 5 minutes is typically above the maximum sane scrape interval. So we can\n\t\t// use keepalive for all configurations.\n\t\tIdleConnTimeout: 5 * time.Minute,\n\t\tDialContext: (&net.Dialer{Timeout: cfg.HTTPConfig.DialTimeout}).DialContext,\n\t\tResponseHeaderTimeout: cfg.Timeout,\n\t}\n\n\t// If a bearer token is provided, create a round tripper that will set the\n\t// Authorization header correctly on each request.\n\tif len(cfg.HTTPConfig.HTTPConfig.BearerToken) > 0 {\n\t\trt = config_util.NewAuthorizationCredentialsRoundTripper(\"Bearer\", cfg.HTTPConfig.HTTPConfig.BearerToken, rt)\n\t} else if len(cfg.HTTPConfig.HTTPConfig.BearerTokenFile) > 0 {\n\t\trt = config_util.NewAuthorizationCredentialsFileRoundTripper(\"Bearer\", cfg.HTTPConfig.HTTPConfig.BearerTokenFile, rt)\n\t}\n\n\tif cfg.HTTPConfig.HTTPConfig.BasicAuth != nil {\n\t\trt = config_util.NewBasicAuthRoundTripper(cfg.HTTPConfig.HTTPConfig.BasicAuth.Username, cfg.HTTPConfig.HTTPConfig.BasicAuth.Password, cfg.HTTPConfig.HTTPConfig.BasicAuth.PasswordFile, rt)\n\t}\n\n\ts.client = &http.Client{Transport: rt}\n\n\tif err := s.targetManager.ApplyConfig(map[string]discovery.Configs{\"foo\": cfg.ServiceDiscoveryConfigs}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (p *Parser) WithConfigFn(fns ...func(cfg *Config)) *Parser {\n\tfor _, fn := range fns {\n\t\tfn(p.cfg)\n\t}\n\treturn p\n}", "func mergeConfig(cfgs ...apiv1.Config) apiv1.Config {\n\tn := apiv1.Config{}\n\tfor _, cfg := range cfgs {\n\t\tfor k, v2 := range cfg {\n\t\t\tif v1, ok := n[k]; ok {\n\t\t\t\tif nv1, ok1 := v1.(apiv1.Config); ok1 {\n\t\t\t\t\tif nv2, ok2 := v2.(apiv1.Config); ok2 {\n\t\t\t\t\t\tn[k] = mergeConfig(nv1, nv2)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tn[k] = v2\n\t\t}\n\t}\n\n\treturn n\n}", "func addFlagToConfig(cfg *config.Config) {\n\tif len(cfg.Targets) == 0 {\n\t\tcfg.Targets = *targets\n\t}\n\tif cfg.Ping.History == 0 {\n\t\tcfg.Ping.History = *historySize\n\t}\n\tif cfg.Ping.Interval == 0 {\n\t\tcfg.Ping.Interval.Set(*pingInterval)\n\t}\n\tif cfg.Ping.Timeout == 0 {\n\t\tcfg.Ping.Timeout.Set(*pingTimeout)\n\t}\n\tif cfg.Ping.Size == 0 {\n\t\tcfg.Ping.Size = *pingSize\n\t}\n\tif cfg.DNS.Refresh == 0 {\n\t\tcfg.DNS.Refresh.Set(*dnsRefresh)\n\t}\n\tif cfg.DNS.Nameserver == \"\" {\n\t\tcfg.DNS.Nameserver = *dnsNameServer\n\t}\n}", "func (m *GraphBaseServiceClient) GroupSettings()(*i4794c103c0d044c27a3ca3af0a0e498e93a9863420c1a4e7a29ef37590053c7b.GroupSettingsRequestBuilder) {\n return i4794c103c0d044c27a3ca3af0a0e498e93a9863420c1a4e7a29ef37590053c7b.NewGroupSettingsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) GroupSettings()(*i4794c103c0d044c27a3ca3af0a0e498e93a9863420c1a4e7a29ef37590053c7b.GroupSettingsRequestBuilder) {\n return i4794c103c0d044c27a3ca3af0a0e498e93a9863420c1a4e7a29ef37590053c7b.NewGroupSettingsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func EnableExtraGroups(initConf EnhancedMetricsConfig, enabledMetrics []string) EnhancedMetricsConfig {\n\tgroupEnableMap := map[string]bool{\n\t\tgroupBlkio: initConf.EnableExtraBlockIOMetrics,\n\t\tgroupCPU: initConf.EnableExtraCPUMetrics,\n\t\tgroupMemory: initConf.EnableExtraMemoryMetrics,\n\t\tgroupNetwork: initConf.EnableExtraNetworkMetrics,\n\t}\n\n\tfor _, metric := range enabledMetrics {\n\t\tif metricInfo, ok := metricSet[metric]; ok {\n\t\t\tgroupEnableMap[metricInfo.Group] = true\n\t\t}\n\t}\n\n\treturn EnhancedMetricsConfig{\n\t\tEnableExtraBlockIOMetrics: groupEnableMap[groupBlkio],\n\t\tEnableExtraCPUMetrics: groupEnableMap[groupCPU],\n\t\tEnableExtraMemoryMetrics: groupEnableMap[groupMemory],\n\t\tEnableExtraNetworkMetrics: groupEnableMap[groupNetwork],\n\t}\n}", "func (g *Group) updateWith(newGroup *Group) error {\n\trulesRegistry := make(map[uint64]Rule)\n\tfor _, nr := range newGroup.Rules {\n\t\trulesRegistry[nr.ID()] = nr\n\t}\n\n\tfor i, or := range g.Rules {\n\t\tnr, ok := rulesRegistry[or.ID()]\n\t\tif !ok {\n\t\t\t// old rule is not present in the new list\n\t\t\t// so we mark it for removing\n\t\t\tg.Rules[i].Close()\n\t\t\tg.Rules[i] = nil\n\t\t\tcontinue\n\t\t}\n\t\tif err := or.UpdateWith(nr); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdelete(rulesRegistry, nr.ID())\n\t}\n\n\tvar newRules []Rule\n\tfor _, r := range g.Rules {\n\t\tif r == nil {\n\t\t\t// skip nil rules\n\t\t\tcontinue\n\t\t}\n\t\tnewRules = append(newRules, r)\n\t}\n\t// add the rest of rules from registry\n\tfor _, nr := range rulesRegistry {\n\t\tnewRules = append(newRules, nr)\n\t}\n\t// note that g.Interval is not updated here\n\t// so the value can be compared later in\n\t// group.Start function\n\tg.Type = newGroup.Type\n\tg.Concurrency = newGroup.Concurrency\n\tg.Params = newGroup.Params\n\tg.Headers = newGroup.Headers\n\tg.NotifierHeaders = newGroup.NotifierHeaders\n\tg.Labels = newGroup.Labels\n\tg.Limit = newGroup.Limit\n\tg.Checksum = newGroup.Checksum\n\tg.Rules = newRules\n\treturn nil\n}", "func internalGroups(configGroups []*prjcfg.ConfigGroup) map[string]*cfgmatcher.Groups {\n\tret := make(map[string]*cfgmatcher.Groups)\n\tfor _, g := range configGroups {\n\t\tfor _, gerrit := range g.Content.Gerrit {\n\t\t\thost := prjcfg.GerritHost(gerrit)\n\t\t\tfor _, p := range gerrit.Projects {\n\t\t\t\thostRepo := host + \"/\" + p.Name\n\t\t\t\tgroup := cfgmatcher.MakeGroup(g, p)\n\t\t\t\tif groups, ok := ret[hostRepo]; ok {\n\t\t\t\t\tgroups.Groups = append(groups.Groups, group)\n\t\t\t\t} else {\n\t\t\t\t\tret[hostRepo] = &cfgmatcher.Groups{Groups: []*cfgmatcher.Group{group}}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn ret\n}", "func processConfig(item *yaml.RNode, meta yaml.ResourceMeta) error {\n\tif meta.APIVersion != \"hnc.x-k8s.io/v1alpha2\" || meta.Kind != \"HierarchyConfiguration\" {\n\t\treturn nil\n\t}\n\tns := forest[meta.Namespace]\n\tns.hasConfig = true\n\n\tspec, err := item.Pipe(yaml.Get(\"spec\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't get spec: %w\", err)\n\t}\n\tparent, err := spec.Pipe(yaml.Get(\"parent\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't get spec.parent: %w\", err)\n\t}\n\n\toldParent := strings.TrimSpace(parent.MustString())\n\tif oldParent != ns.parent {\n\t\tfmt.Fprintf(os.Stderr, \"HC config for %q has the wrong parent %q; updating to %q\\n\", meta.Namespace, oldParent, ns.parent)\n\t\tif err := spec.PipeE(yaml.SetField(\"parent\", yaml.MustParse(ns.parent))); err != nil {\n\t\t\treturn fmt.Errorf(\"couldn't update HC config: %s\\n\", err)\n\t\t}\n\t}\n\treturn nil\n}", "func (g *genFlags) resolveConfig() *config.Config {\n\tif g == nil {\n\t\treturn config.New()\n\t}\n\n\tconf := config.New()\n\tsuppliedConfig := g.sonobuoyConfig.Get()\n\tif suppliedConfig != nil {\n\t\tmergeConfigs(suppliedConfig, conf)\n\t\tconf = suppliedConfig\n\t}\n\n\t// Resolve plugins.\n\t// - If using the plugin flags, no actions needed.\n\t// - Otherwise use the supplied config and mode to figure out the plugins to run.\n\t// This only works for e2e/systemd-logs which are internal plugins so then \"Set\" them\n\t// as if they were provided on the cmdline.\n\t// Gate the logic with a nil check because tests may not specify flags and intend the legacy logic.\n\tif g.genflags == nil || !g.genflags.Changed(\"plugin\") {\n\t\t// Use legacy logic; conf.SelectedPlugins or mode if not set\n\t\tif conf.PluginSelections == nil {\n\t\t\tmodeConfig := g.mode.Get()\n\t\t\tif modeConfig != nil {\n\t\t\t\tconf.PluginSelections = modeConfig.Selectors\n\t\t\t}\n\t\t}\n\n\t\t// Set these values as if the user had requested the defaults.\n\t\tif g.genflags != nil {\n\t\t\tfor _, v := range conf.PluginSelections {\n\t\t\t\tg.genflags.Lookup(\"plugin\").Value.Set(v.Name)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Have to embed the flagset itself so we can inspect if these fields\n\t// have been set explicitly or not on the command line. Otherwise\n\t// we fail to properly prioritize command line/config/default values.\n\tif g.genflags == nil {\n\t\treturn conf\n\t}\n\n\tif g.genflags.Changed(namespaceFlag) {\n\t\tconf.Namespace = g.namespace\n\t}\n\n\tif g.genflags.Changed(sonobuoyImageFlag) {\n\t\tconf.WorkerImage = g.sonobuoyImage\n\t}\n\n\tif g.genflags.Changed(imagePullPolicyFlag) {\n\t\tconf.ImagePullPolicy = g.imagePullPolicy.String()\n\t}\n\n\tif g.genflags.Changed(timeoutFlag) {\n\t\tconf.Aggregation.TimeoutSeconds = g.timeoutSeconds\n\t}\n\n\treturn conf\n}", "func (m *GraphBaseServiceClient) GroupSettingsById(id string)(*if1f8863d252ff8f609844d73316e2ccaa8caf94c5c2e03b8a0aa91bcdc37a4bc.GroupSettingItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"groupSetting%2Did\"] = id\n }\n return if1f8863d252ff8f609844d73316e2ccaa8caf94c5c2e03b8a0aa91bcdc37a4bc.NewGroupSettingItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) GroupSettingsById(id string)(*if1f8863d252ff8f609844d73316e2ccaa8caf94c5c2e03b8a0aa91bcdc37a4bc.GroupSettingItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"groupSetting%2Did\"] = id\n }\n return if1f8863d252ff8f609844d73316e2ccaa8caf94c5c2e03b8a0aa91bcdc37a4bc.NewGroupSettingItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func DefaultConfig() *config.Config {\n\treturn &config.Config{\n\t\tDebug: config.Debug{\n\t\t\tAddr: \"127.0.0.1:9147\",\n\t\t\tToken: \"\",\n\t\t\tPprof: false,\n\t\t\tZpages: false,\n\t\t},\n\t\tGRPC: config.GRPCConfig{\n\t\t\tAddr: \"127.0.0.1:9146\",\n\t\t\tNamespace: \"com.owncloud.api\",\n\t\t\tProtocol: \"tcp\",\n\t\t},\n\t\tService: config.Service{\n\t\t\tName: \"auth-basic\",\n\t\t},\n\t\tReva: shared.DefaultRevaConfig(),\n\t\tAuthProvider: \"ldap\",\n\t\tAuthProviders: config.AuthProviders{\n\t\t\tLDAP: config.LDAPProvider{\n\t\t\t\tURI: \"ldaps://localhost:9235\",\n\t\t\t\tCACert: filepath.Join(defaults.BaseDataPath(), \"idm\", \"ldap.crt\"),\n\t\t\t\tInsecure: false,\n\t\t\t\tUserBaseDN: \"ou=users,o=libregraph-idm\",\n\t\t\t\tGroupBaseDN: \"ou=groups,o=libregraph-idm\",\n\t\t\t\tUserScope: \"sub\",\n\t\t\t\tGroupScope: \"sub\",\n\t\t\t\tLoginAttributes: []string{\"uid\"},\n\t\t\t\tUserFilter: \"\",\n\t\t\t\tGroupFilter: \"\",\n\t\t\t\tUserObjectClass: \"inetOrgPerson\",\n\t\t\t\tGroupObjectClass: \"groupOfNames\",\n\t\t\t\tBindDN: \"uid=reva,ou=sysusers,o=libregraph-idm\",\n\t\t\t\tDisableUserMechanism: \"attribute\",\n\t\t\t\tLdapDisabledUsersGroupDN: \"cn=DisabledUsersGroup,ou=groups,o=libregraph-idm\",\n\t\t\t\tIDP: \"https://localhost:9200\",\n\t\t\t\tUserSchema: config.LDAPUserSchema{\n\t\t\t\t\tID: \"ownclouduuid\",\n\t\t\t\t\tMail: \"mail\",\n\t\t\t\t\tDisplayName: \"displayname\",\n\t\t\t\t\tUsername: \"uid\",\n\t\t\t\t\tEnabled: \"ownCloudUserEnabled\",\n\t\t\t\t},\n\t\t\t\tGroupSchema: config.LDAPGroupSchema{\n\t\t\t\t\tID: \"ownclouduuid\",\n\t\t\t\t\tMail: \"mail\",\n\t\t\t\t\tDisplayName: \"cn\",\n\t\t\t\t\tGroupname: \"cn\",\n\t\t\t\t\tMember: \"member\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tJSON: config.JSONProvider{},\n\t\t\tOwnCloudSQL: config.OwnCloudSQLProvider{\n\t\t\t\tDBUsername: \"owncloud\",\n\t\t\t\tDBHost: \"mysql\",\n\t\t\t\tDBPort: 3306,\n\t\t\t\tDBName: \"owncloud\",\n\t\t\t\tIDP: \"https://localhost:9200\",\n\t\t\t\tNobody: 90,\n\t\t\t\tJoinUsername: false,\n\t\t\t\tJoinOwnCloudUUID: false,\n\t\t\t},\n\t\t},\n\t}\n}", "func SetConfig(config Config, name ...string) {\n\tgroup := DEFAULT_GROUP_NAME\n\tif len(name) > 0 {\n\t\tgroup = name[0]\n\t}\n\tconfigs.Set(group, config)\n\tinstances.Remove(group)\n}", "func (g *generator) ApplyConfig(config *generation.Config) generation.Generator {\n\tif config == nil || config.SchemaPatch == nil {\n\t\treturn g\n\t}\n\n\tfeatureSets := []sets.String{}\n\tfor _, featureSet := range config.SchemaPatch.RequiredFeatureSets {\n\t\tfeatureSets = append(featureSets, sets.NewString(strings.Split(featureSet, \",\")...))\n\t}\n\n\treturn NewGenerator(Options{\n\t\tControllerGen: g.controllerGen,\n\t\tDisabled: config.SchemaPatch.Disabled,\n\t\tRequiredFeatureSets: featureSets,\n\t\tVerify: g.verify,\n\t})\n}", "func (vrm *ResourceManager) AnalyseConfigMap() error {\n\n\tvgDeviceMap := map[string]*VgDeviceConfig{}\n\tvgRegionMap := map[string][]string{}\n\n\tvolumeGroupList := &VgList{}\n\tyamlFile, err := ioutil.ReadFile(vrm.configPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tlog.Debugf(\"volume config file %s not exist\", vrm.configPath)\n\t\t\treturn nil\n\t\t}\n\t\tlog.Errorf(\"AnalyseConfigMap:: ReadFile: yamlFile.Get error #%v \", err)\n\t\treturn err\n\t}\n\n\terr = yaml.Unmarshal(yamlFile, volumeGroupList)\n\tif err != nil {\n\t\tlog.Errorf(\"AnalyseConfigMap:: Unmarshal: parse yaml file error: %v\", err)\n\t\treturn err\n\t}\n\n\tnodeInfo := config.GlobalConfigVar.NodeInfo\n\tfor _, devConfig := range volumeGroupList.VolumeGroups {\n\t\tvgDeviceConfig := &VgDeviceConfig{}\n\n\t\tisMatched := utils.NodeFilter(devConfig.Operator, devConfig.Key, devConfig.Value, nodeInfo)\n\t\tlog.Infof(\"AnalyseConfigMap:: isMatched: %v, devConfig: %+v\", isMatched, devConfig)\n\n\t\tif isMatched {\n\t\t\tswitch devConfig.Topology.Type {\n\t\t\tcase VgTypeDevice:\n\t\t\t\tvgDeviceConfig.PhysicalVolumes = devConfig.Topology.Devices\n\t\t\t\tvgDeviceMap[devConfig.Name] = vgDeviceConfig\n\t\t\tcase VgTypeLocal:\n\t\t\t\ttmpConfig := &VgDeviceConfig{}\n\t\t\t\ttmpConfig.PhysicalVolumes = getPvListForLocalDisk()\n\t\t\t\tvgDeviceMap[devConfig.Name] = tmpConfig\n\t\t\tcase VgTypePvc:\n\t\t\t\t// not support yet\n\t\t\t\tcontinue\n\t\t\tcase VgTypePmem:\n\t\t\t\tvgRegionMap[devConfig.Name] = devConfig.Topology.Regions\n\t\t\tdefault:\n\t\t\t\tlog.Errorf(\"AnalyseConfigMap:: Get unsupported volumegroup type: %s\", devConfig.Topology.Type)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n\tvrm.volumeGroupDeviceMap = vgDeviceMap\n\tvrm.volumeGroupRegionMap = vgRegionMap\n\treturn nil\n}", "func (sm *ShardMaster) haveGroup(config Config, gid int64) bool {\n\tfor gidUsed, _ := range config.Groups {\n\t\tif gid == gidUsed {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (a *AutoScaleGroup) Merge(cfg Config) {\n\tif a.MetricsCalculatePeriod == 0 {\n\t\ta.MetricsCalculatePeriod = cfg.MetricsCalculatePeriod\n\t}\n\tif a.ScaleUpThreshold == \"\" {\n\t\ta.ScaleUpThreshold = cfg.ScaleUpThreshold\n\t}\n\tif a.ScaleDownThreshold == \"\" {\n\t\ta.ScaleDownThreshold = cfg.ScaleDownThreshold\n\t}\n\tif a.LabelSelector == \"\" {\n\t\ta.LabelSelector = cfg.LabelSelector\n\t}\n\tif a.AlarmWindow == 0 {\n\t\ta.AlarmWindow = cfg.AlarmWindow\n\t}\n\tif a.AlarmCoolDown == 0 {\n\t\ta.AlarmCoolDown = cfg.AlarmCoolDown\n\t}\n\tif a.AlarmCancelWindow == 0 {\n\t\ta.AlarmCancelWindow = cfg.AlarmCancelWindow\n\t}\n\tif a.MaxBackendFailure == 0 {\n\t\ta.MaxBackendFailure = cfg.MaxBackendFailure\n\t}\n\tif a.ScaleUpTimeout == 0 {\n\t\ta.ScaleUpTimeout = cfg.ScaleUpTimeout\n\t}\n\tif a.MetricSource.CacheExpireTime == 0 {\n\t\ta.MetricSource.CacheExpireTime = cfg.MetricCacheExpireTime\n\t}\n\tif a.Provisioner.MaxNodeNum == 0 {\n\t\ta.Provisioner.MaxNodeNum = cfg.MaxNodeNum\n\t}\n\tif a.Provisioner.MinNodeNum == 0 {\n\t\ta.Provisioner.MinNodeNum = cfg.MinNodeNum\n\t}\n\tif a.Provisioner.Type == pv.ProvisionerRancherNodePool {\n\t\tif a.Provisioner.RancherAnnotationNamespace == \"\" {\n\t\t\ta.Provisioner.RancherAnnotationNamespace = cfg.RancherAnnotationNamespace\n\t\t}\n\t\tif a.Provisioner.RancherNodePoolNamePrefix == \"\" {\n\t\t\ta.Provisioner.RancherNodePoolNamePrefix = cfg.RancherNodePoolNamePrefix\n\t\t}\n\t}\n}", "func configureCgroup(rt *Runtime, c *Container) error {\n\tif err := configureCgroupPath(rt, c); err != nil {\n\t\treturn err\n\t}\n\n\tif err := checkCgroup(c); err != nil {\n\t\treturn err\n\t}\n\n\tif devices := c.Spec.Linux.Resources.Devices; devices != nil {\n\t\tif rt.Features.CgroupDevices {\n\t\t\tif err := configureDeviceController(c); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tc.Log.Warn().Msg(\"cgroup device controller feature is disabled - access to all devices is granted\")\n\t\t}\n\n\t}\n\n\tif mem := c.Spec.Linux.Resources.Memory; mem != nil {\n\t\tc.Log.Debug().Msg(\"TODO cgroup memory controller not implemented\")\n\t}\n\n\tif cpu := c.Spec.Linux.Resources.CPU; cpu != nil {\n\t\tif err := configureCPUController(rt, cpu); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif pids := c.Spec.Linux.Resources.Pids; pids != nil {\n\t\tif err := c.setConfigItem(\"lxc.cgroup2.pids.max\", fmt.Sprintf(\"%d\", pids.Limit)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif blockio := c.Spec.Linux.Resources.BlockIO; blockio != nil {\n\t\tc.Log.Debug().Msg(\"TODO cgroup blockio controller not implemented\")\n\t}\n\n\tif hugetlb := c.Spec.Linux.Resources.HugepageLimits; hugetlb != nil {\n\t\t// set Hugetlb limit (in bytes)\n\t\tc.Log.Debug().Msg(\"TODO cgroup hugetlb controller not implemented\")\n\t}\n\tif net := c.Spec.Linux.Resources.Network; net != nil {\n\t\tc.Log.Debug().Msg(\"TODO cgroup network controller not implemented\")\n\t}\n\treturn nil\n}", "func (m *Manager) ApplyConfig(cfg map[string]sd_config.ServiceDiscoveryConfig) error {\n\tm.mtx.Lock()\n\tdefer m.mtx.Unlock()\n\n\tm.cancelDiscoverers()\n\tfor name, scfg := range cfg {\n\t\tfor provName, prov := range m.providersFromConfig(scfg) {\n\t\t\tm.startProvider(m.ctx, poolKey{setName: name, provider: provName}, prov)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *Config) Load() (err error) {\n\tc.init()\n\terr = unmarshal(c.Filename, c)\n\tif os.IsNotExist(err) {\n\t\terr = c.Save()\n\t\treturn\n\t} else if err != nil {\n\t\treturn\n\t}\n\tfor file, enable := range c.Includes {\n\t\tgroup := &Group{}\n\t\terr = unmarshal(file, group)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif len(group.Name) < 1 {\n\t\t\tlog.Warnf(\"load group from %v fail with group name is empty\", file)\n\t\t\tcontinue\n\t\t}\n\t\tif len(group.Services) < 1 {\n\t\t\tlog.Warnf(\"load group from %v fail with service list is empty\", file)\n\t\t\tcontinue\n\t\t}\n\t\tgroup.Filename = file\n\t\tgroup.Enable = enable\n\t\tc.Groups[group.Name] = *group\n\t\tlog.Infof(\"load group from %v with %v service\", file, len(group.Services))\n\t}\n\treturn\n}", "func newOrgConfigGroup(org Organization) (*cb.ConfigGroup, error) {\n\torgGroup := newConfigGroup()\n\torgGroup.ModPolicy = AdminsPolicyKey\n\n\tif org.ModPolicy != \"\" {\n\t\torgGroup.ModPolicy = org.ModPolicy\n\t}\n\n\tif err := setPolicies(orgGroup, org.Policies); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfabricMSPConfig, err := org.MSP.toProto()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"converting fabric msp config to proto: %v\", err)\n\t}\n\n\tconf, err := proto.Marshal(fabricMSPConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"marshaling msp config: %v\", err)\n\t}\n\n\t// mspConfig defaults type to FABRIC which implements an X.509 based provider\n\tmspConfig := &mb.MSPConfig{\n\t\tConfig: conf,\n\t}\n\n\terr = setValue(orgGroup, mspValue(mspConfig), AdminsPolicyKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn orgGroup, nil\n}", "func (mg *Groups) Apply(force bool) error {\n\n\tif mg.group != nil && len(mg.group.ID) > 0 {\n\t\tif appClient := application.New(mg.client); appClient != nil {\n\n\t\t\tcallbackFunc := func(app application.AppDefinition) error {\n\n\t\t\t\tif err := appClient.Set(app).Apply(force); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn mg.traverseGroupsWithAppDefinition(mg.group, callbackFunc)\n\t\t}\n\t\treturn fmt.Errorf(\"unnable to connect\")\n\t}\n\treturn errors.New(\"group cannot be null nor empty\")\n}", "func addUserToGroupConfig(groupName string, uid int) error {\n\tconf, err := readConfiguration()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i, group := range conf.Groups {\n\n\t\t// find correct group\n\t\tif group.Name == groupName {\n\n\t\t\t// check if user is already existing\n\t\t\tfor _, member := range group.Users {\n\t\t\t\t// if yes, just do nothing\n\t\t\t\tif member == uid {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// if not add the user\n\t\t\t// here one has to access the original\n\t\t\t// conf variable, as range copies the group object\n\t\t\tconf.Groups[i].addUser(uid)\n\t\t\treturn writeConfiguration(conf)\n\t\t}\n\t}\n\n\t// if one reaches here then the group has not existed\n\treturn fmt.Errorf(\"The group [%s] was not found to append a user\", groupName)\n}", "func include(config render.RenderConfig, groupName jobs.TaskGroupName) bool {\n\tif len(config.Groups) == 0 {\n\t\t// include all\n\t\treturn true\n\t}\n\tfor _, n := range config.Groups {\n\t\tif n == groupName {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func mergeConfigDefs(scd []*tricium.ConfigDef, pcd []*tricium.ConfigDef) []*tricium.ConfigDef {\n\tconfigs := map[string]*tricium.ConfigDef{}\n\tfor _, cd := range scd {\n\t\tconfigs[cd.Name] = cd\n\t}\n\tfor _, cd := range pcd {\n\t\tconfigs[cd.Name] = cd\n\t}\n\tres := []*tricium.ConfigDef{}\n\tfor _, v := range configs {\n\t\tres = append(res, v)\n\t}\n\treturn res\n}", "func configureFlags(api *operations.ToDoDemoAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func configureFlags(api *operations.ToDoDemoAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}", "func (o *Options) apply(featureGate featuregate.FeatureGate) {\n\tcontextualLoggingEnabled := contextualLoggingDefault\n\tif featureGate != nil {\n\t\tcontextualLoggingEnabled = featureGate.Enabled(ContextualLogging)\n\t}\n\n\t// if log format not exists, use nil loggr\n\tfactory, _ := registry.LogRegistry.Get(o.Config.Format)\n\tif factory == nil {\n\t\tklog.ClearLogger()\n\t} else {\n\t\t// This logger will do its own verbosity checking, using the exact same\n\t\t// configuration as klog itself.\n\t\tlog, flush := factory.Create(o.Config)\n\t\t// Therefore it can get called directly. However, we only allow that\n\t\t// when the feature is enabled.\n\t\tklog.SetLoggerWithOptions(log, klog.ContextualLogger(contextualLoggingEnabled), klog.FlushLogger(flush))\n\t}\n\tif err := loggingFlags.Lookup(\"v\").Value.Set(o.Config.Verbosity.String()); err != nil {\n\t\tpanic(fmt.Errorf(\"internal error while setting klog verbosity: %v\", err))\n\t}\n\tif err := loggingFlags.Lookup(\"vmodule\").Value.Set(o.Config.VModule.String()); err != nil {\n\t\tpanic(fmt.Errorf(\"internal error while setting klog vmodule: %v\", err))\n\t}\n\tklog.StartFlushDaemon(o.Config.FlushFrequency)\n\tklog.EnableContextualLogging(contextualLoggingEnabled)\n}", "func (gs *LocalConf) Add(group, repo string) (err error) {\n\tif gs == nil {\n\t\treturn errors.New(\"null.receiver\")\n\t}\n\n\tcd(\"group:%s repo:%s\", group, repo)\n\n\tfor i, g := range gs.Groups {\n\t\tif group == g.Name {\n\t\t\tcd(\"matched:%s\", g.Name)\n\t\t\tg.Repos = append(g.Repos, repo)\n\t\t\tgs.Groups[i].Repos = g.Repos\n\t\t\treturn\n\t\t}\n\t}\n\n\tgs.Groups = append(gs.Groups, Group{ID: fmt.Sprintf(\"id-%d\", time.Now().Unix()), Name: group, Repos: []string{repo}})\n\treturn\n}", "func (f *Flags) newConfig() *Config {\n\tc := new(Config)\n\t// Default values defined here will be overridden by unmarshaling a config file\n\tc.General.Loglevel = \"warn\"\n\tc.General.LogToFile = false // By default, log to stdout/stderr\n\tc.General.LogToJournal = false // Don't log to journal by default\n\t// Config items in the Files section default to a path defined by the --dir flag\n\tc.Files.Pubkey = path.Join(f.Dir, \"key.txt\")\n\tc.Files.Pubring = path.Join(f.Dir, \"pubring.mix\")\n\tc.Files.Secring = path.Join(f.Dir, \"secring.mix\")\n\tc.Files.Mlist2 = path.Join(f.Dir, \"mlist2.txt\")\n\tc.Files.Adminkey = path.Join(f.Dir, \"adminkey.txt\")\n\tc.Files.Help = path.Join(f.Dir, \"help.txt\")\n\tc.Files.Pooldir = path.Join(f.Dir, \"pool\")\n\tc.Files.Maildir = path.Join(f.Dir, \"Maildir\")\n\tc.Files.IDlog = path.Join(f.Dir, \"idlog\")\n\tc.Files.ChunkDB = path.Join(f.Dir, \"chunkdb\")\n\tc.Files.Logfile = path.Join(f.Dir, \"yamn.log\")\n\tc.Urls.Fetch = true\n\tc.Urls.Pubring = \"http://www.mixmin.net/yamn/pubring.mix\"\n\tc.Urls.Mlist2 = \"http://www.mixmin.net/yamn/mlist2.txt\"\n\tc.Mail.Sendmail = false\n\tc.Mail.Outfile = false\n\tc.Mail.SMTPRelay = \"fleegle.mixmin.net\"\n\tc.Mail.SMTPPort = 587\n\tc.Mail.UseTLS = true\n\tc.Mail.MXRelay = true\n\tc.Mail.OnionRelay = false // Allow .onion addresses as MX relays\n\tc.Mail.Sender = \"\"\n\tc.Mail.Username = \"\"\n\tc.Mail.Password = \"\"\n\tc.Mail.OutboundName = \"Anonymous Remailer\"\n\tc.Mail.OutboundAddy = \"[email protected]\"\n\tc.Mail.CustomFrom = false\n\tc.Stats.Minrel = 98.0\n\tc.Stats.Relfinal = 99.0\n\tc.Stats.Minlat = 2\n\tc.Stats.Maxlat = 60\n\tc.Stats.Chain = \"*,*,*\"\n\tc.Stats.Numcopies = 1\n\tc.Stats.Distance = 2\n\tc.Stats.StaleHrs = 24\n\tc.Stats.UseExpired = false\n\tc.Pool.Size = 5 // Good for startups, too small for established\n\tc.Pool.Rate = 65\n\tc.Pool.MinSend = 5 // Only used in Binomial Mix Pools\n\tc.Pool.Loop = 300\n\tc.Pool.MaxAge = 28\n\tc.Remailer.Name = \"anon\"\n\tc.Remailer.Address = \"[email protected]\"\n\tc.Remailer.Exit = false\n\tc.Remailer.MaxSize = 12\n\tc.Remailer.IDexp = 14\n\tc.Remailer.ChunkExpire = 60\n\t// Discard messages if packet timestamp exceeds this age in days\n\tc.Remailer.MaxAge = 14\n\tc.Remailer.Keylife = 14\n\tc.Remailer.Keygrace = 28\n\tc.Remailer.Daemon = false\n\treturn c\n}", "func mergeConfigRule(conf ...*definition.Config) *definition.Config {\n\trules := make([]definition.Rule, 0, 10)\n\tvar gen definition.Generator\n\tfor _, c := range conf {\n\t\tif c.Generator != nil {\n\t\t\tgen = *c.Generator\n\t\t}\n\t\trules = append(rules, c.Rules...)\n\t}\n\treturn &definition.Config{Rules: rules, Generator: &gen}\n}", "func GetConfigGroups(confByte []byte) (GroupSet, error) {\n\tvar groups GroupSet\n\terr := yaml.Unmarshal(confByte, &groups)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn groups, nil\n}", "func (sm *ShardMaster) usingGroup(config Config, gid int64) bool {\n\tfor _, gidUsed := range config.Shards {\n\t\tif gid == gidUsed {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func buildConfig(opts []Option) config {\n\tc := config{\n\t\tclock: clock.New(),\n\t\tslack: 10,\n\t\tper: time.Second,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt.apply(&c)\n\t}\n\treturn c\n}", "func buildConfig(opts []Option) (*Config, error) {\n\tcfg := &Config{\n\t\tkeyPrefix: DefKeyPrefix,\n\t}\n\n\tfor _, opt := range opts {\n\t\tif err := opt(cfg); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn cfg, nil\n}", "func (s stage) createGroups(config types.Config) error {\n\tif len(config.Passwd.Groups) == 0 {\n\t\treturn nil\n\t}\n\ts.Logger.PushPrefix(\"createGroups\")\n\tdefer s.Logger.PopPrefix()\n\n\tfor _, g := range config.Passwd.Groups {\n\t\tif err := s.CreateGroup(g); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create group %q: %v\",\n\t\t\t\tg.Name, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (nc *NabtoClient) ApplyConfig() {\n\n}", "func ToGroupConfig(val interface{}) (*GroupConfig, error) {\n\tvar group GroupConfig\n\tinrec, err := json.Marshal(val)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(inrec, &group)\n\treturn &group, err\n}", "func (setGroup *SettingGroup) checkAndSetDefaultValues(options *OptionGroup) {\n\n\t//Now march over and set each value\n\tfor _, opt := range options.Options {\n\t\t//See if there is a settings group\n\t\tif _, found := setGroup.Settings[opt.Id]; !found {\n\t\t\tsetGroup.Settings[opt.Id] = opt.DefaultValue\n\t\t}\n\t}\n\n\t//Now do this for all of the subgroups\n\tfor _, optGroup := range options.SubGroups {\n\t\t//Get the setSubGroup\n\t\tsetSubGroup := setGroup.GetSubGroup(optGroup.Id)\n\n\t\t//Now update the subgruop\n\t\tsetSubGroup.checkAndSetDefaultValues(&optGroup)\n\t}\n\n}", "func buildConfig(opts []Option) config {\r\n\tc := config{\r\n\t\tclock: clock.New(),\r\n\t\tmaxSlack: 10,\r\n\t\tper: time.Second,\r\n\t}\r\n\tfor _, opt := range opts {\r\n\t\topt.apply(&c)\r\n\t}\r\n\treturn c\r\n}", "func flagSet(name string, cfg *CmdConfig) *flag.FlagSet {\n\tflags := flag.NewFlagSet(name, flag.ExitOnError)\n\tflags.StringVar(\n\t\t&cfg.ConfigPath,\n\t\t\"config-path\",\n\t\tsetFromEnvStr(\"CONFIG_PATH\", \"/repo\"),\n\t\t\"Configuration root directory. Should include the '.porter' or 'environment' directory. \"+\n\t\t\t\"Kubernetes object yaml files may be in the directory or in a subdirectory named 'k8s'.\",\n\t)\n\tflags.StringVar(&cfg.ConfigType, \"config-type\", setFromEnvStr(\"CONFIG_TYPE\", \"porter\"), \"Configuration type, \"+\n\t\t\"simple or porter.\")\n\tflags.StringVar(&cfg.Environment, \"environment\", setFromEnvStr(\"ENVIRONMENT\", \"\"), \"Environment of deployment.\")\n\tflags.IntVar(&cfg.MaxConfigMaps, \"max-cm\", setFromEnvInt(\"MAX_CM\", 5), \"Maximum number of configmaps and secret \"+\n\t\t\"objects to keep per app.\")\n\tflags.StringVar(&cfg.Namespace, \"namespace\", setFromEnvStr(\"NAMESPACE\", \"default\"), \"Kubernetes namespace.\")\n\tflags.StringVar(&cfg.Regions, \"regions\", setFromEnvStr(\"REGIONS\", \"\"), \"Regions\"+\n\t\t\"of deployment. (Multiple Space delimited regions allowed)\")\n\tflags.StringVar(&cfg.SHA, \"sha\", setFromEnvStr(\"sha\", \"\"), \"Deployment sha.\")\n\tflags.StringVar(&cfg.VaultAddress, \"vault-addr\", setFromEnvStr(\"VAULT_ADDR\", \"https://vault.loc.adobe.net\"),\n\t\t\"Vault server.\")\n\tflags.StringVar(&cfg.VaultBasePath, \"vault-path\", setFromEnvStr(\"VAULT_PATH\", \"/\"), \"Path in Vault.\")\n\tflags.StringVar(&cfg.VaultToken, \"vault-token\", setFromEnvStr(\"VAULT_TOKEN\", \"\"), \"Vault token.\")\n\tflags.StringVar(&cfg.SecretPathWhiteList, \"secret-path-whitelist\", setFromEnvStr(\"SECRET_PATH_WHITELIST\", \"\"), \"\"+\n\t\t\"Multiple Space delimited secret path whitelist allowed\")\n\tflags.BoolVar(&cfg.Verbose, \"v\", setFromEnvBool(\"VERBOSE\"), \"Verbose log output.\")\n\tflags.IntVar(&cfg.Wait, \"wait\", setFromEnvInt(\"WAIT\", 180), \"Extra time to wait for deployment to complete in \"+\n\t\t\"seconds.\")\n\tflags.StringVar(&cfg.LogMode, \"log-mode\", setFromEnvStr(\"LOG_MODE\", \"inline\"), \"Pod log streaming mode. \"+\n\t\t\"One of 'inline' (print to porter2k8s log), 'file' (write to filesystem, see log-dir option), \"+\n\t\t\"'none' (disable log streaming)\")\n\tflags.StringVar(&cfg.LogDir, \"log-dir\", setFromEnvStr(\"LOG_DIR\", \"logs\"),\n\t\t\"Directory to write pod logs into. (must already exist)\")\n\n\treturn flags\n}", "func WithContext(ctx context.Context) (*Group, context.Context)", "func initGroup(apiRouter *mux.Router, context *Context) {\n\taddContext := func(handler contextHandlerFunc) *contextHandler {\n\t\treturn newContextHandler(context, handler)\n\t}\n\n\tgroupsRouter := apiRouter.PathPrefix(\"/groups\").Subrouter()\n\tgroupsRouter.Handle(\"\", addContext(handleGetGroups)).Methods(\"GET\")\n\tgroupsRouter.Handle(\"\", addContext(handleCreateGroup)).Methods(\"POST\")\n\tgroupsRouter.Handle(\"/status\", addContext(handleGetGroupsStatus)).Methods(\"GET\")\n\n\tgroupRouter := apiRouter.PathPrefix(\"/group/{group:[A-Za-z0-9]{26}}\").Subrouter()\n\tgroupRouter.Handle(\"\", addContext(handleGetGroup)).Methods(\"GET\")\n\tgroupRouter.Handle(\"\", addContext(handleUpdateGroup)).Methods(\"PUT\")\n\tgroupRouter.Handle(\"\", addContext(handleDeleteGroup)).Methods(\"DELETE\")\n\tgroupRouter.Handle(\"/status\", addContext(handleGetGroupStatus)).Methods(\"GET\")\n\n\tgroupRouter.Handle(\"/annotations\", addContext(handleAddGroupAnnotations)).Methods(\"POST\")\n\tgroupRouter.Handle(\"/annotation/{annotation-name}\", addContext(handleDeleteGroupAnnotation)).Methods(\"DELETE\")\n}", "func initConfig() {\n if cfgFile != \"\" {\n // Use config file from the flag.\n viper.SetConfigFile(cfgFile)\n } else {\n // Find home directory.\n // home, err := homedir.Dir()\n // if err != nil {\n // fmt.Println(err)\n // os.Exit(1)\n // }\n\n // Search config in current directory with name \"gobcos_config\" (without extension).\n viper.AddConfigPath(\".\")\n viper.SetConfigName(\"gobcos_config\")\n }\n\n viper.AutomaticEnv() // read in environment variables that match\n\n // If a config file is found, read it in.\n if err := viper.ReadInConfig(); err == nil {\n if viper.IsSet(\"GroupID\") {\n GroupID = uint(viper.GetInt(\"GroupID\"))\n } else {\n fmt.Println(\"GroupID has not been set, please check the config file gobcos_config.yaml\")\n os.Exit(1)\n }\n if viper.IsSet(\"RPCurl\") {\n URL = viper.GetString(\"RPCurl\")\n } else {\n fmt.Println(\"RPCurl has not been set, please check the config file gobcos_config.yaml\")\n os.Exit(1)\n }\n RPC = getClient(URL, GroupID)\n }\n}", "func configBuildAllConfigs(svc *route53.Route53, path string) {\n\n\t// Make sure the path exists to the best of our ability\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\tos.Mkdir(path, os.ModeDir)\n\t}\n\n\tzones, err := getHostedZones(svc)\n\tif err != nil {\n\t\tlog.Fatalf(\"error obtaining hosted zones list with error: %s\", err)\n\t}\n\n\t// Iterate over all the hosted zones in the account\n\tfor _, val := range zones {\n\n\t\tvar config route53Zone\n\t\tzoneID := aws.StringValue(val.Id)\n\t\tzoneName := aws.StringValue(val.Name)\n\n\t\t// remove the /hostedzone/ path if it's there\n\t\tif strings.HasPrefix(zoneID, \"/hostedzone/\") {\n\t\t\tzoneID = strings.TrimPrefix(zoneID, \"/hostedzone/\")\n\t\t}\n\n\t\trrsets, err := listAllRecordSets(svc, zoneID)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error obtaining recordset for hosted zoneid %s with error: %s\", zoneID, err)\n\t\t}\n\n\t\tconfig.Name = zoneName\n\n\t\tfmt.Println(\"*****************************************\")\n\t\tfmt.Printf(\"Name: %s\\n\", zoneName)\n\t\tfmt.Println(\"*****************************************\")\n\n\t\tfor _, rrset := range rrsets {\n\n\t\t\tgetRoute53ZoneConfig(&config, rrset)\n\n\t\t}\n\n\t\t// Marshal data structure into YAML file\n\t\tyamlFile, err := yaml.Marshal(config)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error serializing config struct to YAML with error: %s\", err)\n\t\t}\n\n\t\t// Build the file path\n\t\tfilePath := path + string(os.PathSeparator) + strings.TrimSuffix(zoneName, \".\") + \".yaml\"\n\n\t\t// Write the file out\n\t\terr = ioutil.WriteFile(filePath, yamlFile, 0644)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error generating configuration file %s with error %s\", filePath, err)\n\t\t}\n\n\t\t// Display some useful information\n\t\tfmt.Println(fmt.Sprintf(\"Records: %d\", len(config.ResourceRecordSets)))\n\t\tfmt.Println(fmt.Sprintf(\"Status: Created file %s\", filePath))\n\t}\n}", "func ByContexts(cfg *configapi.Config, names ...string) *configapi.Config {\n\tconfig := &configapi.Config{}\n\tfor _, name := range names {\n\t\tc := ByContext(cfg, name)\n\t\tconfig.AuthInfos = append(config.AuthInfos, c.AuthInfos...)\n\t\tconfig.Clusters = append(config.Clusters, c.Clusters...)\n\t\tconfig.Contexts = append(config.Contexts, c.Contexts...)\n\t\tconfig.CurrentContext = name\n\t}\n\treturn config\n}", "func (c *Config) AppendGroups(groups []*services.ServiceGroupConfig) error {\n\tvar groupsDereferenced []services.ServiceGroupConfig\n\tfor _, group := range groups {\n\t\tgroupsDereferenced = append(groupsDereferenced, *group)\n\t}\n\treturn errors.WithStack(c.AddGroups(groupsDereferenced))\n}", "func NewConfigGroup(ctx *pulumi.Context,\n\tname string, args *ConfigGroupArgs, opts ...pulumi.ResourceOption) (*ConfigGroup, error) {\n\n\t// Register the resulting resource state.\n\tconfigGroup := &ConfigGroup{\n\t\tResources: map[string]pulumi.Resource{},\n\t}\n\terr := ctx.RegisterComponentResource(\"kubernetes:yaml:ConfigGroup\", name, configGroup, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Now provision all child resources by parsing the YAML files.\n\tif args != nil {\n\t\t// Honor the resource name prefix if specified.\n\t\tif args.ResourcePrefix != \"\" {\n\t\t\tname = args.ResourcePrefix + \"-\" + name\n\t\t}\n\n\t\t// Parse and decode the YAML files.\n\t\tparseOpts := append(opts, pulumi.Parent(configGroup))\n\t\trs, err := parseDecodeYamlFiles(ctx, args, true, parseOpts...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconfigGroup.Resources = rs\n\t}\n\n\t// Finally, register all of the resources found.\n\terr = ctx.RegisterResourceOutputs(configGroup, pulumi.Map{})\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"registering child resources\")\n\t}\n\n\treturn configGroup, nil\n}", "func (gc *GroupsConfig) Load(rootDir string, restrictions *RestrictionsConfig) error {\n\tlog.Printf(\"reading groups.yaml files recursively at %s\", rootDir)\n\n\treturn filepath.Walk(rootDir, func(path string, info os.FileInfo, _ error) error {\n\t\tif filepath.Base(path) == \"groups.yaml\" {\n\t\t\tcleanPath := strings.Trim(strings.TrimPrefix(path, rootDir), string(filepath.Separator))\n\t\t\tlog.Printf(\"groups: %s\", cleanPath)\n\n\t\t\tvar (\n\t\t\t\tgroupsConfigAtPath GroupsConfig\n\t\t\t\tcontent []byte\n\t\t\t\terr error\n\t\t\t)\n\n\t\t\tif content, err = ioutil.ReadFile(path); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error reading groups config file %s: %w\", path, err)\n\t\t\t}\n\t\t\tif err = yaml.Unmarshal(content, &groupsConfigAtPath); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error parsing groups config at %s: %w\", path, err)\n\t\t\t}\n\n\t\t\tr := restrictions.GetRestrictionForPath(path, rootDir)\n\t\t\tmergedGroups, err := mergeGroups(gc.Groups, groupsConfigAtPath.Groups, r)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"couldn't merge groups: %w\", err)\n\t\t\t}\n\t\t\tgc.Groups = mergedGroups\n\t\t}\n\t\treturn nil\n\t})\n}", "func updateConfigValues() bool {\n leftModules := getConfValue(\"main;modules_left\", \"\")\n centerModules := getConfValue(\"main;modules_center\", \"\")\n rightModules := getConfValue(\"main;modules_right\", \"\")\n\n if leftModules == \"\" && centerModules == \"\" && rightModules == \"\" {\n leftModules = defaultEnabledModules[0]\n centerModules = defaultEnabledModules[1]\n rightModules = defaultEnabledModules[2]\n }\n\n paddingLeft := getConfInt(\"main;left_padding\", 0)\n paddingRight := getConfInt(\"main;right_padding\", 0)\n\n seperator := getConfValue(\"main;item_seperator\", \"|\")\n\n if leftModules != enabledModules[0] || centerModules != enabledModules[1] ||\n rightModules != enabledModules[2] {\n enabledModules[0] = leftModules\n enabledModules[1] = centerModules\n enabledModules[2] = rightModules\n return true\n }\n\n if paddingLeft != leftPadding || paddingRight != rightPadding {\n leftPadding = paddingLeft\n rightPadding = paddingRight\n return true\n }\n\n if seperator != elementSeperator {\n elementSeperator = seperator\n return true\n }\n\n return false\n}", "func SetGroups(datasetID string, rawGroupings []map[string]interface{}, data api.DataStorage, meta api.MetadataStorage, config *IngestTaskConfig) error {\n\t// We currently only allow for one image to be present in a dataset.\n\tmultiBandImageGroupings := getMultiBandImageGrouping(rawGroupings)\n\tnumGroupings := len(multiBandImageGroupings)\n\tif numGroupings >= 1 {\n\t\tlog.Warnf(\"found %d multiband image groupings - only first will be used\", numGroupings)\n\t}\n\tif numGroupings > 0 {\n\t\trsg := &model.MultiBandImageGrouping{}\n\t\terr := json.MapToStruct(rsg, multiBandImageGroupings[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Set the name of the expected cluster column - it doesn't necessarily exist.\n\t\tvarName := rsg.IDCol + \"_group\"\n\t\trsg.ClusterCol = model.ClusterVarPrefix + rsg.IDCol\n\t\terr = meta.AddGroupedVariable(datasetID, varName, \"Tile\", model.MultiBandImageType, []string{model.VarDistilRoleGrouping}, rsg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Make sure we set the role of the multiband image's ID column to grouping as filters need this to run DISTINCT ON\n\t\tidColVariable, err := meta.FetchVariable(datasetID, rsg.GetIDCol())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tidColVariable.DistilRole = []string{model.VarDistilRoleGrouping}\n\t\terr = meta.UpdateVariable(datasetID, rsg.GetIDCol(), idColVariable)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tgeoBoundsGroupings := getGeoBoundsGrouping(rawGroupings)\n\tfor _, rawGrouping := range geoBoundsGroupings {\n\t\tgrouping := &model.GeoBoundsGrouping{}\n\t\terr := json.MapToStruct(grouping, rawGrouping)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tds, err := meta.FetchDataset(datasetID, true, true, true)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// confirm that the coordinates col data does exist - it could be that it was removed during the join\n\t\t// process\n\t\texists, err := data.DoesVariableExist(datasetID, ds.StorageName, grouping.CoordinatesCol)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !exists {\n\t\t\tcontinue\n\t\t}\n\n\t\t// confirm the existence of the underlying polygon field, creating it if necessary\n\t\t// (less than ideal because it hides a pretty big side effect)\n\t\t// (other option would be to error here and let calling code worry about it)\n\t\texists, err = data.DoesVariableExist(datasetID, ds.StorageName, grouping.PolygonCol)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !exists {\n\t\t\terr = createGeoboundsField(datasetID, ds.StorageName, grouping.CoordinatesCol, grouping.PolygonCol, data, meta)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Set the name of the expected cluster column\n\t\tvarName := grouping.CoordinatesCol + \"_group\"\n\t\terr = meta.AddGroupedVariable(datasetID, varName, \"coordinates\", model.GeoBoundsType, []string{model.VarDistilRoleGrouping}, grouping)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *C7000) LdapGroups(cfgGroups []*cfgresources.LdapGroup, cfgLdap *cfgresources.Ldap) (err error) {\n\tfor _, group := range cfgGroups {\n\t\tif group.Group == \"\" {\n\t\t\tc.log.V(1).Info(\"Ldap resource parameter Group required but not declared.\",\n\t\t\t\t\"step\", \"applyLdapGroupParams\",\n\t\t\t\t\"HardwareType\", c.HardwareType(),\n\t\t\t\t\"Ldap role\", group.Role,\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// 0. removeLdapGroup\n\t\tif !group.Enable {\n\t\t\terr = c.applyRemoveLdapGroup(group.Group)\n\t\t\tif err != nil {\n\t\t\t\tc.log.V(1).Error(err, \"Remove Ldap Group returned error.\",\n\t\t\t\t\t\"step\", \"applyRemoveLdapGroup\",\n\t\t\t\t\t\"resource\", \"Ldap\",\n\t\t\t\t\t\"IP\", c.ip,\n\t\t\t\t\t\"HardwareType\", c.HardwareType(),\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\tif !c.isRoleValid(group.Role) {\n\t\t\tc.log.V(1).Info(\"Ldap resource Role must be a valid role: admin OR user.\",\n\t\t\t\t\"step\", \"applyLdapGroupParams\",\n\t\t\t\t\"role\", group.Role,\n\t\t\t\t\"HardwareType\", c.HardwareType(),\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// 1. addLdapGroup\n\t\terr = c.applyAddLdapGroup(group.Group)\n\t\tif err != nil {\n\t\t\tc.log.V(1).Error(err, \"addLdapGroup returned error.\",\n\t\t\t\t\"step\", \"applyAddLdapGroup\",\n\t\t\t\t\"resource\", \"Ldap\",\n\t\t\t\t\"IP\", c.ip,\n\t\t\t\t\"HardwareType\", c.HardwareType(),\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// 2. setLdapGroupBayACL\n\t\terr = c.applyLdapGroupBayACL(group.Role, group.Group)\n\t\tif err != nil {\n\t\t\tc.log.V(1).Error(err, \"addLdapGroup returned error.\",\n\t\t\t\t\"step\", \"setLdapGroupBayACL\",\n\t\t\t\t\"resource\", \"Ldap\",\n\t\t\t\t\"IP\", c.ip,\n\t\t\t\t\"HardwareType\", c.HardwareType(),\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// 3. applyAddLdapGroupBayAccess\n\t\terr = c.applyAddLdapGroupBayAccess(group.Group)\n\t\tif err != nil {\n\t\t\tc.log.V(1).Error(err, \"addLdapGroup returned error.\",\n\t\t\t\t\"step\", \"applyAddLdapGroupBayAccess\",\n\t\t\t\t\"resource\", \"Ldap\",\n\t\t\t\t\"IP\", c.ip,\n\t\t\t\t\"HardwareType\", c.HardwareType(),\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t}\n\n\tc.log.V(1).Info(\"Ldap config applied\",\n\t\t\"IP\", c.ip,\n\t\t\"HardwareType\", c.HardwareType(),\n\t)\n\treturn\n}", "func Apply(c Config) {\n\t// Normalize values\n\tif c.StdErrThreshold == 0 {\n\t\tc.StdErrThreshold = DefaultConfig.StdErrThreshold\n\t}\n\n\tif c.Verbosity == 0 {\n\t\tc.Verbosity = DefaultConfig.Verbosity\n\t}\n\n\tif c.OutputDir == \"\" {\n\t\tc.OutputDir = DefaultConfig.OutputDir\n\t}\n\n\t// Mimic flag.Set\n\tlogging.toStderr = (c.Output == OutputStdErr)\n\tlogging.alsoToStderr = (c.Output == OutputBoth)\n\tlogging.stderrThreshold.Set(strconv.FormatInt(int64(c.StdErrThreshold), 10))\n\tlogging.verbosity.Set(strconv.FormatInt(int64(c.Verbosity), 10))\n\n\tvmodules := make([]string, len(c.VerbosityModules))\n\tfor i, vm := range c.VerbosityModules {\n\t\tvmodules[i] = fmt.Sprintf(\"%s=%s\", vm.Module, vm.Verbosity)\n\t}\n\tlogging.vmodule.Set(strings.Join(vmodules, \",\"))\n\n\t// See glog_file.go\n\tlogDirs = []string{c.OutputDir}\n}", "func (nv *NetView) ViewConfig() {\n\tvs := nv.Scene()\n\tif nv.Net == nil || nv.Net.NLayers() == 0 {\n\t\tvs.DeleteChildren(true)\n\t\tvs.Meshes.Reset()\n\t\treturn\n\t}\n\tif vs.Lights.Len() == 0 {\n\t\tnv.ViewDefaults()\n\t}\n\tvs.BgColor = gi.Prefs.Colors.Background // reset in case user changes\n\tnlay := nv.Net.NLayers()\n\tlaysGp, err := vs.ChildByNameTry(\"Layers\", 0)\n\tif err != nil {\n\t\tlaysGp = gi3d.AddNewGroup(vs, vs, \"Layers\")\n\t}\n\tlayConfig := kit.TypeAndNameList{}\n\tfor li := 0; li < nlay; li++ {\n\t\tlay := nv.Net.Layer(li)\n\t\tlmesh := vs.MeshByName(lay.Name())\n\t\tif lmesh == nil {\n\t\t\tAddNewLayMesh(vs, nv, lay)\n\t\t} else {\n\t\t\tlmesh.(*LayMesh).Lay = lay // make sure\n\t\t}\n\t\tlayConfig.Add(gi3d.KiT_Group, lay.Name())\n\t}\n\tgpConfig := kit.TypeAndNameList{}\n\tgpConfig.Add(KiT_LayObj, \"layer\")\n\tgpConfig.Add(KiT_LayName, \"name\")\n\n\t_, updt := laysGp.ConfigChildren(layConfig)\n\t// if !mods {\n\t// \tupdt = laysGp.UpdateStart()\n\t// }\n\tnmin, nmax := nv.Net.Bounds()\n\tnsz := nmax.Sub(nmin).Sub(mat32.Vec3{1, 1, 0}).Max(mat32.Vec3{1, 1, 1})\n\tnsc := mat32.Vec3{1.0 / nsz.X, 1.0 / nsz.Y, 1.0 / nsz.Z}\n\tszc := mat32.Max(nsc.X, nsc.Y)\n\tpoff := mat32.NewVec3Scalar(0.5)\n\tpoff.Y = -0.5\n\tfor li, lgi := range *laysGp.Children() {\n\t\tly := nv.Net.Layer(li)\n\t\tlg := lgi.(*gi3d.Group)\n\t\tlg.ConfigChildren(gpConfig) // won't do update b/c of above\n\t\tlp := ly.Pos()\n\t\tlp.Y = -lp.Y // reverse direction\n\t\tlp = lp.Sub(nmin).Mul(nsc).Sub(poff)\n\t\trp := ly.RelPos()\n\t\tlg.Pose.Pos.Set(lp.X, lp.Z, lp.Y)\n\t\tlg.Pose.Scale.Set(nsc.X*rp.Scale, szc, nsc.Y*rp.Scale)\n\n\t\tlo := lg.Child(0).(*LayObj)\n\t\tlo.Defaults()\n\t\tlo.LayName = ly.Name()\n\t\tlo.NetView = nv\n\t\tlo.SetMeshName(vs, ly.Name())\n\t\tlo.Mat.Color.SetUInt8(255, 100, 255, 255)\n\t\tlo.Mat.Reflective = 8\n\t\tlo.Mat.Bright = 8\n\t\tlo.Mat.Shiny = 30\n\t\t// note: would actually be better to NOT cull back so you can view underneath\n\t\t// but then the front and back fight against each other, causing flickering\n\n\t\ttxt := lg.Child(1).(*LayName)\n\t\ttxt.Nm = \"layname:\" + ly.Name()\n\t\ttxt.Defaults(vs)\n\t\ttxt.NetView = nv\n\t\ttxt.SetText(vs, ly.Name())\n\t\ttxt.Pose.Scale = mat32.NewVec3Scalar(nv.Params.LayNmSize).Div(lg.Pose.Scale)\n\t\ttxt.SetProp(\"text-align\", gist.AlignLeft)\n\t\ttxt.SetProp(\"text-vertical-align\", gist.AlignTop)\n\t}\n\tlaysGp.UpdateEnd(updt)\n}", "func (c *Config) AddGroups(groups []services.ServiceGroupConfig) error {\n\tlog.Printf(\"Adding %d groups.\\n\", len(groups))\n\tfor _, group := range groups {\n\t\tgrp := GroupDef{\n\t\t\tName: group.Name,\n\t\t\tAliases: group.Aliases,\n\t\t\tDescription: group.Description,\n\t\t\tChildren: []string{},\n\t\t\tEnv: group.Env,\n\t\t}\n\t\tfor _, cg := range group.Groups {\n\t\t\tif cg != nil {\n\t\t\t\tgrp.Children = append(grp.Children, cg.Name)\n\t\t\t}\n\t\t}\n\t\tfor _, cs := range group.Services {\n\t\t\tif cs != nil {\n\t\t\t\tgrp.Children = append(grp.Children, cs.Name)\n\t\t\t}\n\t\t}\n\t\tc.Groups = append(c.Groups, grp)\n\t}\n\treturn nil\n}", "func (b *KubeAPIServerOptionsBuilder) configureAggregation(clusterSpec *kops.ClusterSpec) error {\n\tclusterSpec.KubeAPIServer.RequestheaderAllowedNames = []string{\"aggregator\"}\n\tclusterSpec.KubeAPIServer.RequestheaderExtraHeaderPrefixes = []string{\"X-Remote-Extra-\"}\n\tclusterSpec.KubeAPIServer.RequestheaderGroupHeaders = []string{\"X-Remote-Group\"}\n\tclusterSpec.KubeAPIServer.RequestheaderUsernameHeaders = []string{\"X-Remote-User\"}\n\n\treturn nil\n}", "func interceptConfigs(ctx *Context, rootViper *viper.Viper) (*tmcfg.Config, error) {\n\trootDir := rootViper.GetString(flags.FlagHome)\n\tconfigPath := filepath.Join(rootDir, \"config\")\n\tconfigFile := filepath.Join(configPath, \"config.toml\")\n\n\tconf := tmcfg.DefaultConfig()\n\n\tif _, err := os.Stat(configFile); os.IsNotExist(err) {\n\t\ttmcfg.EnsureRoot(rootDir)\n\n\t\tif err = conf.ValidateBasic(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error in config file: %v\", err)\n\t\t}\n\n\t\tconf.ProfListenAddress = \"localhost:6060\"\n\t\tconf.P2P.RecvRate = 5120000\n\t\tconf.P2P.SendRate = 5120000\n\t\tconf.TxIndex.IndexAllKeys = true\n\t\tconf.Consensus.TimeoutCommit = 5 * time.Second\n\t\ttmcfg.WriteConfigFile(configFile, conf)\n\t} else {\n\t\trootViper.SetConfigType(\"toml\")\n\t\trootViper.SetConfigName(\"config\")\n\t\trootViper.AddConfigPath(configPath)\n\t\tif err := rootViper.ReadInConfig(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read in app.toml: %w\", err)\n\t\t}\n\n\t\tif err := rootViper.Unmarshal(conf); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tappConfigFilePath := filepath.Join(configPath, \"app.toml\")\n\tif _, err := os.Stat(appConfigFilePath); os.IsNotExist(err) {\n\t\tappConf, err := config.ParseConfig(ctx.Viper)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse app.toml: %w\", err)\n\t\t}\n\n\t\tconfig.WriteConfigFile(appConfigFilePath, appConf)\n\t}\n\n\tctx.Viper.SetConfigType(\"toml\")\n\tctx.Viper.SetConfigName(\"app\")\n\tctx.Viper.AddConfigPath(configPath)\n\tif err := ctx.Viper.ReadInConfig(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read in app.toml: %w\", err)\n\t}\n\n\treturn conf, nil\n}", "func ByContext(cfg *configapi.Config, name string) *configapi.Config {\n\tconfig := &configapi.Config{}\n\n\tauths := []configapi.NamedAuthInfo{}\n\tclusters := []configapi.NamedCluster{}\n\tcontexts := []configapi.NamedContext{}\n\tfor _, ctx := range cfg.Contexts {\n\t\tif ctx.Name == name {\n\t\t\tcontexts = append(contexts, ctx)\n\t\t\tauths = append(auths, GetAuthInfoByName(cfg, ctx.Context.AuthInfo))\n\t\t\tclusters = append(clusters, GetClusterByName(cfg, ctx.Context.Cluster))\n\t\t}\n\t}\n\n\tconfig.AuthInfos = auths\n\tconfig.Clusters = clusters\n\tconfig.Contexts = contexts\n\tconfig.CurrentContext = name\n\n\treturn config\n}", "func (cm *configManager) proposeGroup(name string, group *cb.ConfigGroup, handler configvaluesapi.ValueProposer, policyHandler policies.Proposer) (*configResult, error) {\n\tsubGroups := make([]string, len(group.Groups))\n\ti := 0\n\tfor subGroup := range group.Groups {\n\t\tsubGroups[i] = subGroup\n\t\ti++\n\t}\n\n\tlogger.Debugf(\"Beginning new config for channel %s and group %s\", cm.chainID, name)\n\tsubHandlers, err := handler.BeginValueProposals(subGroups)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsubPolicyHandlers, err := policyHandler.BeginPolicyProposals(subGroups)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(subHandlers) != len(subGroups) || len(subPolicyHandlers) != len(subGroups) {\n\t\treturn nil, fmt.Errorf(\"Programming error, did not return as many handlers as groups %d vs %d vs %d\", len(subHandlers), len(subGroups), len(subPolicyHandlers))\n\t}\n\n\tresult := &configResult{\n\t\thandler: handler,\n\t\tpolicyHandler: policyHandler,\n\t\tsubResults: make([]*configResult, 0, len(subGroups)),\n\t}\n\n\tfor i, subGroup := range subGroups {\n\t\tsubResult, err := cm.proposeGroup(name+\"/\"+subGroup, group.Groups[subGroup], subHandlers[i], subPolicyHandlers[i])\n\t\tif err != nil {\n\t\t\tresult.rollback()\n\t\t\treturn nil, err\n\t\t}\n\t\tresult.subResults = append(result.subResults, subResult)\n\t}\n\n\tfor key, value := range group.Values {\n\t\tif err := handler.ProposeValue(key, value); err != nil {\n\t\t\tresult.rollback()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tfor key, policy := range group.Policies {\n\t\tif err := policyHandler.ProposePolicy(key, policy); err != nil {\n\t\t\tresult.rollback()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func init() {\n\tcore.RegisterConfigGroup(defaultConfigs)\n\tcore.RegisterServiceWithConfig(\"api\", &api.ApiServiceFactory{}, api.Configs)\n\tcore.RegisterServiceWithConfig(\"collector\", &collector.CollectorServiceFactory{}, collector.Configs)\n}", "func (ctx *TestContext) ThereIsAGroupWith(parameters string) error {\n\tgroup := ctx.getParameterMap(parameters)\n\n\tif _, ok := group[\"name\"]; !ok {\n\t\tgroup[\"name\"] = \"Group \" + referenceToName(group[\"id\"])\n\t}\n\tif _, ok := group[\"type\"]; !ok {\n\t\tgroup[\"type\"] = \"Class\"\n\t}\n\n\tctx.addGroup(group[\"id\"], group[\"name\"], group[\"type\"])\n\n\treturn nil\n}", "func (c *Config) Apply(cfg *Config) {\n\tif cfg == nil {\n\t\treturn\n\t}\n\n\tc.JrnlCtrlConfig.Apply(&cfg.JrnlCtrlConfig)\n\tc.PipesConfig.Apply(&cfg.PipesConfig)\n\n\tif cfg.BaseDir != \"\" {\n\t\tc.BaseDir = cfg.BaseDir\n\t}\n\tif cfg.HostHostId > 0 {\n\t\tc.HostHostId = cfg.HostHostId\n\t}\n\tif !reflect.DeepEqual(c.PublicApiRpc, cfg.PublicApiRpc) {\n\t\tc.PublicApiRpc = cfg.PublicApiRpc\n\t}\n\tif !reflect.DeepEqual(c.PrivateApiRpc, cfg.PrivateApiRpc) {\n\t\tc.PrivateApiRpc = cfg.PrivateApiRpc\n\t}\n\tif cfg.HostLeaseTTLSec > 0 {\n\t\tc.HostLeaseTTLSec = cfg.HostLeaseTTLSec\n\t}\n\tif cfg.HostRegisterTimeoutSec > 0 {\n\t\tc.HostRegisterTimeoutSec = cfg.HostRegisterTimeoutSec\n\t}\n}", "func (b *hereNowBuilder) ChannelGroups(cg []string) *hereNowBuilder {\n\tb.opts.ChannelGroups = cg\n\n\treturn b\n}", "func init() {\n\tfor group, values := range defaultConfigs {\n\t\tcore.RegisterConfig(group, values)\n\t}\n\tcore.RegisterService(\"indicator\", indicator.Configs, &indicator.IndicatorServiceFactory{})\n\tcore.RegisterService(\"executor\", executor.Configs, &executor.ExecutorServiceFactory{})\n}" ]
[ "0.57627124", "0.56928", "0.56323576", "0.5624966", "0.5570035", "0.5451", "0.5444872", "0.54444635", "0.5353685", "0.53158504", "0.53028154", "0.5301918", "0.5294122", "0.52822435", "0.52745837", "0.5246256", "0.52323675", "0.5191772", "0.51847905", "0.5112207", "0.50798076", "0.5062715", "0.5038525", "0.5021557", "0.5004918", "0.4990451", "0.4969295", "0.49295127", "0.4928487", "0.49162894", "0.48740023", "0.48725498", "0.48661917", "0.48615527", "0.4833933", "0.48193467", "0.48164558", "0.48130515", "0.47992954", "0.47992954", "0.47965056", "0.47888902", "0.47855175", "0.47797877", "0.47752115", "0.4767904", "0.4767904", "0.47659117", "0.4764984", "0.47430912", "0.4734792", "0.4732395", "0.47255668", "0.47041804", "0.4696425", "0.4689619", "0.4685755", "0.46700197", "0.46677276", "0.46600825", "0.46561533", "0.46461377", "0.46461377", "0.46288368", "0.4620026", "0.46140355", "0.4611933", "0.46038982", "0.45950207", "0.4594442", "0.45829973", "0.45799378", "0.45766965", "0.45619208", "0.45571813", "0.45570976", "0.45545632", "0.4538349", "0.45335498", "0.45321947", "0.45196956", "0.45179248", "0.45123848", "0.45103797", "0.45018187", "0.44797343", "0.4471935", "0.44575676", "0.44469178", "0.44420862", "0.44360498", "0.44332135", "0.44304478", "0.4428918", "0.44251513", "0.44224247", "0.44123977", "0.44049478", "0.43967053", "0.4388604" ]
0.7091552
0
NewServeBuildTypesInProjectParams creates a new ServeBuildTypesInProjectParams object with the default values initialized.
func NewServeBuildTypesInProjectParams() *ServeBuildTypesInProjectParams { var () return &ServeBuildTypesInProjectParams{ timeout: cr.DefaultTimeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewServeBuildTypesInProjectParamsWithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *ServeBuildTypesInProjectParams) WithFields(fields *string) *ServeBuildTypesInProjectParams {\n\to.SetFields(fields)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithContext(ctx context.Context) *ServeBuildTypesInProjectParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithProjectLocator(projectLocator string) *ServeBuildTypesInProjectParams {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func NewServeBuildTypesInProjectParamsWithContext(ctx context.Context) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewServeFieldParams() *ServeFieldParams {\n\tvar ()\n\treturn &ServeFieldParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewServeBuildFieldShortParams() *ServeBuildFieldShortParams {\n\tvar ()\n\treturn &ServeBuildFieldShortParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ServeBuildTypesInProjectParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *ServeBuildTypesInProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (s *ProjectService) NewCreateProjectParams(displaytext string, name string) *CreateProjectParams {\n\tp := &CreateProjectParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"displaytext\"] = displaytext\n\tp.p[\"name\"] = name\n\treturn p\n}", "func ProjectBody(d *schema.ResourceData) models.ProjectsBodyPost {\n\tquota := d.Get(\"storage_quota\").(int)\n\n\tbody := models.ProjectsBodyPost{\n\t\tProjectName: d.Get(\"name\").(string),\n\t\tRegistryID: d.Get(\"registry_id\").(int),\n\t\tStorageLimit: quota,\n\t}\n\n\tif quota != -1 {\n\t\tbody.StorageLimit = quota * 1073741824\n\t}\n\n\tbody.Metadata.AutoScan = strconv.FormatBool(d.Get(\"vulnerability_scanning\").(bool))\n\tbody.Metadata.Public = d.Get(\"public\").(string)\n\n\tsecurity := d.Get(\"deployment_security\").(string)\n\tif security != \"\" {\n\t\tbody.Metadata.Severity = security\n\t\tbody.Metadata.PreventVul = \"true\"\n\t} else {\n\t\tbody.Metadata.Severity = \"low\"\n\t\tbody.Metadata.PreventVul = \"false\"\n\t}\n\n\tbody.Metadata.EnableContentTrust = strconv.FormatBool(d.Get(\"enable_content_trust\").(bool))\n\n\tcveAllowList := d.Get(\"cve_allowlist\").([]interface{})\n\tlog.Printf(\"[DEBUG] %v \", cveAllowList)\n\tif len(cveAllowList) > 0 {\n\t\tlog.Printf(\"[DEBUG] %v \", expandCveAllowList(cveAllowList))\n\t\tbody.CveAllowlist.Items = expandCveAllowList(cveAllowList)\n\t\tbody.Metadata.ReuseSysCveAllowlist = \"false\"\n\t} else {\n\t\tbody.Metadata.ReuseSysCveAllowlist = \"true\"\n\t}\n\n\treturn body\n}", "func New() {\n\ttypeOfProject()\n}", "func NewServeGroupsParams() *ServeGroupsParams {\n\tvar ()\n\treturn &ServeGroupsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteVeditProjectRequestWithoutParam() *DeleteVeditProjectRequest {\n\n return &DeleteVeditProjectRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/veditProjects/{projectId}\",\n Method: \"DELETE\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "func NewReplaceProjectsParams() *ReplaceProjectsParams {\n\tvar ()\n\treturn &ReplaceProjectsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (w *ServerInterfaceWrapper) NewProject(ctx echo.Context) error {\n\tvar err error\n\n\t// HasSecurity is set\n\n\tctx.Set(\"OpenId.Scopes\", []string{\"exitus/project.write\"})\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.NewProject(ctx)\n\treturn err\n}", "func NewServeBuildFieldShortParamsWithTimeout(timeout time.Duration) *ServeBuildFieldShortParams {\n\tvar ()\n\treturn &ServeBuildFieldShortParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func BuildArgsMap(props *OvfImportTestProperties, testProjectConfig *testconfig.Project,\n\tgcloudBetaArgs, gcloudArgs, wrapperArgs []string) map[e2e.CLITestType][]string {\n\n\tproject := GetProject(props, testProjectConfig)\n\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--project=%v\", project))\n\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--source-uri=%v\", props.SourceURI))\n\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--zone=%v\", props.Zone))\n\n\tgcloudArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--project=%v\", project))\n\tgcloudArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--source-uri=%v\", props.SourceURI))\n\tgcloudArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--zone=%v\", props.Zone))\n\n\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-project=%v\", project))\n\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-ovf-gcs-path=%v\", props.SourceURI))\n\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-zone=%v\", props.Zone))\n\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-build-id=%v\", path.RandString(10)))\n\n\tif len(props.Tags) > 0 {\n\t\ttags := strings.Join(props.Tags, \",\")\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--tags=%v\", tags))\n\t\tgcloudArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--tags=%v\", tags))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-tags=%v\", tags))\n\t}\n\tif props.Os != \"\" {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--os=%v\", props.Os))\n\t\tgcloudArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--os=%v\", props.Os))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-os=%v\", props.Os))\n\t}\n\tif props.MachineType != \"\" {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--machine-type=%v\", props.MachineType))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--machine-type=%v\", props.MachineType))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-machine-type=%v\", props.MachineType))\n\t}\n\tif props.Network != \"\" {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--network=%v\", props.Network))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--network=%v\", props.Network))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-network=%v\", props.Network))\n\t}\n\tif props.Subnet != \"\" {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--subnet=%v\", props.Subnet))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--subnet=%v\", props.Subnet))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-subnet=%v\", props.Subnet))\n\t}\n\tif props.ComputeServiceAccount != \"\" {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--compute-service-account=%v\", props.ComputeServiceAccount))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--compute-service-account=%v\", props.ComputeServiceAccount))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-compute-service-account=%v\", props.ComputeServiceAccount))\n\t}\n\tif props.InstanceServiceAccount != \"\" && !props.NoInstanceServiceAccount {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--service-account=%v\", props.InstanceServiceAccount))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--service-account=%v\", props.InstanceServiceAccount))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-service-account=%v\", props.InstanceServiceAccount))\n\t}\n\tif props.NoInstanceServiceAccount {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, \"--service-account=\")\n\t\tgcloudArgs = append(gcloudArgs, \"--service-account=\")\n\t\twrapperArgs = append(wrapperArgs, \"-service-account=\")\n\t}\n\tif props.InstanceAccessScopes != \"\" && !props.NoInstanceAccessScopes {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--scopes=%v\", props.InstanceAccessScopes))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--scopes=%v\", props.InstanceAccessScopes))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-scopes=%v\", props.InstanceAccessScopes))\n\t}\n\tif props.NoInstanceAccessScopes {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, \"--scopes=\")\n\t\tgcloudArgs = append(gcloudArgs, \"--scopes=\")\n\t\twrapperArgs = append(wrapperArgs, \"-scopes=\")\n\t}\n\n\targsMap := map[e2e.CLITestType][]string{\n\t\te2e.Wrapper: wrapperArgs,\n\t\te2e.GcloudBetaProdWrapperLatest: gcloudBetaArgs,\n\t\te2e.GcloudBetaLatestWrapperLatest: gcloudBetaArgs,\n\t\te2e.GcloudGaLatestWrapperRelease: gcloudArgs,\n\t}\n\treturn argsMap\n}", "func NewNewProjectRequest(server string, body NewProject) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewNewProjectRequestWithBody(server, \"application/json\", bodyReader)\n}", "func NewTestProjectVersionParams() *TestProjectVersionParams {\n\tvar ()\n\treturn &TestProjectVersionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeployRequestWithoutParam() *DeployRequest {\n\n return &DeployRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/scenes/{sceneId}/deployments\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "func NewNewProjectRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl := fmt.Sprintf(\"%s/projects\", server)\n\n\treq, err := http.NewRequest(\"POST\", queryUrl, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewProjectsRequest(server string, params *ProjectsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl := fmt.Sprintf(\"%s/projects\", server)\n\n\tvar queryStrings []string\n\n\tvar queryParam0 string\n\tif params.Q != nil {\n\n\t\tqueryParam0, err = runtime.StyleParam(\"form\", true, \"q\", *params.Q)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tqueryStrings = append(queryStrings, queryParam0)\n\t}\n\n\tvar queryParam1 string\n\tif params.Offset != nil {\n\n\t\tqueryParam1, err = runtime.StyleParam(\"form\", true, \"offset\", *params.Offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tqueryStrings = append(queryStrings, queryParam1)\n\t}\n\n\tvar queryParam2 string\n\tif params.Limit != nil {\n\n\t\tqueryParam2, err = runtime.StyleParam(\"form\", true, \"limit\", *params.Limit)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tqueryStrings = append(queryStrings, queryParam2)\n\t}\n\n\tif len(queryStrings) != 0 {\n\t\tqueryUrl += \"?\" + strings.Join(queryStrings, \"&\")\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryUrl, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func Build(config map[string]interface{}) {\n}", "func (s *ProjectService) NewSuspendProjectParams(id string) *SuspendProjectParams {\n\tp := &SuspendProjectParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func (m *MockProjectServiceIface) NewCreateProjectParams(displaytext, name string) *CreateProjectParams {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewCreateProjectParams\", displaytext, name)\n\tret0, _ := ret[0].(*CreateProjectParams)\n\treturn ret0\n}", "func NewGetProjectsRequest(server string, params *GetProjectsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/projects\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif params.Query != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"query\", *params.Query); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Identifier != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"identifier\", *params.Identifier); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func CreateProject(w http.ResponseWriter, r *http.Request) {\n\t// Get incoming data, content n' stuff\n\t// Pass those data and create em'\n\t// Return new project and response\n}", "func newBuildPipeline(t gaia.PipelineType) BuildPipeline {\n\tvar bP BuildPipeline\n\n\t// Create build pipeline for given pipeline type\n\tswitch t {\n\tcase gaia.PTypeGolang:\n\t\tbP = &BuildPipelineGolang{\n\t\t\tType: t,\n\t\t}\n\tcase gaia.PTypeJava:\n\t\tbP = &BuildPipelineJava{\n\t\t\tType: t,\n\t\t}\n\tcase gaia.PTypePython:\n\t\tbP = &BuildPipelinePython{\n\t\t\tType: t,\n\t\t}\n\tcase gaia.PTypeCpp:\n\t\tbP = &BuildPipelineCpp{\n\t\t\tType: t,\n\t\t}\n\tcase gaia.PTypeRuby:\n\t\tbP = &BuildPipelineRuby{\n\t\t\tType: t,\n\t\t}\n\tcase gaia.PTypeNodeJS:\n\t\tbP = &BuildPipelineNodeJS{\n\t\t\tType: t,\n\t\t}\n\t}\n\n\treturn bP\n}", "func (s *server) addProjects() {\n\tvar projects []Project\n\n\terr := viper.UnmarshalKey(\"projects\", &projects)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tfor _, p := range projects {\n\t\ts.Projects[p.ID] = p\n\t}\n}", "func BuildArgs(s Servable, argsType reflect.Type, argsValue reflect.Value, req *http.Request, buildStructArg func(s Servable, typeName string, req *http.Request) (v reflect.Value, err error)) ([]reflect.Value, error) {\n\tfieldNum := argsType.NumField()\n\tparams := make([]reflect.Value, fieldNum)\n\tfor i := 0; i < fieldNum; i++ {\n\t\tfield := argsType.Field(i)\n\t\tfieldName := field.Name\n\t\tvalueType := argsValue.FieldByName(fieldName).Type()\n\t\tif field.Type.Kind() == reflect.Ptr && valueType.Elem().Kind() == reflect.Struct {\n\t\t\tconvertor := components(req).Convertor(valueType.Elem().Name())\n\t\t\tif convertor != nil {\n\t\t\t\tparams[i] = convertor(req)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tstructName := valueType.Elem().Name()\n\t\t\tv, err := buildStructArg(s, structName, req)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.New(fmt.Sprintf(\"turbo: failed to BuildArgs, error:%s\", err))\n\t\t\t}\n\t\t\tparams[i] = v\n\t\t\tcontinue\n\t\t}\n\t\tv, _ := findValue(fieldName, req)\n\t\tvalue, err := reflectValue(field.Type, argsValue.FieldByName(fieldName), v)\n\t\tlogErrorIf(err)\n\t\tparams[i] = value\n\t}\n\treturn params, nil\n}", "func NewDeletePoolProjectParams() *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewUploadDeployFileParams() *UploadDeployFileParams {\n\tvar ()\n\treturn &UploadDeployFileParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (p *Projector) constructStartSettings(request RequestReader) map[string]interface{} {\n\t\tsettings := make(map[string]interface{})\n\t\tvar setting [2]interface{}\n\t\tsetting[0] = p\n\t\tsetting[1] = request\n\t\t// The \"Key\" key is never used and carries no significance\n\t\tsettings[\"Key\"] = setting\n\t\t\n\treturn settings\n}", "func NewCreateBlueprintInWorkspaceInternalParams() *CreateBlueprintInWorkspaceInternalParams {\n\tvar ()\n\treturn &CreateBlueprintInWorkspaceInternalParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func New(dir, rootDir string) (p *Project) {\n\tv := viper.New()\n\tif !path.IsAbs(dir) {\n\t\td, err := filepath.Abs(dir)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"unable to expand directory %q: %v\", d, err)\n\t\t}\n\t\tdir = d\n\t}\n\tfile := path.Join(dir, configFileName)\n\tv.SetConfigFile(file)\n\tif err := v.ReadInConfig(); err != nil {\n\t\tlog.Fatalf(\"Error reading config file %q: %v\", file, err)\n\t}\n\tif err := v.Unmarshal(&p); err != nil {\n\t\tlog.Fatalf(\"unable to decode file %s into struct: %v\", file, err)\n\t}\n\tif p.Name == \"\" {\n\t\tp.Name = filepath.Base(dir)\n\t}\n\tif p.ContextDir != \"\" && p.Dir == \"\" {\n\t\tfmt.Fprintf(os.Stderr, \"**Deprecated** Project %s, replace `context:` with `workdir: in .gally.yml`\\n\", p.Name)\n\t\tp.Dir = p.ContextDir\n\t\tp.ContextDir = \"\"\n\t}\n\tp.BaseDir = dir\n\tif p.Dir == \"\" {\n\t\tp.Dir = dir\n\t} else {\n\t\tif !path.IsAbs(p.Dir) {\n\t\t\tp.Dir = path.Join(dir, p.Dir)\n\t\t}\n\t\tif _, err := os.Stat(p.Dir); os.IsNotExist(err) {\n\t\t\tlog.Fatalf(\"workdir directory %q does not exist\", p.Dir)\n\t\t}\n\t}\n\tp.RootDir = rootDir\n\tif !path.IsAbs(rootDir) {\n\t\td, err := filepath.Abs(rootDir)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"unable to expand directory %q: %v\", d, err)\n\t\t}\n\t\tp.RootDir = d\n\t}\n\n\tfor k, v := range p.DependsOn {\n\t\tp.DependsOn[k] = path.Join(p.BaseDir, v)\n\t\tif _, err := os.Stat(p.DependsOn[k]); os.IsNotExist(err) {\n\t\t\tlog.Fatalf(\"depends_on directory %q does not exist\", p.DependsOn[k])\n\t\t}\n\t}\n\treturn p\n}", "func ProjectsPOST(c *gin.Context) {\n\tuser := c.MustGet(\"user\").(*User)\n\treq := &ProjectRequest{}\n\tif err := c.BindJSON(req); err != nil {\n\t\treturn\n\t}\n\n\tdateStart, errDateStart := time.Parse(\"2006-01-02\", req.DateStart)\n\tdateEnd, errDateEnd := time.Parse(\"2006-01-02\", req.DateEnd)\n\tif errDateStart != nil || errDateEnd != nil {\n\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t\treturn\n\t}\n\tproject, err := user.NewProject(req.Name, req.Slug, dateStart, dateEnd, req.WordCountStart, req.WordCountGoal)\n\tif err != nil {\n\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tc.Header(\"Location\", fmt.Sprintf(\"/users/%s/projects/%s\", user.Username, project.Slug))\n\tc.Status(http.StatusOK)\n}", "func BuildAcceptProjectInvitePayload(projectAcceptProjectInviteProjectID string, projectAcceptProjectInviteAuth string) (*project.AcceptProjectInvitePayload, error) {\n\tvar err error\n\tvar projectID int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(projectAcceptProjectInviteProjectID, 10, 32)\n\t\tprojectID = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for projectID, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = projectAcceptProjectInviteAuth\n\t}\n\tv := &project.AcceptProjectInvitePayload{}\n\tv.ProjectID = projectID\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func createBuildService() *Service {\n\treturn &Service{\n\t\tList: map[string]string{\n\t\t\t\"all\": ListBuilds,\n\t\t\t\"repo\": ListRepoBuilds,\n\t\t\t\"repoByEvent\": ListRepoBuildsByEvent,\n\t\t\t\"org\": ListOrgBuilds,\n\t\t\t\"orgByEvent\": ListOrgBuildsByEvent,\n\t\t},\n\t\tSelect: map[string]string{\n\t\t\t\"repo\": SelectRepoBuild,\n\t\t\t\"last\": SelectLastRepoBuild,\n\t\t\t\"lastByBranch\": SelectLastRepoBuildByBranch,\n\t\t\t\"count\": SelectBuildsCount,\n\t\t\t\"countByStatus\": SelectBuildsCountByStatus,\n\t\t\t\"countByRepo\": SelectRepoBuildCount,\n\t\t\t\"countByRepoAndEvent\": SelectRepoBuildCountByEvent,\n\t\t\t\"countByOrg\": SelectOrgBuildCount,\n\t\t\t\"countByOrgAndEvent\": SelectOrgBuildCountByEvent,\n\t\t},\n\t\tDelete: DeleteBuild,\n\t}\n}", "func NewProjector(cluster string, kvaddrs []string, adminport string) *Projector {\n\tp := &Projector{\n\t\tcluster: cluster,\n\t\tkvaddrs: kvaddrs,\n\t\tadminport: adminport,\n\t\tbuckets: make(map[string]*couchbase.Bucket),\n\t\treqch: make(chan []interface{}),\n\t\tfinch: make(chan bool),\n\t}\n\t// set the pipelineFactory in pipelineManager to FeedFactory\n\tpm.PipelineManager(&feed_factory, nil);\n\tp.logPrefix = fmt.Sprintf(\"[%v]\", p.repr())\n\tgo mainAdminPort(adminport, p)\n\tgo p.genServer(p.reqch)\n\tc.Infof(\"%v started ...\\n\", p.logPrefix)\n\tp.stats = p.newStats()\n\tp.stats.Set(\"kvaddrs\", kvaddrs)\n\treturn p\n}", "func (a *DefaultApiService) ProjectUsernameProjectBuildNumCancelPost(ctx context.Context, username string, project string, buildNum int32) (Build, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t \tsuccessPayload Build\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/project/{username}/{project}/{build_num}/cancel\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"username\"+\"}\", fmt.Sprintf(\"%v\", username), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"project\"+\"}\", fmt.Sprintf(\"%v\", project), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"build_num\"+\"}\", fmt.Sprintf(\"%v\", buildNum), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json; charset=utf-8\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarQueryParams.Add(\"circle-token\", key)\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "func (gp Provider) Build(config config.Credentials) provider.Provider {\n\tclient := NewClient()\n\n\treturn &Provider{\n\t\tVerifier: provider.NewVerifierBasket(\n\t\t\tNewTeamVerifier(teamConfigsToTeam(config.Github.Teams), client),\n\t\t\tNewOrganizationVerifier(config.Github.Organizations, client),\n\t\t),\n\t}\n}", "func APIProjectCreateHandler(er *Errorly) http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, r *http.Request) {\n\t\tsession, _ := er.Store.Get(r, sessionName)\n\t\tdefer er.SaveSession(session, r, rw)\n\n\t\tif err := r.ParseForm(); err != nil {\n\t\t\ter.Logger.Error().Err(err).Msg(\"Failed to parse form\")\n\t\t\tpassResponse(rw, \"Failed to parse form\", false, http.StatusBadRequest)\n\n\t\t\treturn\n\t\t}\n\n\t\t// Authenticate the user\n\t\tauth, user := er.AuthenticateSession(session)\n\t\tif !auth {\n\t\t\tpassResponse(rw, \"You must be logged in to do this\", false, http.StatusForbidden)\n\n\t\t\treturn\n\t\t}\n\n\t\tprojectName := r.PostFormValue(\"display_name\")\n\t\tif len(projectName) < 3 {\n\t\t\tpassResponse(rw, \"Invalid name was passed\", false, http.StatusBadRequest)\n\n\t\t\treturn\n\t\t}\n\n\t\tprojectURL := r.PostFormValue(\"url\")\n\t\tif projectURL != \"\" {\n\t\t\t_, err := url.Parse(projectURL)\n\t\t\tif err != nil {\n\t\t\t\tpassResponse(rw, \"Invalid URL was passed\", false, http.StatusBadRequest)\n\t\t\t}\n\t\t}\n\n\t\tprojectPrivate, err := strconv.ParseBool(r.PostFormValue(\"private\"))\n\t\tif err != nil {\n\t\t\tprojectPrivate = false\n\t\t}\n\n\t\tprojectLimited, err := strconv.ParseBool(r.PostFormValue(\"limited\"))\n\t\tif err != nil {\n\t\t\tprojectLimited = false\n\t\t}\n\n\t\tuserProjects := make([]structs.Project, 0)\n\n\t\terr = er.Postgres.Model(&userProjects).\n\t\t\tWhere(\"created_by_id = ?\", user.ID).\n\t\t\tSelect()\n\t\tif err != nil {\n\t\t\tpassResponse(rw, err.Error(), false, http.StatusInternalServerError)\n\n\t\t\treturn\n\t\t}\n\n\t\tfor _, userProject := range userProjects {\n\t\t\tif userProject.Settings.DisplayName == projectName {\n\t\t\t\tpassResponse(rw, \"You cannot have multiple projects with the same name\", false, http.StatusBadRequest)\n\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tproject := structs.Project{\n\t\t\tID: er.IDGen.GenerateID(),\n\n\t\t\tCreatedAt: time.Now().UTC(),\n\t\t\tCreatedByID: user.ID,\n\n\t\t\tIntegrations: make([]*structs.User, 0),\n\t\t\tWebhooks: make([]*structs.Webhook, 0),\n\n\t\t\tSettings: structs.ProjectSettings{\n\t\t\t\tDisplayName: projectName,\n\n\t\t\t\tDescription: r.PostFormValue(\"description\"),\n\t\t\t\tURL: projectURL,\n\n\t\t\t\tArchived: false,\n\t\t\t\tPrivate: projectPrivate,\n\n\t\t\t\tLimited: projectLimited,\n\t\t\t},\n\t\t}\n\n\t\t_, err = er.Postgres.Model(&project).Insert()\n\t\tif err != nil {\n\t\t\ter.Logger.Error().Err(err).Msg(\"Failed to insert project\")\n\t\t\tpassResponse(rw, err.Error(), false, http.StatusInternalServerError)\n\n\t\t\treturn\n\t\t}\n\n\t\tuser.ProjectIDs = append(user.ProjectIDs, project.ID)\n\n\t\t_, err = er.Postgres.Model(user).\n\t\t\tWherePK().\n\t\t\tUpdate()\n\t\tif err != nil {\n\t\t\ter.Logger.Error().Err(err).Msg(\"Failed to update user projects\")\n\t\t\tpassResponse(rw, err.Error(), false, http.StatusInternalServerError)\n\n\t\t\treturn\n\t\t}\n\n\t\tpassResponse(rw, structs.PartialProject{\n\t\t\tID: project.ID,\n\t\t\tName: project.Settings.DisplayName,\n\t\t\tDescription: project.Settings.Description,\n\t\t\tArchived: project.Settings.Archived,\n\t\t\tPrivate: project.Settings.Private,\n\t\t\tOpenIssues: project.OpenIssues,\n\t\t\tActiveIssues: project.ActiveIssues,\n\t\t\tResolvedIssues: project.ResolvedIssues,\n\t\t}, true, http.StatusOK)\n\t}\n}", "func NewPostProjectsRequest(server string, body PostProjectsJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewPostProjectsRequestWithBody(server, \"application/json\", bodyReader)\n}", "func NewTestProjectVersionParamsWithTimeout(timeout time.Duration) *TestProjectVersionParams {\n\tvar ()\n\treturn &TestProjectVersionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (m *MockProjectServiceIface) NewListProjectsParams() *ListProjectsParams {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewListProjectsParams\")\n\tret0, _ := ret[0].(*ListProjectsParams)\n\treturn ret0\n}", "func NewServeBuildFieldShortParamsWithHTTPClient(client *http.Client) *ServeBuildFieldShortParams {\n\tvar ()\n\treturn &ServeBuildFieldShortParams{\n\t\tHTTPClient: client,\n\t}\n}", "func CreateProjectHandler(c *gin.Context) {\r\n\tprojectRequest := new(CreateProjectRequest)\r\n\terr := c.Bind(projectRequest)\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t}\r\n\tres, err := CreateProjectCore(projectRequest)\r\n\tc.JSON(201, res)\r\n}", "func (o *ServeBuildTypesInProjectParams) SetProjectLocator(projectLocator string) {\n\to.ProjectLocator = projectLocator\n}", "func NewCreateWidgetParams() *CreateWidgetParams {\n\tvar (\n\t\tacceptDefault = string(\"application/json\")\n\t\tcontentTypeDefault = string(\"application/json\")\n\t)\n\treturn &CreateWidgetParams{\n\t\tAccept: &acceptDefault,\n\t\tContentType: &contentTypeDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewProdnet(cfgFilePath string) *Genesis {\n\tlaunchTime := uint64(1542816000) // '2018-11-22 00:00:00 +0800 CST'\n\n\tgenesisCfg := MustReadConfig(cfgFilePath)\n\n\tinitialAuthorityNodes := loadAuthorityNodes(genesisCfg)\n\tapprovers := loadApprovers(genesisCfg)\n\n\tbuilder := new(Builder).\n\t\tTimestamp(launchTime).\n\t\tGasLimit(polo.InitialGasLimit).\n\t\tState(func(state *state.State) error {\n\t\t\t// alloc precompiled contracts\n\t\t\tfor addr := range vm.PrecompiledContractsByzantium {\n\t\t\t\tstate.SetCode(polo.Address(addr), emptyRuntimeBytecode)\n\t\t\t}\n\n\t\t\t// alloc builtin contracts\n\t\t\tstate.SetCode(builtin.Authority.Address, builtin.Authority.RuntimeBytecodes())\n\t\t\tstate.SetCode(builtin.Executor.Address, builtin.Executor.RuntimeBytecodes())\n\t\t\tstate.SetCode(builtin.Extension.Address, builtin.Extension.RuntimeBytecodes())\n\t\t\tstate.SetCode(builtin.Params.Address, builtin.Params.RuntimeBytecodes())\n\t\t\tstate.SetCode(builtin.Prototype.Address, builtin.Prototype.RuntimeBytecodes())\n\n\t\t\t// alloc tokens for authority node endorsor\n\t\t\tfor _, anode := range initialAuthorityNodes {\n\t\t\t\tstate.SetBalance(anode.endorsorAddress, polo.InitialProposerEndorsement)\n\t\t\t}\n\n\t\t\t// alloc tokens for approvers\n\t\t\tamount := new(big.Int).Mul(big.NewInt(210469086165), big.NewInt(1e17))\n\t\t\tfor _, approver := range approvers {\n\t\t\t\tstate.SetBalance(approver.address, amount)\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\n\t///// initialize builtin contracts\n\n\t// initialize params\n\tdata := mustEncodeInput(builtin.Params.ABI, \"set\", polo.KeyExecutorAddress, new(big.Int).SetBytes(builtin.Executor.Address[:]))\n\tbuilder.Call(tx.NewClause(&builtin.Params.Address).WithData(data), polo.Address{})\n\n\tdata = mustEncodeInput(builtin.Params.ABI, \"set\", polo.KeyBaseGasPrice, polo.InitialBaseGasPrice)\n\tbuilder.Call(tx.NewClause(&builtin.Params.Address).WithData(data), builtin.Executor.Address)\n\n\tdata = mustEncodeInput(builtin.Params.ABI, \"set\", polo.KeyProposerEndorsement, polo.InitialProposerEndorsement)\n\tbuilder.Call(tx.NewClause(&builtin.Params.Address).WithData(data), builtin.Executor.Address)\n\n\t// add initial authority nodes\n\tfor _, anode := range initialAuthorityNodes {\n\t\tdata := mustEncodeInput(builtin.Authority.ABI, \"add\", anode.masterAddress, anode.endorsorAddress, anode.identity)\n\t\tbuilder.Call(tx.NewClause(&builtin.Authority.Address).WithData(data), builtin.Executor.Address)\n\t}\n\n\t// add initial approvers (steering committee)\n\tfor _, approver := range approvers {\n\t\tdata := mustEncodeInput(builtin.Executor.ABI, \"addApprover\", approver.address, polo.BytesToBytes32([]byte(approver.identity)))\n\t\tbuilder.Call(tx.NewClause(&builtin.Executor.Address).WithData(data), builtin.Executor.Address)\n\t}\n\n\tvar extra [28]byte\n\tcopy(extra[:], \"CefaChain\")\n\tbuilder.ExtraData(extra)\n\tid, err := builder.ComputeID()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &Genesis{builder, id, \"cefanet\"}\n}", "func NewProjectFromMap(m map[string]interface{}) *Project {\n\treturn NewProject()\n}", "func NewPostSecdefSearchParams() *PostSecdefSearchParams {\n\tvar ()\n\treturn &PostSecdefSearchParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ServeBuildFieldShortParams) WithProjectLocator(projectLocator string) *ServeBuildFieldShortParams {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func NewProjectKey(funcs ...func(*ProjectKey)) (pk *ProjectKey) {\n\tpk = &ProjectKey{\n\t\tDateAdded: utils.NowTruncated(),\n\t\tPublicKey: utils.RandomString(PROJECT_KEY_PUBLIC_KEY_LENGTH),\n\t\tSecretKey: utils.RandomString(PROJECT_KEY_SECRET_KEY_LENGTH),\n\t}\n\n\tfor _, f := range funcs {\n\t\tf(pk)\n\t}\n\n\treturn\n}", "func NewParams(active bool, lps DistributionSchedules, dds DelegatorDistributionSchedules,\n\tmoneyMarkets MoneyMarkets, checkLtvIndexCount int) Params {\n\treturn Params{\n\t\tActive: active,\n\t\tLiquidityProviderSchedules: lps,\n\t\tDelegatorDistributionSchedules: dds,\n\t\tMoneyMarkets: moneyMarkets,\n\t\tCheckLtvIndexCount: checkLtvIndexCount,\n\t}\n}", "func NewServeFieldParamsWithTimeout(timeout time.Duration) *ServeFieldParams {\n\tvar ()\n\treturn &ServeFieldParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewTicketProjectsImportProjectParams() *TicketProjectsImportProjectParams {\n\tvar ()\n\treturn &TicketProjectsImportProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func buildGeneric(builder *builder, c *cli.Context, p *Project, build procedure) error {\n\tlog.Infof(\"Building %s project at %s.\\n\", builder.name, p.Path)\n\tif err := withCleanup(p.Path, build)(); err != nil {\n\t\tlog.Errorf(\"Project couldn't be built: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\tlog.Info(\"Project built.\")\n\treturn nil\n}", "func NewProjectFromPostForm(pf url.Values) (*Project, error) {\n\tp := NewProject()\n\tdecoder := schema.NewDecoder()\n\n\tif err := decoder.Decode(p, pf); err != nil {\n\t\tfmt.Println(err)\n\t\treturn nil, errors.New(\"Invalid project input. Form-data expected\")\n\t}\n\n\tif !p.IsValid() {\n\t\treturn nil, errors.New(\"Incomplete project data\")\n\t}\n\n\treturn p, nil\n}", "func BuildProject(request *http.Request) (string, interface{}) {\n\t//the build step:\n\t//1. get the resouce code's repo and branch\n\t//2. select the build env base image acording to the projects language\n\t//3. build the project and output the tar or binary file to a appoint dir\n\t//4. if the project include Dockerfile,and then output the Dockerfile together\n\t//5. if the project doesn't include Dockerfile,and the generate the Dockerfile by Dockerfile templaet\n\t//TODO\n\treturn r.StatusOK, \"build the project resource success\"\n}", "func (w *ServerInterfaceWrapper) Projects(ctx echo.Context) error {\n\tvar err error\n\n\t// HasSecurity is set\n\n\tctx.Set(\"OpenId.Scopes\", []string{\"exitus/project.read\"})\n\n\t// Parameter object where we will unmarshal all parameters from the context\n\tvar params ProjectsParams\n\t// ------------- Optional query parameter \"q\" -------------\n\tif paramValue := ctx.QueryParam(\"q\"); paramValue != \"\" {\n\t}\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"q\", ctx.QueryParams(), &params.Q)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter q: %s\", err))\n\t}\n\n\t// ------------- Optional query parameter \"offset\" -------------\n\tif paramValue := ctx.QueryParam(\"offset\"); paramValue != \"\" {\n\t}\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"offset\", ctx.QueryParams(), &params.Offset)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter offset: %s\", err))\n\t}\n\n\t// ------------- Optional query parameter \"limit\" -------------\n\tif paramValue := ctx.QueryParam(\"limit\"); paramValue != \"\" {\n\t}\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"limit\", ctx.QueryParams(), &params.Limit)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter limit: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.Projects(ctx, params)\n\treturn err\n}", "func (co *serverConfig) Build() serverConfig {\n\n\treturn serverConfig{\n\t\tURL: co.URL,\n\t\tRetry: co.Retry,\n\t\tRetryWaitTime: co.RetryWaitTime,\n\t}\n}", "func NewDeletePoolProjectParamsWithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewPostProjectsRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/projects\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func BuildListProjectPayload(stationListProjectID string, stationListProjectDisableFiltering string, stationListProjectAuth string) (*station.ListProjectPayload, error) {\n\tvar err error\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationListProjectID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar disableFiltering *bool\n\t{\n\t\tif stationListProjectDisableFiltering != \"\" {\n\t\t\tvar val bool\n\t\t\tval, err = strconv.ParseBool(stationListProjectDisableFiltering)\n\t\t\tdisableFiltering = &val\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid value for disableFiltering, must be BOOL\")\n\t\t\t}\n\t\t}\n\t}\n\tvar auth *string\n\t{\n\t\tif stationListProjectAuth != \"\" {\n\t\t\tauth = &stationListProjectAuth\n\t\t}\n\t}\n\tv := &station.ListProjectPayload{}\n\tv.ID = id\n\tv.DisableFiltering = disableFiltering\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func NewPrivilegedProjectProvider(client ctrlruntimeclient.Client) (*PrivilegedProjectProvider, error) {\n\treturn &PrivilegedProjectProvider{\n\t\tclientPrivileged: client,\n\t}, nil\n}", "func NewRegenerateDeployKeyParams() *RegenerateDeployKeyParams {\n\treturn &RegenerateDeployKeyParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func newUserProjectBindings(c *KubermaticV1Client) *userProjectBindings {\n\treturn &userProjectBindings{\n\t\tclient: c.RESTClient(),\n\t}\n}", "func (s *ProjectService) NewUpdateProjectParams(id string) *UpdateProjectParams {\n\tp := &UpdateProjectParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewUpdateBuildPropertiesParams() *UpdateBuildPropertiesParams {\n\tvar ()\n\treturn &UpdateBuildPropertiesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewParams(opts []copts.Opt) *Params {\r\n\tparams := &Params{}\r\n\tcopts.Apply(params, opts)\r\n\treturn params\r\n}", "func PipelineParams(pipelineConfig *common.Pipeline, namespace string, serviceName string, codeBranch string, muFile string, params map[string]string) error {\n\n\tparams[\"Namespace\"] = namespace\n\tparams[\"ServiceName\"] = serviceName\n\tparams[\"MuFilename\"] = path.Base(muFile)\n\tparams[\"MuBasedir\"] = path.Dir(muFile)\n\tparams[\"SourceProvider\"] = pipelineConfig.Source.Provider\n\tparams[\"SourceRepo\"] = pipelineConfig.Source.Repo\n\n\tcommon.NewMapElementIfNotEmpty(params, \"SourceBranch\", codeBranch)\n\n\tif pipelineConfig.Source.Provider == \"S3\" {\n\t\trepoParts := strings.Split(pipelineConfig.Source.Repo, \"/\")\n\t\tparams[\"SourceBucket\"] = repoParts[0]\n\t\tparams[\"SourceObjectKey\"] = strings.Join(repoParts[1:], \"/\")\n\t}\n\n\tcommon.NewMapElementIfNotEmpty(params, \"BuildType\", string(pipelineConfig.Build.Type))\n\tcommon.NewMapElementIfNotEmpty(params, \"BuildComputeType\", string(pipelineConfig.Build.ComputeType))\n\tcommon.NewMapElementIfNotEmpty(params, \"BuildImage\", pipelineConfig.Build.Image)\n\tcommon.NewMapElementIfNotEmpty(params, \"PipelineBuildTimeout\", pipelineConfig.Build.BuildTimeout)\n\tcommon.NewMapElementIfNotEmpty(params, \"TestType\", string(pipelineConfig.Acceptance.Type))\n\tcommon.NewMapElementIfNotEmpty(params, \"TestComputeType\", string(pipelineConfig.Acceptance.ComputeType))\n\tcommon.NewMapElementIfNotEmpty(params, \"TestImage\", pipelineConfig.Acceptance.Image)\n\tcommon.NewMapElementIfNotEmpty(params, \"AcptEnv\", pipelineConfig.Acceptance.Environment)\n\tcommon.NewMapElementIfNotEmpty(params, \"PipelineBuildAcceptanceTimeout\", pipelineConfig.Acceptance.BuildTimeout)\n\tcommon.NewMapElementIfNotEmpty(params, \"ProdEnv\", pipelineConfig.Production.Environment)\n\tcommon.NewMapElementIfNotEmpty(params, \"PipelineBuildProductionTimeout\", pipelineConfig.Production.BuildTimeout)\n\tcommon.NewMapElementIfNotEmpty(params, \"MuDownloadBaseurl\", pipelineConfig.MuBaseurl)\n\n\tparams[\"EnableBuildStage\"] = strconv.FormatBool(!pipelineConfig.Build.Disabled)\n\tparams[\"EnableAcptStage\"] = strconv.FormatBool(!pipelineConfig.Acceptance.Disabled)\n\tparams[\"EnableProdStage\"] = strconv.FormatBool(!pipelineConfig.Production.Disabled)\n\n\tversion := pipelineConfig.MuVersion\n\tif version == \"\" {\n\t\tversion = common.GetVersion()\n\t\tif version == \"0.0.0-local\" {\n\t\t\tversion = \"\"\n\t\t}\n\t}\n\tif version != \"\" {\n\t\tparams[\"MuDownloadVersion\"] = version\n\t}\n\n\treturn nil\n}", "func (client *BuildServiceClient) listBuildServicesCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *BuildServiceClientListBuildServicesOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewParams(opts []copts.Opt) *Params {\n\tparams := &Params{}\n\tcopts.Apply(params, opts)\n\treturn params\n}", "func (m *MockProjectServiceIface) NewSuspendProjectParams(id string) *SuspendProjectParams {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewSuspendProjectParams\", id)\n\tret0, _ := ret[0].(*SuspendProjectParams)\n\treturn ret0\n}", "func NewReplaceProjectsParamsWithTimeout(timeout time.Duration) *ReplaceProjectsParams {\n\tvar ()\n\treturn &ReplaceProjectsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewGetBuildPropertiesParams() *GetBuildPropertiesParams {\n\tvar ()\n\treturn &GetBuildPropertiesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (t *Task) BuildParams() []string {\n\tvar params []string\n\n\t// Enable gofumpt's extra rules.\n\tif t.opts.extraRules {\n\t\tparams = append(params, \"-extra\")\n\t}\n\n\t// List files whose formatting are non-compliant to gofumpt's styles.\n\tif t.opts.listNonCompliantFiles {\n\t\tparams = append(params, \"-l\")\n\t}\n\n\t// Write result to source files instead of stdout.\n\tif t.opts.persistChanges {\n\t\tparams = append(params, \"-w\")\n\t}\n\n\t// Report all errors and not just the first 10 on different lines.\n\tif t.opts.reportAllErrors {\n\t\tparams = append(params, \"-e\")\n\t}\n\n\tif t.opts.simplify {\n\t\tparams = append(params, \"-s\")\n\t}\n\n\t// Include additionally configured arguments.\n\tparams = append(params, t.opts.extraArgs...)\n\n\t// Only search in specified paths for Go source files...\n\tif len(t.opts.paths) > 0 {\n\t\tparams = append(params, t.opts.paths...)\n\t} else {\n\t\t// ...or otherwise search recursively starting from the working directory of the current process.\n\t\tparams = append(params, \".\")\n\t}\n\n\treturn params\n}", "func NewCreateWidgetParamsWithTimeout(timeout time.Duration) *CreateWidgetParams {\n\tvar (\n\t\tacceptDefault = string(\"application/json\")\n\t\tcontentTypeDefault = string(\"application/json\")\n\t)\n\treturn &CreateWidgetParams{\n\t\tAccept: &acceptDefault,\n\t\tContentType: &contentTypeDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (m *MockProjectServiceIface) NewListProjectInvitationsParams() *ListProjectInvitationsParams {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewListProjectInvitationsParams\")\n\tret0, _ := ret[0].(*ListProjectInvitationsParams)\n\treturn ret0\n}", "func NewParameters(bitlen int) *Parameters {\n\tm, err := rand.Prime(rand.Reader, bitlen)\n\tif err != nil {\n\t\tpanic(\"Could not generate randon prime\")\n\t}\n\tn := 3\n\treturn &Parameters{\n\t\tn: n,\n\t\tM: m,\n\t\ttriplet: GenerateBeaverTriplet(m),\n\t\tassinc: mr.Intn(n),\n\t}\n}", "func CreateProjectHandler(w http.ResponseWriter, r *http.Request) {\n\tvar user models.User\n\tuser = context.Get(r, config.RequestUser).(models.User)\n\n\tvar projectStruct models.Project\n\n\t// Obtain project info from JSON\n\tdec := json.NewDecoder(r.Body)\n\terr := dec.Decode(&projectStruct)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"Error decoding JSON\"))\n\t\treturn\n\t}\n\n\tprojectStruct.UserID = user.ID\n\n\t// Attempt to create the project in the database\n\tproject, err := models.CreateProject(&projectStruct)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"Error creating project\"))\n\t\treturn\n\t}\n\n\t// Attempt to create JSON encoded project info, then send a response\n\trs, err := json.Marshal(project)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"Error Marshalling project info to JSON\"))\n\t\treturn\n\t}\n\n\tlog.Println(\"Created Project: \", project.Name)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\tw.Write(rs)\n\treturn\n}", "func BuildConfig() {\n\tvar pdToken SecretString\n\t// First look up flags\n\tflag.StringSliceP(\"schedules\", \"s\", nil, \"Comma separated list of PagerDuty schedule IDs\")\n\tflag.StringP(\"config\", \"c\", \"\", \"(Optional) Provide config file path. Looks for \\\"config.yaml\\\" by default\")\n\tflag.String(\"csvdir\", \"\", \"(Optional) Print as CSVs to this directory\")\n\tflag.String(\"gsheetid\", \"\", \"(Optional) Print to Google Sheet ID provided\")\n\tflag.String(\"google-safile\", \"\", \"(Optional) Google Service Account token JSON file\")\n\tflag.VarP(&pdToken, \"pagerduty-token\", \"t\", \"PagerDuty API token\")\n\tflag.StringP(\"month\", \"m\", \"\", \"(Optional) Provide the month and year you want to process. Format: March 2018. Default: previous month\")\n\tprintHelp := flag.BoolP(\"help\", \"h\", false, \"Print usage\")\n\n\t// Parse flags\n\tflag.Parse()\n\tif *printHelp {\n\t\tflag.Usage()\n\t\tos.Exit(0)\n\t}\n\n\t// Register some aliases\n\tviper.RegisterAlias(\"sheet-id\", \"gsheetid\")\n\tviper.RegisterAlias(\"start-month\", \"month\")\n\tviper.RegisterAlias(\"pagerduty-schedules\", \"schedules\")\n\n\t// Bind the resulting flags to Viper values\n\tviper.BindPFlags(flag.CommandLine)\n\n\tif pdToken != \"\" {\n\t\t// Force the pagerduty token to the correct SecretString type\n\t\tviper.Set(\"pagerduty-token\", pdToken)\n\t}\n\n\t// We prefix all ENVVARs with \"PDS_\" because that's good practice\n\tviper.SetEnvPrefix(\"pds\")\n\t// Config will be a YAML file\n\tviper.SetConfigType(\"yaml\")\n\t// Expect a file called \"config.yaml\" by default\n\tviper.SetConfigName(\"config\")\n\t// Look for that file in the current directory\n\tviper.AddConfigPath(\".\")\n\t// This will look for any ENVVAR with the \"PDS_\" prefix automatically and bind them to Viper values\n\tviper.AutomaticEnv()\n\t// Make sure we use a strings.Replacer so we can convert \"-\" to \"_\" in ENVVARs\n\treplacer := strings.NewReplacer(\"-\", \"_\")\n\tviper.SetEnvKeyReplacer(replacer)\n\n\tif insecurePdToken, exists := os.LookupEnv(\"PDS_PAGERDUTY_TOKEN\"); exists {\n\t\tpdToken = SecretString(insecurePdToken)\n\t\t// Force the pagerduty token to the correct SecretString type\n\t\tviper.Set(\"pagerduty-token\", pdToken)\n\t}\n\n\t// If we've explicitly set the config flag, use that file\n\tif viper.IsSet(\"config\") {\n\t\tviper.SetConfigFile(viper.GetString(\"config\"))\n\t}\n\t// Read config file, provided through flag or directory discovery\n\terr := viper.ReadInConfig()\n\tif err != nil {\n\t\te, ok := err.(viper.ConfigParseError)\n\t\tif ok {\n\t\t\tlog.Fatalf(\"error parsing config file: %v\", e)\n\t\t}\n\t\t// Should this be a fatal? Technically you could provide everything through other means\n\t\tlog.Warn(\"no config file found\")\n\t}\n\tlog.Debug(\"Using config file: \", viper.ConfigFileUsed())\n\n\t// Set defaults\n\tviper.SetDefault(\"timezone\", time.Local.String())\n\tviper.SetDefault(\"business_hours.start\", \"09:00\")\n\tviper.SetDefault(\"business_hours.end\", \"17:30\")\n\n\t// Create a time.Location using the timezone that we can use for parsing\n\tlog.Debugf(\"Loading timezone %s\", viper.GetString(\"timezone\"))\n\tloc, err := time.LoadLocation(viper.GetString(\"timezone\"))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to parse timezone. use IANA TZ format, err: %s\", err.Error())\n\t}\n\n\t// If start-month is not set, default to previous month\n\tif !viper.IsSet(\"start-month\") || viper.GetString(\"start-month\") == \"\" {\n\t\tviper.Set(\"start-month\", fmt.Sprintf(\"%s %d\", time.Now().AddDate(0, -1, 0).Month(), time.Now().AddDate(0, -1, 0).Year()))\n\t}\n\n\t// Create a time.Time from the start-month\n\tstartDate, err := time.ParseInLocation(\"January 2006\", viper.GetString(\"start-month\"), loc)\n\tendDate := startDate.AddDate(0, +1, 0)\n\n\t// Let's add start and end dates to viper as well for convenience\n\tviper.Set(\"start_date\", startDate)\n\tviper.Set(\"end_date\", endDate)\n\n\t// fail on mandatory config\n\tif !viper.IsSet(\"pagerduty-token\") || string(viper.Get(\"pagerduty-token\").(SecretString)) == \"\" {\n\t\tlog.Fatal(\"PagerDuty access token not provided. Use 'PDS_PAGERDUTY_TOKEN' or flag '--pagerduty-token' / '-t'\")\n\t}\n\tif !viper.IsSet(\"schedules\") || len(viper.GetStringSlice(\"schedules\")) == 0 {\n\t\tlog.Fatal(\"PagerDuty schedules not specified. Use comma separated list in envvar 'PDS_PAGERDUTY_SCHEDULES' or flag '--schedules'\")\n\t}\n\n\t// Kind of a hack because of https://github.com/spf13/viper/issues/380\n\tviper.Set(\"schedules\", commaSeparatedStringToSlice(viper.GetStringSlice(\"schedules\")))\n\n\tif viper.IsSet(\"gsheetid\") {\n\t\tif !viper.IsSet(\"google-safile\") {\n\t\t\tlog.Fatal(\"Google sheets output requires a Google service account file (\\\"--google-safile\\\")\")\n\t\t}\n\t}\n\n\tviper.Set(\"parsed_timezone\", loc)\n\n\tGlobalConfig = ScheduleConfig{\n\t\tHolidays: viper.GetStringSlice(\"holidays\"),\n\t\tBusinessHours: BusinessHoursStruct{\n\t\t\tStart: viper.GetString(\"business_hours.start\"),\n\t\t\tEnd: viper.GetString(\"business_hours.end\"),\n\t\t},\n\t\tCalendarURL: viper.GetString(\"ical_url\"),\n\t\tTimezone: viper.GetString(\"timezone\"),\n\t\tCompanyDays: viper.GetStringSlice(\"company_days\"),\n\t\tParsedTimezone: viper.Get(\"parsed_timezone\").(*time.Location),\n\t\tScheduleSpan: timespan.New(viper.GetTime(\"start_date\"), viper.GetTime(\"end_date\")),\n\t\tDebug: viper.GetBool(\"debug\"),\n\t}\n\n\tlog.Debug(fmt.Sprintf(\"Viper Configuration: %+v\", viper.AllSettings()))\n}", "func NewTeamMemberSettings()(*TeamMemberSettings) {\n m := &TeamMemberSettings{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "func ProjectCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab url path variables\n\turlVars := mux.Vars(r)\n\turlProject := urlVars[\"project\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\trefUserUUID := gorillaContext.Get(r, \"auth_user_uuid\").(string)\n\n\t// Read POST JSON body\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\terr := APIErrorInvalidRequestBody()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Parse pull options\n\tpostBody, err := projects.GetFromJSON(body)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Project\")\n\t\trespondErr(w, err)\n\t\tlog.Error(string(body[:]))\n\t\treturn\n\t}\n\n\tuuid := uuid.NewV4().String() // generate a new uuid to attach to the new project\n\tcreated := time.Now().UTC()\n\t// Get Result Object\n\n\tres, err := projects.CreateProject(uuid, urlProject, created, refUserUUID, postBody.Description, refStr)\n\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Project\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func (p *broStructure) ParseProject(filter func(info os.FileInfo) bool) {\n\tfor _, dir := range p.listDirs() {\n\t\tfileset := token.NewFileSet()\n\t\tmapped, _ := parser.ParseDir(fileset, dir, filter, parser.AllErrors|parser.ParseComments)\n\t\tfor key, val := range mapped {\n\t\t\tp.packageFiles[key] = val\n\t\t}\n\t}\n}", "func MakeTestParams(t genparams.TestingT) string {\n\tdefaultTest := Param{}\n\treturn MakeTestParamsFromList(t, []Param{defaultTest})\n}", "func loadCreateProjectRequest(t *testing.T, filename string) (r *requests.CreateProject) {\n\tloadJSON(t, filename, &r)\n\treturn\n}", "func NewParameters(cfg config.Config, license license.License) Parameters {\n\treturn Parameters{\n\t\tConfig: cfg,\n\t\tLicense: license,\n\t}\n}", "func NewCreateBlueprintInWorkspaceInternalParamsWithTimeout(timeout time.Duration) *CreateBlueprintInWorkspaceInternalParams {\n\tvar ()\n\treturn &CreateBlueprintInWorkspaceInternalParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewListIssueGroupOfProjectVersionParams() *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tshowhiddenDefault = bool(false)\n\t\tshowremovedDefault = bool(false)\n\t\tshowshortfilenamesDefault = bool(false)\n\t\tshowsuppressedDefault = bool(false)\n\t\tstartDefault = int32(0)\n\t)\n\treturn &ListIssueGroupOfProjectVersionParams{\n\t\tLimit: &limitDefault,\n\t\tShowhidden: &showhiddenDefault,\n\t\tShowremoved: &showremovedDefault,\n\t\tShowshortfilenames: &showshortfilenamesDefault,\n\t\tShowsuppressed: &showsuppressedDefault,\n\t\tStart: &startDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (c *Client) Build(params map[string]interface{}) (api.ClientAPI, error) {\n\t// tenantName, _ := params[\"name\"].(string)\n\n\tidentity, _ := params[\"identity\"].(map[string]interface{})\n\tcompute, _ := params[\"compute\"].(map[string]interface{})\n\t// network, _ := params[\"network\"].(map[string]interface{})\n\n\tusername, _ := identity[\"Username\"].(string)\n\tpassword, _ := identity[\"Password\"].(string)\n\tdomainName, _ := identity[\"UserDomainName\"].(string)\n\n\tregion, _ := compute[\"Region\"].(string)\n\tprojectName, _ := compute[\"ProjectName\"].(string)\n\tprojectID, _ := compute[\"ProjectID\"].(string)\n\tdefaultImage, _ := compute[\"DefaultImage\"].(string)\n\n\treturn AuthenticatedClient(\n\t\tAuthOptions{\n\t\t\tUsername: username,\n\t\t\tPassword: password,\n\t\t\tRegion: region,\n\t\t\tDomainName: domainName,\n\t\t\tProjectName: projectName,\n\t\t\tProjectID: projectID,\n\t\t},\n\t\topenstack.CfgOptions{\n\t\t\tDefaultImage: defaultImage,\n\t\t},\n\t)\n}", "func NewProject(dir string, recipe RecipeInterface, vars map[string]interface{}) ProjectInterface {\n\tproject := &project{\n\t\tdir: dir,\n\t\trecipe: recipe,\n\t}\n\n\t// Merge vars\n\t_ = mergo.Merge(&project.vars, recipe.Vars())\n\t_ = mergo.Merge(&project.vars, vars, mergo.WithOverride)\n\n\treturn project\n}", "func (o *GetBuildPropertiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param buildId\n\tif err := r.SetPathParam(\"buildId\", swag.FormatInt32(o.BuildID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func NewProject(path string, flagVCFG *vcfg.VCFG, logger elog.View) error {\n\tlogger.Printf(\"Creating project at '%s'\", path)\n\n\tvcfgPath := filepath.Join(path, \"default.vcfg\")\n\tprojectPath := filepath.Join(path, \".vorteilproject\")\n\n\terr := createVCFGFile(vcfgPath, flagVCFG)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = createProjectFile(projectPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}" ]
[ "0.7486306", "0.7412505", "0.67208457", "0.6383573", "0.61682904", "0.6063506", "0.55452806", "0.5441888", "0.53527576", "0.533795", "0.51392543", "0.5004528", "0.49889004", "0.49443364", "0.49411315", "0.49374586", "0.49106893", "0.4866594", "0.47469872", "0.47384357", "0.4684402", "0.4672263", "0.4666469", "0.46571654", "0.46528926", "0.46033773", "0.45935255", "0.45878392", "0.45855334", "0.4580184", "0.45498702", "0.45233157", "0.45136625", "0.448981", "0.4487538", "0.44505793", "0.44418007", "0.44389662", "0.44342947", "0.44102615", "0.44082087", "0.43865845", "0.43778962", "0.4376476", "0.43739593", "0.43733218", "0.4363791", "0.43635833", "0.43517512", "0.4335448", "0.4323491", "0.43191954", "0.4312642", "0.43000072", "0.4282914", "0.42739508", "0.4273603", "0.4268782", "0.42631686", "0.4240758", "0.42395538", "0.42386445", "0.4238148", "0.42360237", "0.4230005", "0.4206852", "0.4203759", "0.4193197", "0.41818038", "0.4181785", "0.41811404", "0.417257", "0.41658005", "0.41498908", "0.4145178", "0.41410193", "0.41305047", "0.41302153", "0.41273063", "0.41163558", "0.41049019", "0.41020662", "0.4101803", "0.40902478", "0.40874326", "0.40860993", "0.4085705", "0.40843442", "0.40826958", "0.40779746", "0.40772575", "0.4076605", "0.4069381", "0.40662712", "0.4060028", "0.40563947", "0.405225", "0.4047985", "0.40465903", "0.40415713" ]
0.8533326
0
NewServeBuildTypesInProjectParamsWithTimeout creates a new ServeBuildTypesInProjectParams object with the default values initialized, and the ability to set a timeout on a request
func NewServeBuildTypesInProjectParamsWithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams { var () return &ServeBuildTypesInProjectParams{ timeout: timeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ServeBuildTypesInProjectParams) WithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewServeBuildTypesInProjectParams() *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ServeBuildTypesInProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewTestProjectVersionParamsWithTimeout(timeout time.Duration) *TestProjectVersionParams {\n\tvar ()\n\treturn &TestProjectVersionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *TicketProjectsImportProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ReplaceProjectsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServeBuildFieldShortParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewServeBuildFieldShortParamsWithTimeout(timeout time.Duration) *ServeBuildFieldShortParams {\n\tvar ()\n\treturn &ServeBuildFieldShortParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *TestProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePoolProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall) Timeout(timeout int64) *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall {\n\tc.urlParams_.Set(\"timeout\", fmt.Sprint(timeout))\n\treturn c\n}", "func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *TestProjectVersionParams) WithTimeout(timeout time.Duration) *TestProjectVersionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewReplaceProjectsParamsWithTimeout(timeout time.Duration) *ReplaceProjectsParams {\n\tvar ()\n\treturn &ReplaceProjectsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewServeFieldParamsWithTimeout(timeout time.Duration) *ServeFieldParams {\n\tvar ()\n\treturn &ServeFieldParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewCreateBlueprintInWorkspaceInternalParamsWithTimeout(timeout time.Duration) *CreateBlueprintInWorkspaceInternalParams {\n\tvar ()\n\treturn &CreateBlueprintInWorkspaceInternalParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewGetBuildPropertiesParamsWithTimeout(timeout time.Duration) *GetBuildPropertiesParams {\n\tvar ()\n\treturn &GetBuildPropertiesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewCreateWidgetParamsWithTimeout(timeout time.Duration) *CreateWidgetParams {\n\tvar (\n\t\tacceptDefault = string(\"application/json\")\n\t\tcontentTypeDefault = string(\"application/json\")\n\t)\n\treturn &CreateWidgetParams{\n\t\tAccept: &acceptDefault,\n\t\tContentType: &contentTypeDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ListSourceFileOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewRegenerateDeployKeyParamsWithTimeout(timeout time.Duration) *RegenerateDeployKeyParams {\n\treturn &RegenerateDeployKeyParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *UpdateBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewGetProjectMetricsParamsWithTimeout(timeout time.Duration) *GetProjectMetricsParams {\n\tvar ()\n\treturn &GetProjectMetricsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *GetProjectMetricsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeletePoolProjectParamsWithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ReplaceProjectsParams) WithTimeout(timeout time.Duration) *ReplaceProjectsParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithFields(fields *string) *ServeBuildTypesInProjectParams {\n\to.SetFields(fields)\n\treturn o\n}", "func (o *GetPlatformsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServeBuildFieldShortParams) WithTimeout(timeout time.Duration) *ServeBuildFieldShortParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithContext(ctx context.Context) *ServeBuildTypesInProjectParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RegenerateDeployKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewPostSecdefSearchParamsWithTimeout(timeout time.Duration) *PostSecdefSearchParams {\n\tvar ()\n\treturn &PostSecdefSearchParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *GetExampleNewProjectDescriptionCompatibilityVersion1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewUpdateBuildPropertiesParamsWithTimeout(timeout time.Duration) *UpdateBuildPropertiesParams {\n\tvar ()\n\treturn &UpdateBuildPropertiesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) WithTimeout(timeout time.Duration) *CreateBlueprintInWorkspaceInternalParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateRepoNotificationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListDeploymentsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UploadDeployFileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CloudTargetCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewTimeout(parameters ...wparams.ParamStorer) Error {\n\treturn newGenericError(nil, DefaultTimeout, wparams.NewParamStorer(parameters...))\n}", "func NewSizeParamsWithTimeout(timeout time.Duration) *SizeParams {\n\tvar ()\n\treturn &SizeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewListIssueGroupOfProjectVersionParamsWithTimeout(timeout time.Duration) *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tshowhiddenDefault = bool(false)\n\t\tshowremovedDefault = bool(false)\n\t\tshowshortfilenamesDefault = bool(false)\n\t\tshowsuppressedDefault = bool(false)\n\t\tstartDefault = int32(0)\n\t)\n\treturn &ListIssueGroupOfProjectVersionParams{\n\t\tLimit: &limitDefault,\n\t\tShowhidden: &showhiddenDefault,\n\t\tShowremoved: &showremovedDefault,\n\t\tShowshortfilenames: &showshortfilenamesDefault,\n\t\tShowsuppressed: &showsuppressedDefault,\n\t\tStart: &startDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *GetPackageSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateRuntimeMapParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetWorkflowBuildTaskMetaMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *FileInfoCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewUploadDeployFileParamsWithTimeout(timeout time.Duration) *UploadDeployFileParams {\n\tvar ()\n\treturn &UploadDeployFileParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateWidgetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewTicketProjectsImportProjectParamsWithTimeout(timeout time.Duration) *TicketProjectsImportProjectParams {\n\tvar ()\n\treturn &TicketProjectsImportProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PostSecdefSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateTokenParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateInstantPaymentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPublicsRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateUserIssueSearchOptionsOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *TicketProjectsImportProjectParams) WithTimeout(timeout time.Duration) *TicketProjectsImportProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *AddRepositoryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SearchWorkspacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewServeGroupsParamsWithTimeout(timeout time.Duration) *ServeGroupsParams {\n\tvar ()\n\treturn &ServeGroupsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ListIssueGroupOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PetCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewGetPlatformsParamsWithTimeout(timeout time.Duration) *GetPlatformsParams {\n\tvar ()\n\treturn &GetPlatformsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewSearchWorkspacesParamsWithTimeout(timeout time.Duration) *SearchWorkspacesParams {\n\tvar ()\n\treturn &SearchWorkspacesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PublicWebLinkPlatformEstablishParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreatePackageRepositoryDeltaUploadParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *IgroupInitiatorCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetCurrentGenerationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetDeploymentPreview1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCartUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewCloudTargetCreateParamsWithTimeout(timeout time.Duration) *CloudTargetCreateParams {\n\treturn &CloudTargetCreateParams{\n\t\ttimeout: timeout,\n\t}\n}", "func WithTimeout(timeoutType fab.TimeoutType, timeout time.Duration) RequestOption {\n\treturn func(ctx context.Client, o *requestOptions) error {\n\t\tif o.Timeouts == nil {\n\t\t\to.Timeouts = make(map[fab.TimeoutType]time.Duration)\n\t\t}\n\t\to.Timeouts[timeoutType] = timeout\n\t\treturn nil\n\t}\n}", "func NewTimeoutFlags(devel bool) *TimeoutFlags {\n\treturn &TimeoutFlags{\n\t\tflags: NewFlags(devel),\n\t}\n}", "func (o *CreateRunbookRunCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(timeout time.Duration) BuilderOptionFunc {\n\treturn func(b *Builder) error {\n\t\tb.timeout = timeout\n\t\treturn nil\n\t}\n}", "func NewCreateRuntimeMapParamsWithTimeout(timeout time.Duration) *CreateRuntimeMapParams {\n\tvar ()\n\treturn &CreateRuntimeMapParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *UploadWorkflowTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ChatNewParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ImportApplicationUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetOrganizationApplicationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(duration time.Duration) Option {\n\treturn wrappedOption{otlpconfig.WithTimeout(duration)}\n}", "func (o *GetActionTemplateLogoVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSiteDeployParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCustomerTenantsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostSecdefSearchParams) WithTimeout(timeout time.Duration) *PostSecdefSearchParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CreatePublicIPAdressUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewContainerListParamsWithTimeout(timeout time.Duration) *ContainerListParams {\n\tvar (\n\t\tallDefault = bool(false)\n\t\tsizeDefault = bool(false)\n\t)\n\treturn &ContainerListParams{\n\t\tAll: &allDefault,\n\t\tSize: &sizeDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPublicAuthParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateLifecycleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (r *Search) Timeout(timeout string) *Search {\n\n\tr.req.Timeout = &timeout\n\n\treturn r\n}", "func (o *GetClusterTemplateByNameInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateTenantParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostContextsAddPhpParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}" ]
[ "0.7753572", "0.7616564", "0.7420207", "0.6309718", "0.62877584", "0.62607044", "0.6151105", "0.6107298", "0.60912824", "0.59665763", "0.5954188", "0.59011006", "0.5892997", "0.5859184", "0.5858744", "0.58216727", "0.58138007", "0.579796", "0.57729006", "0.5734317", "0.5727969", "0.5717971", "0.5673497", "0.5671955", "0.56629306", "0.5650518", "0.5643415", "0.56420726", "0.5638662", "0.563164", "0.56072706", "0.56037515", "0.5595951", "0.55492216", "0.5531962", "0.5521633", "0.5499734", "0.549575", "0.54874176", "0.5477908", "0.5462363", "0.5458884", "0.54522216", "0.54513144", "0.54439074", "0.5441696", "0.54359263", "0.54344785", "0.5428446", "0.5428149", "0.5422237", "0.541593", "0.540982", "0.54032767", "0.53958505", "0.5384966", "0.5383626", "0.5372227", "0.5367328", "0.5357779", "0.5349762", "0.53487027", "0.53450125", "0.5344746", "0.5344272", "0.53358984", "0.5333323", "0.5328982", "0.5314943", "0.53112686", "0.530562", "0.53045636", "0.5285364", "0.5285122", "0.52839005", "0.52814686", "0.527828", "0.52782786", "0.52781713", "0.5277692", "0.526433", "0.52600014", "0.5259583", "0.5244006", "0.524163", "0.5241277", "0.5239049", "0.5236542", "0.52325934", "0.52315176", "0.52205324", "0.5216074", "0.5205801", "0.5205507", "0.52041477", "0.5198737", "0.5192852", "0.5192767", "0.51920635", "0.5188022" ]
0.84048605
0
NewServeBuildTypesInProjectParamsWithContext creates a new ServeBuildTypesInProjectParams object with the default values initialized, and the ability to set a context for a request
func NewServeBuildTypesInProjectParamsWithContext(ctx context.Context) *ServeBuildTypesInProjectParams { var () return &ServeBuildTypesInProjectParams{ Context: ctx, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewServeBuildTypesInProjectParams() *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ServeBuildTypesInProjectParams) WithContext(ctx context.Context) *ServeBuildTypesInProjectParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewServeBuildTypesInProjectParamsWithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ServeBuildTypesInProjectParams) WithFields(fields *string) *ServeBuildTypesInProjectParams {\n\to.SetFields(fields)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithProjectLocator(projectLocator string) *ServeBuildTypesInProjectParams {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func NewReplaceProjectsParamsWithContext(ctx context.Context) *ReplaceProjectsParams {\n\tvar ()\n\treturn &ReplaceProjectsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewServeFieldParamsWithContext(ctx context.Context) *ServeFieldParams {\n\tvar ()\n\treturn &ServeFieldParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (project *ProjectV1) CreateProjectWithContext(ctx context.Context, createProjectOptions *CreateProjectOptions) (result *Project, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(createProjectOptions, \"createProjectOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(createProjectOptions, \"createProjectOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = project.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range createProjectOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"project\", \"V1\", \"CreateProject\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\n\tbuilder.AddQuery(\"resource_group\", fmt.Sprint(*createProjectOptions.ResourceGroup))\n\tbuilder.AddQuery(\"location\", fmt.Sprint(*createProjectOptions.Location))\n\n\tbody := make(map[string]interface{})\n\tif createProjectOptions.Name != nil {\n\t\tbody[\"name\"] = createProjectOptions.Name\n\t}\n\tif createProjectOptions.Description != nil {\n\t\tbody[\"description\"] = createProjectOptions.Description\n\t}\n\tif createProjectOptions.Configs != nil {\n\t\tbody[\"configs\"] = createProjectOptions.Configs\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = project.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalProject)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "func NewServeBuildFieldShortParamsWithContext(ctx context.Context) *ServeBuildFieldShortParams {\n\tvar ()\n\treturn &ServeBuildFieldShortParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewReplaceProjectsParams() *ReplaceProjectsParams {\n\tvar ()\n\treturn &ReplaceProjectsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewCreateRepoNotificationParamsWithContext(ctx context.Context) *CreateRepoNotificationParams {\n\tvar ()\n\treturn &CreateRepoNotificationParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams) WithProject(project string) *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams {\n\to.SetProject(project)\n\treturn o\n}", "func BuildAcceptProjectInvitePayload(projectAcceptProjectInviteProjectID string, projectAcceptProjectInviteAuth string) (*project.AcceptProjectInvitePayload, error) {\n\tvar err error\n\tvar projectID int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(projectAcceptProjectInviteProjectID, 10, 32)\n\t\tprojectID = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for projectID, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = projectAcceptProjectInviteAuth\n\t}\n\tv := &project.AcceptProjectInvitePayload{}\n\tv.ProjectID = projectID\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func NewServeGroupsParamsWithContext(ctx context.Context) *ServeGroupsParams {\n\tvar ()\n\treturn &ServeGroupsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewTestProjectVersionParamsWithContext(ctx context.Context) *TestProjectVersionParams {\n\tvar ()\n\treturn &TestProjectVersionParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewTicketProjectsImportProjectParamsWithContext(ctx context.Context) *TicketProjectsImportProjectParams {\n\tvar ()\n\treturn &TicketProjectsImportProjectParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *ReplaceProjectsParams) WithContext(ctx context.Context) *ReplaceProjectsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewPutOrganizationProjectApisBuildDefinitionsDefinitionIDParamsWithContext(ctx context.Context) *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams {\n\tvar ()\n\treturn &PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCreateWidgetParamsWithContext(ctx context.Context) *CreateWidgetParams {\n\tvar (\n\t\tacceptDefault = string(\"application/json\")\n\t\tcontentTypeDefault = string(\"application/json\")\n\t)\n\treturn &CreateWidgetParams{\n\t\tAccept: &acceptDefault,\n\t\tContentType: &contentTypeDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func NewPrivilegedProjectProvider(client ctrlruntimeclient.Client) (*PrivilegedProjectProvider, error) {\n\treturn &PrivilegedProjectProvider{\n\t\tclientPrivileged: client,\n\t}, nil\n}", "func NewCreateDatabaseOnServerParamsWithContext(ctx context.Context) *CreateDatabaseOnServerParams {\n\tvar ()\n\treturn &CreateDatabaseOnServerParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *ServeBuildTypesInProjectParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func NewTicketProjectsImportProjectParams() *TicketProjectsImportProjectParams {\n\tvar ()\n\treturn &TicketProjectsImportProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (w *ServerInterfaceWrapper) NewProject(ctx echo.Context) error {\n\tvar err error\n\n\t// HasSecurity is set\n\n\tctx.Set(\"OpenId.Scopes\", []string{\"exitus/project.write\"})\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.NewProject(ctx)\n\treturn err\n}", "func NewUpdateBuildPropertiesParamsWithContext(ctx context.Context) *UpdateBuildPropertiesParams {\n\tvar ()\n\treturn &UpdateBuildPropertiesParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *ListResourceTypesUsingGET2Params) SetProjectIds(projectIds []string) {\n\to.ProjectIds = projectIds\n}", "func (o *ServeBuildTypesInProjectParams) SetProjectLocator(projectLocator string) {\n\to.ProjectLocator = projectLocator\n}", "func (s *ProjectService) NewCreateProjectParams(displaytext string, name string) *CreateProjectParams {\n\tp := &CreateProjectParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"displaytext\"] = displaytext\n\tp.p[\"name\"] = name\n\treturn p\n}", "func NewPostSecdefSearchParamsWithContext(ctx context.Context) *PostSecdefSearchParams {\n\tvar ()\n\treturn &PostSecdefSearchParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewGetProjectsProjectIDLogsBadRequest() *GetProjectsProjectIDLogsBadRequest {\n\treturn &GetProjectsProjectIDLogsBadRequest{}\n}", "func NewReplaceProjectsParamsWithTimeout(timeout time.Duration) *ReplaceProjectsParams {\n\tvar ()\n\treturn &ReplaceProjectsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewCreateBlueprintInWorkspaceInternalParamsWithContext(ctx context.Context) *CreateBlueprintInWorkspaceInternalParams {\n\tvar ()\n\treturn &CreateBlueprintInWorkspaceInternalParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewUploadPluginParamsWithContext(ctx context.Context) *UploadPluginParams {\n\tvar (\n\t\toverrideAlertsDefault = bool(false)\n\t)\n\treturn &UploadPluginParams{\n\t\tOverrideAlerts: &overrideAlertsDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func WithProject(ctx context.Context, project string) context.Context {\n\tif ctx == nil {\n\t\tctx = context.TODO()\n\t}\n\treturn context.WithValue(ctx, ProjectKey, project)\n}", "func NewSearchWorkspacesParamsWithContext(ctx context.Context) *SearchWorkspacesParams {\n\tvar ()\n\treturn &SearchWorkspacesParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewPutOrganizationProjectApisBuildDefinitionsDefinitionIDParams() *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams {\n\tvar ()\n\treturn &PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewCreateGitWebhookUsingPOSTParamsWithContext(ctx context.Context) *CreateGitWebhookUsingPOSTParams {\n\treturn &CreateGitWebhookUsingPOSTParams{\n\t\tContext: ctx,\n\t}\n}", "func NewProjectProvider(createMasterImpersonatedClient impersonationClient, client ctrlruntimeclient.Client) (*ProjectProvider, error) {\n\n\treturn &ProjectProvider{\n\t\tcreateMasterImpersonatedClient: createMasterImpersonatedClient,\n\t\tclientPrivileged: client,\n\t}, nil\n}", "func NewNewProjectRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl := fmt.Sprintf(\"%s/projects\", server)\n\n\treq, err := http.NewRequest(\"POST\", queryUrl, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewCreateProjectBadRequest() *CreateProjectBadRequest {\n\n\treturn &CreateProjectBadRequest{}\n}", "func (o *ReplaceProjectsParams) WithTimeout(timeout time.Duration) *ReplaceProjectsParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewUploadDeployFileParamsWithContext(ctx context.Context) *UploadDeployFileParams {\n\tvar ()\n\treturn &UploadDeployFileParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewListEngineTypeParamsWithContext(ctx context.Context) *ListEngineTypeParams {\n\tvar ()\n\treturn &ListEngineTypeParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewUploadWorkflowTemplateParamsWithContext(ctx context.Context) *UploadWorkflowTemplateParams {\n\tvar ()\n\treturn &UploadWorkflowTemplateParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewTicketProjectsImportProjectParamsWithTimeout(timeout time.Duration) *TicketProjectsImportProjectParams {\n\tvar ()\n\treturn &TicketProjectsImportProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (w *ServerInterfaceWrapper) Projects(ctx echo.Context) error {\n\tvar err error\n\n\t// HasSecurity is set\n\n\tctx.Set(\"OpenId.Scopes\", []string{\"exitus/project.read\"})\n\n\t// Parameter object where we will unmarshal all parameters from the context\n\tvar params ProjectsParams\n\t// ------------- Optional query parameter \"q\" -------------\n\tif paramValue := ctx.QueryParam(\"q\"); paramValue != \"\" {\n\t}\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"q\", ctx.QueryParams(), &params.Q)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter q: %s\", err))\n\t}\n\n\t// ------------- Optional query parameter \"offset\" -------------\n\tif paramValue := ctx.QueryParam(\"offset\"); paramValue != \"\" {\n\t}\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"offset\", ctx.QueryParams(), &params.Offset)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter offset: %s\", err))\n\t}\n\n\t// ------------- Optional query parameter \"limit\" -------------\n\tif paramValue := ctx.QueryParam(\"limit\"); paramValue != \"\" {\n\t}\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"limit\", ctx.QueryParams(), &params.Limit)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter limit: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.Projects(ctx, params)\n\treturn err\n}", "func (m *MockProjectServiceIface) NewCreateProjectParams(displaytext, name string) *CreateProjectParams {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewCreateProjectParams\", displaytext, name)\n\tret0, _ := ret[0].(*CreateProjectParams)\n\treturn ret0\n}", "func (cb *CommandScopedStatsProjectCommandContextBuilder) BuildProjectContext(\n\tctx *command.Context,\n\tcmdName command.Name,\n\tsubCmdName string,\n\tprjCfg valid.MergedProjectCfg,\n\tcommentFlags []string,\n\trepoDir string,\n\tautomerge, parallelApply, parallelPlan, verbose, abortOnExcecutionOrderFail bool,\n\tterraformClient terraform.Client,\n) (projectCmds []command.ProjectContext) {\n\tcb.ProjectCounter.Inc(1)\n\n\tcmds := cb.ProjectCommandContextBuilder.BuildProjectContext(\n\t\tctx, cmdName, subCmdName, prjCfg, commentFlags, repoDir, automerge, parallelApply, parallelPlan, verbose, abortOnExcecutionOrderFail, terraformClient,\n\t)\n\n\tprojectCmds = []command.ProjectContext{}\n\n\tfor _, cmd := range cmds {\n\n\t\t// specifically use the command name in the context instead of the arg\n\t\t// since we can return multiple commands worth of contexts for a given command name arg\n\t\t// to effectively pipeline them.\n\t\tcmd.Scope = cmd.SetProjectScopeTags(cmd.Scope)\n\t\tprojectCmds = append(projectCmds, cmd)\n\t}\n\n\treturn\n}", "func NewUpdateUserIssueSearchOptionsOfProjectVersionParamsWithContext(ctx context.Context) *UpdateUserIssueSearchOptionsOfProjectVersionParams {\n\tvar ()\n\treturn &UpdateUserIssueSearchOptionsOfProjectVersionParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeletePoolProjectParamsWithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *TicketProjectsImportProjectParams) WithContext(ctx context.Context) *TicketProjectsImportProjectParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewCreatePackageRepositoryDeltaUploadParamsWithContext(ctx context.Context) *CreatePackageRepositoryDeltaUploadParams {\n\tvar ()\n\treturn &CreatePackageRepositoryDeltaUploadParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *CreateProjectOK) WithPayload(payload *models.Project) *CreateProjectOK {\n\to.Payload = payload\n\treturn o\n}", "func NewCreateCustomerTenantsParamsWithContext(ctx context.Context) *CreateCustomerTenantsParams {\n\tvar ()\n\treturn &CreateCustomerTenantsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewReplaceProjectsParamsWithHTTPClient(client *http.Client) *ReplaceProjectsParams {\n\tvar ()\n\treturn &ReplaceProjectsParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewPutStackParamsWithContext(ctx context.Context) *PutStackParams {\n\tvar ()\n\treturn &PutStackParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *ReplaceProjectsParams) WithBody(body *models.Projects) *ReplaceProjectsParams {\n\to.SetBody(body)\n\treturn o\n}", "func NewGetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParamsWithContext(ctx context.Context) *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams {\n\treturn &GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams{\n\t\tContext: ctx,\n\t}\n}", "func NewAddProjectBadRequest() *AddProjectBadRequest {\n\n\treturn &AddProjectBadRequest{}\n}", "func (o *ListResourceTypesUsingGET2Params) WithProjectIds(projectIds []string) *ListResourceTypesUsingGET2Params {\n\to.SetProjectIds(projectIds)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams) SetProject(project string) {\n\to.Project = project\n}", "func NewRegenerateDeployKeyParamsWithContext(ctx context.Context) *RegenerateDeployKeyParams {\n\treturn &RegenerateDeployKeyParams{\n\t\tContext: ctx,\n\t}\n}", "func NewPutMenuItemParamsWithContext(ctx context.Context) *PutMenuItemParams {\n\tvar ()\n\treturn &PutMenuItemParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewPutOrganizationProjectApisBuildDefinitionsDefinitionIDParamsWithTimeout(timeout time.Duration) *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams {\n\tvar ()\n\treturn &PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ServeBuildFieldShortParams) WithProjectLocator(projectLocator string) *ServeBuildFieldShortParams {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func NewGetUserIssueSearchOptionsOfProjectVersionParamsWithContext(ctx context.Context) *GetUserIssueSearchOptionsOfProjectVersionParams {\n\tvar ()\n\treturn &GetUserIssueSearchOptionsOfProjectVersionParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewFileInfoCreateParamsWithContext(ctx context.Context) *FileInfoCreateParams {\n\treturn &FileInfoCreateParams{\n\t\tContext: ctx,\n\t}\n}", "func NewSystemEventsParamsWithContext(ctx context.Context) *SystemEventsParams {\n\tvar ()\n\treturn &SystemEventsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewUpdateZoneProjectsUsingPUTParamsWithContext(ctx context.Context) *UpdateZoneProjectsUsingPUTParams {\n\treturn &UpdateZoneProjectsUsingPUTParams{\n\t\tContext: ctx,\n\t}\n}", "func (o *TicketProjectsImportProjectParams) WithTimeout(timeout time.Duration) *TicketProjectsImportProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewPostProjectsProjectIDRobotsBadRequest() *PostProjectsProjectIDRobotsBadRequest {\n\treturn &PostProjectsProjectIDRobotsBadRequest{}\n}", "func NewPutOrganizationProjectApisBuildDefinitionsDefinitionIDParamsWithHTTPClient(client *http.Client) *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams {\n\tvar ()\n\treturn &PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeletePoolProjectParams() *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s *ProjectService) NewSuspendProjectParams(id string) *SuspendProjectParams {\n\tp := &SuspendProjectParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func (s *ProjectService) NewDeleteProjectParams(id string) *DeleteProjectParams {\n\tp := &DeleteProjectParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func (o *UpdateBuildPropertiesParams) WithProject(project string) *UpdateBuildPropertiesParams {\n\to.SetProject(project)\n\treturn o\n}", "func NewListIssueGroupOfProjectVersionParamsWithContext(ctx context.Context) *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tshowhiddenDefault = bool(false)\n\t\tshowremovedDefault = bool(false)\n\t\tshowshortfilenamesDefault = bool(false)\n\t\tshowsuppressedDefault = bool(false)\n\t\tstartDefault = int32(0)\n\t)\n\treturn &ListIssueGroupOfProjectVersionParams{\n\t\tLimit: &limitDefault,\n\t\tShowhidden: &showhiddenDefault,\n\t\tShowremoved: &showremovedDefault,\n\t\tShowshortfilenames: &showshortfilenamesDefault,\n\t\tShowsuppressed: &showsuppressedDefault,\n\t\tStart: &startDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func (mr *MockProjectServiceIfaceMockRecorder) NewCreateProjectParams(displaytext, name interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"NewCreateProjectParams\", reflect.TypeOf((*MockProjectServiceIface)(nil).NewCreateProjectParams), displaytext, name)\n}", "func (b *Builder) WithProject(project *gardencorev1beta1.Project) *Builder {\n\tb.projectFunc = func(context.Context) (*gardencorev1beta1.Project, error) { return project, nil }\n\treturn b\n}", "func NewAcceptLogoutRequestParamsWithContext(ctx context.Context) *AcceptLogoutRequestParams {\n\tvar ()\n\treturn &AcceptLogoutRequestParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewPostMenuItemParamsWithContext(ctx context.Context) *PostMenuItemParams {\n\tvar ()\n\treturn &PostMenuItemParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewTicketProjectsImportProjectParamsWithHTTPClient(client *http.Client) *TicketProjectsImportProjectParams {\n\tvar ()\n\treturn &TicketProjectsImportProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *SaveTemplateParams) WithProject(project string) *SaveTemplateParams {\n\to.SetProject(project)\n\treturn o\n}", "func NewCreateRuntimeMapParamsWithContext(ctx context.Context) *CreateRuntimeMapParams {\n\tvar ()\n\treturn &CreateRuntimeMapParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (fb *ExternalFunctionBuilder) WithArgTypes(argtypes string) *ExternalFunctionBuilder {\n\targtypeslist := strings.ReplaceAll(argtypes, \"-\", \", \")\n\tfb.argtypes = argtypeslist\n\treturn fb\n}", "func NewServeAgentsParamsWithContext(ctx context.Context) *ServeAgentsParams {\n\tvar ()\n\treturn &ServeAgentsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCreateCartUsingPOSTParamsWithContext(ctx context.Context) *CreateCartUsingPOSTParams {\n\tvar (\n\t\tfieldsDefault = string(\"DEFAULT\")\n\t)\n\treturn &CreateCartUsingPOSTParams{\n\t\tFields: &fieldsDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func (project *ProjectV1) UpdateProjectWithContext(ctx context.Context, updateProjectOptions *UpdateProjectOptions) (result *Project, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(updateProjectOptions, \"updateProjectOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(updateProjectOptions, \"updateProjectOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"id\": *updateProjectOptions.ID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.PATCH)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = project.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects/{id}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range updateProjectOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"project\", \"V1\", \"UpdateProject\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\n\tbody := make(map[string]interface{})\n\tif updateProjectOptions.Name != nil {\n\t\tbody[\"name\"] = updateProjectOptions.Name\n\t}\n\tif updateProjectOptions.Description != nil {\n\t\tbody[\"description\"] = updateProjectOptions.Description\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = project.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalProject)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "func NewDeletePoolProjectParamsWithContext(ctx context.Context) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewIgroupInitiatorCreateParamsWithContext(ctx context.Context) *IgroupInitiatorCreateParams {\n\treturn &IgroupInitiatorCreateParams{\n\t\tContext: ctx,\n\t}\n}", "func (o *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams) WithContext(ctx context.Context) *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams) WithContext(ctx context.Context) *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewRestrictApplicationsParamsWithContext(ctx context.Context) *RestrictApplicationsParams {\n\tvar ()\n\treturn &RestrictApplicationsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewSaveTemplateParamsWithContext(ctx context.Context) *SaveTemplateParams {\n\tvar ()\n\treturn &SaveTemplateParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (_mr *MockECRAPIMockRecorder) InitiateLayerUploadWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\t_s := append([]interface{}{arg0, arg1}, arg2...)\n\treturn _mr.mock.ctrl.RecordCall(_mr.mock, \"InitiateLayerUploadWithContext\", _s...)\n}" ]
[ "0.7373301", "0.7141826", "0.6851082", "0.6752004", "0.6576293", "0.6058851", "0.5999975", "0.54382735", "0.46670368", "0.45456892", "0.4485083", "0.43633604", "0.43238646", "0.43169162", "0.42369106", "0.41815728", "0.4150892", "0.413766", "0.41346347", "0.41274652", "0.4108657", "0.40971464", "0.40538588", "0.4051929", "0.4033901", "0.40289128", "0.4019304", "0.40187106", "0.40107563", "0.39950582", "0.3983968", "0.3970045", "0.3960093", "0.39440227", "0.39119324", "0.39070582", "0.39024526", "0.38977525", "0.3882479", "0.38817823", "0.3881002", "0.38788325", "0.38654894", "0.3863639", "0.3861637", "0.385266", "0.38514015", "0.38503468", "0.38190708", "0.38183784", "0.38135394", "0.37977272", "0.37973753", "0.3795488", "0.37851894", "0.37797958", "0.3775565", "0.3771162", "0.37677705", "0.37585583", "0.375787", "0.37571925", "0.37547615", "0.3752788", "0.37496337", "0.3740848", "0.3740494", "0.3739152", "0.37372035", "0.3730509", "0.37273163", "0.37209928", "0.3719484", "0.37073314", "0.37036344", "0.37016955", "0.3699773", "0.36874017", "0.36723816", "0.36647055", "0.36511633", "0.36507452", "0.36481744", "0.36465707", "0.36407784", "0.363557", "0.3631048", "0.362137", "0.36169982", "0.3606304", "0.36047748", "0.35920066", "0.3579916", "0.35729998", "0.3572113", "0.3571372", "0.3569783", "0.35654536", "0.3565188", "0.35646898" ]
0.81666464
0
NewServeBuildTypesInProjectParamsWithHTTPClient creates a new ServeBuildTypesInProjectParams object with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams { var () return &ServeBuildTypesInProjectParams{ HTTPClient: client, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ServeBuildTypesInProjectParams) WithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewServeBuildTypesInProjectParams() *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *TicketProjectsImportProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewServeBuildTypesInProjectParamsWithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ServeBuildFieldShortParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ReplaceProjectsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TestProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewTestProjectVersionParamsWithHTTPClient(client *http.Client) *TestProjectVersionParams {\n\tvar ()\n\treturn &TestProjectVersionParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *GetBuildPropertiesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListSourceFileOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetProjectMetricsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *FileInfoCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostSecdefSearchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateBuildPropertiesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePoolProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TestProjectVersionParams) WithHTTPClient(client *http.Client) *TestProjectVersionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetWorkflowBuildTaskMetaMoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UploadDeployFileParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateUserIssueSearchOptionsOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewServeFieldParamsWithHTTPClient(client *http.Client) *ServeFieldParams {\n\tvar ()\n\treturn &ServeFieldParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *ReplaceProjectsParams) WithHTTPClient(client *http.Client) *ReplaceProjectsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithFields(fields *string) *ServeBuildTypesInProjectParams {\n\to.SetFields(fields)\n\treturn o\n}", "func (o *UploadPluginParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetPlatformsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateWidgetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewCreateWidgetParamsWithHTTPClient(client *http.Client) *CreateWidgetParams {\n\tvar (\n\t\tacceptDefault = string(\"application/json\")\n\t\tcontentTypeDefault = string(\"application/json\")\n\t)\n\treturn &CreateWidgetParams{\n\t\tAccept: &acceptDefault,\n\t\tContentType: &contentTypeDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func (o *CreateRepoNotificationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostPartsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *IgroupInitiatorCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeFieldParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateRuntimeMapParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePackageRepositoryDeltaUploadParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CloudTargetCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeBuildFieldShortParams) WithHTTPClient(client *http.Client) *ServeBuildFieldShortParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *RegenerateDeployKeyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewServeBuildFieldShortParamsWithHTTPClient(client *http.Client) *ServeBuildFieldShortParams {\n\tvar ()\n\treturn &ServeBuildFieldShortParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *CreateTokenParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetBuildQueuePositionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetCreationTasksParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateScheduledPlanParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewReplaceProjectsParamsWithHTTPClient(client *http.Client) *ReplaceProjectsParams {\n\tvar ()\n\treturn &ReplaceProjectsParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeBuildTypesInProjectParams) WithContext(ctx context.Context) *ServeBuildTypesInProjectParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *CreateInstantPaymentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostContextsAddPhpParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PublicWebLinkPlatformEstablishParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ChatNewParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListIssueGroupOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetFileSystemParametersInternalParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SearchWorkspacesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListEngineTypeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TicketProjectsImportProjectParams) WithHTTPClient(client *http.Client) *TicketProjectsImportProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *GetPackageSearchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddRepositoryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetProjectMetricsParams) WithHTTPClient(client *http.Client) *GetProjectMetricsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CreatePublicIPAdressUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PetCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetBundleByKeyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UploadTaskFileParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeBuildTypesInProjectParams) WithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *SetPlanParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetTasksGetPhpParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostAPIV3MachinesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCartUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetGCParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *StartGatewayBundleUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewGetProjectMetricsParamsWithHTTPClient(client *http.Client) *GetProjectMetricsParams {\n\tvar ()\n\treturn &GetProjectMetricsParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *ImportApplicationUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateRoutingInstanceUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetWorkItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) WithHTTPClient(client *http.Client) *CreateBlueprintInWorkspaceInternalParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *GetPublicAuthParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ImagePushParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SharedCatalogSharedCatalogRepositoryV1SavePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QueueCommandUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetCurrentGenerationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetDeploymentPreview1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCustomerTenantsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCrossConnectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewWithHTTPClient(cfg *Config, httpClient *http.Client) (j *Jusibe, err error) {\n\tif cfg.AccessToken == \"\" || cfg.PublicKey == \"\" {\n\t\terr = errors.New(\"failed to create New Jusibe client. accessToken and publicKey are required\")\n\t\treturn\n\t}\n\n\tj = &Jusibe{\n\t\thttpClient: httpClient,\n\t\taccessToken: cfg.AccessToken,\n\t\tpublicKey: cfg.PublicKey,\n\t}\n\n\treturn\n}", "func NewServeGroupsParamsWithHTTPClient(client *http.Client) *ServeGroupsParams {\n\tvar ()\n\treturn &ServeGroupsParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *CreatePolicyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SkuPackPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *OptionsTodoTodoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutFlagSettingParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCognitoIDPParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PublicPlatformLinkV3Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateTenantParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateScriptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "0.78104955", "0.7212851", "0.6715457", "0.6287052", "0.62357384", "0.5993569", "0.59835106", "0.5969915", "0.59567153", "0.5944078", "0.5916733", "0.58386105", "0.58123255", "0.5805793", "0.5793114", "0.5763703", "0.57297885", "0.5727", "0.5721299", "0.5706304", "0.5683268", "0.56744546", "0.5668669", "0.5667639", "0.5651429", "0.56474197", "0.5635095", "0.5623401", "0.5612931", "0.56114095", "0.5606085", "0.56006616", "0.55963933", "0.55854493", "0.55668414", "0.5555098", "0.55435145", "0.553059", "0.55173016", "0.55119014", "0.5503653", "0.5503041", "0.549993", "0.5498611", "0.5496011", "0.54918474", "0.5488881", "0.5486016", "0.5476961", "0.54759884", "0.54652864", "0.54651517", "0.54619694", "0.545991", "0.5456841", "0.5456647", "0.545572", "0.5454087", "0.54495007", "0.5446636", "0.5441927", "0.54378825", "0.5435148", "0.54272956", "0.54221153", "0.5416022", "0.5412554", "0.5404188", "0.5403438", "0.53986454", "0.53919214", "0.539083", "0.5390567", "0.53885096", "0.5387418", "0.53872263", "0.5383785", "0.5373592", "0.53703463", "0.53661144", "0.5364523", "0.5359162", "0.5354353", "0.535365", "0.53536373", "0.5343477", "0.5343324", "0.5340094", "0.5338081", "0.5337071", "0.5335061", "0.53346485", "0.5330998", "0.53309", "0.5330353", "0.53296226", "0.5328338", "0.5321464", "0.5321132", "0.53198606" ]
0.8134441
0
WithTimeout adds the timeout to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) WithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams { o.SetTimeout(timeout) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ServeBuildTypesInProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewServeBuildTypesInProjectParamsWithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ServeBuildFieldShortParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func AddTimeout() {\n\ttimeout, _ := strconv.Atoi(os.Getenv(\"DEBUG_TIMEOUT\"))\n\tlogrus.Infof(\"Add timeout of %vs for debug build\", timeout)\n\ttime.Sleep(time.Duration(timeout) * time.Second)\n}", "func WithTimeout(duration time.Duration) Option {\n\treturn wrappedOption{otlpconfig.WithTimeout(duration)}\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(opts *Opts) error {\n\t\topts.Timeout = timeout\n\t\treturn nil\n\t}\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(o *options) {\n\t\to.timeout = timeout\n\t}\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(o *options) {\n\t\to.timeout = timeout\n\t}\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(opts *Options) {\n\t\topts.Timeout = timeout\n\t}\n}", "func (o *ReplaceProjectsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(t time.Duration) apiOption {\n\treturn func(m *Management) {\n\t\tm.timeout = t\n\t}\n}", "func WithTimeout(timeout time.Duration) BuilderOptionFunc {\n\treturn func(b *Builder) error {\n\t\tb.timeout = timeout\n\t\treturn nil\n\t}\n}", "func (o *TicketProjectsImportProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *TestProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewServeBuildTypesInProjectParams() *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ServeBuildFieldShortParams) WithTimeout(timeout time.Duration) *ServeBuildFieldShortParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *UpdateBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListSourceFileOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPlatformsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (b *taskBuilder) timeout(timeout time.Duration) {\n\tb.Spec.ExecutionTimeout = timeout\n\tb.Spec.IoTimeout = timeout // With kitchen, step logs don't count toward IoTimeout.\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall) Timeout(timeout int64) *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall {\n\tc.urlParams_.Set(\"timeout\", fmt.Sprint(timeout))\n\treturn c\n}", "func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(timeout time.Duration) configF {\n\treturn func(c *config) *config {\n\t\tc.defaultTimeout = timeout\n\t\treturn c\n\t}\n}", "func (o *DeletePoolProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(duration time.Duration) Option {\n\treturn wrappedOption{oconf.WithTimeout(duration)}\n}", "func (o *GetWorkflowBuildTaskMetaMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ShowPackageParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetProjectMetricsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (r *Search) Timeout(timeout string) *Search {\n\n\tr.req.Timeout = &timeout\n\n\treturn r\n}", "func (o *ListDeploymentsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetExampleNewProjectDescriptionCompatibilityVersion1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(t time.Duration) Option {\n\treturn func(o *Manager) {\n\t\to.timeout = t\n\t}\n}", "func (o *ImportApplicationUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RegenerateDeployKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetActionTemplateLogoVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetCurrentGenerationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetDeploymentPreview1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddRepositoryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetContentSourcesUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(t time.Duration) APIOption {\n\treturn newAPIOption(func(o *Options) {\n\t\to.Timeout = t\n\t})\n}", "func AddUpdateLUNMapTimeout() {\n\ttimeout, _ := strconv.Atoi(os.Getenv(\"UpdateLUNMap_TIMEOUT\"))\n\tlogrus.Infof(\"AddUpdateLUNMap timeout of %vs for debug build\", timeout)\n\tUpdateLUNMapTimeoutTriggered = true\n\ttime.Sleep(time.Duration(timeout) * time.Second)\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UploadDeployFileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func Timeout(timeout time.Duration) ServerOption {\n\treturn func(s *Server) {\n\t\ts.timeout = timeout\n\t}\n}", "func (o *GetPublicsRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPackageSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RegisterApplicationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostSecdefSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateWidgetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewServeBuildFieldShortParamsWithTimeout(timeout time.Duration) *ServeBuildFieldShortParams {\n\tvar ()\n\treturn &ServeBuildFieldShortParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func WithTimeout(t time.Duration) Option {\n\treturn func(c *Client) { c.httpClient.Timeout = t }\n}", "func (o *GetClusterTemplateByNameInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetOrganizationApplicationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *StartGatewayBundleUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SearchWorkspacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func AddPreloadTimeout() {\n\ttimeout, _ := strconv.Atoi(os.Getenv(\"PRELOAD_TIMEOUT\"))\n\tlogrus.Infof(\"Add preload timeout of %vs for debug build\", timeout)\n\ttime.Sleep(time.Duration(timeout) * time.Second)\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithCustomTimouts(to Timeouts) ServerOption {\n\treturn func(server *Server) {\n\t\tif to.WriteTimeout != 0 {\n\t\t\tserver.http.WriteTimeout = to.WriteTimeout\n\t\t}\n\t\tif to.ReadTimeout != 0 {\n\t\t\tserver.http.ReadTimeout = to.ReadTimeout\n\t\t}\n\t}\n}", "func (o BuildRunStatusBuildSpecOutput) Timeout() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BuildRunStatusBuildSpec) *string { return v.Timeout }).(pulumi.StringPtrOutput)\n}", "func WithTimeout(ctx context.Context, time time.Duration) (ret context.Context) {\n\tret = context.WithValue(ctx, liverpc.KeyTimeout, time)\n\treturn\n}", "func WithTimeout(timeout time.Duration) ClientOption {\n\treturn withTimeout{timeout}\n}", "func (o *UpdateUserIssueSearchOptionsOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateRuntimeMapParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetWormDomainParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func Timeout(timeout int64) Option {\n\treturn func(opts *options) {\n\t\topts.timeout = time.Duration(timeout) * time.Second\n\t}\n}", "func (o *GetDeploymentByIDV3UsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListStacksByWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSiteDeployParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithHTTPServerTimeout(t time.Duration) Option {\n\treturn func(s *Server) {\n\t\ts.HTTPServerTimeout = t\n\t}\n}", "func (o *IndexSiteRoutesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SkuPackPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(opts *VDRI) {\n\t\topts.client.Timeout = timeout\n\t}\n}", "func (o *GetContentSourceUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(timeout int) OptionPortScanner {\n\treturn timeoutOption(timeout)\n}", "func Timeout(d time.Duration) ConfigOpt {\n\treturn func(c *Config) {\n\t\tc.transport.ResponseHeaderTimeout = d\n\t\tc.transport.TLSHandshakeTimeout = d\n\t\tc.dialer.Timeout = d\n\t}\n}", "func (o *ListEngineTypeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (x Go) Timeout(timeout time.Duration) Go {\n\tx.timeout = timeout\n\treturn x\n}", "func (o *CreateRoutingInstanceUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateDashboardRenderTaskParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListIssueGroupOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func Timeout(timeout time.Duration) Option {\n\treturn func(client *http.Client) {\n\t\tclient.Timeout = timeout\n\t}\n}", "func Timeout(timeout time.Duration) Option {\n\treturn func(client *http.Client) {\n\t\tclient.Timeout = timeout\n\t}\n}", "func (o *TestProjectVersionParams) WithTimeout(timeout time.Duration) *TestProjectVersionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CreateDatabaseOnServerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func Timeout(t time.Duration) Option {\n\treturn func(o *Options) {\n\t\to.Timeout = t\n\t}\n}", "func Timeout(t time.Duration) Option {\n\treturn func(o *Options) {\n\t\to.Timeout = t\n\t}\n}", "func Timeout(t time.Duration) Option {\n\treturn func(o *Options) {\n\t\to.Timeout = t\n\t}\n}", "func Timeout(t time.Duration) Option {\n\treturn func(o *Options) {\n\t\to.Timeout = t\n\t}\n}", "func (o *ServeFieldParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(t time.Duration) OptFunc {\n\treturn func(d *Downloader) {\n\t\td.timeout = t\n\t}\n}", "func (o *SaveTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PublicWebLinkPlatformEstablishParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetBundleByKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetProductsCodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}" ]
[ "0.7595703", "0.7160451", "0.6507878", "0.6212922", "0.6174165", "0.6115348", "0.6079806", "0.6071666", "0.6071666", "0.6068324", "0.60425395", "0.60084176", "0.5989488", "0.59716976", "0.5946808", "0.59018415", "0.588376", "0.5881653", "0.58409494", "0.5826338", "0.5818078", "0.5786883", "0.5760526", "0.5755012", "0.57383233", "0.5738141", "0.5727099", "0.57158494", "0.570488", "0.5689136", "0.56771755", "0.5673442", "0.56552815", "0.56502885", "0.56278014", "0.56232554", "0.56211996", "0.56156033", "0.56125736", "0.55846584", "0.5552743", "0.55436236", "0.55391455", "0.5538834", "0.55344725", "0.55329454", "0.5530868", "0.55305374", "0.55284345", "0.5521315", "0.5520368", "0.55192393", "0.5518225", "0.5518206", "0.5517882", "0.5517354", "0.5489123", "0.54859704", "0.54815626", "0.5476107", "0.54752433", "0.5473392", "0.54724455", "0.5472167", "0.54620385", "0.54555935", "0.5453095", "0.54530096", "0.5451235", "0.54476684", "0.5445689", "0.5424308", "0.54240555", "0.5421849", "0.5412792", "0.54108214", "0.5408226", "0.5400825", "0.5394671", "0.53914887", "0.5385467", "0.53837734", "0.5379276", "0.53774214", "0.5373524", "0.5373524", "0.53690624", "0.5367442", "0.5352866", "0.5345022", "0.5345022", "0.5345022", "0.5345022", "0.5343271", "0.53375447", "0.53363794", "0.5335695", "0.53350395", "0.5329447", "0.5327755" ]
0.7457063
1
SetTimeout adds the timeout to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) SetTimeout(timeout time.Duration) { o.timeout = timeout }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ServeBuildFieldShortParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServeBuildTypesInProjectParams) WithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *TestProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ReplaceProjectsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *TicketProjectsImportProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetWorkflowBuildTaskMetaMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPlatformsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetCurrentGenerationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListSourceFileOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetProjectMetricsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewServeBuildTypesInProjectParamsWithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeletePoolProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetDeploymentPreview1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetExampleNewProjectDescriptionCompatibilityVersion1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListDeploymentsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostSecdefSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetActionTemplateLogoVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UploadDeployFileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateWidgetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListEngineTypeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RegenerateDeployKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateNetworkHTTPServerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ShowPackageParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServeFieldParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateUserIssueSearchOptionsOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetWormDomainParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRuntimeServersParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SearchWorkspacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ImportApplicationUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateDashboardRenderTaskParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPublicsRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateRuntimeMapParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServeAgentsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateOrganizationTeamParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetClusterTemplateByNameInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListEnvironmentsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *StartGatewayBundleUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PopContainerToDebugParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListStacksByWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RegisterApplicationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddRepositoryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateProjectTriggerSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostAPIV3MachinesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetContentSourcesUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetOperatingSystemsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetGPUArchitectureParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *IndexSiteRoutesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SaveTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RebuildIndexSetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostIPLoadbalancingServiceNameHTTPFrontendParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetIngredientVersionRevisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SkuPackPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetOrganizationApplicationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetDatalakeDbConfigParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PublicWebLinkPlatformEstablishParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ToggleNetworkGeneratorsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SearchHomepagesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSiteDeployParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreatePackageRepositoryDeltaUploadParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPackageSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRackTopoesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetServerStatusParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetFyiSettingsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCartUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UploadWorkflowTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListIssueGroupOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetNdmpSettingsVariableParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateDatabaseOnServerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetDeploymentByIDV3UsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateScriptParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetNetworkAppliancePortParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetFileSystemParametersInternalParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BundleProductOptionManagementV1SavePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EditParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NarrowSearchRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetTasksGetPhpParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *FetchIntegrationFormParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostPartsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SetPlanParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutOrganizationProjectApisBuildDefinitionsDefinitionIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddVMParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetProductsCodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AllLookmlTestsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostLTENetworkIDDNSRecordsDomainParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServeGroupsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchAssetDeviceConfigurationsMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetContentSourceUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetTreeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *StopGatewayBundleUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetGCParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateRoutingInstanceUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}" ]
[ "0.7388812", "0.72719175", "0.7180849", "0.6979523", "0.6947313", "0.6929973", "0.6903697", "0.6882665", "0.68718266", "0.6781225", "0.67740536", "0.67329264", "0.671004", "0.6702148", "0.666024", "0.66481775", "0.6646039", "0.6637369", "0.66349614", "0.6622779", "0.66117066", "0.661049", "0.65961915", "0.65399367", "0.6538483", "0.653704", "0.652691", "0.6498962", "0.6495187", "0.64943314", "0.64922744", "0.6486797", "0.6480117", "0.6479316", "0.6478752", "0.6477791", "0.6475941", "0.64719415", "0.6464749", "0.6457578", "0.64525086", "0.6440812", "0.64375144", "0.643258", "0.6430872", "0.6420194", "0.6417874", "0.6400533", "0.63954014", "0.63911855", "0.638761", "0.638473", "0.63839656", "0.6381934", "0.63814855", "0.63802946", "0.63708806", "0.63689977", "0.6368323", "0.63672996", "0.6355722", "0.63551176", "0.63485307", "0.6346395", "0.63436455", "0.6340821", "0.6337665", "0.63364905", "0.6332585", "0.6331823", "0.6327531", "0.63272625", "0.632385", "0.63163316", "0.6309948", "0.6306436", "0.63035524", "0.63024366", "0.6297405", "0.6287474", "0.62839687", "0.62822175", "0.6279106", "0.6276035", "0.6270286", "0.6269881", "0.62690336", "0.6267687", "0.6261882", "0.62571466", "0.6256058", "0.62515646", "0.6249681", "0.6249027", "0.6238661", "0.6234071", "0.6230937", "0.62290037", "0.6227165", "0.62246794" ]
0.856146
0
WithContext adds the context to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) WithContext(ctx context.Context) *ServeBuildTypesInProjectParams { o.SetContext(ctx) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func AddServantWithContext(v dispatch, f interface{}, obj string) {\n\taddServantCommon(v, f, obj, true)\n}", "func (o *ServeBuildTypesInProjectParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (obj *ConfigWriter) AddServantWithContext(imp impConfigWriterWithContext, objStr string) {\n\ttars.AddServantWithContext(obj, imp, objStr)\n}", "func (_obj *Apilangpack) AddServantWithContext(imp _impApilangpackWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "func sendWithContext(ctx context.Context, httpClient *http.Client, url string, body io.Reader, opt *Options) (*http.Response, error) {\n\tv, _ := query.Values(opt)\n\n\t// fmt.Print(v.Encode()) will output: \"city=0&mr=1&pb=4&pro=0&yys=0\"\n\tAPIEndpoint := fmt.Sprintf(\"%s&%s\", url, v.Encode())\n\tfmt.Println(APIEndpoint)\n\t// Change NewRequest to NewRequestWithContext and pass context it\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, APIEndpoint, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// http.DefaultClient\n\tres, err := httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "func (web *webConfig) PrependWithContextRoot(path string) string {\n\treturn web.ContextRoot + strings.Trim(path, \"/\")\n}", "func WithContext(parent context.Context, projID string, c *http.Client) context.Context {\n\tif _, ok := c.Transport.(*internal.Transport); !ok {\n\t\tc.Transport = &internal.Transport{Base: c.Transport}\n\t}\n\tvals := make(map[string]interface{})\n\tvals[\"project_id\"] = projID\n\tvals[\"http_client\"] = c\n\t// TODO(jbd): Lazily initiate the service objects.\n\t// There is no datastore service as we use the proto directly\n\t// without passing through google-api-go-client.\n\tvals[\"pubsub_service\"], _ = pubsub.New(c)\n\tvals[\"storage_service\"], _ = storage.New(c)\n\tvals[\"container_service\"], _ = container.New(c)\n\treturn context.WithValue(parent, internal.ContextKey(\"base\"), vals)\n}", "func (obj *ShopSys) AddServantWithContext(imp impShopSysWithContext, objStr string) {\n\ttars.AddServantWithContext(obj, imp, objStr)\n}", "func (obj *ShopSys) AddServantWithContext(imp impShopSysWithContext, objStr string) {\n\ttars.AddServantWithContext(obj, imp, objStr)\n}", "func WithProd(c context.Context, req *http.Request) context.Context {\n\t// These are needed to use fetchCachedSettings.\n\tc = logging.SetLevel(c, logging.Debug)\n\tc = prod.Use(c, req)\n\tc = settings.Use(c, globalSettings)\n\n\t// Fetch and apply configuration stored in the datastore.\n\tcachedSettings := fetchCachedSettings(c)\n\tc = logging.SetLevel(c, cachedSettings.LoggingLevel)\n\tif !cachedSettings.DisableDSCache {\n\t\tc = dscache.AlwaysFilterRDS(c)\n\t}\n\n\t// The rest of the service may use applied configuration.\n\tc = proccache.Use(c, globalProcessCache)\n\tc = config.SetImplementation(c, gaeconfig.New(c))\n\tc = gaesecrets.Use(c, nil)\n\tc = auth.SetConfig(c, globalAuthConfig)\n\treturn cacheContext.Wrap(c)\n}", "func With(ctx context.Context, kvs ...interface{}) context.Context {\n\tl := fromCtx(ctx)\n\tl = l.With(kvs...)\n\treturn toCtx(ctx, l)\n}", "func With(ctx context.Context, app *App) context.Context {\n\treturn context.WithValue(ctx, appContextKey, app)\n}", "func (_obj *Apipayments) AddServantWithContext(imp _impApipaymentsWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "func (_obj *DataService) AddServantWithContext(imp _impDataServiceWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "func (_obj *LacService) AddServantWithContext(imp _impLacServiceWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func WithRequestContext(ctx context.Context) PubOpt {\n\treturn func(pubopts *PubOpts) error {\n\t\tpubopts.RequestContext = ctx\n\t\treturn nil\n\t}\n}", "func (_obj *Apichannels) AddServantWithContext(imp _impApichannelsWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "func (c *PlatformTypesListCall) Context(ctx context.Context) *PlatformTypesListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (s *Search) Context(ctx *gin.Context) {\n\tapp := ctx.Param(\"app\")\n\tappLabel := config.LogAppLabel()\n\toptions := config.ConvertRequestQueryParams(ctx.Request.URL.Query())\n\toptions[appLabel] = app\n\tresults, err := s.Service.Context(options, ctx.MustGet(\"page\").(models.Page))\n\tif err != nil {\n\t\tutils.ErrorResponse(ctx, utils.NewError(GetLogContextError, err))\n\t\treturn\n\t}\n\n\tutils.Ok(ctx, results)\n\treturn\n}", "func WithContext(ctx context.Context) Option {\n\treturn func(o *Registry) { o.ctx = ctx }\n}", "func (_obj *Apichannels) Channels_getAdminLogWithContext(tarsCtx context.Context, params *TLchannels_getAdminLog, _opt ...map[string]string) (ret Channels_AdminLogResults, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_getAdminLog\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func BuildContext() string {\n\treturn fmt.Sprintf(\"(go=%s, date=%s)\", goVersion, commitDate)\n}", "func (page *ProjectListPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ProjectListPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.pl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.pl = next\n\treturn nil\n}", "func (_obj *WebApiAuth) AddServantWithContext(imp _impWebApiAuthWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "func (s *SizedWaitGroup) AddWithContext(ctx context.Context) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase s.current <- struct{}{}:\n\t\tbreak\n\t}\n\ts.wg.Add(1)\n\treturn nil\n}", "func MetaWithContext(ctx context.Context, newMeta map[string]interface{}) context.Context {\n\tprevMeta := MetaFromContext(ctx)\n\n\tif prevMeta == nil {\n\t\tprevMeta = make(map[string]interface{})\n\t}\n\n\tfor k, v := range newMeta {\n\t\tprevMeta[k] = v\n\t}\n\n\treturn context.WithValue(ctx, MetaCtxKey, prevMeta)\n}", "func newWithContext(ctx context.Context, token string) *GitHub {\n\treturn newWithAuth(ctx, token)\n}", "func (req *SelectRequest) Context(ctx context.Context) *SelectRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "func WithContext(ctx context.Context, opts ...TreeOption) context.Context {\n\tchosenName := fmt.Sprintf(\"tree-%d\", rand.Uint64())\n\tbaseOpts := append([]TreeOption{\n\t\toversight.WithRestartStrategy(oversight.OneForAll()),\n\t\toversight.NeverHalt(),\n\t}, opts...)\n\ttree := oversight.New(baseOpts...)\n\n\tmu.Lock()\n\ttrees[chosenName] = tree\n\tmu.Unlock()\n\n\twrapped := context.WithValue(ctx, treeName, chosenName)\n\tgo tree.Start(wrapped)\n\treturn wrapped\n}", "func OrganizationCtx(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\torganizationID := chi.URLParam(r, \"organizationID\")\n\t\tctx := context.WithValue(r.Context(), ContextKeyOrganization, organizationID)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "func (c *Client) PostWithContext(ctx context.Context, url string, reqBody, resType interface{}) error {\n\treturn c.CallAPIWithContext(ctx, \"POST\", url, reqBody, resType, true)\n}", "func WithContext(ctx context.Context) EngineOpt {\n\treturn func(e *engine) error {\n\t\te.ctx = ctx\n\n\t\treturn nil\n\t}\n}", "func WithContext(ctx context.Context) ServerOption {\n\treturn func(s *Server) {\n\t\ts.ctx = ctx\n\t}\n}", "func (_obj *Apichannels) Channels_inviteToChannelWithContext(tarsCtx context.Context, params *TLchannels_inviteToChannel, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_inviteToChannel\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func Contexter() func(next http.Handler) http.Handler {\n\trnd := templates.HTMLRenderer()\n\tcsrfOpts := CsrfOptions{\n\t\tSecret: setting.SecretKey,\n\t\tCookie: setting.CSRFCookieName,\n\t\tSetCookie: true,\n\t\tSecure: setting.SessionConfig.Secure,\n\t\tCookieHTTPOnly: setting.CSRFCookieHTTPOnly,\n\t\tHeader: \"X-Csrf-Token\",\n\t\tCookieDomain: setting.SessionConfig.Domain,\n\t\tCookiePath: setting.SessionConfig.CookiePath,\n\t\tSameSite: setting.SessionConfig.SameSite,\n\t}\n\tif !setting.IsProd {\n\t\tCsrfTokenRegenerationInterval = 5 * time.Second // in dev, re-generate the tokens more aggressively for debug purpose\n\t}\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {\n\t\t\tctx := Context{\n\t\t\t\tResp: NewResponse(resp),\n\t\t\t\tCache: mc.GetCache(),\n\t\t\t\tLocale: middleware.Locale(resp, req),\n\t\t\t\tLink: setting.AppSubURL + strings.TrimSuffix(req.URL.EscapedPath(), \"/\"),\n\t\t\t\tRender: rnd,\n\t\t\t\tSession: session.GetSession(req),\n\t\t\t\tRepo: &Repository{\n\t\t\t\t\tPullRequest: &PullRequest{},\n\t\t\t\t},\n\t\t\t\tOrg: &Organization{},\n\t\t\t\tData: middleware.GetContextData(req.Context()),\n\t\t\t}\n\t\t\tdefer ctx.Close()\n\n\t\t\tctx.Data.MergeFrom(middleware.CommonTemplateContextData())\n\t\t\tctx.Data[\"Context\"] = &ctx\n\t\t\tctx.Data[\"CurrentURL\"] = setting.AppSubURL + req.URL.RequestURI()\n\t\t\tctx.Data[\"Link\"] = ctx.Link\n\t\t\tctx.Data[\"locale\"] = ctx.Locale\n\n\t\t\t// PageData is passed by reference, and it will be rendered to `window.config.pageData` in `head.tmpl` for JavaScript modules\n\t\t\tctx.PageData = map[string]any{}\n\t\t\tctx.Data[\"PageData\"] = ctx.PageData\n\n\t\t\tctx.Req = WithContext(req, &ctx)\n\t\t\tctx.Csrf = PrepareCSRFProtector(csrfOpts, &ctx)\n\n\t\t\t// Get the last flash message from cookie\n\t\t\tlastFlashCookie := middleware.GetSiteCookie(ctx.Req, CookieNameFlash)\n\t\t\tif vals, _ := url.ParseQuery(lastFlashCookie); len(vals) > 0 {\n\t\t\t\t// store last Flash message into the template data, to render it\n\t\t\t\tctx.Data[\"Flash\"] = &middleware.Flash{\n\t\t\t\t\tDataStore: &ctx,\n\t\t\t\t\tValues: vals,\n\t\t\t\t\tErrorMsg: vals.Get(\"error\"),\n\t\t\t\t\tSuccessMsg: vals.Get(\"success\"),\n\t\t\t\t\tInfoMsg: vals.Get(\"info\"),\n\t\t\t\t\tWarningMsg: vals.Get(\"warning\"),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// prepare an empty Flash message for current request\n\t\t\tctx.Flash = &middleware.Flash{DataStore: &ctx, Values: url.Values{}}\n\t\t\tctx.Resp.Before(func(resp ResponseWriter) {\n\t\t\t\tif val := ctx.Flash.Encode(); val != \"\" {\n\t\t\t\t\tmiddleware.SetSiteCookie(ctx.Resp, CookieNameFlash, val, 0)\n\t\t\t\t} else if lastFlashCookie != \"\" {\n\t\t\t\t\tmiddleware.SetSiteCookie(ctx.Resp, CookieNameFlash, \"\", -1)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t// If request sends files, parse them here otherwise the Query() can't be parsed and the CsrfToken will be invalid.\n\t\t\tif ctx.Req.Method == \"POST\" && strings.Contains(ctx.Req.Header.Get(\"Content-Type\"), \"multipart/form-data\") {\n\t\t\t\tif err := ctx.Req.ParseMultipartForm(setting.Attachment.MaxSize << 20); err != nil && !strings.Contains(err.Error(), \"EOF\") { // 32MB max size\n\t\t\t\t\tctx.ServerError(\"ParseMultipartForm\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thttpcache.SetCacheControlInHeader(ctx.Resp.Header(), 0, \"no-transform\")\n\t\t\tctx.Resp.Header().Set(`X-Frame-Options`, setting.CORSConfig.XFrameOptions)\n\n\t\t\tctx.Data[\"CsrfToken\"] = ctx.Csrf.GetToken()\n\t\t\tctx.Data[\"CsrfTokenHtml\"] = template.HTML(`<input type=\"hidden\" name=\"_csrf\" value=\"` + ctx.Data[\"CsrfToken\"].(string) + `\">`)\n\n\t\t\t// FIXME: do we really always need these setting? There should be someway to have to avoid having to always set these\n\t\t\tctx.Data[\"DisableMigrations\"] = setting.Repository.DisableMigrations\n\t\t\tctx.Data[\"DisableStars\"] = setting.Repository.DisableStars\n\t\t\tctx.Data[\"EnableActions\"] = setting.Actions.Enabled\n\n\t\t\tctx.Data[\"ManifestData\"] = setting.ManifestData\n\n\t\t\tctx.Data[\"UnitWikiGlobalDisabled\"] = unit.TypeWiki.UnitGlobalDisabled()\n\t\t\tctx.Data[\"UnitIssuesGlobalDisabled\"] = unit.TypeIssues.UnitGlobalDisabled()\n\t\t\tctx.Data[\"UnitPullsGlobalDisabled\"] = unit.TypePullRequests.UnitGlobalDisabled()\n\t\t\tctx.Data[\"UnitProjectsGlobalDisabled\"] = unit.TypeProjects.UnitGlobalDisabled()\n\t\t\tctx.Data[\"UnitActionsGlobalDisabled\"] = unit.TypeActions.UnitGlobalDisabled()\n\n\t\t\tctx.Data[\"AllLangs\"] = translation.AllLangs()\n\n\t\t\tnext.ServeHTTP(ctx.Resp, ctx.Req)\n\t\t})\n\t}\n}", "func WithContext(context string) StructuredLogger {\n\treturn factory.WithContext(context)\n}", "func (req MinRequest) Context(ctx context.Context) MinRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "func (r *Request) WithContext(ctx context.Context) *Request", "func NewServeBuildTypesInProjectParams() *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (_obj *DataService) CreateApplyWithContext(tarsCtx context.Context, wx_id string, club_id string, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"createApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (_obj *Apipayments) Payments_sendPaymentFormWithContext(tarsCtx context.Context, params *TLpayments_sendPaymentForm, _opt ...map[string]string) (ret Payments_PaymentResult, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"payments_sendPaymentForm\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (r *Request) Context() context.Context", "func withTodo(ctx context.Context, todo *types.Todo) context.Context {\n\treturn context.WithValue(ctx, todoKey, todo)\n}", "func PublishContext(ctx context.Context) PublishOption {\n\treturn func(o *PublishOptions) {\n\t\to.Context = ctx\n\t}\n}", "func WithRegistry(ctx context.Context, reg *Registry) context.Context {\n\treturn context.WithValue(ctx, registryContextKey{}, reg)\n}", "func (req *MinRequest) Context(ctx context.Context) *MinRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "func (p *BuildsPaginator) NextWithContext(context context.Context) bool {\n\toptions := p.options\n\n\tif options == nil {\n\t\toptions = &BuildsPageOptions{}\n\t}\n\n\tif p.CurrentPage() != nil {\n\t\tnextPage := p.CurrentPage().Meta.NextPageURL\n\n\t\tif nextPage == nil {\n\t\t\treturn false\n\t\t}\n\n\t\tparsedURL, err := url.Parse(*nextPage)\n\t\tif err != nil {\n\t\t\tp.Page.Error = err\n\t\t\treturn false\n\t\t}\n\n\t\toptions.PageToken = utils.String(parsedURL.Query().Get(\"PageToken\"))\n\n\t\tpage, pageErr := strconv.Atoi(parsedURL.Query().Get(\"Page\"))\n\t\tif pageErr != nil {\n\t\t\tp.Page.Error = pageErr\n\t\t\treturn false\n\t\t}\n\t\toptions.Page = utils.Int(page)\n\n\t\tpageSize, pageSizeErr := strconv.Atoi(parsedURL.Query().Get(\"PageSize\"))\n\t\tif pageSizeErr != nil {\n\t\t\tp.Page.Error = pageSizeErr\n\t\t\treturn false\n\t\t}\n\t\toptions.PageSize = utils.Int(pageSize)\n\t}\n\n\tresp, err := p.Page.client.PageWithContext(context, options)\n\tp.Page.CurrentPage = resp\n\tp.Page.Error = err\n\n\tif p.Page.Error == nil {\n\t\tp.Builds = append(p.Builds, resp.Builds...)\n\t}\n\n\treturn p.Page.Error == nil\n}", "func (_obj *WebApiAuth) SysConfig_GetPageWithContext(tarsCtx context.Context, pageSize int32, pageIndex int32, req *SysConfig, res *SysConfig_List, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(pageSize, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(pageIndex, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = req.WriteBlock(_os, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 4)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"SysConfig_GetPage\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 4, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (c Client) PageWithContext(context context.Context, options *BuildsPageOptions) (*BuildsPageResponse, error) {\n\top := client.Operation{\n\t\tMethod: http.MethodGet,\n\t\tURI: \"/Services/{serviceSid}/Builds\",\n\t\tPathParams: map[string]string{\n\t\t\t\"serviceSid\": c.serviceSid,\n\t\t},\n\t\tQueryParams: utils.StructToURLValues(options),\n\t}\n\n\tresponse := &BuildsPageResponse{}\n\tif err := c.client.Send(context, op, nil, response); err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "func (c *ProjectsPatchDeploymentsListCall) Context(ctx context.Context) *ProjectsPatchDeploymentsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (l *loader) WithContext(ctx interface{}) parser.Render {\n\tif l.err != nil {\n\t\treturn l\n\t}\n\tconst key = \"context\"\n\tf, err := cueparser.ParseFile(key, marshal(key, ctx))\n\tif err != nil {\n\t\tl.err = errors.Errorf(\"loader parse %s error\", key)\n\t}\n\tl.files[key] = f\n\treturn l\n}", "func (c *OrganizationsDevelopersAppsAttributesListCall) Context(ctx context.Context) *OrganizationsDevelopersAppsAttributesListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func WithContext(context ...Context) Opt {\n\treturn func(opts *Options) {\n\t\topts.Context = context\n\t}\n}", "func NewServerWithContext(ctx context.Context) *Server {\n\treturn &Server{\n\t\tctx: ctx,\n\t\tmaxIdleConns: 1024,\n\t\terrHandler: ignoreErrorHandler,\n\t}\n}", "func (_obj *Apilangpack) Langpack_getLanguageWithContext(tarsCtx context.Context, params *TLlangpack_getLanguage, _opt ...map[string]string) (ret LangPackLanguage, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"langpack_getLanguage\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (h ContextHandlerFunc) ServeHTTPWithContext(ctx context.Context, w http.ResponseWriter, req *http.Request) {\n\th(ctx, w, req)\n}", "func (e *executor) RunWithContext(ctx context.Context, cmd *exec.Cmd) (string, error) {\n\tvar out bytes.Buffer\n\n\tprefix := color.BlueString(cmd.Args[0])\n\tlogger := e.logger.WithContext(log.ContextWithPrefix(prefix))\n\n\tcmd.Stdout = io.MultiWriter(&out, log.LineWriter(logger.Info))\n\tcmd.Stderr = io.MultiWriter(&out, log.LineWriter(logger.Error))\n\n\treturn e.run(ctx, &out, cmd)\n}", "func (_obj *Apilangpack) Langpack_getLangPackWithContext(tarsCtx context.Context, params *TLlangpack_getLangPack, _opt ...map[string]string) (ret LangPackDifference, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"langpack_getLangPack\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func WithContext(ctxt string) TranslateOption {\n\treturn fnTranslateOption(func(cfg translateConfig) translateConfig {\n\t\tcfg.ctxt = ctxt\n\t\treturn cfg\n\t})\n}", "func (c *OrganizationsDevelopersAppsAttributesCall) Context(ctx context.Context) *OrganizationsDevelopersAppsAttributesCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (c *OrganizationsApisDeploymentsListCall) Context(ctx context.Context) *OrganizationsApisDeploymentsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (req *SetRequest) Context(ctx context.Context) *SetRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "func withHealthCheck(parent context.Context) context.Context {\n\treturn context.WithValue(parent, requestTypeKey{}, reqTypeHealthCheck)\n}", "func (o *ServeBuildFieldShortParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func WithContext(ctx context.Context, fields ...zap.Field) *zap.Logger {\n\treqID, _ := requestid.Value(ctx)\n\tlog := zap.L()\n\tif len(fields) > 0 {\n\t\tlog = log.With(fields...)\n\t}\n\tif reqID != \"\" {\n\t\treturn log.With(ReqIDField(reqID))\n\t}\n\treturn log\n}", "func requestWithNewContextValue(r *http.Request, key ltiContextKey, value interface{}) *http.Request {\n\tnewRequest := r.WithContext(context.WithValue(r.Context(), key, value))\n\treturn newRequest\n}", "func (_obj *WebApiAuth) SysConfig_CreateWithContext(tarsCtx context.Context, req *SysConfig, res *SysConfig, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = req.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"SysConfig_Create\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 2, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (b *ReflectClientBuilder) WithContext(ctx context.Context) {\n\tb.ctx = ctx\n}", "func getResolutionContext() *build.Context {\n\tif stdContext == nil {\n\t\t// reduce resolution paths to point only at root\n\t\tstdContext = &build.Context{}\n\t\t*stdContext = build.Default // copy\n\t\tstdContext.GOPATH = runtime.GOROOT()\n\t}\n\treturn stdContext\n}", "func (_obj *Apipayments) Payments_getPaymentFormWithContext(tarsCtx context.Context, params *TLpayments_getPaymentForm, _opt ...map[string]string) (ret Payments_PaymentForm, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"payments_getPaymentForm\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (c *RootCategoriesInfoTypesListCall) Context(ctx context.Context) *RootCategoriesInfoTypesListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func buildContext(a *authority.Authority, scepAuthority *scep.Authority, acmeDB acme.DB, acmeLinker acme.Linker) context.Context {\n\tctx := authority.NewContext(context.Background(), a)\n\tif authDB := a.GetDatabase(); authDB != nil {\n\t\tctx = db.NewContext(ctx, authDB)\n\t}\n\tif adminDB := a.GetAdminDatabase(); adminDB != nil {\n\t\tctx = admin.NewContext(ctx, adminDB)\n\t}\n\tif scepAuthority != nil {\n\t\tctx = scep.NewContext(ctx, scepAuthority)\n\t}\n\tif acmeDB != nil {\n\t\tctx = acme.NewContext(ctx, acmeDB, acme.NewClient(), acmeLinker, nil)\n\t}\n\treturn ctx\n}", "func (rf factory) NewWithContext(ctx context.Context) router.Router {\n\treturn chiRouter{rf.cfg, ctx, rf.cfg.RunServer}\n}", "func Context() context.Context {\n\n\t// -------------------------------------------------------------------------\n\t// Logging\n\n\tlogConfig := logger.NewDevelopmentConfig()\n\tlogConfig.Main.Format |= logger.IncludeSystem | logger.IncludeMicro\n\tlogConfig.Main.MinLevel = logger.LevelVerbose\n\tlogConfig.EnableSubSystem(rpcnode.SubSystem)\n\tlogConfig.EnableSubSystem(txbuilder.SubSystem)\n\n\tif strings.ToUpper(os.Getenv(\"LOG_FORMAT\")) == \"TEXT\" {\n\t\tlogConfig.IsText = true\n\t}\n\n\tlogPath := os.Getenv(\"LOG_FILE_PATH\")\n\tif len(logPath) > 0 {\n\t\tos.MkdirAll(path.Dir(os.Getenv(\"LOG_FILE_PATH\")), os.ModePerm)\n\t\tlogFileName := filepath.FromSlash(os.Getenv(\"LOG_FILE_PATH\"))\n\t\tlogFile, err := os.OpenFile(logFileName, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"Failed to open log file : %v\\n\", err))\n\t\t}\n\t\tdefer logFile.Close()\n\n\t\tlogConfig.Main.AddWriter(logFile)\n\t}\n\n\t// Configure spynode logs\n\tlogPath = os.Getenv(\"SPYNODE_LOG_FILE_PATH\")\n\tif len(logPath) > 0 {\n\t\tspynodeConfig := logger.NewDevelopmentSystemConfig()\n\t\tspynodeConfig.SetFile(logPath)\n\t\tspynodeConfig.MinLevel = logger.LevelDebug\n\t\tlogConfig.SubSystems[spynode.SubSystem] = spynodeConfig\n\t}\n\n\treturn logger.ContextWithLogConfig(context.Background(), logConfig)\n}", "func (c *OrganizationsDeploymentsListCall) Context(ctx context.Context) *OrganizationsDeploymentsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (_obj *WebApiAuth) LoginLog_GetPageWithContext(tarsCtx context.Context, pageSize int32, pageIndex int32, req *LoginLog, res *LoginLog_List, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(pageSize, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(pageIndex, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = req.WriteBlock(_os, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 4)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"LoginLog_GetPage\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 4, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (c *OrganizationsApiproductsListCall) Context(ctx context.Context) *OrganizationsApiproductsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (_obj *Apichannels) Channels_editLocationWithContext(tarsCtx context.Context, params *TLchannels_editLocation, _opt ...map[string]string) (ret Bool, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_editLocation\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (c *ProjectsPatchDeploymentsPatchCall) Context(ctx context.Context) *ProjectsPatchDeploymentsPatchCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (c *OrganizationsDevelopersAttributesListCall) Context(ctx context.Context) *OrganizationsDevelopersAttributesListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (c *OrganizationsDevelopersUpdateMonetizationConfigCall) Context(ctx context.Context) *OrganizationsDevelopersUpdateMonetizationConfigCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (b *Builder) WithContext(context interface{}) *Builder {\n\tb.context = context\n\treturn b\n}", "func getContext(request *http.Request) context.Context {\n\tif config.Server.HostedInGAE {\n\t\treturn appengine.NewContext(request)\n\t} else {\n\t\treturn context.Background()\n\t}\n}", "func (m *MinikubeRunner) RunWithContext(ctx context.Context, cmdStr string, wait ...bool) (string, string, error) {\n\tprofileArg := fmt.Sprintf(\"-p=%s \", m.Profile)\n\tcmdStr = profileArg + cmdStr\n\tcmdArgs := strings.Split(cmdStr, \" \")\n\tpath, _ := filepath.Abs(m.BinaryPath)\n\n\tcmd := exec.CommandContext(ctx, path, cmdArgs...)\n\tLogf(\"RunWithContext: %s\", cmd.Args)\n\treturn m.teeRun(cmd, wait...)\n}", "func (c *ProjectsLocationsInstancesApplyParametersCall) Context(ctx context.Context) *ProjectsLocationsInstancesApplyParametersCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (c *OrganizationsDevelopersAppsListCall) Context(ctx context.Context) *OrganizationsDevelopersAppsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func WriteBoolWithContext(ctx context.Context, p thrift.TProtocol, value bool, name string, field int16) error {\n\tif err := p.WriteFieldBegin(ctx, name, thrift.BOOL, field); err != nil {\n\t\treturn thrift.PrependError(\"write field begin error: \", err)\n\t}\n\tif err := p.WriteBool(ctx, value); err != nil {\n\t\treturn thrift.PrependError(\"field write error: \", err)\n\t}\n\tif err := p.WriteFieldEnd(ctx); err != nil {\n\t\treturn thrift.PrependError(\"write field end error: \", err)\n\t}\n\treturn nil\n}", "func WithFeatureCtx(ctx context.Context) context.Context {\n\tg := genesis.MustExtractGenesisContext(ctx)\n\theight := MustGetBlockCtx(ctx).BlockHeight\n\treturn context.WithValue(\n\t\tctx,\n\t\tfeatureContextKey{},\n\t\tFeatureCtx{\n\t\t\tFixDoubleChargeGas: g.IsPacific(height),\n\t\t\tSystemWideActionGasLimit: !g.IsAleutian(height),\n\t\t\tNotFixTopicCopyBug: !g.IsAleutian(height),\n\t\t\tSetRevertMessageToReceipt: g.IsHawaii(height),\n\t\t\tFixGetHashFnHeight: g.IsHawaii(height),\n\t\t\tFixSortCacheContractsAndUsePendingNonce: g.IsHawaii(height),\n\t\t\tAsyncContractTrie: g.IsGreenland(height),\n\t\t\tAddOutOfGasToTransactionLog: !g.IsGreenland(height),\n\t\t\tAddChainIDToConfig: g.IsIceland(height),\n\t\t\tUseV2Storage: g.IsGreenland(height),\n\t\t\tCannotUnstakeAgain: g.IsGreenland(height),\n\t\t\tSkipStakingIndexer: !g.IsFairbank(height),\n\t\t\tReturnFetchError: !g.IsGreenland(height),\n\t\t\tCannotTranferToSelf: g.IsHawaii(height),\n\t\t\tNewStakingReceiptFormat: g.IsFbkMigration(height),\n\t\t\tUpdateBlockMeta: g.IsGreenland(height),\n\t\t\tCurrentEpochProductivity: g.IsGreenland(height),\n\t\t\tFixSnapshotOrder: g.IsKamchatka(height),\n\t\t\tAllowCorrectDefaultChainID: g.IsMidway(height),\n\t\t\tCorrectGetHashFn: g.IsMidway(height),\n\t\t\tCorrectTxLogIndex: g.IsMidway(height),\n\t\t\tRevertLog: g.IsMidway(height),\n\t\t\tTolerateLegacyAddress: !g.IsNewfoundland(height),\n\t\t\tValidateRewardProtocol: g.IsNewfoundland(height),\n\t\t\tCreateLegacyNonceAccount: !g.IsOkhotsk(height),\n\t\t\tFixGasAndNonceUpdate: g.IsOkhotsk(height),\n\t\t\tFixUnproductiveDelegates: g.IsOkhotsk(height),\n\t\t\tCorrectGasRefund: g.IsOkhotsk(height),\n\t\t\tSkipSystemActionNonce: g.IsPalau(height),\n\t\t\tValidateSystemAction: g.IsQuebec(height),\n\t\t\tAllowCorrectChainIDOnly: g.IsQuebec(height),\n\t\t\tAddContractStakingVotes: g.IsQuebec(height),\n\t\t\tSharedGasWithDapp: g.IsToBeEnabled(height),\n\t\t},\n\t)\n}", "func NewWithContext(ctx context.Context, method, url string, body io.Reader) (*http.Request, error) {\n\tr, err := http.NewRequestWithContext(ctx, method, url, body)\n\tif err != nil {\n\t\treturn r, err\n\t}\n\tr.Header.Set(\"User-Agent\", \"saucectl/\"+version.Version)\n\n\treturn r, err\n}", "func WithContext(ctx context.Context) CallOpt {\n\treturn func(c *call) error {\n\t\tc.req = c.req.WithContext(ctx)\n\t\treturn nil\n\t}\n}", "func (_obj *LacService) TestWithContext(ctx context.Context, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\terr = _obj.s.Tars_invoke(ctx, 0, \"test\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_obj.setMap(len(_opt), _resp, _context, _status)\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func NewServeBuildTypesInProjectParamsWithContext(ctx context.Context) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (_obj *WebApiAuth) SysConfig_GetWithContext(tarsCtx context.Context, req *SysConfig, res *SysConfig, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = req.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"SysConfig_Get\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 2, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func NewContext(ctx context.Context) context.Context {\n\treturn context.WithValue(ctx, timingKey, &[]buildapi.StageInfo{})\n}", "func (c *OrganizationsApiproductsAttributesListCall) Context(ctx context.Context) *OrganizationsApiproductsAttributesListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (c *OrganizationsDevelopersAttributesCall) Context(ctx context.Context) *OrganizationsDevelopersAttributesCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (c *OrganizationsApisRevisionsDeploymentsListCall) Context(ctx context.Context) *OrganizationsApisRevisionsDeploymentsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func runWithContext(fun func(ctx context.Context) error) (context.CancelFunc, chan error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdone := make(chan error, 1)\n\tgo func() {\n\t\tdefer close(done)\n\t\tdone <- fun(ctx)\n\t}()\n\n\treturn cancel, done\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDeployCall) Context(ctx context.Context) *OrganizationsEnvironmentsApisRevisionsDeployCall {\n\tc.ctx_ = ctx\n\treturn c\n}" ]
[ "0.5824641", "0.56842536", "0.55590117", "0.55434525", "0.5448408", "0.53201246", "0.52816117", "0.51922303", "0.51922303", "0.51864815", "0.51484287", "0.51070935", "0.5094628", "0.50915027", "0.5088895", "0.49437878", "0.49402988", "0.49129236", "0.48921087", "0.4885113", "0.48486015", "0.48362255", "0.48332146", "0.48294982", "0.4818807", "0.4817678", "0.48039052", "0.47820657", "0.47703207", "0.4755594", "0.47444296", "0.47437182", "0.4722001", "0.4711757", "0.47080797", "0.47075388", "0.4685144", "0.46739313", "0.4669193", "0.46688333", "0.46578726", "0.46504277", "0.46455792", "0.46304712", "0.4623975", "0.46210065", "0.4616759", "0.46131358", "0.46121487", "0.46011317", "0.459978", "0.45997623", "0.45854133", "0.45835897", "0.45669222", "0.4547703", "0.453695", "0.45292494", "0.45285034", "0.452309", "0.45055503", "0.44937092", "0.44905245", "0.4486656", "0.44850287", "0.44814837", "0.44813594", "0.44758365", "0.44746685", "0.4464908", "0.44625208", "0.44600984", "0.44579738", "0.4455515", "0.44453013", "0.44431156", "0.44427562", "0.4441641", "0.4441168", "0.44403177", "0.44294113", "0.4427335", "0.4421965", "0.4421542", "0.4417242", "0.44149643", "0.4414939", "0.44127062", "0.441164", "0.4407847", "0.4404267", "0.44040892", "0.4400985", "0.44008377", "0.44005567", "0.4400354", "0.43979713", "0.4397536", "0.4396685", "0.43953034" ]
0.61060834
0
SetContext adds the context to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) SetContext(ctx context.Context) { o.Context = ctx }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ServeBuildFieldShortParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ServeBuildTypesInProjectParams) WithContext(ctx context.Context) *ServeBuildTypesInProjectParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *GetPlatformsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (server *DSServer) SetContext(ctx sdk.Context) {\n\tserver.Lock()\n\tdefer server.Unlock()\n\n\tserver.ctx = ctx\n}", "func (o *GetRuntimeServersParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetDeploymentPreview1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *StartGatewayBundleUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UploadPluginParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func SetServerContext(ctx context.Context) {\n\tinternal.NewContext = func(r *http.Request) context.Context {\n\t\treturn ctx\n\t}\n}", "func (o *ServeGroupsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetCurrentGenerationParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetWorkflowBuildTaskMetaMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetContentSourcesUsingGETParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ServeFieldParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ReplaceProjectsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *TestProjectVersionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ListEngineTypeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ServeAgentsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateDatabaseOnServerParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func SetGinContext(w http.ResponseWriter, r *http.Request) *gin.Context {\n\tgc, _ := gin.CreateTestContext(w)\n\tgc.Request = r\n\treturn gc\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostSecdefSearchParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetBuildPropertiesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostPartsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateRuntimeMapParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func SetContext(ctx *apm.Context, req *http.Request, resp *Response, body *apm.BodyCapturer) {\n\tctx.SetHTTPRequest(req)\n\tctx.SetHTTPRequestBody(body)\n\tctx.SetHTTPStatusCode(resp.StatusCode)\n\tctx.SetHTTPResponseHeaders(resp.Headers)\n}", "func (_m *MockHTTPServerInterface) SetContext(_a0 context.Context) {\n\t_m.Called(_a0)\n}", "func (o *ListSourceFileOfProjectVersionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ListDeploymentsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateWidgetParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetContentSourceUsingGETParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetGPUArchitectureParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *StopGatewayBundleUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func SetContext(thread *starlark.Thread, ctx Context) {\n\tthread.SetLocal(contextKey, ctx)\n}", "func (o *GetRackTopoesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ShowPackageParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AddRepositoryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateBuildPropertiesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetPublicAuthParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (f *Fastglue) SetContext(c interface{}) {\n\tf.context = c\n}", "func (o *GetWormDomainParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostIPLoadbalancingServiceNameHTTPFrontendParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AllLookmlTestsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UploadDeployFileParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreatePackageRepositoryDeltaUploadParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateNetworkHTTPServerParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SearchWorkspacesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateScriptParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PublicWebLinkPlatformEstablishParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetPublicsRecipeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetRepository15Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AddServerGroupInUpstreamParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ImportApplicationUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SetPlanParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetProjectMetricsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostContextsAddPhpParams) SetContext(ctx ccontext.Context) {\n\to.Context = ctx\n}", "func (o *PostAPIV3MachinesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateCartUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetaspecificPbxDeviceFirmwareBinaryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetClusterTemplateByNameInWorkspaceParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ListPipelinesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *TicketProjectsImportProjectParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetBundleByKeyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetProductsByIDPromotionsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetRacksParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SkuPackPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetSeriesIDEpisodesQueryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *StoreProductParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetFileSystemParametersInternalParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SearchKeywordChunkedParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PopContainerToDebugParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PatchStorageVirtualDriveExtensionsMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func SetContext(ctx context.Context) ServerOptionFunc {\n\treturn func(s *Server) error {\n\t\ts.ctx, s.cancel = context.WithCancel(ctx)\n\t\treturn nil\n\t}\n}", "func (o *DetectLanguageParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func SetCompilerOnContext(context *storage.Context, compiler *ast.Compiler) {\n\tcontext.Put(managerCompilerContextKey, compiler)\n}", "func (o *GetRepositoriesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostDeviceRackParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *StartV1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *QueueCommandUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *RebuildIndexSetParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetDeploymentByIDV3UsingGETParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *VectorThumbnailParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ImportStore1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *RegenerateDeployKeyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutLolPerksV1CurrentpageParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PatchAddonParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UploadWorkflowTemplateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetPackageSearchParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PollersPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateAddonParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetPluginEndpointParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostDockerRegistriesSearchListParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ListStacksByWorkspaceParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetTenantTagTestSpacesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *RegisterApplicationParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetLolClashV1ThirdpartyTeamDataParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}" ]
[ "0.6325545", "0.62608", "0.6089055", "0.60458696", "0.60446584", "0.60260916", "0.59930575", "0.5983732", "0.5980096", "0.59745187", "0.5971307", "0.5965182", "0.5955881", "0.59308636", "0.59253246", "0.5910732", "0.5909664", "0.5893768", "0.58796793", "0.58767", "0.5866419", "0.58576256", "0.5825472", "0.5803274", "0.5802678", "0.57989746", "0.57989126", "0.5790855", "0.577183", "0.5763195", "0.57514256", "0.574964", "0.57463235", "0.5733491", "0.57328856", "0.573122", "0.5730829", "0.5723282", "0.57217526", "0.57167566", "0.5711721", "0.57054555", "0.57026076", "0.5677254", "0.5674887", "0.5674659", "0.56714", "0.567127", "0.5661457", "0.56557214", "0.5642772", "0.563921", "0.5635907", "0.5634", "0.5624819", "0.56242394", "0.56210905", "0.562091", "0.56193924", "0.56102204", "0.55980027", "0.55729496", "0.5572222", "0.55720925", "0.55670893", "0.5564867", "0.5559866", "0.5557359", "0.5549027", "0.55485344", "0.5542942", "0.55419576", "0.5541345", "0.55390805", "0.55340856", "0.5531279", "0.5529832", "0.5526431", "0.5525229", "0.5524184", "0.552046", "0.55199844", "0.5516611", "0.55164903", "0.5513501", "0.5509582", "0.5508583", "0.55084884", "0.5507927", "0.54980403", "0.5496023", "0.54957414", "0.54928917", "0.54900324", "0.5486054", "0.5485193", "0.5484136", "0.5481908", "0.54777443", "0.5476413" ]
0.75824684
0
WithHTTPClient adds the HTTPClient to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) WithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams { o.SetHTTPClient(client) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ServeBuildTypesInProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *ServeBuildFieldShortParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetBuildPropertiesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TicketProjectsImportProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetWorkflowBuildTaskMetaMoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetProjectMetricsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ReplaceProjectsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TestProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateBuildPropertiesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListSourceFileOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(httpClient *http.Client) Option {\n\treturn func(cfg *config) {\n\t\tcfg.httpClient = httpClient\n\t}\n}", "func (o *GetPlatformsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeFieldParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ShowPackageParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(httpclient *http.Client) ClientOption {\n\treturn func(client *Client) {\n\t\tclient.httpClient = httpclient\n\t}\n}", "func (o *ListEngineTypeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(c *http.Client) Option {\n\treturn func(args *Client) {\n\t\targs.httpClient = c\n\t}\n}", "func (o *PostSecdefSearchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetGPUArchitectureParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(client HTTPClient) Option {\n\treturn func(opts *Client) {\n\t\topts.httpClient = client\n\t}\n}", "func (o *GetContentSourcesUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostPartsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetWormDomainParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetPlanParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetDeploymentByIDV3UsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetCurrentGenerationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateWidgetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(client *http.Client) OptionFunc {\n\treturn func(c *Client) {\n\t\tc.client = client\n\t}\n}", "func (o *GetDatalakeDbConfigParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ImportApplicationUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RegisterApplicationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(client *http.Client) Opt {\n\treturn func(c *Client) error {\n\t\tif client != nil {\n\t\t\tc.client = client\n\t\t}\n\t\treturn nil\n\t}\n}", "func (o *UpdateUserIssueSearchOptionsOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(client *http.Client) Opt {\n\treturn func(c *Client) {\n\t\tc.httpClient = client\n\t}\n}", "func WithHTTPClient(httpClient *http.Client) ConfigOption {\n\treturn func(c *Config) {\n\t\tc.httpClient = httpClient\n\t}\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UploadDeployFileParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetFileSystemParametersInternalParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(client *http.Client) Option {\n\treturn func(o *Options) {\n\t\to.Client = client\n\t}\n}", "func WithHTTPClient(client *http.Client) ClientOption {\n\treturn func(c *Client) {\n\t\tc.httpClient = client\n\t}\n}", "func (o *AllLookmlTestsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddRepositoryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutFlagSettingParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetBundleByKeyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeGroupsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetDeploymentPreview1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *OptionsTodoTodoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostApplyManifestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(h HTTPClient) ClientOption {\n\treturn clientOptionFunc(func(c interface{}) {\n\t\tswitch c := c.(type) {\n\t\tcase *Client:\n\t\t\tc.httpClient = h\n\t\tdefault:\n\t\t\tpanic(\"unknown type\")\n\t\t}\n\t})\n}", "func (o *ServeAgentsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(client *Client) {\n\t\tclient.httpClient = httpClient\n\t}\n}", "func (o *PostContextsAddPhpParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetaspecificPbxDeviceFirmwareBinaryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddBranchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePoolProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ConfigGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateDashboardRenderTaskParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetContentSourceUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetGroupsByTypeUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QueryDirectoryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SearchWorkspacesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *FileInfoCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UploadPluginParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PopContainerToDebugParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostAPIV3MachinesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetWorkItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "func (o *GetActionTemplateLogoVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(hClient *http.Client) clientOption {\n\treturn func(c *client) {\n\t\tc.httpClient = hClient\n\t}\n}", "func (o *GetGCParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetProductsByIDPromotionsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetItemByAppIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetTerraformConfigurationSourcesUsingGET1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *StartGatewayBundleUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ToggleNetworkGeneratorsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateRuntimeMapParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RegenerateDeployKeyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateScheduledPlanParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RestrictApplicationsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(client *http.Client) Option {\n\treturn func(c *Client) error {\n\t\tif client == nil {\n\t\t\treturn errors.New(\"client cannot be nil\")\n\t\t}\n\n\t\tc.client = client\n\t\treturn nil\n\t}\n}", "func (o *UpdateOrganizationTeamParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetComplianceByResourceTypesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "0.7745308", "0.70955724", "0.6670485", "0.6533715", "0.6520046", "0.6457731", "0.6444158", "0.6399344", "0.638961", "0.6367487", "0.6361963", "0.63518184", "0.6349728", "0.63250554", "0.6235281", "0.62278366", "0.62212664", "0.6219559", "0.62041163", "0.6203834", "0.616828", "0.61569214", "0.6156435", "0.61534363", "0.61487776", "0.6148477", "0.61474", "0.61430746", "0.6139136", "0.61232364", "0.61219203", "0.6119106", "0.6115179", "0.6112174", "0.61080664", "0.6103375", "0.60912174", "0.6085006", "0.6075976", "0.60670674", "0.6064778", "0.6060914", "0.60608345", "0.60587716", "0.6058417", "0.60527825", "0.6050475", "0.6045108", "0.60395074", "0.6038311", "0.60367805", "0.6036636", "0.6034038", "0.6032489", "0.60321784", "0.60313183", "0.60306746", "0.60299265", "0.60247594", "0.6023561", "0.601864", "0.60152644", "0.6014101", "0.60121036", "0.6011182", "0.60101867", "0.60071915", "0.6006869", "0.6006463", "0.60048", "0.6000401", "0.59964085", "0.599633", "0.5996023", "0.599172", "0.599172", "0.599172", "0.599172", "0.599172", "0.599172", "0.599172", "0.599172", "0.599172", "0.599172", "0.5987731", "0.5987245", "0.59851146", "0.5984629", "0.598297", "0.59819794", "0.5981011", "0.5979579", "0.5977246", "0.5974189", "0.5970779", "0.59695804", "0.59691405", "0.59674877", "0.59661406", "0.5963167" ]
0.74663234
1
SetHTTPClient adds the HTTPClient to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *TicketProjectsImportProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetWorkflowBuildTaskMetaMoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeBuildFieldShortParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ReplaceProjectsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetBuildPropertiesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TestProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateBuildPropertiesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetPlanParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetProjectMetricsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetV1TicketingProjectsTicketingProjectIDConfigurationOptionsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListSourceFileOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetPlatformsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetCurrentGenerationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeFieldParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetGPUArchitectureParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RegisterApplicationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetDatalakeDbConfigParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeAgentsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListEngineTypeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostSecdefSearchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetContentSourcesUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ShowPackageParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ToggleNetworkGeneratorsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *StartGatewayBundleUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UploadPluginParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutFlagSettingParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ImportApplicationUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostPartsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RebuildIndexSetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateWidgetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetDeploymentPreview1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateDashboardRenderTaskParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddRepositoryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AllLookmlTestsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PopContainerToDebugParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetBuildQueuePositionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePackageRepositoryDeltaUploadParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateUserIssueSearchOptionsOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func SetHTTPClient(client *http.Client) {\n\thttpClient = client\n}", "func (o *OptionsTodoTodoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ConfigGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UploadDeployFileParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateFeaturesConfigurationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *StartPacketCaptureParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateOrganizationTeamParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateProjectTriggerSpacesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetContentSourceUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetWormDomainParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetTerraformConfigurationSourcesUsingGET1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetDeploymentByIDV3UsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateNetworkHTTPServerParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PatchAssetDeviceConfigurationsMoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListTaskNexusParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *FreezeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetFyiSettingsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetFileSystemParametersInternalParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetActionTemplateLogoVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeGroupsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostApplyManifestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TurnOnLightParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListStacksByWorkspaceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCartUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePoolProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SaveTemplateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetNdmpSettingsVariableParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRuntimeServersParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SearchWorkspacesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ModifyProxyConfigInternalParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ConfigListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostAPIV3MachinesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostMultiNodeDeviceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListPipelinesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetGCParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServeBuildTypesInProjectParams) WithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *QueryDirectoryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostIPLoadbalancingServiceNameHTTPFrontendParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetExampleNewProjectDescriptionCompatibilityVersion1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EditParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QueueCommandUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetSimulationActivityParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RegenerateDeployKeyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateDatabaseOnServerParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostContextsAddPhpParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddBranchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SkuPackPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostIPAMSwitchesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetProductsByIDPromotionsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRackTopoesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (e *Env) SetHTTPClient(c *http.Client) {\n\te.client = c\n}", "func (o *ImagePushParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetTreeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostHyperflexAutoSupportPoliciesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "0.75687206", "0.75462866", "0.752815", "0.7496607", "0.74776006", "0.74260134", "0.738448", "0.7375586", "0.73665917", "0.73571175", "0.73543626", "0.7317679", "0.72968477", "0.7290288", "0.72661227", "0.7244928", "0.7242501", "0.721808", "0.72103995", "0.72103137", "0.72081226", "0.72078025", "0.7207585", "0.72046065", "0.71995366", "0.7196592", "0.7195578", "0.7178401", "0.7177993", "0.7174399", "0.7174107", "0.71724325", "0.71532184", "0.71512777", "0.714582", "0.71440744", "0.7141375", "0.7139289", "0.7130949", "0.7129176", "0.7124292", "0.7122309", "0.7120256", "0.7119096", "0.7117967", "0.7115705", "0.7114591", "0.7112681", "0.7108093", "0.710654", "0.710197", "0.70958704", "0.7095866", "0.70941055", "0.7093687", "0.7091328", "0.7089415", "0.70884097", "0.70844996", "0.70815456", "0.70801085", "0.7077757", "0.7076116", "0.70739406", "0.7073023", "0.70715755", "0.70629483", "0.70625556", "0.7061939", "0.7060303", "0.70595807", "0.70582795", "0.7056233", "0.7055436", "0.7055276", "0.70543677", "0.7052879", "0.70505315", "0.7038337", "0.7035704", "0.70356816", "0.7034986", "0.70329916", "0.70307183", "0.7028704", "0.70216197", "0.701848", "0.7017442", "0.70146346", "0.70090157", "0.70067394", "0.7004934", "0.6999118", "0.69979256", "0.69972575", "0.69937915", "0.6990458", "0.69896555", "0.6989162", "0.69861126" ]
0.8605697
0
WithFields adds the fields to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) WithFields(fields *string) *ServeBuildTypesInProjectParams { o.SetFields(fields) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ServeBuildTypesInProjectParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func NewServeBuildTypesInProjectParams() *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func WithFields(fields ...string) ReqOption {\n\treturn func(v url.Values) {\n\t\tv.Set(\"fields\", strings.Join(fields, \",\"))\n\t\tv.Set(\"include_fields\", \"true\")\n\t}\n}", "func (o *ServeBuildTypesInProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (c *PlatformTypesGetCall) Fields(s ...googleapi.Field) *PlatformTypesGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (s ProjectDetails) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ConsoleUrl != nil {\n\t\tv := *s.ConsoleUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"consoleUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.LastUpdatedDate != nil {\n\t\tv := *s.LastUpdatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedDate\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectId != nil {\n\t\tv := *s.ProjectId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"projectId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Region != nil {\n\t\tv := *s.Region\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"region\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Resources) > 0 {\n\t\tv := s.Resources\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"resources\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"state\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "func NewServeBuildTypesInProjectParamsWithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (s AwsCodeBuildProjectDetails) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.EncryptionKey != nil {\n\t\tv := *s.EncryptionKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"EncryptionKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Environment != nil {\n\t\tv := s.Environment\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Environment\", v, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ServiceRole != nil {\n\t\tv := *s.ServiceRole\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ServiceRole\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Source != nil {\n\t\tv := s.Source\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Source\", v, metadata)\n\t}\n\tif s.VpcConfig != nil {\n\t\tv := s.VpcConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"VpcConfig\", v, metadata)\n\t}\n\treturn nil\n}", "func (c *ProjectsCreateCall) Fields(s ...googleapi.Field) *ProjectsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func NewServeBuildFieldShortParamsWithHTTPClient(client *http.Client) *ServeBuildFieldShortParams {\n\tvar ()\n\treturn &ServeBuildFieldShortParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewServeBuildFieldShortParams() *ServeBuildFieldShortParams {\n\tvar ()\n\treturn &ServeBuildFieldShortParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ServeBuildTypesInProjectParams) WithContext(ctx context.Context) *ServeBuildTypesInProjectParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func WithFields(ctx context.Context, fields Fields) context.Context {\n\tnewFields := mergeFields(ContextFields(ctx), fields)\n\treturn context.WithValue(ctx, fieldsKey, newFields)\n}", "func (s CreateProjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PlacementTemplate != nil {\n\t\tv := s.PlacementTemplate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"placementTemplate\", v, metadata)\n\t}\n\tif s.ProjectName != nil {\n\t\tv := *s.ProjectName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"projectName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "func (r *Search) Fields(fields ...types.FieldAndFormat) *Search {\n\tr.req.Fields = fields\n\n\treturn r\n}", "func (c *PlatformTypesListCall) Fields(s ...googleapi.Field) *PlatformTypesListCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func WithFields(ctx context.Context, fields ...zap.Field) context.Context {\n\treturn WithContext(ctx, FromContext(ctx).With(fields...))\n}", "func (c *ProjectsPatchDeploymentsCreateCall) Fields(s ...googleapi.Field) *ProjectsPatchDeploymentsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsOsConfigsCreateCall) Fields(s ...googleapi.Field) *ProjectsOsConfigsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (b Build) Fields() map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"app\": b.App,\n\t\t\"build_date\": b.Date,\n\t\t\"commit\": b.Commit,\n\t}\n}", "func (c *SettingsSearchapplicationsCreateCall) Fields(s ...googleapi.Field) *SettingsSearchapplicationsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *SettingsSearchapplicationsCreateCall) Fields(s ...googleapi.Field) *SettingsSearchapplicationsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func NewServeBuildFieldShortParamsWithTimeout(timeout time.Duration) *ServeBuildFieldShortParams {\n\tvar ()\n\treturn &ServeBuildFieldShortParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (c *ProjectsInstancesCreateCall) Fields(s ...googleapi.Field) *ProjectsInstancesCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *ServeBuildFieldShortParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param btLocator\n\tif err := r.SetPathParam(\"btLocator\", o.BtLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param buildLocator\n\tif err := r.SetPathParam(\"buildLocator\", o.BuildLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param field\n\tif err := r.SetPathParam(\"field\", o.Field); err != nil {\n\t\treturn err\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (c *OrganizationsDevelopersGetMonetizationConfigCall) Fields(s ...googleapi.Field) *OrganizationsDevelopersGetMonetizationConfigCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *UrlTestingToolsMobileFriendlyTestRunCall) Fields(s ...googleapi.Field) *UrlTestingToolsMobileFriendlyTestRunCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (b *GroupsGetBuilder) Fields(v []string) *GroupsGetBuilder {\n\tb.Params[\"fields\"] = v\n\treturn b\n}", "func (c *AppsModulesVersionsCreateCall) Fields(s ...googleapi.Field) *AppsModulesVersionsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsDevelopersUpdateMonetizationConfigCall) Fields(s ...googleapi.Field) *OrganizationsDevelopersUpdateMonetizationConfigCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsProvisionOrganizationCall) Fields(s ...googleapi.Field) *ProjectsProvisionOrganizationCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (s UpdateProjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectDescription != nil {\n\t\tv := *s.ProjectDescription\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"projectDescription\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectName != nil {\n\t\tv := *s.ProjectName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"projectName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectId != nil {\n\t\tv := *s.ProjectId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"projectId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (c *MediaUploadCall) Fields(s ...googleapi.Field) *MediaUploadCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *MediaUploadCall) Fields(s ...googleapi.Field) *MediaUploadCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsScanConfigsCreateCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsGetCall) Fields(s ...googleapi.Field) *ProjectsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsGetCall) Fields(s ...googleapi.Field) *ProjectsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (s ExportProjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ProjectId != nil {\n\t\tv := *s.ProjectId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"projectId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func Build(schema *models.Schema, modulesProvider ModulesProvider) *graphql.Field {\n\tfield := &graphql.Field{\n\t\tName: \"Explore\",\n\t\tDescription: descriptions.LocalExplore,\n\t\tType: graphql.NewList(exploreObject()),\n\t\tResolve: newResolver(modulesProvider).resolve,\n\t\tArgs: graphql.FieldConfigArgument{\n\t\t\t\"offset\": &graphql.ArgumentConfig{\n\t\t\t\tType: graphql.Int,\n\t\t\t\tDescription: descriptions.Offset,\n\t\t\t},\n\t\t\t\"limit\": &graphql.ArgumentConfig{\n\t\t\t\tType: graphql.Int,\n\t\t\t\tDescription: descriptions.Limit,\n\t\t\t},\n\n\t\t\t\"nearVector\": nearVectorArgument(),\n\t\t\t\"nearObject\": nearObjectArgument(),\n\t\t},\n\t}\n\n\tif modulesProvider != nil {\n\t\tfor name, argument := range modulesProvider.ExploreArguments(schema) {\n\t\t\tfield.Args[name] = argument\n\t\t}\n\t}\n\n\treturn field\n}", "func (c *OrganizationsDevelopersAppsKeysCreateCreateCall) Fields(s ...googleapi.Field) *OrganizationsDevelopersAppsKeysCreateCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSetIamPolicyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSetIamPolicyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (log *logger) WithFields(fields slf.Fields) slf.StructuredLogger {\n\tres := log.copy()\n\tfor k, v := range fields {\n\t\tres.fields[k] = v\n\t}\n\treturn res\n}", "func (c *ProjectsTransferConfigsCreateCall) Fields(s ...googleapi.Field) *ProjectsTransferConfigsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsScanConfigsStartCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsStartCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsPatchDeploymentsPatchCall) Fields(s ...googleapi.Field) *ProjectsPatchDeploymentsPatchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsApiproductsCreateCall) Fields(s ...googleapi.Field) *OrganizationsApiproductsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsPatchDeploymentsPauseCall) Fields(s ...googleapi.Field) *ProjectsPatchDeploymentsPauseCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *FloodlightActivitiesGeneratetagCall) Fields(s ...googleapi.Field) *FloodlightActivitiesGeneratetagCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsApiproductsRateplansCreateCall) Fields(s ...googleapi.Field) *OrganizationsApiproductsRateplansCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (b *GroupsGetRequestsBuilder) Fields(v []string) *GroupsGetRequestsBuilder {\n\tb.Params[\"fields\"] = v\n\treturn b\n}", "func (c *OrganizationsDevelopersAppsCreateCall) Fields(s ...googleapi.Field) *OrganizationsDevelopersAppsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (s CreateProjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.Contents != nil {\n\t\tv := s.Contents\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetStream(protocol.PayloadTarget, \"contents\", protocol.BytesStream(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Region != nil {\n\t\tv := *s.Region\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"region\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SnapshotId != nil {\n\t\tv := *s.SnapshotId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"snapshotId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (s CreateProjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.Contents != nil {\n\t\tv := s.Contents\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetStream(protocol.PayloadTarget, \"contents\", protocol.BytesStream(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Region != nil {\n\t\tv := *s.Region\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"region\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SnapshotId != nil {\n\t\tv := *s.SnapshotId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"snapshotId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (b *GroupsGetByIDBuilder) Fields(v []string) *GroupsGetByIDBuilder {\n\tb.Params[\"fields\"] = v\n\treturn b\n}", "func (c *OrganizationsGetProjectMappingCall) Fields(s ...googleapi.Field) *OrganizationsGetProjectMappingCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsDevelopersAppsKeysCreateCall) Fields(s ...googleapi.Field) *OrganizationsDevelopersAppsKeysCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsProfilesCreateCall) Fields(s ...googleapi.Field) *ProjectsProfilesCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsGetBillingInfoCall) Fields(s ...googleapi.Field) *ProjectsGetBillingInfoCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func NewServeFieldParams() *ServeFieldParams {\n\tvar ()\n\treturn &ServeFieldParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s ExportProjectOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.DownloadUrl != nil {\n\t\tv := *s.DownloadUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"downloadUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ShareUrl != nil {\n\t\tv := *s.ShareUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"shareUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SnapshotId != nil {\n\t\tv := *s.SnapshotId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"snapshotId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (s CreateProjectOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Details != nil {\n\t\tv := s.Details\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"details\", v, metadata)\n\t}\n\treturn nil\n}", "func (s CreateProjectOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Details != nil {\n\t\tv := s.Details\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"details\", v, metadata)\n\t}\n\treturn nil\n}", "func (c *PagesCreateCall) Fields(s ...googleapi.Field) *PagesCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsListCall) Fields(s ...googleapi.Field) *ProjectsListCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsListCall) Fields(s ...googleapi.Field) *ProjectsListCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsDevelopersCreateCall) Fields(s ...googleapi.Field) *OrganizationsDevelopersCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsOsConfigsPatchCall) Fields(s ...googleapi.Field) *ProjectsOsConfigsPatchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsUpdateBillingInfoCall) Fields(s ...googleapi.Field) *ProjectsUpdateBillingInfoCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func WithHTTPFields(ctx context.Context, fields Fields) context.Context {\n\treturn context.WithValue(ctx, contextHTTPLogFields, fields)\n}", "func (o *GetBuildPropertiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param buildId\n\tif err := r.SetPathParam(\"buildId\", swag.FormatInt32(o.BuildID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (c *PropertiesCreateCall) Fields(s ...googleapi.Field) *PropertiesCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetIamPolicyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetIamPolicyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func WithFields(ctx context.Context, fields ...LogField) context.Context {\n\tif val := ctx.Value(fieldsContextKey); val != nil {\n\t\tif arr, ok := val.([]LogField); ok {\n\t\t\treturn context.WithValue(ctx, fieldsContextKey, append(arr, fields...))\n\t\t}\n\t}\n\n\treturn context.WithValue(ctx, fieldsContextKey, fields)\n}", "func (s UpdateProjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.Contents != nil {\n\t\tv := s.Contents\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetStream(protocol.PayloadTarget, \"contents\", protocol.BytesStream(v), metadata)\n\t}\n\tif s.ProjectId != nil {\n\t\tv := *s.ProjectId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"projectId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (s DescribeProjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ProjectId != nil {\n\t\tv := *s.ProjectId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"projectId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SyncFromResources != nil {\n\t\tv := *s.SyncFromResources\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"syncFromResources\", protocol.BoolValue(v), metadata)\n\t}\n\treturn nil\n}", "func (c *OrganizationsDevelopersAppsGenerateKeyPairOrUpdateDeveloperAppStatusCall) Fields(s ...googleapi.Field) *OrganizationsDevelopersAppsGenerateKeyPairOrUpdateDeveloperAppStatusCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsPatchDeploymentsResumeCall) Fields(s ...googleapi.Field) *ProjectsPatchDeploymentsResumeCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsEnvironmentsUpdateDebugmaskCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsUpdateDebugmaskCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsServiceAccountsSignJwtCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSignJwtCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsServiceAccountsSignJwtCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSignJwtCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsTimeSeriesCreateCall) Fields(s ...googleapi.Field) *ProjectsTimeSeriesCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *SitesAddCall) Fields(s ...googleapi.Field) *SitesAddCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *SpacesWebhooksCall) Fields(s ...googleapi.Field) *SpacesWebhooksCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *ServeBuildTypesInProjectParams) WithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (c *ProjectsUpdateCall) Fields(s ...googleapi.Field) *ProjectsUpdateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *StartCall) Fields(s ...googleapi.Field) *StartCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ContentRedactCall) Fields(s ...googleapi.Field) *ContentRedactCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *PropertiesFirebaseLinksCreateCall) Fields(s ...googleapi.Field) *PropertiesFirebaseLinksCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *MediaDownloadCall) Fields(s ...googleapi.Field) *MediaDownloadCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *MediaDownloadCall) Fields(s ...googleapi.Field) *MediaDownloadCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *AppsModulesPatchCall) Fields(s ...googleapi.Field) *AppsModulesPatchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *ServeBuildTypesInProjectParams) WithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (c *ProjectsOsConfigsGetCall) Fields(s ...googleapi.Field) *ProjectsOsConfigsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func Fields(fields ...string) Parameter {\n\treturn func(pa Parameterizable) {\n\t\tpa.SetParameter(\"fields\", fields)\n\t}\n}", "func (c *OrganizationsEnvironmentsFlowhooksAttachSharedFlowToFlowHookCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsFlowhooksAttachSharedFlowToFlowHookCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *SettingsSearchapplicationsPatchCall) Fields(s ...googleapi.Field) *SettingsSearchapplicationsPatchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}" ]
[ "0.66100436", "0.5987162", "0.5916288", "0.5896456", "0.5783438", "0.54266256", "0.54260683", "0.54170036", "0.5374443", "0.5309174", "0.52923715", "0.5277465", "0.5254697", "0.52541536", "0.5239775", "0.5225227", "0.52088237", "0.5208637", "0.5194907", "0.5160286", "0.5101717", "0.5091614", "0.5091614", "0.50833005", "0.50825894", "0.5073136", "0.5057971", "0.5057342", "0.5052682", "0.504743", "0.50435096", "0.5039927", "0.503833", "0.5024391", "0.5024391", "0.5022491", "0.5017494", "0.5017494", "0.50079644", "0.49997693", "0.4995457", "0.49862745", "0.49623007", "0.49623007", "0.49467936", "0.49423292", "0.49408305", "0.49359918", "0.4933554", "0.49334365", "0.492664", "0.49255306", "0.4918403", "0.4914166", "0.4910052", "0.4910052", "0.4907791", "0.49037367", "0.49020547", "0.4900602", "0.48990324", "0.4894843", "0.4892112", "0.48906228", "0.48906228", "0.48885795", "0.48668405", "0.48668405", "0.4866776", "0.48632637", "0.48582795", "0.48579523", "0.4847977", "0.4841307", "0.484075", "0.484075", "0.4835368", "0.48351645", "0.48316446", "0.48289308", "0.48271397", "0.48069203", "0.47991183", "0.47991183", "0.4798782", "0.47956437", "0.47947794", "0.47899294", "0.47781098", "0.47776628", "0.47762412", "0.4775722", "0.4774871", "0.4774871", "0.47723642", "0.47687778", "0.4768747", "0.4764532", "0.47579578", "0.4757024" ]
0.68725204
0
SetFields adds the fields to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) SetFields(fields *string) { o.Fields = fields }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Type) SetFields(fields []*Field)", "func (o *ServeBuildTypesInProjectParams) WithFields(fields *string) *ServeBuildTypesInProjectParams {\n\to.SetFields(fields)\n\treturn o\n}", "func (o *CreateCartUsingPOSTParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *ListSourceFileOfProjectVersionParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *ServeBuildTypesInProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (s ProjectDetails) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ConsoleUrl != nil {\n\t\tv := *s.ConsoleUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"consoleUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.LastUpdatedDate != nil {\n\t\tv := *s.LastUpdatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedDate\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectId != nil {\n\t\tv := *s.ProjectId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"projectId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Region != nil {\n\t\tv := *s.Region\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"region\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Resources) > 0 {\n\t\tv := s.Resources\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"resources\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"state\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "func (o *SearchKeywordChunkedParams) SetFields(fields string) {\n\to.Fields = fields\n}", "func (o *ListEngineTypeParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *ServeGroupsParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *SearchHomepagesParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *ServeAgentsParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *CreateDashboardRenderTaskParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *ExportProductsUsingGETParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *GetPageDataUsingGETParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (c *OrganizationsDevelopersUpdateMonetizationConfigCall) Fields(s ...googleapi.Field) *OrganizationsDevelopersUpdateMonetizationConfigCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (c *PlatformTypesGetCall) Fields(s ...googleapi.Field) *PlatformTypesGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsEnvironmentsUpdateDebugmaskCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsUpdateDebugmaskCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (r *Search) Fields(fields ...types.FieldAndFormat) *Search {\n\tr.req.Fields = fields\n\n\treturn r\n}", "func (c *PlatformTypesListCall) Fields(s ...googleapi.Field) *PlatformTypesListCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *NarrowSearchRecipeParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (c *ProjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSetIamPolicyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSetIamPolicyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func SetFields(c context.Context, fields Fields) context.Context {\n\treturn context.WithValue(c, fieldsKey, fields)\n}", "func (o *GetTasksGetPhpParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *SearchDashboardElementsParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (o *SetBuildQueuePositionParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func NewServeBuildTypesInProjectParams() *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s AwsCodeBuildProjectDetails) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.EncryptionKey != nil {\n\t\tv := *s.EncryptionKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"EncryptionKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Environment != nil {\n\t\tv := s.Environment\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Environment\", v, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ServiceRole != nil {\n\t\tv := *s.ServiceRole\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ServiceRole\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Source != nil {\n\t\tv := s.Source\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Source\", v, metadata)\n\t}\n\tif s.VpcConfig != nil {\n\t\tv := s.VpcConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"VpcConfig\", v, metadata)\n\t}\n\treturn nil\n}", "func (c *ProjectsPatchDeploymentsCreateCall) Fields(s ...googleapi.Field) *ProjectsPatchDeploymentsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *UrlTestingToolsMobileFriendlyTestRunCall) Fields(s ...googleapi.Field) *UrlTestingToolsMobileFriendlyTestRunCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsPatchDeploymentsPatchCall) Fields(s ...googleapi.Field) *ProjectsPatchDeploymentsPatchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *GetWorkItemParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (b Build) Fields() map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"app\": b.App,\n\t\t\"build_date\": b.Date,\n\t\t\"commit\": b.Commit,\n\t}\n}", "func (c *OrganizationsDevelopersGetMonetizationConfigCall) Fields(s ...googleapi.Field) *OrganizationsDevelopersGetMonetizationConfigCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (b *GroupsGetBuilder) Fields(v []string) *GroupsGetBuilder {\n\tb.Params[\"fields\"] = v\n\treturn b\n}", "func (o *PublicViewInfo) SetFields(v []PublicField) {\n\to.Fields = v\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (s UpdateProjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectDescription != nil {\n\t\tv := *s.ProjectDescription\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"projectDescription\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectName != nil {\n\t\tv := *s.ProjectName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"projectName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectId != nil {\n\t\tv := *s.ProjectId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"projectId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (m *MockedManager) SetFields(interface{}) error {\n\treturn nil\n}", "func (o *ListIssueGroupOfProjectVersionParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (s CreateProjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PlacementTemplate != nil {\n\t\tv := s.PlacementTemplate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"placementTemplate\", v, metadata)\n\t}\n\tif s.ProjectName != nil {\n\t\tv := *s.ProjectName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"projectName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "func (o *InventoryStocktakingSearchParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (fm *FieldModelOrder) SetFields(fbeValue *Order) error {\n var err error = nil\n\n if err = fm.Id.Set(fbeValue.Id); err != nil {\n return err\n }\n if err = fm.Symbol.Set(fbeValue.Symbol); err != nil {\n return err\n }\n if err = fm.Side.Set(&fbeValue.Side); err != nil {\n return err\n }\n if err = fm.Type.Set(&fbeValue.Type); err != nil {\n return err\n }\n if err = fm.Price.Set(fbeValue.Price); err != nil {\n return err\n }\n if err = fm.Volume.Set(fbeValue.Volume); err != nil {\n return err\n }\n return err\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDeployCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsApisRevisionsDeployCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsProvisionOrganizationCall) Fields(s ...googleapi.Field) *ProjectsProvisionOrganizationCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *SearchAbsoluteParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func Fields(fields ...string) Parameter {\n\treturn func(pa Parameterizable) {\n\t\tpa.SetParameter(\"fields\", fields)\n\t}\n}", "func (c *ProjectsPatchDeploymentsPauseCall) Fields(s ...googleapi.Field) *ProjectsPatchDeploymentsPauseCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsCreateCall) Fields(s ...googleapi.Field) *ProjectsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (b *GroupsGetByIDBuilder) Fields(v []string) *GroupsGetByIDBuilder {\n\tb.Params[\"fields\"] = v\n\treturn b\n}", "func (s Stage) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.AccessLogSettings != nil {\n\t\tv := s.AccessLogSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"accessLogSettings\", v, metadata)\n\t}\n\tif s.ClientCertificateId != nil {\n\t\tv := *s.ClientCertificateId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientCertificateId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.DefaultRouteSettings != nil {\n\t\tv := s.DefaultRouteSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"defaultRouteSettings\", v, metadata)\n\t}\n\tif s.DeploymentId != nil {\n\t\tv := *s.DeploymentId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deploymentId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastUpdatedDate != nil {\n\t\tv := *s.LastUpdatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedDate\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif len(s.RouteSettings) > 0 {\n\t\tv := s.RouteSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"routeSettings\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.StageName != nil {\n\t\tv := *s.StageName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stageName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.StageVariables) > 0 {\n\t\tv := s.StageVariables\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"stageVariables\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "func (c *AppsModulesVersionsCreateCall) Fields(s ...googleapi.Field) *AppsModulesVersionsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsServiceAccountsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSetIamPolicyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsServiceAccountsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSetIamPolicyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (b *GroupsGetRequestsBuilder) Fields(v []string) *GroupsGetRequestsBuilder {\n\tb.Params[\"fields\"] = v\n\treturn b\n}", "func (c *MediaUploadCall) Fields(s ...googleapi.Field) *MediaUploadCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *MediaUploadCall) Fields(s ...googleapi.Field) *MediaUploadCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsOsConfigsPatchCall) Fields(s ...googleapi.Field) *ProjectsOsConfigsPatchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *VariantsetsPatchCall) Fields(s ...googleapi.Field) *VariantsetsPatchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *MetroclusterInterconnectGetParams) SetFields(fields []string) {\n\to.Fields = fields\n}", "func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDeploymentsGenerateDeployChangeReportCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsApisRevisionsDeploymentsGenerateDeployChangeReportCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsEnvironmentsFlowhooksAttachSharedFlowToFlowHookCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsFlowhooksAttachSharedFlowToFlowHookCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsUpdateCall) Fields(s ...googleapi.Field) *ProjectsUpdateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsPatchDeploymentsResumeCall) Fields(s ...googleapi.Field) *ProjectsPatchDeploymentsResumeCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *AppsModulesPatchCall) Fields(s ...googleapi.Field) *AppsModulesPatchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (s Stage) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.AccessLogSettings != nil {\n\t\tv := s.AccessLogSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"accessLogSettings\", v, metadata)\n\t}\n\tif s.ApiGatewayManaged != nil {\n\t\tv := *s.ApiGatewayManaged\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiGatewayManaged\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.AutoDeploy != nil {\n\t\tv := *s.AutoDeploy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"autoDeploy\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ClientCertificateId != nil {\n\t\tv := *s.ClientCertificateId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientCertificateId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: \"iso8601\", QuotedFormatTime: true}, metadata)\n\t}\n\tif s.DefaultRouteSettings != nil {\n\t\tv := s.DefaultRouteSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"defaultRouteSettings\", v, metadata)\n\t}\n\tif s.DeploymentId != nil {\n\t\tv := *s.DeploymentId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deploymentId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastDeploymentStatusMessage != nil {\n\t\tv := *s.LastDeploymentStatusMessage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastDeploymentStatusMessage\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastUpdatedDate != nil {\n\t\tv := *s.LastUpdatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: \"iso8601\", QuotedFormatTime: true}, metadata)\n\t}\n\tif s.RouteSettings != nil {\n\t\tv := s.RouteSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"routeSettings\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.StageName != nil {\n\t\tv := *s.StageName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stageName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StageVariables != nil {\n\t\tv := s.StageVariables\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"stageVariables\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "func (s ExportProjectOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.DownloadUrl != nil {\n\t\tv := *s.DownloadUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"downloadUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ShareUrl != nil {\n\t\tv := *s.ShareUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"shareUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SnapshotId != nil {\n\t\tv := *s.SnapshotId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"snapshotId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (c *ProjectsUpdateBillingInfoCall) Fields(s ...googleapi.Field) *ProjectsUpdateBillingInfoCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *PortsetCollectionGetParams) SetFields(fields []string) {\n\to.Fields = fields\n}", "func (c *ProjectsScanConfigsStartCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsStartCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsEnvironmentsSharedflowsRevisionsDeployCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsSharedflowsRevisionsDeployCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsEnvironmentsGetDebugmaskCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsGetDebugmaskCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsOsConfigsCreateCall) Fields(s ...googleapi.Field) *ProjectsOsConfigsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsEnvironmentsUpdateEnvironmentCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsUpdateEnvironmentCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsTransferConfigsStartManualRunsCall) Fields(s ...googleapi.Field) *ProjectsTransferConfigsStartManualRunsCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *FileInfoCollectionGetParams) SetFields(fields []string) {\n\to.Fields = fields\n}", "func (c *OrganizationsEnvironmentsModifyEnvironmentCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsModifyEnvironmentCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (s UpdateProjectInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.Contents != nil {\n\t\tv := s.Contents\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetStream(protocol.PayloadTarget, \"contents\", protocol.BytesStream(v), metadata)\n\t}\n\tif s.ProjectId != nil {\n\t\tv := *s.ProjectId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"projectId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (e *CallEvent) SetFields(array []string) *CallEvent {\n\n\ttimeObj, err := time.Parse(TIME_FORMAT, array[0])\n\tif err != nil {\n\t\ttimeObj = time.Now()\n\t}\n\te.Date = timeObj\n\n\tif len(array) > 2 {\n\t\te.Operation = array[1]\n\t}\n\n\tif len(array) > 3 {\n\t\te.Irrelevant = array[2]\n\t}\n\n\tif len(array) > 4 {\n\t\te.Line = array[3]\n\t}\n\n\tif len(array) > 5 {\n\t\te.SourceNumber = array[4]\n\t}\n\n\tif len(array) > 6 {\n\t\te.TargetNumber = array[5]\n\t}\n\n\tif len(array) > 7 {\n\t\te.InternalPort = array[6]\n\t}\n\treturn e\n}", "func (o *ServeBuildFieldShortParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param btLocator\n\tif err := r.SetPathParam(\"btLocator\", o.BtLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param buildLocator\n\tif err := r.SetPathParam(\"buildLocator\", o.BuildLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param field\n\tif err := r.SetPathParam(\"field\", o.Field); err != nil {\n\t\treturn err\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (c *ProjectsTransferConfigsPatchCall) Fields(s ...googleapi.Field) *ProjectsTransferConfigsPatchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *FloodlightConfigurationsUpdateCall) Fields(s ...googleapi.Field) *FloodlightConfigurationsUpdateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (b *MessagesGetChatPreviewBuilder) Fields(v []string) *MessagesGetChatPreviewBuilder {\n\tb.Params[\"fields\"] = v\n\treturn b\n}", "func (l *Logger) SetFields(fields ...Field) {\n\tl.mu.Lock()\n\tl.setFields(fields...)\n\tl.mu.Unlock()\n}", "func (c *ProjectsInstancesUpdateCall) Fields(s ...googleapi.Field) *ProjectsInstancesUpdateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ProjectsLocationsMigrationJobsPromoteCall) Fields(s ...googleapi.Field) *ProjectsLocationsMigrationJobsPromoteCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsApisRevisionsUpdateApiProxyRevisionCall) Fields(s ...googleapi.Field) *OrganizationsApisRevisionsUpdateApiProxyRevisionCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (cr CommonWriter) WriteBodyFields(op thrift.TProtocol, request *CommonReq, reqType *types.IDLStruct) (err error) {\n\tfor k, v := range reqType.NameMembers {\n\t\tif v.Required == 0 { //需要的\n\t\t\t_, ok := request.Body[k]\n\t\t\tif !ok { //必填字段没有传。\n\t\t\t\tcr.crLog.Infof(\"[WriteBodyFields]: file: %s struct: %s, request: %s missed\", reqType.GetFileName(), reqType.IDLDefine.GetName(), k)\n\t\t\t}\n\t\t}\n\t}\n\tidlMember, okName := reqType.NameMembers[\"Files\"]\n\tif okName {\n\t\tlistType, okType := idlMember.GetFieldType().(*types.IDLList)\n\t\tif okType && listType.GetValueType().GetName() == \"File\" {\n\t\t\tif err := cr.WriteFiles(op, request.Files, idlMember); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range request.Body {\n\t\tidlMember, ok := reqType.NameMembers[k]\n\t\tif !ok { // 这个字段协议不能识别,跳过\n\t\t\tmetrics.EmitCounterV2(metrics.Metric_CommCli_FailWriterType,\n\t\t\t\tmap[string]string{\"err_file_type\": fmt.Sprintf(\"%s_%s\", reqType.GetFileName(), reqType.GetName())})\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := cr.WriteField(op, v, idlMember); err != nil {\n\t\t\treturn fmt.Errorf(\"%s WriteField err: %v\", cr, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (c *VariantsetsCreateCall) Fields(s ...googleapi.Field) *VariantsetsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *ScriptsRunCall) Fields(s ...googleapi.Field) *ScriptsRunCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (a *api) h_POST_orgs_orgId_fields(c *gin.Context) {\n\torgId, err := parseInt64Param(c, \"orgId\")\n\ta.logger.Debug(\"POST /orgs/\", orgId, \"/fields\")\n\tif a.errorResponse(c, err) {\n\t\treturn\n\t}\n\n\taCtx := a.getAuthContext(c)\n\tif a.errorResponse(c, aCtx.AuthZOrgAdmin(orgId)) {\n\t\treturn\n\t}\n\n\tvar mis OrgMetaInfoArr\n\tif a.errorResponse(c, bindAppJson(c, &mis)) {\n\t\treturn\n\t}\n\n\tfis := a.metaInfos2FieldInfos(mis, orgId)\n\tif a.errorResponse(c, a.Dc.InsertNewFields(orgId, fis)) {\n\t\treturn\n\t}\n\n\ta.logger.Info(\"New fields were added for orgId=\", orgId, \" \", fis)\n\tc.Status(http.StatusCreated)\n}", "func (o *ConfigurationBackupGetParams) SetFields(fields []string) {\n\to.Fields = fields\n}", "func (c *OrganizationsEnvironmentsTargetserversUpdateCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsTargetserversUpdateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (o *GetLogsParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func (c *ProjectsTransferConfigsCreateCall) Fields(s ...googleapi.Field) *ProjectsTransferConfigsCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (c *OrganizationsEnvironmentsTargetserversCreateCall) Fields(s ...googleapi.Field) *OrganizationsEnvironmentsTargetserversCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (s *Select) SetFields(fieldName ...string) *Select {\n\tfor _, field := range fieldName {\n\t\ts.fields = append(s.fields, strings.ToLower(field))\n\t}\n\treturn s\n}", "func SetFields(m map[string]interface{}) []FieldMutation {\n\tout := make([]FieldMutation, 0, len(m))\n\tfor k, v := range m {\n\t\tout = append(out, SetField(k, v))\n\t}\n\treturn out\n}" ]
[ "0.61145896", "0.6003318", "0.5694692", "0.5633783", "0.56072956", "0.5597505", "0.55960107", "0.55826265", "0.5574439", "0.5572398", "0.55162513", "0.55050796", "0.5490232", "0.5446149", "0.54154396", "0.54018956", "0.53571707", "0.5356919", "0.53469956", "0.53294134", "0.5314952", "0.52996427", "0.52996427", "0.5272467", "0.52643645", "0.5252775", "0.524774", "0.5246843", "0.5237492", "0.5224377", "0.52197003", "0.521642", "0.5210591", "0.51966184", "0.5193844", "0.5193062", "0.51901203", "0.51828176", "0.51672906", "0.51505476", "0.5148729", "0.51397616", "0.5125065", "0.5122603", "0.51212245", "0.51184595", "0.5117341", "0.5113929", "0.5102077", "0.5099781", "0.509113", "0.50761503", "0.50727564", "0.507183", "0.507183", "0.506306", "0.50584036", "0.50584036", "0.50555843", "0.5048365", "0.5041639", "0.504125", "0.50407684", "0.50238204", "0.5022456", "0.5017338", "0.50116336", "0.50095206", "0.5001364", "0.4999075", "0.4997538", "0.4993666", "0.49902722", "0.49801496", "0.4980046", "0.4972937", "0.49713182", "0.49593982", "0.49570566", "0.4954451", "0.49483138", "0.49462205", "0.4943254", "0.49378487", "0.49375606", "0.49301952", "0.4930058", "0.49262407", "0.4924833", "0.4921023", "0.49138317", "0.49130797", "0.49109718", "0.4907574", "0.49064934", "0.49036542", "0.49034652", "0.49015075", "0.48982808", "0.48980632" ]
0.77153915
0
WithProjectLocator adds the projectLocator to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) WithProjectLocator(projectLocator string) *ServeBuildTypesInProjectParams { o.SetProjectLocator(projectLocator) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ServeBuildTypesInProjectParams) SetProjectLocator(projectLocator string) {\n\to.ProjectLocator = projectLocator\n}", "func (o *ServeBuildFieldShortParams) SetProjectLocator(projectLocator string) {\n\to.ProjectLocator = projectLocator\n}", "func (o *ServeBuildFieldShortParams) WithProjectLocator(projectLocator string) *ServeBuildFieldShortParams {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewServeBuildTypesInProjectParams() *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeletePoolProjectParams) SetProjectLocator(projectLocator string) {\n\to.ProjectLocator = projectLocator\n}", "func (o *GetExampleNewProjectDescriptionCompatibilityVersion1Params) SetProjectLocator(projectLocator string) {\n\to.ProjectLocator = projectLocator\n}", "func NewServeBuildTypesInProjectParamsWithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ServeBuildFieldShortParams) SetBuildLocator(buildLocator string) {\n\to.BuildLocator = buildLocator\n}", "func (o *SetFinishedTimeParams) SetBuildLocator(buildLocator string) {\n\to.BuildLocator = buildLocator\n}", "func (o *ServeBuildTypesInProjectParams) WithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ServeAgentsParams) WithLocator(locator *string) *ServeAgentsParams {\n\to.SetLocator(locator)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ServeBuildTypesInProjectParams) WithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *ServeBuildFieldShortParams) WithBuildLocator(buildLocator string) *ServeBuildFieldShortParams {\n\to.SetBuildLocator(buildLocator)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithContext(ctx context.Context) *ServeBuildTypesInProjectParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *ServeAgentsParams) SetLocator(locator *string) {\n\to.Locator = locator\n}", "func (o *DeletePoolProjectParams) WithProjectLocator(projectLocator string) *DeletePoolProjectParams {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func (o *ReplaceProjectsParams) WithAgentPoolLocator(agentPoolLocator string) *ReplaceProjectsParams {\n\to.SetAgentPoolLocator(agentPoolLocator)\n\treturn o\n}", "func (o *ServeBuildFieldShortParams) WithBtLocator(btLocator string) *ServeBuildFieldShortParams {\n\to.SetBtLocator(btLocator)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithFields(fields *string) *ServeBuildTypesInProjectParams {\n\to.SetFields(fields)\n\treturn o\n}", "func (o *GetExampleNewProjectDescriptionCompatibilityVersion1Params) WithProjectLocator(projectLocator string) *GetExampleNewProjectDescriptionCompatibilityVersion1Params {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func WithProject(with string) wrapping.Option {\n\treturn func() interface{} {\n\t\treturn OptionFunc(func(o *options) error {\n\t\t\to.withProject = with\n\t\t\treturn nil\n\t\t})\n\t}\n}", "func (o *ServeFieldParams) WithVcsRootLocator(vcsRootLocator string) *ServeFieldParams {\n\to.SetVcsRootLocator(vcsRootLocator)\n\treturn o\n}", "func (o *SetFinishedTimeParams) WithBuildLocator(buildLocator string) *SetFinishedTimeParams {\n\to.SetBuildLocator(buildLocator)\n\treturn o\n}", "func (o *ServeBuildFieldShortParams) SetBtLocator(btLocator string) {\n\to.BtLocator = btLocator\n}", "func (o *ServeBuildTypesInProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewPlacesRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*PlacesRequestBuilder) {\n m := &PlacesRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/places{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "func (o *ServeBuildTypesInProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (a *Client) PostAppRestBuildsBuildLocator(params *PostAppRestBuildsBuildLocatorParams, authInfo runtime.ClientAuthInfoWriter) (*PostAppRestBuildsBuildLocatorOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostAppRestBuildsBuildLocatorParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostAppRestBuildsBuildLocator\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/app/rest/builds/{buildLocator}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/xml\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/xml\", \"text/plain\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostAppRestBuildsBuildLocatorReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PostAppRestBuildsBuildLocatorOK), nil\n\n}", "func (s *server) addProjects() {\n\tvar projects []Project\n\n\terr := viper.UnmarshalKey(\"projects\", &projects)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tfor _, p := range projects {\n\t\ts.Projects[p.ID] = p\n\t}\n}", "func NewTeamworkRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*TeamworkRequestBuilder) {\n m := &TeamworkRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/me/teamwork{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "func (c *DOM) PushNodeByPathToFrontendWithParams(v *DOMPushNodeByPathToFrontendParams) (int, error) {\n\tresp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"DOM.pushNodeByPathToFrontend\", Params: v})\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tvar chromeData struct {\n\t\tResult struct {\n\t\t\tNodeId int\n\t\t}\n\t}\n\n\tif resp == nil {\n\t\treturn 0, &gcdmessage.ChromeEmptyResponseErr{}\n\t}\n\n\t// test if error first\n\tcerr := &gcdmessage.ChromeErrorResponse{}\n\tjson.Unmarshal(resp.Data, cerr)\n\tif cerr != nil && cerr.Error != nil {\n\t\treturn 0, &gcdmessage.ChromeRequestErr{Resp: cerr}\n\t}\n\n\tif err := json.Unmarshal(resp.Data, &chromeData); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn chromeData.Result.NodeId, nil\n}", "func (o *GetZippedParams) SetLocator(locator *string) {\n\to.Locator = locator\n}", "func WithPaths(paths []string) BuildOption {\n\treturn func(buildOptions *buildOptions) {\n\t\tbuildOptions.paths = paths\n\t}\n}", "func (o *ReplaceProjectsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param agentPoolLocator\n\tif err := r.SetPathParam(\"agentPoolLocator\", o.AgentPoolLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (_options *CreateConfigOptions) SetLocatorID(locatorID string) *CreateConfigOptions {\n\t_options.LocatorID = core.StringPtr(locatorID)\n\treturn _options\n}", "func (promCli *prometheusStorageClient) buildURL(path string, params map[string]interface{}) url.URL {\n\tpromURL := *promCli.url\n\t// treat federate special\n\tif path == \"/federate\" {\n\t\tpromURL = *promCli.federateURL\n\t}\n\n\t// change original request to point to our backing Prometheus\n\tpromURL.Path += path\n\tqueryParams := url.Values{}\n\tfor k, v := range params {\n\t\tif s, ok := v.(string); ok {\n\t\t\tif s != \"\" {\n\t\t\t\tqueryParams.Add(k, s)\n\t\t\t}\n\t\t} else {\n\t\t\tfor _, s := range v.([]string) {\n\t\t\t\tqueryParams.Add(k, s)\n\t\t\t}\n\t\t}\n\t}\n\tpromURL.RawQuery = queryParams.Encode()\n\n\treturn promURL\n}", "func (sw *scanWrap) Project(paths ...string) Scan {\n\treturn &scanWrap{\n\t\tscan: sw.scan.Project(paths...),\n\t}\n}", "func init() {\n\t// Fill in PROJECT_REPO_MAPPING.\n\tfor k, v := range REPO_PROJECT_MAPPING {\n\t\tPROJECT_REPO_MAPPING[v] = k\n\t}\n\t// buildbot.git is sometimes referred to as \"buildbot\" instead of\n\t// \"skiabuildbot\". Add the alias to the mapping.\n\tPROJECT_REPO_MAPPING[\"buildbot\"] = REPO_SKIA_INFRA\n\n\t// internal_test.git is sometimes referred to as \"internal_test\" instead\n\t// of \"skia_internal_test\". Add the alias to the mapping.\n\tPROJECT_REPO_MAPPING[\"internal_test\"] = REPO_SKIA_INTERNAL_TEST\n\n\t// skia_internal.git is sometimes referred to as \"skia_internal\" instead\n\t// of \"skia-internal\". Add the alias to the mapping.\n\tPROJECT_REPO_MAPPING[\"skia_internal\"] = REPO_SKIA_INTERNAL\n}", "func (b *BuildProps) processPaths(ctx blueprint.BaseModuleContext) {\n\tprefix := projectModuleDir(ctx)\n\n\tb.Export_local_include_dirs = utils.PrefixDirs(b.Export_local_include_dirs, prefix)\n\tb.Export_local_system_include_dirs = utils.PrefixDirs(b.Export_local_system_include_dirs, prefix)\n\n\tb.processBuildWrapper(ctx)\n}", "func (o *DeletePoolProjectParams) WithAgentPoolLocator(agentPoolLocator string) *DeletePoolProjectParams {\n\to.SetAgentPoolLocator(agentPoolLocator)\n\treturn o\n}", "func projectHandler(w http.ResponseWriter, r *http.Request) {\n\n\thelper.GetProjects(w, r)\n\n}", "func (o *ReplaceProjectsParams) SetAgentPoolLocator(agentPoolLocator string) {\n\to.AgentPoolLocator = agentPoolLocator\n}", "func NewTeamItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*TeamItemRequestBuilder) {\n m := &TeamItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/me/joinedTeams/{team%2Did}{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "func (g *Gitlab) ProjectMergeRequestAccept(id, merge_request_id string, req *AcceptMergeRequestRequest) (*MergeRequest, error) {\n\tu := g.ResourceUrl(ProjectMergeRequestMergeApiPath, map[string]string{\n\t\t\":id\": id,\n\t\t\":merge_request_id\": merge_request_id,\n\t})\n\n\tencodedRequest, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, _, err := g.buildAndExecRequest(\"PUT\", u.String(), encodedRequest)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmr := new(MergeRequest)\n\terr = json.Unmarshal(data, mr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn mr, nil\n}", "func (o *GetZippedParams) WithLocator(locator *string) *GetZippedParams {\n\to.SetLocator(locator)\n\treturn o\n}", "func NewThirdPartyLocator(client httprequest.Doer, cache *bakery.ThirdPartyStore) *ThirdPartyLocator {\n\tif cache == nil {\n\t\tcache = bakery.NewThirdPartyStore()\n\t}\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\treturn &ThirdPartyLocator{\n\t\tclient: client,\n\t\tcache: cache,\n\t}\n}", "func ProjectReg(req map[string]interface{}, r *http.Request) (interface{}, int) {\n\n\tdb := utils.GetDB()\n\tdefer db.Close()\n\n\tgh_username := req[\"username\"].(string)\n\tmentor := models.Mentor{}\n\tdb.Where(&models.Mentor{Username: gh_username}).First(&mentor)\n\n\terr := db.Create(&models.Project{\n\t\tName: req[\"name\"].(string),\n\t\tDesc: req[\"desc\"].(string),\n\t\tTags: req[\"tags\"].(string),\n\t\tRepoLink: req[\"repoLink\"].(string),\n\t\tComChannel: req[\"comChannel\"].(string),\n\t\tMentorID : mentor.ID,\n\t}).Error\n\n\tif err != nil {\n\t\tutils.LOG.Println(err)\n\t\treturn err.Error(), 500\n\t}\n\n\treturn \"success\", 200\n\n}", "func PipelineParams(pipelineConfig *common.Pipeline, namespace string, serviceName string, codeBranch string, muFile string, params map[string]string) error {\n\n\tparams[\"Namespace\"] = namespace\n\tparams[\"ServiceName\"] = serviceName\n\tparams[\"MuFilename\"] = path.Base(muFile)\n\tparams[\"MuBasedir\"] = path.Dir(muFile)\n\tparams[\"SourceProvider\"] = pipelineConfig.Source.Provider\n\tparams[\"SourceRepo\"] = pipelineConfig.Source.Repo\n\n\tcommon.NewMapElementIfNotEmpty(params, \"SourceBranch\", codeBranch)\n\n\tif pipelineConfig.Source.Provider == \"S3\" {\n\t\trepoParts := strings.Split(pipelineConfig.Source.Repo, \"/\")\n\t\tparams[\"SourceBucket\"] = repoParts[0]\n\t\tparams[\"SourceObjectKey\"] = strings.Join(repoParts[1:], \"/\")\n\t}\n\n\tcommon.NewMapElementIfNotEmpty(params, \"BuildType\", string(pipelineConfig.Build.Type))\n\tcommon.NewMapElementIfNotEmpty(params, \"BuildComputeType\", string(pipelineConfig.Build.ComputeType))\n\tcommon.NewMapElementIfNotEmpty(params, \"BuildImage\", pipelineConfig.Build.Image)\n\tcommon.NewMapElementIfNotEmpty(params, \"PipelineBuildTimeout\", pipelineConfig.Build.BuildTimeout)\n\tcommon.NewMapElementIfNotEmpty(params, \"TestType\", string(pipelineConfig.Acceptance.Type))\n\tcommon.NewMapElementIfNotEmpty(params, \"TestComputeType\", string(pipelineConfig.Acceptance.ComputeType))\n\tcommon.NewMapElementIfNotEmpty(params, \"TestImage\", pipelineConfig.Acceptance.Image)\n\tcommon.NewMapElementIfNotEmpty(params, \"AcptEnv\", pipelineConfig.Acceptance.Environment)\n\tcommon.NewMapElementIfNotEmpty(params, \"PipelineBuildAcceptanceTimeout\", pipelineConfig.Acceptance.BuildTimeout)\n\tcommon.NewMapElementIfNotEmpty(params, \"ProdEnv\", pipelineConfig.Production.Environment)\n\tcommon.NewMapElementIfNotEmpty(params, \"PipelineBuildProductionTimeout\", pipelineConfig.Production.BuildTimeout)\n\tcommon.NewMapElementIfNotEmpty(params, \"MuDownloadBaseurl\", pipelineConfig.MuBaseurl)\n\n\tparams[\"EnableBuildStage\"] = strconv.FormatBool(!pipelineConfig.Build.Disabled)\n\tparams[\"EnableAcptStage\"] = strconv.FormatBool(!pipelineConfig.Acceptance.Disabled)\n\tparams[\"EnableProdStage\"] = strconv.FormatBool(!pipelineConfig.Production.Disabled)\n\n\tversion := pipelineConfig.MuVersion\n\tif version == \"\" {\n\t\tversion = common.GetVersion()\n\t\tif version == \"0.0.0-local\" {\n\t\t\tversion = \"\"\n\t\t}\n\t}\n\tif version != \"\" {\n\t\tparams[\"MuDownloadVersion\"] = version\n\t}\n\n\treturn nil\n}", "func NewProjector(cluster string, kvaddrs []string, adminport string) *Projector {\n\tp := &Projector{\n\t\tcluster: cluster,\n\t\tkvaddrs: kvaddrs,\n\t\tadminport: adminport,\n\t\tbuckets: make(map[string]*couchbase.Bucket),\n\t\treqch: make(chan []interface{}),\n\t\tfinch: make(chan bool),\n\t}\n\t// set the pipelineFactory in pipelineManager to FeedFactory\n\tpm.PipelineManager(&feed_factory, nil);\n\tp.logPrefix = fmt.Sprintf(\"[%v]\", p.repr())\n\tgo mainAdminPort(adminport, p)\n\tgo p.genServer(p.reqch)\n\tc.Infof(\"%v started ...\\n\", p.logPrefix)\n\tp.stats = p.newStats()\n\tp.stats.Set(\"kvaddrs\", kvaddrs)\n\treturn p\n}", "func LocationPath(project, location string) string {\n\treturn \"\" +\n\t\t\"projects/\" +\n\t\tproject +\n\t\t\"/locations/\" +\n\t\tlocation +\n\t\t\"\"\n}", "func NewPlacesRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*PlacesRequestBuilder) {\n m := &PlacesRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/places\", pathParameters),\n }\n return m\n}", "func LocationRunPath(project, location, transferConfig, run string) string {\n\treturn \"\" +\n\t\t\"projects/\" +\n\t\tproject +\n\t\t\"/locations/\" +\n\t\tlocation +\n\t\t\"/transferConfigs/\" +\n\t\ttransferConfig +\n\t\t\"/runs/\" +\n\t\trun +\n\t\t\"\"\n}", "func LoadProjectFromPaths(filepaths []string) (*project.Project, error) {\n\tvar targets docker.ComposeFileArray\n\tvar proj project.APIProject\n\tvar err error\n\n\tif targets, err = FindComposeFiles(filepaths); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif proj, err = newProject(targets); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn proj.(*project.Project), nil\n}", "func (o *ServeFieldParams) SetVcsRootLocator(vcsRootLocator string) {\n\to.VcsRootLocator = vcsRootLocator\n}", "func ProjectSelector(project string) string {\n\treturn LabelProject + \"=\" + project\n}", "func buildPlugins(options *Options, metricWriter MetricWriter) PluginManagerContainer {\n\tplugins := make(PluginManagerContainer)\n\n\tif !options.UseLocalRouter {\n\t\tplugin := NewPluginManager(options.RouterPlugin, options.RouterPluginArgs, RouterPlugin, metricWriter)\n\t\tplugins[RouterPlugin] = []PluginManager{plugin}\n\t}\n\n\tif !options.UseLocalLoadBalancer {\n\t\tplugin := NewPluginManager(options.LoadBalancerPlugin, options.LoadBalancerPluginArgs, LoadBalancerPlugin, metricWriter)\n\t\tplugins[LoadBalancerPlugin] = []PluginManager{plugin}\n\t}\n\n\tfor _, plugin := range options.UpstreamPlugins {\n\t\tplugins[UpstreamPlugin] = append(plugins[UpstreamPlugin], NewPluginManager(plugin, options.UpstreamPluginArgs, UpstreamPlugin, metricWriter))\n\t}\n\n\tfor _, plugin := range options.ModifierPlugins {\n\t\tplugins[ModifierPlugin] = append(plugins[ModifierPlugin], NewPluginManager(plugin, options.ModifierPluginArgs, ModifierPlugin, metricWriter))\n\t}\n\n\tfor _, plugin := range options.MetricPlugins {\n\t\tplugins[MetricPlugin] = append(plugins[MetricPlugin], NewPluginManager(plugin, options.MetricPluginArgs, MetricPlugin, metricWriter))\n\t}\n\treturn plugins\n}", "func Project(project string) Option {\n\treturn func(stackdriver *Stackdriver) {\n\t\tstackdriver.Builder.Model.MetricQuery.ProjectName = project\n\t}\n}", "func NewNewProjectRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl := fmt.Sprintf(\"%s/projects\", server)\n\n\treq, err := http.NewRequest(\"POST\", queryUrl, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func WithRemoteProvider(provider RemoteProvider) DocumentLoaderOpts {\n\treturn documentloader.WithRemoteProvider(provider)\n}", "func (cmd *UpdateProjectCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tcc.Flags().StringVar(&cmd.Payload, \"payload\", \"\", \"Request body encoded in JSON\")\n\tcc.Flags().StringVar(&cmd.ContentType, \"content\", \"\", \"Request content type override, e.g. 'application/x-www-form-urlencoded'\")\n\tvar projectID int\n\tcc.Flags().IntVar(&cmd.ProjectID, \"projectId\", projectID, ``)\n}", "func (a *App) ShowProject(w http.ResponseWriter, req *http.Request) {\n\tdb := context.Get(req, \"db\").(*mgo.Database)\n\tif db == nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Unable to access database\"})\n\t\treturn\n\t}\n\tvars := mux.Vars(req)\n\tpid := vars[\"pid\"]\n\tpid, ok := vars[\"pid\"]\n\tif !ok {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Missing of invalid project id\"})\n\t\treturn\n\t}\n\tproject := &lair.Project{}\n\tif err := db.C(a.C.Projects).FindId(pid).One(&project); err != nil {\n\t\ta.R.JSON(w, http.StatusNotFound, &Response{Status: \"Error\", Message: \"Unable to retrieve project or project does not exist\"})\n\t\treturn\n\t}\n\thosts := []lair.Host{}\n\tif err := db.C(a.C.Hosts).Find(bson.M{\"projectId\": pid}).All(&hosts); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tfor i := range hosts {\n\t\tservices := []lair.Service{}\n\t\tif err := db.C(a.C.Services).Find(bson.M{\"hostId\": hosts[i].ID}).All(&services); err != nil {\n\t\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\t\treturn\n\t\t}\n\t\thosts[i].Services = services\n\t\twebs := []lair.WebDirectory{}\n\t\tif err := db.C(a.C.WebDirectories).Find(bson.M{\"hostId\": hosts[i].ID}).All(&webs); err != nil {\n\t\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\t\treturn\n\t\t}\n\t\thosts[i].WebDirectories = webs\n\t}\n\tproject.Hosts = hosts\n\n\tpeople := []lair.Person{}\n\tif err := db.C(a.C.People).Find(bson.M{\"projectId\": pid}).All(&people); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.People = people\n\n\tissues := []lair.Issue{}\n\tif err := db.C(a.C.Issues).Find(bson.M{\"projectId\": pid}).Sort(\"-cvss\", \"title\").All(&issues); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.Issues = issues\n\n\tcreds := []lair.Credential{}\n\tif err := db.C(a.C.Credentials).Find(bson.M{\"projectId\": pid}).All(&creds); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.Credentials = creds\n\n\tauths := []lair.AuthInterface{}\n\tif err := db.C(a.C.AuthInterfaces).Find(bson.M{\"projectId\": pid}).All(&auths); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.AuthInterfaces = auths\n\n\tnets := []lair.Netblock{}\n\tif err := db.C(a.C.Netblocks).Find(bson.M{\"projectId\": pid}).All(&nets); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.Netblocks = nets\n\n\ta.R.JSON(w, http.StatusOK, project)\n}", "func addKnownTypes(scheme *runtime.Scheme) error {\n\tscheme.AddKnownTypes(SchemeGroupVersion,\n\t\t&Project{},\n\t\t&ProjectList{},\n\t\t&ProjectRequest{},\n\t)\n\treturn nil\n}", "func (cmd *ListProjectCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n}", "func NewTeamsAppSettingsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*TeamsAppSettingsRequestBuilder) {\n m := &TeamsAppSettingsRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/teamwork/teamsAppSettings{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "func WithProject(factory ProjectFactory, action ProjectAction) func(context *cli.Context) error {\n\treturn func(context *cli.Context) error {\n\t\tp, err := factory.Create(context)\n\t\tif err != nil {\n\t\t\tlogrus.Fatalf(\"Failed to read project: %v\", err)\n\t\t}\n\t\treturn action(p, context)\n\t}\n}", "func NewSiteItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*SiteItemRequestBuilder) {\n m := &SiteItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/sites/{site%2Did}{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams\n m.requestAdapter = requestAdapter\n return m\n}", "func NewBrandingRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*BrandingRequestBuilder) {\n m := &BrandingRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/organization/{organization%2Did}/branding{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "func NewVersionsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*VersionsRequestBuilder) {\n m := &VersionsRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/users/{user%2Did}/drives/{drive%2Did}/list/items/{listItem%2Did}/versions{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "func (p *ProjectRef) MergeWithParserProject(version string) error {\n\tparserProject, err := ParserProjectByVersion(p.Id, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif parserProject != nil {\n\t\tif parserProject.PerfEnabled != nil {\n\t\t\tp.PerfEnabled = parserProject.PerfEnabled\n\t\t}\n\t\tif parserProject.DeactivatePrevious != nil {\n\t\t\tp.DeactivatePrevious = parserProject.DeactivatePrevious\n\t\t}\n\t\tif parserProject.TaskAnnotationSettings != nil {\n\t\t\tp.TaskAnnotationSettings = *parserProject.TaskAnnotationSettings\n\t\t}\n\t}\n\treturn nil\n}", "func (cmd *GetImageProjectCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tvar projectID int\n\tcc.Flags().IntVar(&cmd.ProjectID, \"projectId\", projectID, ``)\n}", "func PublisherProjectPath(project string) string {\n\tpath, err := publisherProjectPathTemplate.Render(map[string]string{\n\t\t\"project\": project,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn path\n}", "func (widgets *Widgets) RegisterViewPath(p string) {\n\tfor _, gopath := range strings.Split(os.Getenv(\"GOPATH\"), \":\") {\n\t\tif registerViewPath(path.Join(gopath, \"src\", p)) == nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "func buildParams(region string, groups []string) []string {\n\tparams := []string{\n\t\t\"-g\", strings.Join(groups, \",\"),\n\t\t\"-M\", reportFormat,\n\t\t\"-F\", reportName,\n\t}\n\tif region != \"\" {\n\t\tparams = append(params, \"-r\", region, \"-f\", region)\n\t} else {\n\t\tparams = append(params, \"-r\", defaultAPIRegion)\n\t}\n\treturn params\n}", "func getProjectClients(ctx iris.Context) {\n\tprojectID := ctx.Params().Get(\"projectID\")\n\tif projectID == \"\" {\n\t\thandleError(ctx, apiErrors.ErrBadRequest)\n\t\treturn\n\t}\n\n\tresult, err := store.GetProjectClients(projectID)\n\tif err != nil {\n\t\thandleError(ctx, err)\n\t\treturn\n\t}\n\n\trender.JSON(ctx, iris.StatusOK, result)\n}", "func (r *Router) Platform(pattern string, platform Platform) {\n\tc := r.pattern(pattern)\n\tplatform.Routes(r.clone(c))\n}", "func (cfg *ProjectVersionConfig) ToParam(projectVersionerFactory distgo.ProjectVersionerFactory) (distgo.ProjectVersionerParam, error) {\n\tif cfg == nil {\n\t\t// if configuration is nil, return git versioner as default\n\t\treturn distgo.ProjectVersionerParam{\n\t\t\tProjectVersioner: git.New(),\n\t\t}, nil\n\t}\n\tprojectVersioner, err := newProjectVersioner(cfg.Type, cfg.Config, projectVersionerFactory)\n\tif err != nil {\n\t\treturn distgo.ProjectVersionerParam{}, err\n\t}\n\treturn distgo.ProjectVersionerParam{\n\t\tProjectVersioner: projectVersioner,\n\t}, nil\n}", "func (j *Jenkins) BuildWithParamaters(jobName string, params map[string]interface{}) error {\n\tqueryParams := \"\"\n\tfor key, value := range params {\n\t\tqueryParams += fmt.Sprintf(\"&%s=%v\", key, value)\n\t}\n\tresp, err := j.Do(fmt.Sprintf(\"job/%s/buildWithParameters?%s\", jobName, strings.Trim(queryParams, \"&\")), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp != nil {\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer resp.Body.Close()\n\t\t\treturn errors.New(string(body))\n\t\t}\n\t}\n\treturn nil\n}", "func BuildParameters(hostDir string, containerDir string, args []string) []string {\n\tfiles, _ := ioutil.ReadDir(hostDir)\n\n\tif len(containerDir) > 0 && containerDir[len(containerDir)-1] != '/' {\n\t\tcontainerDir = containerDir + \"/\"\n\t}\n\n\tfor i, e := range(args) {\n\t\tif(len(e) == 0) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Determine if this is a relative path\n\t\t// that we need to add the mounted PWD volume path to\n\t\trelpath := false\n\t\tif(e[0] != '/' && // not absolute path\n\t\t\tstrings.Contains(e, \"/\")) { // but it is a path...\n\t\t\trelpath = true\n\t\t} else {\n\t\t\tfor _, f := range files {\n\t\t\t\tif f.Name() == e { // a file is in current pwd\n\t\t\t\t\trelpath = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif relpath {\n\t\t\targs[i] = containerDir + e\n\t\t}\n\t}\n\treturn args\n}", "func UnmarshalProjectConfigPatchRequest(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ProjectConfigPatchRequest)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"labels\", &obj.Labels)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"type\", &obj.Type)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"external_resources_account\", &obj.ExternalResourcesAccount)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"locator_id\", &obj.LocatorID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"input\", &obj.Input, UnmarshalProjectConfigInputVariable)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"setting\", &obj.Setting, UnmarshalProjectConfigSettingCollection)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func AddSearchPath(path string) {\n\tgopaths := strings.Split(build.Default.GOPATH, \":\")\n\tfor _, gopath := range gopaths {\n\t\tpaths := strings.Split(path, \":\")\n\t\tfor _, p := range paths {\n\t\t\trevel.ConfPaths = append(revel.ConfPaths, gopath+\"/src/\"+p)\n\t\t}\n\t}\n}", "func BytomMainNetParams(vaporParam *Params) *Params {\n\tbech32HRPSegwit := \"sm\"\n\tswitch vaporParam.Name {\n\tcase \"main\":\n\t\tbech32HRPSegwit = \"bm\"\n\tcase \"test\":\n\t\tbech32HRPSegwit = \"tm\"\n\t}\n\treturn &Params{Bech32HRPSegwit: bech32HRPSegwit}\n}", "func GetBaseURIParameters(config CONFIGURATION) map[string]interface{} {\r\n kvpMap := map[string]interface{}{\r\n }\r\n return kvpMap;\r\n}", "func (cmd *AddProjectCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tcc.Flags().StringVar(&cmd.Payload, \"payload\", \"\", \"Request body encoded in JSON\")\n\tcc.Flags().StringVar(&cmd.ContentType, \"content\", \"\", \"Request content type override, e.g. 'application/x-www-form-urlencoded'\")\n}", "func (o *DeletePoolProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param agentPoolLocator\n\tif err := r.SetPathParam(\"agentPoolLocator\", o.AgentPoolLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func NewTestProjectVersionParamsWithHTTPClient(client *http.Client) *TestProjectVersionParams {\n\tvar ()\n\treturn &TestProjectVersionParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (a *Client) ServeBuildActualParameters(params *ServeBuildActualParametersParams, authInfo runtime.ClientAuthInfoWriter) (*ServeBuildActualParametersOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewServeBuildActualParametersParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"serveBuildActualParameters\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/app/rest/builds/{buildLocator}/resulting-properties\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/xml\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/xml\", \"text/plain\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ServeBuildActualParametersReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ServeBuildActualParametersOK), nil\n\n}", "func (cmd *InviteUserProjectCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tcc.Flags().StringVar(&cmd.Payload, \"payload\", \"\", \"Request body encoded in JSON\")\n\tcc.Flags().StringVar(&cmd.ContentType, \"content\", \"\", \"Request content type override, e.g. 'application/x-www-form-urlencoded'\")\n\tvar projectID int\n\tcc.Flags().IntVar(&cmd.ProjectID, \"projectId\", projectID, ``)\n}", "func BuildProject(request *http.Request) (string, interface{}) {\n\t//the build step:\n\t//1. get the resouce code's repo and branch\n\t//2. select the build env base image acording to the projects language\n\t//3. build the project and output the tar or binary file to a appoint dir\n\t//4. if the project include Dockerfile,and then output the Dockerfile together\n\t//5. if the project doesn't include Dockerfile,and the generate the Dockerfile by Dockerfile templaet\n\t//TODO\n\treturn r.StatusOK, \"build the project resource success\"\n}", "func (o *ExportUsingGETParams) SetProject(project *string) {\n\to.Project = project\n}", "func AddSpawnInfosPipelineBuildJob(pipelineBuildJobID int64, infos []SpawnInfo) error {\n\tdata, errm := json.Marshal(infos)\n\tif errm != nil {\n\t\treturn errm\n\t}\n\n\tpath := fmt.Sprintf(\"/queue/%d/spawn/infos\", pipelineBuildJobID)\n\t_, _, err := Request(\"POST\", path, data)\n\treturn err\n}", "func WithBothProjectConfigs(f func(cfg *configpb.ProjectConfig, name string)) func() {\n\treturn func() {\n\t\tmonorailCfg := CreateMonorailPlaceholderProjectConfig()\n\t\tbuganizerCfg := CreateBuganizerPlaceholderProjectConfig()\n\t\tf(monorailCfg, \"monorail\")\n\t\tf(buganizerCfg, \"buganizer\")\n\t}\n}", "func ProjectBody(d *schema.ResourceData) models.ProjectsBodyPost {\n\tquota := d.Get(\"storage_quota\").(int)\n\n\tbody := models.ProjectsBodyPost{\n\t\tProjectName: d.Get(\"name\").(string),\n\t\tRegistryID: d.Get(\"registry_id\").(int),\n\t\tStorageLimit: quota,\n\t}\n\n\tif quota != -1 {\n\t\tbody.StorageLimit = quota * 1073741824\n\t}\n\n\tbody.Metadata.AutoScan = strconv.FormatBool(d.Get(\"vulnerability_scanning\").(bool))\n\tbody.Metadata.Public = d.Get(\"public\").(string)\n\n\tsecurity := d.Get(\"deployment_security\").(string)\n\tif security != \"\" {\n\t\tbody.Metadata.Severity = security\n\t\tbody.Metadata.PreventVul = \"true\"\n\t} else {\n\t\tbody.Metadata.Severity = \"low\"\n\t\tbody.Metadata.PreventVul = \"false\"\n\t}\n\n\tbody.Metadata.EnableContentTrust = strconv.FormatBool(d.Get(\"enable_content_trust\").(bool))\n\n\tcveAllowList := d.Get(\"cve_allowlist\").([]interface{})\n\tlog.Printf(\"[DEBUG] %v \", cveAllowList)\n\tif len(cveAllowList) > 0 {\n\t\tlog.Printf(\"[DEBUG] %v \", expandCveAllowList(cveAllowList))\n\t\tbody.CveAllowlist.Items = expandCveAllowList(cveAllowList)\n\t\tbody.Metadata.ReuseSysCveAllowlist = \"false\"\n\t} else {\n\t\tbody.Metadata.ReuseSysCveAllowlist = \"true\"\n\t}\n\n\treturn body\n}", "func (r *Routing) SetProjectRoutes(project string, routes config.Routes) {\n\tr.lock.Lock()\n\tdefer r.lock.Unlock()\n\n\tr.routes.addProjectRoutes(project, routes)\n}", "func BuildArgsMap(props *OvfImportTestProperties, testProjectConfig *testconfig.Project,\n\tgcloudBetaArgs, gcloudArgs, wrapperArgs []string) map[e2e.CLITestType][]string {\n\n\tproject := GetProject(props, testProjectConfig)\n\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--project=%v\", project))\n\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--source-uri=%v\", props.SourceURI))\n\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--zone=%v\", props.Zone))\n\n\tgcloudArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--project=%v\", project))\n\tgcloudArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--source-uri=%v\", props.SourceURI))\n\tgcloudArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--zone=%v\", props.Zone))\n\n\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-project=%v\", project))\n\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-ovf-gcs-path=%v\", props.SourceURI))\n\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-zone=%v\", props.Zone))\n\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-build-id=%v\", path.RandString(10)))\n\n\tif len(props.Tags) > 0 {\n\t\ttags := strings.Join(props.Tags, \",\")\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--tags=%v\", tags))\n\t\tgcloudArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--tags=%v\", tags))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-tags=%v\", tags))\n\t}\n\tif props.Os != \"\" {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--os=%v\", props.Os))\n\t\tgcloudArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--os=%v\", props.Os))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-os=%v\", props.Os))\n\t}\n\tif props.MachineType != \"\" {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--machine-type=%v\", props.MachineType))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--machine-type=%v\", props.MachineType))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-machine-type=%v\", props.MachineType))\n\t}\n\tif props.Network != \"\" {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--network=%v\", props.Network))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--network=%v\", props.Network))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-network=%v\", props.Network))\n\t}\n\tif props.Subnet != \"\" {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--subnet=%v\", props.Subnet))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--subnet=%v\", props.Subnet))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-subnet=%v\", props.Subnet))\n\t}\n\tif props.ComputeServiceAccount != \"\" {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--compute-service-account=%v\", props.ComputeServiceAccount))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--compute-service-account=%v\", props.ComputeServiceAccount))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-compute-service-account=%v\", props.ComputeServiceAccount))\n\t}\n\tif props.InstanceServiceAccount != \"\" && !props.NoInstanceServiceAccount {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--service-account=%v\", props.InstanceServiceAccount))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--service-account=%v\", props.InstanceServiceAccount))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-service-account=%v\", props.InstanceServiceAccount))\n\t}\n\tif props.NoInstanceServiceAccount {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, \"--service-account=\")\n\t\tgcloudArgs = append(gcloudArgs, \"--service-account=\")\n\t\twrapperArgs = append(wrapperArgs, \"-service-account=\")\n\t}\n\tif props.InstanceAccessScopes != \"\" && !props.NoInstanceAccessScopes {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, fmt.Sprintf(\"--scopes=%v\", props.InstanceAccessScopes))\n\t\tgcloudArgs = append(gcloudArgs, fmt.Sprintf(\"--scopes=%v\", props.InstanceAccessScopes))\n\t\twrapperArgs = append(wrapperArgs, fmt.Sprintf(\"-scopes=%v\", props.InstanceAccessScopes))\n\t}\n\tif props.NoInstanceAccessScopes {\n\t\tgcloudBetaArgs = append(gcloudBetaArgs, \"--scopes=\")\n\t\tgcloudArgs = append(gcloudArgs, \"--scopes=\")\n\t\twrapperArgs = append(wrapperArgs, \"-scopes=\")\n\t}\n\n\targsMap := map[e2e.CLITestType][]string{\n\t\te2e.Wrapper: wrapperArgs,\n\t\te2e.GcloudBetaProdWrapperLatest: gcloudBetaArgs,\n\t\te2e.GcloudBetaLatestWrapperLatest: gcloudBetaArgs,\n\t\te2e.GcloudGaLatestWrapperRelease: gcloudArgs,\n\t}\n\treturn argsMap\n}", "func (cmd *ListCurrentProjectCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n}", "func (cmd *GetProjectCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tvar projectID int\n\tcc.Flags().IntVar(&cmd.ProjectID, \"projectId\", projectID, ``)\n}", "func Serve(path string, options ServeOptions) error {\n\t// First check if the passed path is a verless project (valid verless cfg).\n\tcfg, err := config.FromFile(path, config.Filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttargetFiles := outputDir(path, &options.BuildOptions)\n\n\t// If yes, build it if requested to do so.\n\toptions.BuildOptions.RecompileTemplates = options.Watch\n\toptions.Overwrite = true\n\n\tmemMapFs := afero.NewMemMapFs()\n\n\tdone := make(chan bool)\n\trebuildCh := make(chan string)\n\n\tif options.Watch {\n\t\tif err := watch(watchContext{\n\t\t\tIgnorePaths: []string{\n\t\t\t\ttargetFiles,\n\t\t\t\tfilepath.Join(path, config.StaticDir, config.GeneratedDir),\n\t\t\t\ttheme.GeneratedPath(path, cfg.Theme),\n\t\t\t},\n\t\t\tPath: path,\n\t\t\tChangedCh: rebuildCh,\n\t\t\tStopCh: done,\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tout.T(style.Sparkles, \"building project ...\")\n\n\tbuild, err := NewBuild(memMapFs, path, options.BuildOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := build.Run(); err != nil {\n\t\treturn err\n\t}\n\n\tout.T(style.HeavyCheckMark, \"project built successfully\")\n\n\t// If --watch is enabled, launch a goroutine that handles rebuilds.\n\tif options.Watch {\n\t\tfactory := func() (*Build, error) {\n\t\t\treturn NewBuild(memMapFs, path, options.BuildOptions)\n\t\t}\n\t\tgo watchAndRebuild(factory, rebuildCh, done)\n\t}\n\n\t// If the target folder doesn't exist, return an error.\n\tif _, err := memMapFs.Stat(targetFiles); err != nil {\n\t\treturn err\n\t}\n\n\terr = listenAndServe(memMapFs, targetFiles, options.IP, options.Port)\n\tclose(done)\n\n\treturn err\n}", "func mustMakePubliclyViewableParams(fsc *frontendServerConfig) publicparams.Matcher {\n\tvar publiclyViewableParams publicparams.Matcher\n\tvar err error\n\n\t// Load the publiclyViewable params if configured and disable querying for issues.\n\tif len(fsc.PubliclyAllowableParams) > 0 {\n\t\tif publiclyViewableParams, err = publicparams.MatcherFromRules(fsc.PubliclyAllowableParams); err != nil {\n\t\t\tsklog.Fatalf(\"Could not load list of public params: %s\", err)\n\t\t}\n\t}\n\n\t// Check if this is public instance. If so, make sure we have a non-nil Matcher.\n\tif fsc.IsPublicView && publiclyViewableParams == nil {\n\t\tsklog.Fatal(\"A non-empty map of publiclyViewableParams must be provided if is public view.\")\n\t}\n\n\treturn publiclyViewableParams\n}" ]
[ "0.7248386", "0.6595592", "0.57543266", "0.56240505", "0.5361639", "0.53399926", "0.5312299", "0.5185255", "0.5043616", "0.49534318", "0.48969832", "0.48632684", "0.47102168", "0.47026002", "0.46766442", "0.46068385", "0.4547183", "0.45457774", "0.4456394", "0.43693376", "0.43494996", "0.43461508", "0.42287976", "0.4208258", "0.4137613", "0.40832067", "0.4026251", "0.40066904", "0.39695635", "0.3938737", "0.3926118", "0.38984436", "0.3897046", "0.3879346", "0.3878516", "0.38544112", "0.38199028", "0.38077608", "0.37987417", "0.3789519", "0.37798685", "0.37775305", "0.37752876", "0.37655154", "0.37332398", "0.37272844", "0.371872", "0.37120953", "0.369607", "0.36947483", "0.36840943", "0.36835432", "0.368139", "0.36607987", "0.36485678", "0.36432758", "0.36391646", "0.36336792", "0.36336207", "0.36325058", "0.36228555", "0.36213696", "0.3606543", "0.36043212", "0.35986435", "0.35952678", "0.3594792", "0.3593721", "0.3591804", "0.3590564", "0.35887071", "0.35784656", "0.3572085", "0.35706186", "0.3570152", "0.35639867", "0.35520986", "0.35413945", "0.3537713", "0.35368723", "0.3535134", "0.35336888", "0.35296944", "0.352784", "0.35277325", "0.35227987", "0.3520434", "0.35082972", "0.3507809", "0.34883192", "0.34873885", "0.34862122", "0.34824774", "0.34814698", "0.34795022", "0.3471211", "0.34676915", "0.34674057", "0.3465778", "0.34634915" ]
0.7110577
1
SetProjectLocator adds the projectLocator to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) SetProjectLocator(projectLocator string) { o.ProjectLocator = projectLocator }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ServeBuildFieldShortParams) SetProjectLocator(projectLocator string) {\n\to.ProjectLocator = projectLocator\n}", "func (o *ServeBuildTypesInProjectParams) WithProjectLocator(projectLocator string) *ServeBuildTypesInProjectParams {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func (o *GetExampleNewProjectDescriptionCompatibilityVersion1Params) SetProjectLocator(projectLocator string) {\n\to.ProjectLocator = projectLocator\n}", "func (o *DeletePoolProjectParams) SetProjectLocator(projectLocator string) {\n\to.ProjectLocator = projectLocator\n}", "func (o *SetFinishedTimeParams) SetBuildLocator(buildLocator string) {\n\to.BuildLocator = buildLocator\n}", "func (o *ServeAgentsParams) SetLocator(locator *string) {\n\to.Locator = locator\n}", "func (o *ServeBuildFieldShortParams) SetBuildLocator(buildLocator string) {\n\to.BuildLocator = buildLocator\n}", "func (o *ServeBuildFieldShortParams) WithProjectLocator(projectLocator string) *ServeBuildFieldShortParams {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func (o *ReplaceProjectsParams) WithAgentPoolLocator(agentPoolLocator string) *ReplaceProjectsParams {\n\to.SetAgentPoolLocator(agentPoolLocator)\n\treturn o\n}", "func (o *ServeAgentsParams) WithLocator(locator *string) *ServeAgentsParams {\n\to.SetLocator(locator)\n\treturn o\n}", "func (o *GetZippedParams) SetLocator(locator *string) {\n\to.Locator = locator\n}", "func (o *DeletePoolProjectParams) WithProjectLocator(projectLocator string) *DeletePoolProjectParams {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *GetExampleNewProjectDescriptionCompatibilityVersion1Params) WithProjectLocator(projectLocator string) *GetExampleNewProjectDescriptionCompatibilityVersion1Params {\n\to.SetProjectLocator(projectLocator)\n\treturn o\n}", "func (o *ReplaceProjectsParams) SetAgentPoolLocator(agentPoolLocator string) {\n\to.AgentPoolLocator = agentPoolLocator\n}", "func NewServeBuildTypesInProjectParams() *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (_options *CreateConfigOptions) SetLocatorID(locatorID string) *CreateConfigOptions {\n\t_options.LocatorID = core.StringPtr(locatorID)\n\treturn _options\n}", "func (o *ServeFieldParams) SetVcsRootLocator(vcsRootLocator string) {\n\to.VcsRootLocator = vcsRootLocator\n}", "func (o *ServeBuildFieldShortParams) SetBtLocator(btLocator string) {\n\to.BtLocator = btLocator\n}", "func (r *Routing) SetProjectRoutes(project string, routes config.Routes) {\n\tr.lock.Lock()\n\tdefer r.lock.Unlock()\n\n\tr.routes.addProjectRoutes(project, routes)\n}", "func (o *ServeBuildTypesInProjectParams) WithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewServeBuildTypesInProjectParamsWithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\tvar ()\n\treturn &ServeBuildTypesInProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ServeFieldParams) WithVcsRootLocator(vcsRootLocator string) *ServeFieldParams {\n\to.SetVcsRootLocator(vcsRootLocator)\n\treturn o\n}", "func (o *ServeBuildFieldShortParams) WithBuildLocator(buildLocator string) *ServeBuildFieldShortParams {\n\to.SetBuildLocator(buildLocator)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetFinishedTimeParams) WithBuildLocator(buildLocator string) *SetFinishedTimeParams {\n\to.SetBuildLocator(buildLocator)\n\treturn o\n}", "func init() {\n\t// Fill in PROJECT_REPO_MAPPING.\n\tfor k, v := range REPO_PROJECT_MAPPING {\n\t\tPROJECT_REPO_MAPPING[v] = k\n\t}\n\t// buildbot.git is sometimes referred to as \"buildbot\" instead of\n\t// \"skiabuildbot\". Add the alias to the mapping.\n\tPROJECT_REPO_MAPPING[\"buildbot\"] = REPO_SKIA_INFRA\n\n\t// internal_test.git is sometimes referred to as \"internal_test\" instead\n\t// of \"skia_internal_test\". Add the alias to the mapping.\n\tPROJECT_REPO_MAPPING[\"internal_test\"] = REPO_SKIA_INTERNAL_TEST\n\n\t// skia_internal.git is sometimes referred to as \"skia_internal\" instead\n\t// of \"skia-internal\". Add the alias to the mapping.\n\tPROJECT_REPO_MAPPING[\"skia_internal\"] = REPO_SKIA_INTERNAL\n}", "func (o *DeletePoolProjectParams) SetAgentPoolLocator(agentPoolLocator string) {\n\to.AgentPoolLocator = agentPoolLocator\n}", "func NewThirdPartyLocator(client httprequest.Doer, cache *bakery.ThirdPartyStore) *ThirdPartyLocator {\n\tif cache == nil {\n\t\tcache = bakery.NewThirdPartyStore()\n\t}\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\treturn &ThirdPartyLocator{\n\t\tclient: client,\n\t\tcache: cache,\n\t}\n}", "func (o *GetPointsByQueryParams) SetProject(project string) {\n\to.Project = project\n}", "func (a *App) setRouters() {\n\t// Routing for handling the projects\n\ta.Get(\"/namespaces\", a.GetNamespaces)\n\ta.Get(\"/namespaces/{name}\", a.GetNamespace)\n\ta.Get(\"/pods/{namespace}\", a.GetPods)\n\ta.Get(\"/deployments/{namespace}\", a.GetDeployments)\n\ta.Post(\"/createdemodeployment/{namespace}\", a.CreateDemoDeployment)\n\ta.Post(\"/deployments/{namespace}\", a.CreateDeployment)\n\ta.Put(\"/deployments/{namespace}\", a.UpdateDeployment)\n\ta.Delete(\"/deployments/{namespace}/{deployment}\", a.DeleteDeployment)\n\ta.Delete(\"/deletedemodeployments/{namespace}\", a.DeleteDemoDeployment)\n}", "func (o *ServeBuildTypesInProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (a *App) setRouters() {\n\t// Routing for handling the projects\n\ta.Get(\"/healtz\", a.GetHealtStatus)\n}", "func NewProjector(cluster string, kvaddrs []string, adminport string) *Projector {\n\tp := &Projector{\n\t\tcluster: cluster,\n\t\tkvaddrs: kvaddrs,\n\t\tadminport: adminport,\n\t\tbuckets: make(map[string]*couchbase.Bucket),\n\t\treqch: make(chan []interface{}),\n\t\tfinch: make(chan bool),\n\t}\n\t// set the pipelineFactory in pipelineManager to FeedFactory\n\tpm.PipelineManager(&feed_factory, nil);\n\tp.logPrefix = fmt.Sprintf(\"[%v]\", p.repr())\n\tgo mainAdminPort(adminport, p)\n\tgo p.genServer(p.reqch)\n\tc.Infof(\"%v started ...\\n\", p.logPrefix)\n\tp.stats = p.newStats()\n\tp.stats.Set(\"kvaddrs\", kvaddrs)\n\treturn p\n}", "func (o *DeletePoolProjectParams) WithAgentPoolLocator(agentPoolLocator string) *DeletePoolProjectParams {\n\to.SetAgentPoolLocator(agentPoolLocator)\n\treturn o\n}", "func SetDockerRepository(projectParam distgo.ProjectParam, repository string) {\n\tfor _, productParam := range projectParam.Products {\n\t\tif productParam.Docker == nil {\n\t\t\tcontinue\n\t\t}\n\t\tproductParam.Docker.Repository = repository\n\t}\n}", "func (o *ServeBuildTypesInProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServeBuildFieldShortParams) WithBtLocator(btLocator string) *ServeBuildFieldShortParams {\n\to.SetBtLocator(btLocator)\n\treturn o\n}", "func (o *ServeBuildTypesInProjectParams) WithTimeout(timeout time.Duration) *ServeBuildTypesInProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetBuildPropertiesParams) SetProject(project string) {\n\to.Project = project\n}", "func (a *Client) PostAppRestBuildsBuildLocator(params *PostAppRestBuildsBuildLocatorParams, authInfo runtime.ClientAuthInfoWriter) (*PostAppRestBuildsBuildLocatorOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostAppRestBuildsBuildLocatorParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostAppRestBuildsBuildLocator\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/app/rest/builds/{buildLocator}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/xml\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/xml\", \"text/plain\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostAppRestBuildsBuildLocatorReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PostAppRestBuildsBuildLocatorOK), nil\n\n}", "func (o *ExportUsingGETParams) SetProject(project *string) {\n\to.Project = project\n}", "func (o *GetTerraformConfigurationSourcesUsingGET1Params) SetProjects(projects []string) {\n\to.Projects = projects\n}", "func SetDefaultProject(projectName string) {\n\tviper.Set(\"context.project\", strings.TrimSpace(projectName))\n\t_ = viper.WriteConfig()\n}", "func (s *server) addProjects() {\n\tvar projects []Project\n\n\terr := viper.UnmarshalKey(\"projects\", &projects)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tfor _, p := range projects {\n\t\ts.Projects[p.ID] = p\n\t}\n}", "func LoadProjectFromPaths(filepaths []string) (*project.Project, error) {\n\tvar targets docker.ComposeFileArray\n\tvar proj project.APIProject\n\tvar err error\n\n\tif targets, err = FindComposeFiles(filepaths); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif proj, err = newProject(targets); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn proj.(*project.Project), nil\n}", "func (o *GetContentSourcesUsingGETParams) SetProjectIds(projectIds []string) {\n\to.ProjectIds = projectIds\n}", "func ProjectSelector(project string) string {\n\treturn LabelProject + \"=\" + project\n}", "func (v projectsVal) Set(projects string) error {\n\tif projects == \"\" {\n\t\treturn fmt.Errorf(\"empty GCE project\")\n\t}\n\tprj := strings.Split(projects, \",\")\n\tif !v.acceptMultipleProjects && len(prj) > 1 {\n\t\treturn fmt.Errorf(\"multiple GCE projects not supported for command\")\n\t}\n\tv.opts.projects = prj\n\treturn nil\n}", "func (b *BuildProps) processPaths(ctx blueprint.BaseModuleContext) {\n\tprefix := projectModuleDir(ctx)\n\n\tb.Export_local_include_dirs = utils.PrefixDirs(b.Export_local_include_dirs, prefix)\n\tb.Export_local_system_include_dirs = utils.PrefixDirs(b.Export_local_system_include_dirs, prefix)\n\n\tb.processBuildWrapper(ctx)\n}", "func (widgets *Widgets) RegisterViewPath(p string) {\n\tfor _, gopath := range strings.Split(os.Getenv(\"GOPATH\"), \":\") {\n\t\tif registerViewPath(path.Join(gopath, \"src\", p)) == nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "func NewPlacesRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*PlacesRequestBuilder) {\n m := &PlacesRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/places{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "func (o *GetZippedParams) SetVcsRootInstanceLocator(vcsRootInstanceLocator string) {\n\to.VcsRootInstanceLocator = vcsRootInstanceLocator\n}", "func (o *ReplaceProjectsParams) WithHTTPClient(client *http.Client) *ReplaceProjectsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *UpdateBuildPropertiesParams) SetProject(project string) {\n\to.Project = project\n}", "func (r *Router) Platform(pattern string, platform Platform) {\n\tc := r.pattern(pattern)\n\tplatform.Routes(r.clone(c))\n}", "func NewTeamworkRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*TeamworkRequestBuilder) {\n m := &TeamworkRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/me/teamwork{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "func SetRoutes(engine *gin.Engine, h Handler) error {\n\tapi := engine.Group(\"/api\")\n\n\tapi.Use(OpenCORSMiddleware())\n\n\tapi.GET(\"/:project\", h.ReadProject) // returns entire root tree\n\tapi.POST(\"/:project\", h.CreateProject) // create a new tree at `project`\n\tapi.DELETE(\"/:project\", h.DeleteProject) // project tree must be empty to delete\n\n\tapi.GET(\"/:project/*keys\", h.ReadProjectKey)\n\tapi.POST(\"/:project/*keys\", h.CreateProjectKey)\n\tapi.PUT(\"/:project/*keys\", h.UpdateProjectKey)\n\tapi.DELETE(\"/:project/*keys\", h.DeleteProjectKey)\n\n\treturn nil\n}", "func (hg *HostGroup) SetLocInfo(ctx context.Context, params interface{}) ([]byte, error) {\n\treturn hg.client.PostIn(ctx, \"/api/v1.0/HostGroup.SetLocInfo\", params)\n}", "func LocationPath(project, location string) string {\n\treturn \"\" +\n\t\t\"projects/\" +\n\t\tproject +\n\t\t\"/locations/\" +\n\t\tlocation +\n\t\t\"\"\n}", "func (m *Application) SetPublicClient(value PublicClientApplicationable)() {\n m.publicClient = value\n}", "func LocationRunPath(project, location, transferConfig, run string) string {\n\treturn \"\" +\n\t\t\"projects/\" +\n\t\tproject +\n\t\t\"/locations/\" +\n\t\tlocation +\n\t\t\"/transferConfigs/\" +\n\t\ttransferConfig +\n\t\t\"/runs/\" +\n\t\trun +\n\t\t\"\"\n}", "func (o *TicketProjectsImportProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ReplaceProjectsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param agentPoolLocator\n\tif err := r.SetPathParam(\"agentPoolLocator\", o.AgentPoolLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SiteAllOfNameResolutionGcpResolvers) SetProjectFilter(v string) {\n\to.ProjectFilter = &v\n}", "func ProjectReg(req map[string]interface{}, r *http.Request) (interface{}, int) {\n\n\tdb := utils.GetDB()\n\tdefer db.Close()\n\n\tgh_username := req[\"username\"].(string)\n\tmentor := models.Mentor{}\n\tdb.Where(&models.Mentor{Username: gh_username}).First(&mentor)\n\n\terr := db.Create(&models.Project{\n\t\tName: req[\"name\"].(string),\n\t\tDesc: req[\"desc\"].(string),\n\t\tTags: req[\"tags\"].(string),\n\t\tRepoLink: req[\"repoLink\"].(string),\n\t\tComChannel: req[\"comChannel\"].(string),\n\t\tMentorID : mentor.ID,\n\t}).Error\n\n\tif err != nil {\n\t\tutils.LOG.Println(err)\n\t\treturn err.Error(), 500\n\t}\n\n\treturn \"success\", 200\n\n}", "func NewServiceLocator() ServiceLocator {\n\tserviceLocator := new(DefaultServiceLocator)\n\tserviceLocator.dbDirPath = \"./data/dbs\"\n\tserviceLocator.viewDirPath = \"./data/views\"\n\tserviceLocator.fileHandler = new(DefaultFileHandler)\n\tserviceLocator.localDB = NewLocalDB()\n\treturn serviceLocator\n}", "func (sw *scanWrap) Project(paths ...string) Scan {\n\treturn &scanWrap{\n\t\tscan: sw.scan.Project(paths...),\n\t}\n}", "func (s *Server) SetSearchPath(ctx context.Context, paths, namespaces []string) {\n\t// Provide direct access to intercepted namespaces\n\tfor _, ns := range namespaces {\n\t\tpaths = append(paths, ns+\".svc.\"+s.clusterDomain)\n\t}\n\tselect {\n\tcase <-ctx.Done():\n\tcase s.searchPathCh <- paths:\n\t}\n}", "func (o *SaveTemplateParams) SetProject(project string) {\n\to.Project = project\n}", "func WithProject(with string) wrapping.Option {\n\treturn func() interface{} {\n\t\treturn OptionFunc(func(o *options) error {\n\t\t\to.withProject = with\n\t\t\treturn nil\n\t\t})\n\t}\n}", "func SetBreakpointByURL(lineNumber int64) *SetBreakpointByURLParams {\n\treturn &SetBreakpointByURLParams{\n\t\tLineNumber: lineNumber,\n\t}\n}", "func PublisherProjectPath(project string) string {\n\tpath, err := publisherProjectPathTemplate.Render(map[string]string{\n\t\t\"project\": project,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn path\n}", "func (o *ServeBuildTypesInProjectParams) WithContext(ctx context.Context) *ServeBuildTypesInProjectParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func setLogger(managers map[string]*meters.Manager, logger meters.Logger) {\n\tfor _, m := range managers {\n\t\tm.Conn.Logger(logger)\n\t}\n}", "func SetRoutes(engine *gin.Engine, h Handler) error {\n\tapi := engine.Group(\"/\")\n\n\tapi.Use(OpenCORSMiddleware())\n\n\tapi.POST(\"/:project\", h.CreateRecord)\n\tapi.GET(\"/:project\", h.SearchRecords)\n\n\treturn nil\n}", "func NewPlacesRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*PlacesRequestBuilder) {\n m := &PlacesRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/places\", pathParameters),\n }\n return m\n}", "func (w *Workspace) SetRelativeFilepaths() {\n\t// itterate over all elements\n\tfor pi, p := range w.Projects {\n\t\tfor si, s := range p.Systems {\n\t\t\tfor fi, f := range s.Files {\n\t\t\t\tw.Projects[pi].Systems[si].Files[fi].FilePathName = filepath.Join(FileFolder(f.Type), filepath.Base(f.FilePathName))\n\t\t\t}\n\t\t}\n\t}\n}", "func (o *ListParams) SetProject(project string) {\n\to.Project = project\n}", "func (c *Client) setURL() (err error) {\n\tvar parsedTemplate *template.Template\n\tparsedTemplate, err = template.New(\"url\").Parse(c.url)\n\tif err != nil {\n\t\treturn\n\t}\n\t//create the hash map for filling template from client and data\n\tvar urlParamsMap map[string]interface{}\n\turlParamsMap, err = helpers.StructToMap(\"url\", c, c.data)\n\tif err != nil {\n\t\treturn\n\t}\n\t//fill the template with proper values\n\tvar b bytes.Buffer\n\terr = parsedTemplate.Execute(&b, urlParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\tc.url = string(b.Bytes())\n\treturn\n}", "func MakeLocator(app string) (*Locator, error) {\n\treturn MakeLocatorWithDefault(app, func(name string) string {\n\t\treturn LatestVersion\n\t})\n}", "func SetOpenAPI(eg *echo.Group, f *openapis.FOpenAPIs) {\n\teg.GET(\"/docs/openapi.yaml\", f.GenOpenAPI)\n\teg.GET(\"/docs/index.html\", f.SwaggerUI)\n\teg.Static(\"/docs/swagger-ui/assets\", \"./www/public/swagger-ui/assets\")\n}", "func setTracerProvider(url string) error {\n\t// Create the Jaeger exporter\n\texp, err := jaeger.New(\n\t\tjaeger.WithCollectorEndpoint(jaeger.WithEndpoint(url)),\n\t\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttp := tracesdk.NewTracerProvider(\n\t\t// Set the sampling rate based on the parent span to 100% 设置采样率\n\t\ttracesdk.WithSampler(tracesdk.ParentBased(tracesdk.TraceIDRatioBased(1.0))),\n\t\t// Always be sure to batch in production.\n\t\ttracesdk.WithBatcher(exp),\n\t\t// Record information about this application in an Resource.\n\t\t/*tracesdk.WithResource(resource.NewWithAttributes(\n\t\t\tsemconv.SchemaURL,\n\t\t\tsemconv.ServiceNameKey.String(service),\n\t\t\tattribute.String(\"environment\", environment),\n\t\t\tattribute.Int64(\"ID\", id),\n\t\t)),*/\n\t\ttracesdk.WithResource(resource.NewSchemaless(\n\t\t\tsemconv.ServiceNameKey.String(service),\n\t\t\tattribute.String(\"env\", \"dev\"),\n\t\t)),\n\t)\n\totel.SetTracerProvider(tp)\n\treturn nil\n}", "func Project(project string) Option {\n\treturn func(stackdriver *Stackdriver) {\n\t\tstackdriver.Builder.Model.MetricQuery.ProjectName = project\n\t}\n}", "func (o *ServeBuildTypesInProjectParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "func getProjectClients(ctx iris.Context) {\n\tprojectID := ctx.Params().Get(\"projectID\")\n\tif projectID == \"\" {\n\t\thandleError(ctx, apiErrors.ErrBadRequest)\n\t\treturn\n\t}\n\n\tresult, err := store.GetProjectClients(projectID)\n\tif err != nil {\n\t\thandleError(ctx, err)\n\t\treturn\n\t}\n\n\trender.JSON(ctx, iris.StatusOK, result)\n}", "func SetRouters(m *macaron.Macaron) {\n\tm.Group(\"/v1\", func() {\n\t\tm.Get(\"/\", handler.IndexV1Handler)\n\n\t\tm.Group(\"/:namespace\", func() {\n\n\t\t\tm.Group(\"/components\", func() {\n\t\t\t\tm.Get(\"/\", handler.ListComponents)\n\n\t\t\t\tm.Post(\"/\", handler.CreateComponent)\n\t\t\t\tm.Get(\"/:component\", handler.GetComponent)\n\t\t\t\tm.Put(\"/:component\", handler.UpdateComponent)\n\t\t\t\tm.Delete(\"/:component\", handler.DeleteComponent)\n\n\t\t\t\t// m.Get(\"/:component/debug\", handler.DebugComponentJson(), handler.DebugComponentLog)\n\t\t\t\t//m.Get(\"/ws/debug\",\n\t\t\t\t//\tsockets.JSON(handler.DebugComponentMessage{}),\n\t\t\t\t//\tfunc(\n\t\t\t\t//\treceiver <-chan *handler.DebugComponentMessage,\n\t\t\t\t//\tsender chan<- *handler.DebugComponentMessage,\n\t\t\t\t//\tdone <-chan bool,\n\t\t\t\t//\tdisconnect chan<- int,\n\t\t\t\t//\terrChan <-chan error) {})\n\t\t\t})\n\t\t})\n\t})\n}", "func SetWriters(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"INFO\\tSet Writers\")\n\tfmt.Println(\"INFO\\tSet Writers\")\n\n\t/*\n\t\tvars := mux.Vars(r)\n\t\tip := vars[\"ip\"]\n\n\t\tips := strings.Split(ip, DELIM)\n\n\t\tfor i := range ips {\n\t\t\tdata.writers[ips[i]] = true\n\t\t}\n\n\t\tif data.processType == 3 {\n\t\t\tvar clients map[string]bool = data.writers\n\t\t\tserverListStr := create_server_list_string()\n\t\t\tj := 0\n\t\t\tfor ipaddr := range clients {\n\t\t\t\tsend_command_to_process(ipaddr, \"SetServers\", serverListStr)\n\t\t\t\tname := \"writer_\" + fmt.Sprintf(\"%d\", j)\n\t\t\t\tsend_command_to_process(ipaddr, \"SetName\", name)\n\t\t\t\tj = j + 1\n\t\t\t}\n\t\t}\n\t*/\n}", "func (s *serverConfigV14) SetBrowser(v string) {\n\tserverConfigMu.Lock()\n\tdefer serverConfigMu.Unlock()\n\n\t// Set browser param\n\ts.Browser = v\n}", "func SetRemoteEnvironment(environ map[string]string) {\n\tremoteEnvironment = environ\n}", "func NewLocator(src, dest, destPkg string) (*Locator, error) {\n\tloc := &Locator{}\n\treturn loc, loc.Init(src, dest, destPkg)\n}", "func (a *App) ShowProject(w http.ResponseWriter, req *http.Request) {\n\tdb := context.Get(req, \"db\").(*mgo.Database)\n\tif db == nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Unable to access database\"})\n\t\treturn\n\t}\n\tvars := mux.Vars(req)\n\tpid := vars[\"pid\"]\n\tpid, ok := vars[\"pid\"]\n\tif !ok {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Missing of invalid project id\"})\n\t\treturn\n\t}\n\tproject := &lair.Project{}\n\tif err := db.C(a.C.Projects).FindId(pid).One(&project); err != nil {\n\t\ta.R.JSON(w, http.StatusNotFound, &Response{Status: \"Error\", Message: \"Unable to retrieve project or project does not exist\"})\n\t\treturn\n\t}\n\thosts := []lair.Host{}\n\tif err := db.C(a.C.Hosts).Find(bson.M{\"projectId\": pid}).All(&hosts); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tfor i := range hosts {\n\t\tservices := []lair.Service{}\n\t\tif err := db.C(a.C.Services).Find(bson.M{\"hostId\": hosts[i].ID}).All(&services); err != nil {\n\t\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\t\treturn\n\t\t}\n\t\thosts[i].Services = services\n\t\twebs := []lair.WebDirectory{}\n\t\tif err := db.C(a.C.WebDirectories).Find(bson.M{\"hostId\": hosts[i].ID}).All(&webs); err != nil {\n\t\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\t\treturn\n\t\t}\n\t\thosts[i].WebDirectories = webs\n\t}\n\tproject.Hosts = hosts\n\n\tpeople := []lair.Person{}\n\tif err := db.C(a.C.People).Find(bson.M{\"projectId\": pid}).All(&people); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.People = people\n\n\tissues := []lair.Issue{}\n\tif err := db.C(a.C.Issues).Find(bson.M{\"projectId\": pid}).Sort(\"-cvss\", \"title\").All(&issues); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.Issues = issues\n\n\tcreds := []lair.Credential{}\n\tif err := db.C(a.C.Credentials).Find(bson.M{\"projectId\": pid}).All(&creds); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.Credentials = creds\n\n\tauths := []lair.AuthInterface{}\n\tif err := db.C(a.C.AuthInterfaces).Find(bson.M{\"projectId\": pid}).All(&auths); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.AuthInterfaces = auths\n\n\tnets := []lair.Netblock{}\n\tif err := db.C(a.C.Netblocks).Find(bson.M{\"projectId\": pid}).All(&nets); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.Netblocks = nets\n\n\ta.R.JSON(w, http.StatusOK, project)\n}", "func (o *PutFlagSettingParams) SetProjectKey(projectKey string) {\n\to.ProjectKey = projectKey\n}", "func SetInfoLogger(l Logger) ClientOptionFunc {\n\treturn func(c *TogglHttpClient) error {\n\t\tc.infoLog = l\n\t\treturn nil\n\t}\n}", "func (o *ReplaceProjectsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewTeamItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*TeamItemRequestBuilder) {\n m := &TeamItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/me/joinedTeams/{team%2Did}{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "func (o *ServeBuildTypesInProjectParams) WithFields(fields *string) *ServeBuildTypesInProjectParams {\n\to.SetFields(fields)\n\treturn o\n}", "func (u *PrivatecaCaPoolIamUpdater) SetProject(project string) {\n\tu.project = project\n}", "func initConfig() {\n\n\t_, hasToken := os.LookupEnv(\"PRIVATE_ACCESS_TOKEN\")\n\t_, hasURL := os.LookupEnv(\"CI_PROJECT_URL\")\n\tif !hasToken || !hasURL {\n\t\tlog.Fatal(\"You need to set 'CI_PROJECT_URL' and 'PRIVATE_ACCESS_TOKEN'\")\n\t}\n\n\tviper.Set(\"Token\", os.Getenv(\"PRIVATE_ACCESS_TOKEN\"))\n\tviper.Set(\"ProjectUrl\", os.Getenv(\"CI_PROJECT_URL\"))\n\n\tu, err := url.Parse(viper.GetString(\"ProjectUrl\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tviper.Set(\"BaseUrl\", fmt.Sprintf(\"%s://%s\", u.Scheme, u.Host))\n\tviper.Set(\"RegistryUrl\", fmt.Sprintf(\"%s/container_registry.json\", viper.GetString(\"ProjectUrl\")))\n\n}", "func SetRepo(name string, repo string, miners map[string][]PimpMiner) string {\n\tout := \"\"\n\tfor _, v := range miners {\n\t\tif v[0].Info == name {\n\t\t\tout = pimp2repo + repo + \".tgz\" // for output / return value\n\t\t\tv[0].Repo = out // update the object\n\t\t}\n\t}\n\treturn out\n}" ]
[ "0.72239214", "0.6809504", "0.6473648", "0.6300842", "0.5715826", "0.5690421", "0.55002725", "0.54463214", "0.5107865", "0.5072284", "0.5005963", "0.48641327", "0.48102462", "0.47401085", "0.46515155", "0.4593909", "0.4561133", "0.45040965", "0.4462763", "0.4391426", "0.43801856", "0.43525422", "0.43517306", "0.43513703", "0.42920843", "0.42534736", "0.41265693", "0.41232198", "0.41049778", "0.4088415", "0.40875337", "0.40694824", "0.40694633", "0.4058265", "0.4044497", "0.40391394", "0.40337673", "0.40275958", "0.40274224", "0.40086657", "0.39943555", "0.394258", "0.39125955", "0.38971946", "0.38823262", "0.38766062", "0.38765723", "0.38676775", "0.38646588", "0.38617998", "0.38555846", "0.38499618", "0.38270566", "0.38163447", "0.38092145", "0.3796158", "0.37915128", "0.3780578", "0.37679267", "0.3734565", "0.37322554", "0.3727642", "0.37225434", "0.37223247", "0.37208834", "0.3717354", "0.37143338", "0.37098637", "0.37085268", "0.37003842", "0.3690416", "0.36904126", "0.3688775", "0.36869633", "0.3684469", "0.36726037", "0.3657621", "0.36543164", "0.36528456", "0.36440387", "0.36362445", "0.36348173", "0.36276594", "0.3621939", "0.3621428", "0.36182368", "0.36059964", "0.3603433", "0.36028472", "0.35952273", "0.359486", "0.3591419", "0.35848987", "0.35831618", "0.3582282", "0.35811532", "0.3578557", "0.35777414", "0.35675874", "0.35601127" ]
0.7869428
0
WriteToRequest writes these params to a swagger request
func (o *ServeBuildTypesInProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err } var res []error if o.Fields != nil { // query param fields var qrFields string if o.Fields != nil { qrFields = *o.Fields } qFields := qrFields if qFields != "" { if err := r.SetQueryParam("fields", qFields); err != nil { return err } } } // path param projectLocator if err := r.SetPathParam("projectLocator", o.ProjectLocator); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *FileInfoCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.ByteOffset != nil {\n\n\t\t// query param byte_offset\n\t\tvar qrByteOffset int64\n\n\t\tif o.ByteOffset != nil {\n\t\t\tqrByteOffset = *o.ByteOffset\n\t\t}\n\t\tqByteOffset := swag.FormatInt64(qrByteOffset)\n\t\tif qByteOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"byte_offset\", qByteOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif o.Info != nil {\n\t\tif err := r.SetBodyParam(o.Info); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Overwrite != nil {\n\n\t\t// query param overwrite\n\t\tvar qrOverwrite bool\n\n\t\tif o.Overwrite != nil {\n\t\t\tqrOverwrite = *o.Overwrite\n\t\t}\n\t\tqOverwrite := swag.FormatBool(qrOverwrite)\n\t\tif qOverwrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"overwrite\", qOverwrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param path\n\tif err := r.SetPathParam(\"path\", o.Path); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StreamName != nil {\n\n\t\t// query param stream_name\n\t\tvar qrStreamName string\n\n\t\tif o.StreamName != nil {\n\t\t\tqrStreamName = *o.StreamName\n\t\t}\n\t\tqStreamName := qrStreamName\n\t\tif qStreamName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"stream_name\", qStreamName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param volume.uuid\n\tif err := r.SetPathParam(\"volume.uuid\", o.VolumeUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Device-Id\n\tif err := r.SetHeaderParam(\"Device-Id\", o.DeviceID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.DeviceOS != nil {\n\n\t\t// header param Device-OS\n\t\tif err := r.SetHeaderParam(\"Device-OS\", *o.DeviceOS); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param fiscalDocumentNumber\n\tif err := r.SetPathParam(\"fiscalDocumentNumber\", swag.FormatUint64(o.FiscalDocumentNumber)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param fiscalDriveNumber\n\tif err := r.SetPathParam(\"fiscalDriveNumber\", swag.FormatUint64(o.FiscalDriveNumber)); err != nil {\n\t\treturn err\n\t}\n\n\t// query param fiscalSign\n\tqrFiscalSign := o.FiscalSign\n\tqFiscalSign := swag.FormatUint64(qrFiscalSign)\n\tif qFiscalSign != \"\" {\n\t\tif err := r.SetQueryParam(\"fiscalSign\", qFiscalSign); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.SendToEmail != nil {\n\n\t\t// query param sendToEmail\n\t\tvar qrSendToEmail string\n\t\tif o.SendToEmail != nil {\n\t\t\tqrSendToEmail = *o.SendToEmail\n\t\t}\n\t\tqSendToEmail := qrSendToEmail\n\t\tif qSendToEmail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sendToEmail\", qSendToEmail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *StartV1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Environment != nil {\n\n\t\t// query param environment\n\t\tvar qrEnvironment string\n\t\tif o.Environment != nil {\n\t\t\tqrEnvironment = *o.Environment\n\t\t}\n\t\tqEnvironment := qrEnvironment\n\t\tif qEnvironment != \"\" {\n\t\t\tif err := r.SetQueryParam(\"environment\", qEnvironment); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateAutoTagParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetIntrospectionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ResponseAsJwt != nil {\n\n\t\t// query param response_as_jwt\n\t\tvar qrResponseAsJwt bool\n\t\tif o.ResponseAsJwt != nil {\n\t\t\tqrResponseAsJwt = *o.ResponseAsJwt\n\t\t}\n\t\tqResponseAsJwt := swag.FormatBool(qrResponseAsJwt)\n\t\tif qResponseAsJwt != \"\" {\n\t\t\tif err := r.SetQueryParam(\"response_as_jwt\", qResponseAsJwt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param token\n\tqrToken := o.Token\n\tqToken := qrToken\n\tif qToken != \"\" {\n\t\tif err := r.SetQueryParam(\"token\", qToken); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.TokenTypeHint != nil {\n\n\t\t// query param token_type_hint\n\t\tvar qrTokenTypeHint string\n\t\tif o.TokenTypeHint != nil {\n\t\t\tqrTokenTypeHint = *o.TokenTypeHint\n\t\t}\n\t\tqTokenTypeHint := qrTokenTypeHint\n\t\tif qTokenTypeHint != \"\" {\n\t\t\tif err := r.SetQueryParam(\"token_type_hint\", qTokenTypeHint); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostContextsAddPhpParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param name\n\tqrName := o.Name\n\tqName := qrName\n\tif qName != \"\" {\n\n\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Private != nil {\n\n\t\t// query param private\n\t\tvar qrPrivate int64\n\n\t\tif o.Private != nil {\n\t\t\tqrPrivate = *o.Private\n\t\t}\n\t\tqPrivate := swag.FormatInt64(qrPrivate)\n\t\tif qPrivate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"private\", qPrivate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetInstancesDocsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.OperationID != nil {\n\n\t\t// query param operationId\n\t\tvar qrOperationID string\n\t\tif o.OperationID != nil {\n\t\t\tqrOperationID = *o.OperationID\n\t\t}\n\t\tqOperationID := qrOperationID\n\t\tif qOperationID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"operationId\", qOperationID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Version != nil {\n\n\t\t// query param version\n\t\tvar qrVersion string\n\t\tif o.Version != nil {\n\t\t\tqrVersion = *o.Version\n\t\t}\n\t\tqVersion := qrVersion\n\t\tif qVersion != \"\" {\n\t\t\tif err := r.SetQueryParam(\"version\", qVersion); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CloudTargetCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.CheckOnly != nil {\n\n\t\t// query param check_only\n\t\tvar qrCheckOnly bool\n\n\t\tif o.CheckOnly != nil {\n\t\t\tqrCheckOnly = *o.CheckOnly\n\t\t}\n\t\tqCheckOnly := swag.FormatBool(qrCheckOnly)\n\t\tif qCheckOnly != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"check_only\", qCheckOnly); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.IgnoreWarnings != nil {\n\n\t\t// query param ignore_warnings\n\t\tvar qrIgnoreWarnings bool\n\n\t\tif o.IgnoreWarnings != nil {\n\t\t\tqrIgnoreWarnings = *o.IgnoreWarnings\n\t\t}\n\t\tqIgnoreWarnings := swag.FormatBool(qrIgnoreWarnings)\n\t\tif qIgnoreWarnings != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ignore_warnings\", qIgnoreWarnings); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif o.Info != nil {\n\t\tif err := r.SetBodyParam(o.Info); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ReturnTimeout != nil {\n\n\t\t// query param return_timeout\n\t\tvar qrReturnTimeout int64\n\n\t\tif o.ReturnTimeout != nil {\n\t\t\tqrReturnTimeout = *o.ReturnTimeout\n\t\t}\n\t\tqReturnTimeout := swag.FormatInt64(qrReturnTimeout)\n\t\tif qReturnTimeout != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_timeout\", qReturnTimeout); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SayParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Sinkid != nil {\n\n\t\t// query param sinkid\n\t\tvar qrSinkid string\n\t\tif o.Sinkid != nil {\n\t\t\tqrSinkid = *o.Sinkid\n\t\t}\n\t\tqSinkid := qrSinkid\n\t\tif qSinkid != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sinkid\", qSinkid); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Voiceid != nil {\n\n\t\t// query param voiceid\n\t\tvar qrVoiceid string\n\t\tif o.Voiceid != nil {\n\t\t\tqrVoiceid = *o.Voiceid\n\t\t}\n\t\tqVoiceid := qrVoiceid\n\t\tif qVoiceid != \"\" {\n\t\t\tif err := r.SetQueryParam(\"voiceid\", qVoiceid); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *HandleGetAboutUsingGETParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// query param apiVersion\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\n\tif err := r.SetQueryParam(\"apiVersion\", qAPIVersion); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetFileSystemParametersInternalParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AccountID != nil {\n\n\t\t// query param accountId\n\t\tvar qrAccountID string\n\t\tif o.AccountID != nil {\n\t\t\tqrAccountID = *o.AccountID\n\t\t}\n\t\tqAccountID := qrAccountID\n\t\tif qAccountID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accountId\", qAccountID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.AccountName != nil {\n\n\t\t// query param accountName\n\t\tvar qrAccountName string\n\t\tif o.AccountName != nil {\n\t\t\tqrAccountName = *o.AccountName\n\t\t}\n\t\tqAccountName := qrAccountName\n\t\tif qAccountName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accountName\", qAccountName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.AttachedCluster != nil {\n\n\t\t// query param attachedCluster\n\t\tvar qrAttachedCluster bool\n\t\tif o.AttachedCluster != nil {\n\t\t\tqrAttachedCluster = *o.AttachedCluster\n\t\t}\n\t\tqAttachedCluster := swag.FormatBool(qrAttachedCluster)\n\t\tif qAttachedCluster != \"\" {\n\t\t\tif err := r.SetQueryParam(\"attachedCluster\", qAttachedCluster); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param blueprintName\n\tqrBlueprintName := o.BlueprintName\n\tqBlueprintName := qrBlueprintName\n\tif qBlueprintName != \"\" {\n\t\tif err := r.SetQueryParam(\"blueprintName\", qBlueprintName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param clusterName\n\tqrClusterName := o.ClusterName\n\tqClusterName := qrClusterName\n\tif qClusterName != \"\" {\n\t\tif err := r.SetQueryParam(\"clusterName\", qClusterName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param fileSystemType\n\tqrFileSystemType := o.FileSystemType\n\tqFileSystemType := qrFileSystemType\n\tif qFileSystemType != \"\" {\n\t\tif err := r.SetQueryParam(\"fileSystemType\", qFileSystemType); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Secure != nil {\n\n\t\t// query param secure\n\t\tvar qrSecure bool\n\t\tif o.Secure != nil {\n\t\t\tqrSecure = *o.Secure\n\t\t}\n\t\tqSecure := swag.FormatBool(qrSecure)\n\t\tif qSecure != \"\" {\n\t\t\tif err := r.SetQueryParam(\"secure\", qSecure); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param storageName\n\tqrStorageName := o.StorageName\n\tqStorageName := qrStorageName\n\tif qStorageName != \"\" {\n\t\tif err := r.SetQueryParam(\"storageName\", qStorageName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param workspaceId\n\tif err := r.SetPathParam(\"workspaceId\", swag.FormatInt64(o.WorkspaceID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ServeBuildFieldShortParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param btLocator\n\tif err := r.SetPathParam(\"btLocator\", o.BtLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param buildLocator\n\tif err := r.SetPathParam(\"buildLocator\", o.BuildLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param field\n\tif err := r.SetPathParam(\"field\", o.Field); err != nil {\n\t\treturn err\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetRequestDetailsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param extra\n\tif err := r.SetPathParam(\"extra\", o.Extra); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetWorkItemParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DollarExpand != nil {\n\n\t\t// query param $expand\n\t\tvar qrNrDollarExpand string\n\t\tif o.DollarExpand != nil {\n\t\t\tqrNrDollarExpand = *o.DollarExpand\n\t\t}\n\t\tqNrDollarExpand := qrNrDollarExpand\n\t\tif qNrDollarExpand != \"\" {\n\t\t\tif err := r.SetQueryParam(\"$expand\", qNrDollarExpand); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.AsOf != nil {\n\n\t\t// query param asOf\n\t\tvar qrAsOf strfmt.DateTime\n\t\tif o.AsOf != nil {\n\t\t\tqrAsOf = *o.AsOf\n\t\t}\n\t\tqAsOf := qrAsOf.String()\n\t\tif qAsOf != \"\" {\n\t\t\tif err := r.SetQueryParam(\"asOf\", qAsOf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt32(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *IntegrationsManualHTTPSCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Data); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ValidateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostSecdefSearchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Symbol); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UserShowV1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param name\n\tif err := r.SetPathParam(\"name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetLogsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.From != nil {\n\n\t\t// query param from\n\t\tvar qrFrom string\n\t\tif o.From != nil {\n\t\t\tqrFrom = *o.From\n\t\t}\n\t\tqFrom := qrFrom\n\t\tif qFrom != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeFields != nil {\n\n\t\t// query param include_fields\n\t\tvar qrIncludeFields bool\n\t\tif o.IncludeFields != nil {\n\t\t\tqrIncludeFields = *o.IncludeFields\n\t\t}\n\t\tqIncludeFields := swag.FormatBool(qrIncludeFields)\n\t\tif qIncludeFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_fields\", qIncludeFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeTotals != nil {\n\n\t\t// query param include_totals\n\t\tvar qrIncludeTotals bool\n\t\tif o.IncludeTotals != nil {\n\t\t\tqrIncludeTotals = *o.IncludeTotals\n\t\t}\n\t\tqIncludeTotals := swag.FormatBool(qrIncludeTotals)\n\t\tif qIncludeTotals != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_totals\", qIncludeTotals); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int64\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt64(qrPerPage)\n\t\tif qPerPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Take != nil {\n\n\t\t// query param take\n\t\tvar qrTake int64\n\t\tif o.Take != nil {\n\t\t\tqrTake = *o.Take\n\t\t}\n\t\tqTake := swag.FormatInt64(qrTake)\n\t\tif qTake != \"\" {\n\t\t\tif err := r.SetQueryParam(\"take\", qTake); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostGetOneParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tvaluesRelated := o.Related\n\n\tjoinedRelated := swag.JoinByFormat(valuesRelated, \"\")\n\t// query array param related\n\tif err := r.SetQueryParam(\"related\", joinedRelated...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *BarParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ConfigGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Option != nil {\n\n\t\t// binding items for option\n\t\tjoinedOption := o.bindParamOption(reg)\n\n\t\t// query array param option\n\t\tif err := r.SetQueryParam(\"option\", joinedOption...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ProjectID != nil {\n\n\t\t// query param project_id\n\t\tvar qrProjectID int64\n\n\t\tif o.ProjectID != nil {\n\t\t\tqrProjectID = *o.ProjectID\n\t\t}\n\t\tqProjectID := swag.FormatInt64(qrProjectID)\n\t\tif qProjectID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"project_id\", qProjectID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.UserID != nil {\n\n\t\t// query param user_id\n\t\tvar qrUserID int64\n\n\t\tif o.UserID != nil {\n\t\t\tqrUserID = *o.UserID\n\t\t}\n\t\tqUserID := swag.FormatInt64(qrUserID)\n\t\tif qUserID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"user_id\", qUserID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetSsoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param code\n\tqrCode := o.Code\n\tqCode := qrCode\n\tif qCode != \"\" {\n\t\tif err := r.SetQueryParam(\"code\", qCode); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param resource_id\n\tqrResourceID := o.ResourceID\n\tqResourceID := qrResourceID\n\tif qResourceID != \"\" {\n\t\tif err := r.SetQueryParam(\"resource_id\", qResourceID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *AllLookmlTestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.FileID != nil {\n\n\t\t// query param file_id\n\t\tvar qrFileID string\n\t\tif o.FileID != nil {\n\t\t\tqrFileID = *o.FileID\n\t\t}\n\t\tqFileID := qrFileID\n\t\tif qFileID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"file_id\", qFileID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param project_id\n\tif err := r.SetPathParam(\"project_id\", o.ProjectID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *APIServiceHaltsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Height != nil {\n\n\t\t// query param height\n\t\tvar qrHeight string\n\t\tif o.Height != nil {\n\t\t\tqrHeight = *o.Height\n\t\t}\n\t\tqHeight := qrHeight\n\t\tif qHeight != \"\" {\n\t\t\tif err := r.SetQueryParam(\"height\", qHeight); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Connection != nil {\n\n\t\t// query param connection\n\t\tvar qrConnection string\n\t\tif o.Connection != nil {\n\t\t\tqrConnection = *o.Connection\n\t\t}\n\t\tqConnection := qrConnection\n\t\tif qConnection != \"\" {\n\t\t\tif err := r.SetQueryParam(\"connection\", qConnection); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeFields != nil {\n\n\t\t// query param include_fields\n\t\tvar qrIncludeFields bool\n\t\tif o.IncludeFields != nil {\n\t\t\tqrIncludeFields = *o.IncludeFields\n\t\t}\n\t\tqIncludeFields := swag.FormatBool(qrIncludeFields)\n\t\tif qIncludeFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_fields\", qIncludeFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeTotals != nil {\n\n\t\t// query param include_totals\n\t\tvar qrIncludeTotals bool\n\t\tif o.IncludeTotals != nil {\n\t\t\tqrIncludeTotals = *o.IncludeTotals\n\t\t}\n\t\tqIncludeTotals := swag.FormatBool(qrIncludeTotals)\n\t\tif qIncludeTotals != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_totals\", qIncludeTotals); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int64\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt64(qrPerPage)\n\t\tif qPerPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SearchEngine != nil {\n\n\t\t// query param search_engine\n\t\tvar qrSearchEngine string\n\t\tif o.SearchEngine != nil {\n\t\t\tqrSearchEngine = *o.SearchEngine\n\t\t}\n\t\tqSearchEngine := qrSearchEngine\n\t\tif qSearchEngine != \"\" {\n\t\t\tif err := r.SetQueryParam(\"search_engine\", qSearchEngine); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBlockGeneratorResultParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateRuntimeMapParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.FileUpload != nil {\n\n\t\tif o.FileUpload != nil {\n\n\t\t\t// form file param file_upload\n\t\t\tif err := r.SetFileParam(\"file_upload\", o.FileUpload); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetPlatformsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Extended != nil {\n\n\t\t// query param extended\n\t\tvar qrExtended bool\n\t\tif o.Extended != nil {\n\t\t\tqrExtended = *o.Extended\n\t\t}\n\t\tqExtended := swag.FormatBool(qrExtended)\n\t\tif qExtended != \"\" {\n\t\t\tif err := r.SetQueryParam(\"extended\", qExtended); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetUserUsageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Cloud != nil {\n\n\t\t// query param cloud\n\t\tvar qrCloud string\n\t\tif o.Cloud != nil {\n\t\t\tqrCloud = *o.Cloud\n\t\t}\n\t\tqCloud := qrCloud\n\t\tif qCloud != \"\" {\n\t\t\tif err := r.SetQueryParam(\"cloud\", qCloud); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Filterenddate != nil {\n\n\t\t// query param filterenddate\n\t\tvar qrFilterenddate int64\n\t\tif o.Filterenddate != nil {\n\t\t\tqrFilterenddate = *o.Filterenddate\n\t\t}\n\t\tqFilterenddate := swag.FormatInt64(qrFilterenddate)\n\t\tif qFilterenddate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filterenddate\", qFilterenddate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Since != nil {\n\n\t\t// query param since\n\t\tvar qrSince int64\n\t\tif o.Since != nil {\n\t\t\tqrSince = *o.Since\n\t\t}\n\t\tqSince := swag.FormatInt64(qrSince)\n\t\tif qSince != \"\" {\n\t\t\tif err := r.SetQueryParam(\"since\", qSince); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Zone != nil {\n\n\t\t// query param zone\n\t\tvar qrZone string\n\t\tif o.Zone != nil {\n\t\t\tqrZone = *o.Zone\n\t\t}\n\t\tqZone := qrZone\n\t\tif qZone != \"\" {\n\t\t\tif err := r.SetQueryParam(\"zone\", qZone); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetOrderParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.MerchantID != nil {\n\n\t\t// query param merchantId\n\t\tvar qrMerchantID int64\n\t\tif o.MerchantID != nil {\n\t\t\tqrMerchantID = *o.MerchantID\n\t\t}\n\t\tqMerchantID := swag.FormatInt64(qrMerchantID)\n\t\tif qMerchantID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"merchantId\", qMerchantID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetPropertyDescriptorParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\t// query param propertyName\n\tqrPropertyName := o.PropertyName\n\tqPropertyName := qrPropertyName\n\tif qPropertyName != \"\" {\n\n\t\tif err := r.SetQueryParam(\"propertyName\", qPropertyName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetCurrentGenerationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ViewsGetByIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param identifier\n\tif err := r.SetPathParam(\"identifier\", o.Identifier); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateGitWebhookUsingPOSTParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// query param apiVersion\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\n\tif err := r.SetQueryParam(\"apiVersion\", qAPIVersion); err != nil {\n\t\treturn err\n\t}\n\tif err := r.SetBodyParam(o.GitWebhookSpec); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateDeviceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param deviceId\n\tif err := r.SetPathParam(\"deviceId\", o.DeviceID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.UpdateDeviceRequest != nil {\n\t\tif err := r.SetBodyParam(o.UpdateDeviceRequest); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SaveTemplateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\t// path param templateId\n\tif err := r.SetPathParam(\"templateId\", o.TemplateID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ConvertParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param from.currency_code\n\tif err := r.SetPathParam(\"from.currency_code\", o.FromCurrencyCode); err != nil {\n\t\treturn err\n\t}\n\n\tif o.FromNanos != nil {\n\n\t\t// query param from.nanos\n\t\tvar qrFromNanos int32\n\t\tif o.FromNanos != nil {\n\t\t\tqrFromNanos = *o.FromNanos\n\t\t}\n\t\tqFromNanos := swag.FormatInt32(qrFromNanos)\n\t\tif qFromNanos != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from.nanos\", qFromNanos); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FromUnits != nil {\n\n\t\t// query param from.units\n\t\tvar qrFromUnits string\n\t\tif o.FromUnits != nil {\n\t\t\tqrFromUnits = *o.FromUnits\n\t\t}\n\t\tqFromUnits := qrFromUnits\n\t\tif qFromUnits != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from.units\", qFromUnits); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param to_code\n\tif err := r.SetPathParam(\"to_code\", o.ToCode); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SystemEventsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Filters != nil {\n\n\t\t// query param filters\n\t\tvar qrFilters string\n\t\tif o.Filters != nil {\n\t\t\tqrFilters = *o.Filters\n\t\t}\n\t\tqFilters := qrFilters\n\t\tif qFilters != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filters\", qFilters); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Since != nil {\n\n\t\t// query param since\n\t\tvar qrSince string\n\t\tif o.Since != nil {\n\t\t\tqrSince = *o.Since\n\t\t}\n\t\tqSince := qrSince\n\t\tif qSince != \"\" {\n\t\t\tif err := r.SetQueryParam(\"since\", qSince); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Until != nil {\n\n\t\t// query param until\n\t\tvar qrUntil string\n\t\tif o.Until != nil {\n\t\t\tqrUntil = *o.Until\n\t\t}\n\t\tqUntil := qrUntil\n\t\tif qUntil != \"\" {\n\t\t\tif err := r.SetQueryParam(\"until\", qUntil); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBundleByKeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Audit != nil {\n\n\t\t// query param audit\n\t\tvar qrAudit string\n\n\t\tif o.Audit != nil {\n\t\t\tqrAudit = *o.Audit\n\t\t}\n\t\tqAudit := qrAudit\n\t\tif qAudit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"audit\", qAudit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// query param externalKey\n\tqrExternalKey := o.ExternalKey\n\tqExternalKey := qrExternalKey\n\tif qExternalKey != \"\" {\n\n\t\tif err := r.SetQueryParam(\"externalKey\", qExternalKey); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.IncludedDeleted != nil {\n\n\t\t// query param includedDeleted\n\t\tvar qrIncludedDeleted bool\n\n\t\tif o.IncludedDeleted != nil {\n\t\t\tqrIncludedDeleted = *o.IncludedDeleted\n\t\t}\n\t\tqIncludedDeleted := swag.FormatBool(qrIncludedDeleted)\n\t\tif qIncludedDeleted != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"includedDeleted\", qIncludedDeleted); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// header param WithProfilingInfo\n\tif o.WithProfilingInfo != nil && len(*o.WithProfilingInfo) > 0 {\n\t\tif err := r.SetHeaderParam(\"X-Killbill-Profiling-Req\", *o.WithProfilingInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param withStackTrace\n\tif o.WithStackTrace != nil && *o.WithStackTrace {\n\t\tif err := r.SetQueryParam(\"withStackTrace\", \"true\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SwarmUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.RotateManagerToken != nil {\n\n\t\t// query param rotateManagerToken\n\t\tvar qrRotateManagerToken bool\n\t\tif o.RotateManagerToken != nil {\n\t\t\tqrRotateManagerToken = *o.RotateManagerToken\n\t\t}\n\t\tqRotateManagerToken := swag.FormatBool(qrRotateManagerToken)\n\t\tif qRotateManagerToken != \"\" {\n\t\t\tif err := r.SetQueryParam(\"rotateManagerToken\", qRotateManagerToken); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RotateManagerUnlockKey != nil {\n\n\t\t// query param rotateManagerUnlockKey\n\t\tvar qrRotateManagerUnlockKey bool\n\t\tif o.RotateManagerUnlockKey != nil {\n\t\t\tqrRotateManagerUnlockKey = *o.RotateManagerUnlockKey\n\t\t}\n\t\tqRotateManagerUnlockKey := swag.FormatBool(qrRotateManagerUnlockKey)\n\t\tif qRotateManagerUnlockKey != \"\" {\n\t\t\tif err := r.SetQueryParam(\"rotateManagerUnlockKey\", qRotateManagerUnlockKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RotateWorkerToken != nil {\n\n\t\t// query param rotateWorkerToken\n\t\tvar qrRotateWorkerToken bool\n\t\tif o.RotateWorkerToken != nil {\n\t\t\tqrRotateWorkerToken = *o.RotateWorkerToken\n\t\t}\n\t\tqRotateWorkerToken := swag.FormatBool(qrRotateWorkerToken)\n\t\tif qRotateWorkerToken != \"\" {\n\t\t\tif err := r.SetQueryParam(\"rotateWorkerToken\", qRotateWorkerToken); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param version\n\tqrVersion := o.Version\n\tqVersion := swag.FormatInt64(qrVersion)\n\tif qVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"version\", qVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ServiceInstanceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.XBrokerAPIOriginatingIdentity != nil {\n\n\t\t// header param X-Broker-API-Originating-Identity\n\t\tif err := r.SetHeaderParam(\"X-Broker-API-Originating-Identity\", *o.XBrokerAPIOriginatingIdentity); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param X-Broker-API-Version\n\tif err := r.SetHeaderParam(\"X-Broker-API-Version\", o.XBrokerAPIVersion); err != nil {\n\t\treturn err\n\t}\n\n\t// path param instance_id\n\tif err := r.SetPathParam(\"instance_id\", o.InstanceID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SizeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Parameters); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ShowPackageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param media_type\n\tif err := r.SetPathParam(\"media_type\", o.MediaType); err != nil {\n\t\treturn err\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param package\n\tif err := r.SetPathParam(\"package\", o.Package); err != nil {\n\t\treturn err\n\t}\n\n\t// path param release\n\tif err := r.SetPathParam(\"release\", o.Release); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetOutagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param count\n\tqrCount := o.Count\n\tqCount := swag.FormatFloat64(qrCount)\n\tif qCount != \"\" {\n\n\t\tif err := r.SetQueryParam(\"count\", qCount); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.DeviceID != nil {\n\n\t\t// query param deviceId\n\t\tvar qrDeviceID string\n\n\t\tif o.DeviceID != nil {\n\t\t\tqrDeviceID = *o.DeviceID\n\t\t}\n\t\tqDeviceID := qrDeviceID\n\t\tif qDeviceID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"deviceId\", qDeviceID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.InProgress != nil {\n\n\t\t// query param inProgress\n\t\tvar qrInProgress bool\n\n\t\tif o.InProgress != nil {\n\t\t\tqrInProgress = *o.InProgress\n\t\t}\n\t\tqInProgress := swag.FormatBool(qrInProgress)\n\t\tif qInProgress != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"inProgress\", qInProgress); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// query param page\n\tqrPage := o.Page\n\tqPage := swag.FormatFloat64(qrPage)\n\tif qPage != \"\" {\n\n\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Period != nil {\n\n\t\t// query param period\n\t\tvar qrPeriod float64\n\n\t\tif o.Period != nil {\n\t\t\tqrPeriod = *o.Period\n\t\t}\n\t\tqPeriod := swag.FormatFloat64(qrPeriod)\n\t\tif qPeriod != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"period\", qPeriod); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Query != nil {\n\n\t\t// query param query\n\t\tvar qrQuery string\n\n\t\tif o.Query != nil {\n\t\t\tqrQuery = *o.Query\n\t\t}\n\t\tqQuery := qrQuery\n\t\tif qQuery != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *TerminateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param extractorId\n\tif err := r.SetPathParam(\"extractorId\", o.ExtractorID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param inputId\n\tif err := r.SetPathParam(\"inputId\", o.InputID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ServeFieldParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param field\n\tif err := r.SetPathParam(\"field\", o.Field); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vcsRootLocator\n\tif err := r.SetPathParam(\"vcsRootLocator\", o.VcsRootLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostV1DevicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// form param device_identifier\n\tfrDeviceIdentifier := o.DeviceIdentifier\n\tfDeviceIdentifier := frDeviceIdentifier\n\tif fDeviceIdentifier != \"\" {\n\t\tif err := r.SetFormParam(\"device_identifier\", fDeviceIdentifier); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// form param kind\n\tfrKind := o.Kind\n\tfKind := frKind\n\tif fKind != \"\" {\n\t\tif err := r.SetFormParam(\"kind\", fKind); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// form param name\n\tfrName := o.Name\n\tfName := frName\n\tif fName != \"\" {\n\t\tif err := r.SetFormParam(\"name\", fName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.NotificationIdentifier != nil {\n\n\t\t// form param notification_identifier\n\t\tvar frNotificationIdentifier string\n\t\tif o.NotificationIdentifier != nil {\n\t\t\tfrNotificationIdentifier = *o.NotificationIdentifier\n\t\t}\n\t\tfNotificationIdentifier := frNotificationIdentifier\n\t\tif fNotificationIdentifier != \"\" {\n\t\t\tif err := r.SetFormParam(\"notification_identifier\", fNotificationIdentifier); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SubscribeNotification != nil {\n\n\t\t// form param subscribe_notification\n\t\tvar frSubscribeNotification bool\n\t\tif o.SubscribeNotification != nil {\n\t\t\tfrSubscribeNotification = *o.SubscribeNotification\n\t\t}\n\t\tfSubscribeNotification := swag.FormatBool(frSubscribeNotification)\n\t\tif fSubscribeNotification != \"\" {\n\t\t\tif err := r.SetFormParam(\"subscribe_notification\", fSubscribeNotification); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *QueryFirewallFieldsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset string\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := qrOffset\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PlatformID != nil {\n\n\t\t// query param platform_id\n\t\tvar qrPlatformID string\n\n\t\tif o.PlatformID != nil {\n\t\t\tqrPlatformID = *o.PlatformID\n\t\t}\n\t\tqPlatformID := qrPlatformID\n\t\tif qPlatformID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"platform_id\", qPlatformID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetCatalogXMLParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AccountID != nil {\n\n\t\t// query param accountId\n\t\tvar qrAccountID strfmt.UUID\n\n\t\tif o.AccountID != nil {\n\t\t\tqrAccountID = *o.AccountID\n\t\t}\n\t\tqAccountID := qrAccountID.String()\n\t\tif qAccountID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"accountId\", qAccountID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RequestedDate != nil {\n\n\t\t// query param requestedDate\n\t\tvar qrRequestedDate strfmt.DateTime\n\n\t\tif o.RequestedDate != nil {\n\t\t\tqrRequestedDate = *o.RequestedDate\n\t\t}\n\t\tqRequestedDate := qrRequestedDate.String()\n\t\tif qRequestedDate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"requestedDate\", qRequestedDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// header param WithProfilingInfo\n\tif o.WithProfilingInfo != nil && len(*o.WithProfilingInfo) > 0 {\n\t\tif err := r.SetHeaderParam(\"X-Killbill-Profiling-Req\", *o.WithProfilingInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param withStackTrace\n\tif o.WithStackTrace != nil && *o.WithStackTrace {\n\t\tif err := r.SetQueryParam(\"withStackTrace\", \"true\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetClockParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param X-Killbill-ApiKey\n\tif err := r.SetHeaderParam(\"X-Killbill-ApiKey\", o.XKillbillAPIKey); err != nil {\n\t\treturn err\n\t}\n\n\t// header param X-Killbill-ApiSecret\n\tif err := r.SetHeaderParam(\"X-Killbill-ApiSecret\", o.XKillbillAPISecret); err != nil {\n\t\treturn err\n\t}\n\n\t// header param WithProfilingInfo\n\tif o.WithProfilingInfo != nil && len(*o.WithProfilingInfo) > 0 {\n\t\tif err := r.SetHeaderParam(\"X-Killbill-Profiling-Req\", *o.WithProfilingInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param withStackTrace\n\tif o.WithStackTrace != nil && *o.WithStackTrace {\n\t\tif err := r.SetQueryParam(\"withStackTrace\", \"true\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *AdminCreateJusticeUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param targetNamespace\n\tif err := r.SetPathParam(\"targetNamespace\", o.TargetNamespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateWidgetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Accept != nil {\n\n\t\t// header param Accept\n\t\tif err := r.SetHeaderParam(\"Accept\", *o.Accept); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.ContentType != nil {\n\n\t\t// header param Content-Type\n\t\tif err := r.SetHeaderParam(\"Content-Type\", *o.ContentType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param uuid\n\tif err := r.SetPathParam(\"uuid\", o.UUID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.WidgetBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *TestEndpointParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetLogsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.XRequestID != nil {\n\n\t\t// header param X-Request-Id\n\t\tif err := r.SetHeaderParam(\"X-Request-Id\", *o.XRequestID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param page_size\n\t\tvar qrPageSize int64\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt64(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page_size\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param project_name\n\tif err := r.SetPathParam(\"project_name\", o.ProjectName); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ListSourceFileOfProjectVersionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param parentId\n\tif err := r.SetPathParam(\"parentId\", swag.FormatInt64(o.ParentID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetDrgParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param drgId\n\tif err := r.SetPathParam(\"drgId\", o.DrgID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateFlowParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param bucketId\n\tif err := r.SetPathParam(\"bucketId\", o.BucketID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param flowId\n\tif err := r.SetPathParam(\"flowId\", o.FlowID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateWidgetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Accept != nil {\n\n\t\t// header param Accept\n\t\tif err := r.SetHeaderParam(\"Accept\", *o.Accept); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.ContentType != nil {\n\n\t\t// header param Content-Type\n\t\tif err := r.SetHeaderParam(\"Content-Type\", *o.ContentType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif err := r.SetBodyParam(o.WidgetBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBodyResourceByDatePeriodParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param date\n\tif err := r.SetPathParam(\"date\", o.Date.String()); err != nil {\n\t\treturn err\n\t}\n\n\t// path param period\n\tif err := r.SetPathParam(\"period\", o.Period); err != nil {\n\t\treturn err\n\t}\n\n\t// path param resource-path\n\tif err := r.SetPathParam(\"resource-path\", o.ResourcePath); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetAboutUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tvaluesSelect := o.Select\n\n\tjoinedSelect := swag.JoinByFormat(valuesSelect, \"csv\")\n\t// query array param select\n\tif err := r.SetQueryParam(\"select\", joinedSelect...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ExtractionListV1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param id\n\tqrID := o.ID\n\tqID := qrID\n\tif qID != \"\" {\n\n\t\tif err := r.SetQueryParam(\"id\", qID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset string\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := qrOffset\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetAuditEventsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int32\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param resourceCrn\n\tqrResourceCrn := o.ResourceCrn\n\tqResourceCrn := qrResourceCrn\n\tif qResourceCrn != \"\" {\n\t\tif err := r.SetQueryParam(\"resourceCrn\", qResourceCrn); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Size != nil {\n\n\t\t// query param size\n\t\tvar qrSize int32\n\t\tif o.Size != nil {\n\t\t\tqrSize = *o.Size\n\t\t}\n\t\tqSize := swag.FormatInt32(qrSize)\n\t\tif qSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"size\", qSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PcloudSystempoolsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param cloud_instance_id\n\tif err := r.SetPathParam(\"cloud_instance_id\", o.CloudInstanceID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *WaitListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param address\n\tif err := r.SetPathParam(\"address\", o.Address); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Height != nil {\n\n\t\t// query param height\n\t\tvar qrHeight uint64\n\n\t\tif o.Height != nil {\n\t\t\tqrHeight = *o.Height\n\t\t}\n\t\tqHeight := swag.FormatUint64(qrHeight)\n\t\tif qHeight != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"height\", qHeight); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PublicKey != nil {\n\n\t\t// query param public_key\n\t\tvar qrPublicKey string\n\n\t\tif o.PublicKey != nil {\n\t\t\tqrPublicKey = *o.PublicKey\n\t\t}\n\t\tqPublicKey := qrPublicKey\n\t\tif qPublicKey != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"public_key\", qPublicKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *BudgetAddParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetGCParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param gc_id\n\tif err := r.SetPathParam(\"gc_id\", swag.FormatInt64(o.GcID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PartialUpdateAppParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\t// path param app_id\n\tif err := r.SetPathParam(\"app_id\", swag.FormatInt64(o.AppID)); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\t// path param team_id\n\tif err := r.SetPathParam(\"team_id\", swag.FormatInt64(o.TeamID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *StartPacketCaptureParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *TaskSchemasIDGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param identifier\n\tif err := r.SetPathParam(\"identifier\", o.Identifier); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ResolveRef != nil {\n\n\t\t// query param resolveRef\n\t\tvar qrResolveRef bool\n\t\tif o.ResolveRef != nil {\n\t\t\tqrResolveRef = *o.ResolveRef\n\t\t}\n\t\tqResolveRef := swag.FormatBool(qrResolveRef)\n\t\tif qResolveRef != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resolveRef\", qResolveRef); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UploadTaskFileParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Description != nil {\n\n\t\t// form param description\n\t\tvar frDescription string\n\t\tif o.Description != nil {\n\t\t\tfrDescription = *o.Description\n\t\t}\n\t\tfDescription := frDescription\n\t\tif fDescription != \"\" {\n\t\t\tif err := r.SetFormParam(\"description\", fDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.File != nil {\n\n\t\tif o.File != nil {\n\t\t\t// form file param file\n\t\t\tif err := r.SetFileParam(\"file\", o.File); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PetCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *QueryChangesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetInstrumentsInstrumentOrderBookParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AcceptDatetimeFormat != nil {\n\n\t\t// header param Accept-Datetime-Format\n\t\tif err := r.SetHeaderParam(\"Accept-Datetime-Format\", *o.AcceptDatetimeFormat); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param instrument\n\tif err := r.SetPathParam(\"instrument\", o.Instrument); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Time != nil {\n\n\t\t// query param time\n\t\tvar qrTime string\n\t\tif o.Time != nil {\n\t\t\tqrTime = *o.Time\n\t\t}\n\t\tqTime := qrTime\n\t\tif qTime != \"\" {\n\t\t\tif err := r.SetQueryParam(\"time\", qTime); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetScopeConfigurationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param scope_id\n\tif err := r.SetPathParam(\"scope_id\", o.ScopeID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param site_id\n\tif err := r.SetPathParam(\"site_id\", o.SiteID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param stack_id\n\tif err := r.SetPathParam(\"stack_id\", o.StackID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateEventParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param eventId\n\tif err := r.SetPathParam(\"eventId\", o.EventID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param koronaAccountId\n\tif err := r.SetPathParam(\"koronaAccountId\", o.KoronaAccountID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetV1FunctionalitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Impacted != nil {\n\n\t\t// query param impacted\n\t\tvar qrImpacted string\n\n\t\tif o.Impacted != nil {\n\t\t\tqrImpacted = *o.Impacted\n\t\t}\n\t\tqImpacted := qrImpacted\n\t\tif qImpacted != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"impacted\", qImpacted); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Labels != nil {\n\n\t\t// query param labels\n\t\tvar qrLabels string\n\n\t\tif o.Labels != nil {\n\t\t\tqrLabels = *o.Labels\n\t\t}\n\t\tqLabels := qrLabels\n\t\tif qLabels != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"labels\", qLabels); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Lite != nil {\n\n\t\t// query param lite\n\t\tvar qrLite bool\n\n\t\tif o.Lite != nil {\n\t\t\tqrLite = *o.Lite\n\t\t}\n\t\tqLite := swag.FormatBool(qrLite)\n\t\tif qLite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"lite\", qLite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Owner != nil {\n\n\t\t// query param owner\n\t\tvar qrOwner string\n\n\t\tif o.Owner != nil {\n\t\t\tqrOwner = *o.Owner\n\t\t}\n\t\tqOwner := qrOwner\n\t\tif qOwner != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"owner\", qOwner); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int32\n\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int32\n\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt32(qrPerPage)\n\t\tif qPerPage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Query != nil {\n\n\t\t// query param query\n\t\tvar qrQuery string\n\n\t\tif o.Query != nil {\n\t\t\tqrQuery = *o.Query\n\t\t}\n\t\tqQuery := qrQuery\n\t\tif qQuery != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ContainerUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.Update); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetPointsByQueryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DollarSkip != nil {\n\n\t\t// query param $skip\n\t\tvar qrNrDollarSkip int32\n\t\tif o.DollarSkip != nil {\n\t\t\tqrNrDollarSkip = *o.DollarSkip\n\t\t}\n\t\tqNrDollarSkip := swag.FormatInt32(qrNrDollarSkip)\n\t\tif qNrDollarSkip != \"\" {\n\t\t\tif err := r.SetQueryParam(\"$skip\", qNrDollarSkip); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.DollarTop != nil {\n\n\t\t// query param $top\n\t\tvar qrNrDollarTop int32\n\t\tif o.DollarTop != nil {\n\t\t\tqrNrDollarTop = *o.DollarTop\n\t\t}\n\t\tqNrDollarTop := swag.FormatInt32(qrNrDollarTop)\n\t\tif qNrDollarTop != \"\" {\n\t\t\tif err := r.SetQueryParam(\"$top\", qNrDollarTop); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ResolveBatchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Account != nil {\n\n\t\t// query param account\n\t\tvar qrAccount string\n\t\tif o.Account != nil {\n\t\t\tqrAccount = *o.Account\n\t\t}\n\t\tqAccount := qrAccount\n\t\tif qAccount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"account\", qAccount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Environment != nil {\n\n\t\t// query param environment\n\t\tvar qrEnvironment string\n\t\tif o.Environment != nil {\n\t\t\tqrEnvironment = *o.Environment\n\t\t}\n\t\tqEnvironment := qrEnvironment\n\t\tif qEnvironment != \"\" {\n\t\t\tif err := r.SetQueryParam(\"environment\", qEnvironment); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.From != nil {\n\n\t\t// query param from\n\t\tvar qrFrom string\n\t\tif o.From != nil {\n\t\t\tqrFrom = *o.From\n\t\t}\n\t\tqFrom := qrFrom\n\t\tif qFrom != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int32\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Region != nil {\n\n\t\t// query param region\n\t\tvar qrRegion string\n\t\tif o.Region != nil {\n\t\t\tqrRegion = *o.Region\n\t\t}\n\t\tqRegion := qrRegion\n\t\tif qRegion != \"\" {\n\t\t\tif err := r.SetQueryParam(\"region\", qRegion); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.To != nil {\n\n\t\t// query param to\n\t\tvar qrTo string\n\t\tif o.To != nil {\n\t\t\tqrTo = *o.To\n\t\t}\n\t\tqTo := qrTo\n\t\tif qTo != \"\" {\n\t\t\tif err := r.SetQueryParam(\"to\", qTo); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SyncStatusUsingGETParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param namespaceSelfLinkId\n\tif err := r.SetPathParam(\"namespaceSelfLinkId\", o.NamespaceSelfLinkID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param requestId\n\tif err := r.SetPathParam(\"requestId\", o.RequestID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.Authorization != nil {\n\n\t\t// header param Authorization\n\t\tif err := r.SetHeaderParam(\"Authorization\", *o.Authorization); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Country != nil {\n\n\t\t// query param country\n\t\tvar qrCountry string\n\t\tif o.Country != nil {\n\t\t\tqrCountry = *o.Country\n\t\t}\n\t\tqCountry := qrCountry\n\t\tif qCountry != \"\" {\n\t\t\tif err := r.SetQueryParam(\"country\", qCountry); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Email != nil {\n\n\t\t// query param email\n\t\tvar qrEmail string\n\t\tif o.Email != nil {\n\t\t\tqrEmail = *o.Email\n\t\t}\n\t\tqEmail := qrEmail\n\t\tif qEmail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"email\", qEmail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesFields := o.Fields\n\n\tjoinedFields := swag.JoinByFormat(valuesFields, \"csv\")\n\t// query array param fields\n\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.PersonID != nil {\n\n\t\t// query param person_id\n\t\tvar qrPersonID string\n\t\tif o.PersonID != nil {\n\t\t\tqrPersonID = *o.PersonID\n\t\t}\n\t\tqPersonID := qrPersonID\n\t\tif qPersonID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"person_id\", qPersonID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetDeviceHealthParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param deviceId\n\tif err := r.SetPathParam(\"deviceId\", o.DeviceID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdatePatientParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param ID\n\tif err := r.SetPathParam(\"ID\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Patient != nil {\n\t\tif err := r.SetBodyParam(o.Patient); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateCustomIDPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.CustomIDP != nil {\n\t\tif err := r.SetBodyParam(o.CustomIDP); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param aid\n\tif err := r.SetPathParam(\"aid\", o.Aid); err != nil {\n\t\treturn err\n\t}\n\n\t// path param iid\n\tif err := r.SetPathParam(\"iid\", o.Iid); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tid\n\tif err := r.SetPathParam(\"tid\", o.Tid); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetSeriesIDFilterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AcceptLanguage != nil {\n\n\t\t// header param Accept-Language\n\t\tif err := r.SetHeaderParam(\"Accept-Language\", *o.AcceptLanguage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\t// query param keys\n\tqrKeys := o.Keys\n\tqKeys := qrKeys\n\tif qKeys != \"\" {\n\t\tif err := r.SetQueryParam(\"keys\", qKeys); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AccountID != nil {\n\n\t\t// query param accountId\n\t\tvar qrAccountID string\n\t\tif o.AccountID != nil {\n\t\t\tqrAccountID = *o.AccountID\n\t\t}\n\t\tqAccountID := qrAccountID\n\t\tif qAccountID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accountId\", qAccountID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param workspaceId\n\tif err := r.SetPathParam(\"workspaceId\", swag.FormatInt64(o.WorkspaceID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *OrgGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param org\n\tif err := r.SetPathParam(\"org\", o.Org); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetVersioningPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Description != nil {\n\n\t\t// query param Description\n\t\tvar qrDescription string\n\t\tif o.Description != nil {\n\t\t\tqrDescription = *o.Description\n\t\t}\n\t\tqDescription := qrDescription\n\t\tif qDescription != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Description\", qDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IgnoreFilesGreaterThan != nil {\n\n\t\t// query param IgnoreFilesGreaterThan\n\t\tvar qrIgnoreFilesGreaterThan string\n\t\tif o.IgnoreFilesGreaterThan != nil {\n\t\t\tqrIgnoreFilesGreaterThan = *o.IgnoreFilesGreaterThan\n\t\t}\n\t\tqIgnoreFilesGreaterThan := qrIgnoreFilesGreaterThan\n\t\tif qIgnoreFilesGreaterThan != \"\" {\n\t\t\tif err := r.SetQueryParam(\"IgnoreFilesGreaterThan\", qIgnoreFilesGreaterThan); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaxSizePerFile != nil {\n\n\t\t// query param MaxSizePerFile\n\t\tvar qrMaxSizePerFile string\n\t\tif o.MaxSizePerFile != nil {\n\t\t\tqrMaxSizePerFile = *o.MaxSizePerFile\n\t\t}\n\t\tqMaxSizePerFile := qrMaxSizePerFile\n\t\tif qMaxSizePerFile != \"\" {\n\t\t\tif err := r.SetQueryParam(\"MaxSizePerFile\", qMaxSizePerFile); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaxTotalSize != nil {\n\n\t\t// query param MaxTotalSize\n\t\tvar qrMaxTotalSize string\n\t\tif o.MaxTotalSize != nil {\n\t\t\tqrMaxTotalSize = *o.MaxTotalSize\n\t\t}\n\t\tqMaxTotalSize := qrMaxTotalSize\n\t\tif qMaxTotalSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"MaxTotalSize\", qMaxTotalSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param Name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param Uuid\n\tif err := r.SetPathParam(\"Uuid\", o.UUID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.VersionsDataSourceBucket != nil {\n\n\t\t// query param VersionsDataSourceBucket\n\t\tvar qrVersionsDataSourceBucket string\n\t\tif o.VersionsDataSourceBucket != nil {\n\t\t\tqrVersionsDataSourceBucket = *o.VersionsDataSourceBucket\n\t\t}\n\t\tqVersionsDataSourceBucket := qrVersionsDataSourceBucket\n\t\tif qVersionsDataSourceBucket != \"\" {\n\t\t\tif err := r.SetQueryParam(\"VersionsDataSourceBucket\", qVersionsDataSourceBucket); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.VersionsDataSourceName != nil {\n\n\t\t// query param VersionsDataSourceName\n\t\tvar qrVersionsDataSourceName string\n\t\tif o.VersionsDataSourceName != nil {\n\t\t\tqrVersionsDataSourceName = *o.VersionsDataSourceName\n\t\t}\n\t\tqVersionsDataSourceName := qrVersionsDataSourceName\n\t\tif qVersionsDataSourceName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"VersionsDataSourceName\", qVersionsDataSourceName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ExtrasGraphsReadParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBuildPropertiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param buildId\n\tif err := r.SetPathParam(\"buildId\", swag.FormatInt32(o.BuildID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *AdminGetBannedDevicesV4Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif o.DeviceType != nil {\n\n\t\t// query param deviceType\n\t\tvar qrDeviceType string\n\t\tif o.DeviceType != nil {\n\t\t\tqrDeviceType = *o.DeviceType\n\t\t}\n\t\tqDeviceType := qrDeviceType\n\t\tif qDeviceType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"deviceType\", qDeviceType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.EndDate != nil {\n\n\t\t// query param endDate\n\t\tvar qrEndDate string\n\t\tif o.EndDate != nil {\n\t\t\tqrEndDate = *o.EndDate\n\t\t}\n\t\tqEndDate := qrEndDate\n\t\tif qEndDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"endDate\", qEndDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.StartDate != nil {\n\n\t\t// query param startDate\n\t\tvar qrStartDate string\n\t\tif o.StartDate != nil {\n\t\t\tqrStartDate = *o.StartDate\n\t\t}\n\t\tqStartDate := qrStartDate\n\t\tif qStartDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"startDate\", qStartDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "func (o *BikePointGetAllParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *DecryptParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Parameters); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *DeleteRequestsRequestNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// query param requestName\n\tqrRequestName := o.RequestName\n\tqRequestName := qrRequestName\n\tif qRequestName != \"\" {\n\t\tif err := r.SetQueryParam(\"requestName\", qRequestName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Synchronous != nil {\n\n\t\t// query param synchronous\n\t\tvar qrSynchronous bool\n\t\tif o.Synchronous != nil {\n\t\t\tqrSynchronous = *o.Synchronous\n\t\t}\n\t\tqSynchronous := swag.FormatBool(qrSynchronous)\n\t\tif qSynchronous != \"\" {\n\t\t\tif err := r.SetQueryParam(\"synchronous\", qSynchronous); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SearchAbsoluteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Decorate != nil {\n\n\t\t// query param decorate\n\t\tvar qrDecorate bool\n\t\tif o.Decorate != nil {\n\t\t\tqrDecorate = *o.Decorate\n\t\t}\n\t\tqDecorate := swag.FormatBool(qrDecorate)\n\t\tif qDecorate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"decorate\", qDecorate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param from\n\tqrFrom := o.From\n\tqFrom := qrFrom\n\tif qFrom != \"\" {\n\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param query\n\tqrQuery := o.Query\n\tqQuery := qrQuery\n\tif qQuery != \"\" {\n\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param to\n\tqrTo := o.To\n\tqTo := qrTo\n\tif qTo != \"\" {\n\t\tif err := r.SetQueryParam(\"to\", qTo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetCountersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.ClusterNodeID != nil {\n\n\t\t// query param clusterNodeId\n\t\tvar qrClusterNodeID string\n\n\t\tif o.ClusterNodeID != nil {\n\t\t\tqrClusterNodeID = *o.ClusterNodeID\n\t\t}\n\t\tqClusterNodeID := qrClusterNodeID\n\t\tif qClusterNodeID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"clusterNodeId\", qClusterNodeID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Nodewise != nil {\n\n\t\t// query param nodewise\n\t\tvar qrNodewise bool\n\n\t\tif o.Nodewise != nil {\n\t\t\tqrNodewise = *o.Nodewise\n\t\t}\n\t\tqNodewise := swag.FormatBool(qrNodewise)\n\t\tif qNodewise != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"nodewise\", qNodewise); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *MetroclusterInterconnectGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param adapter\n\tif err := r.SetPathParam(\"adapter\", o.Adapter); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// binding items for fields\n\t\tjoinedFields := o.bindParamFields(reg)\n\n\t\t// query array param fields\n\t\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param node.uuid\n\tif err := r.SetPathParam(\"node.uuid\", o.NodeUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param partner_type\n\tif err := r.SetPathParam(\"partner_type\", o.PartnerType); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Item != nil {\n\t\tif err := r.SetBodyParam(o.Item); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param itemId\n\tif err := r.SetPathParam(\"itemId\", o.ItemID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateAccessPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *DeleteDataSourceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.APIKey != nil {\n\n\t\t// query param ApiKey\n\t\tvar qrAPIKey string\n\n\t\tif o.APIKey != nil {\n\t\t\tqrAPIKey = *o.APIKey\n\t\t}\n\t\tqAPIKey := qrAPIKey\n\t\tif qAPIKey != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ApiKey\", qAPIKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.APISecret != nil {\n\n\t\t// query param ApiSecret\n\t\tvar qrAPISecret string\n\n\t\tif o.APISecret != nil {\n\t\t\tqrAPISecret = *o.APISecret\n\t\t}\n\t\tqAPISecret := qrAPISecret\n\t\tif qAPISecret != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ApiSecret\", qAPISecret); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.CreationDate != nil {\n\n\t\t// query param CreationDate\n\t\tvar qrCreationDate int32\n\n\t\tif o.CreationDate != nil {\n\t\t\tqrCreationDate = *o.CreationDate\n\t\t}\n\t\tqCreationDate := swag.FormatInt32(qrCreationDate)\n\t\tif qCreationDate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"CreationDate\", qCreationDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Disabled != nil {\n\n\t\t// query param Disabled\n\t\tvar qrDisabled bool\n\n\t\tif o.Disabled != nil {\n\t\t\tqrDisabled = *o.Disabled\n\t\t}\n\t\tqDisabled := swag.FormatBool(qrDisabled)\n\t\tif qDisabled != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"Disabled\", qDisabled); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.EncryptionKey != nil {\n\n\t\t// query param EncryptionKey\n\t\tvar qrEncryptionKey string\n\n\t\tif o.EncryptionKey != nil {\n\t\t\tqrEncryptionKey = *o.EncryptionKey\n\t\t}\n\t\tqEncryptionKey := qrEncryptionKey\n\t\tif qEncryptionKey != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"EncryptionKey\", qEncryptionKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.EncryptionMode != nil {\n\n\t\t// query param EncryptionMode\n\t\tvar qrEncryptionMode string\n\n\t\tif o.EncryptionMode != nil {\n\t\t\tqrEncryptionMode = *o.EncryptionMode\n\t\t}\n\t\tqEncryptionMode := qrEncryptionMode\n\t\tif qEncryptionMode != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"EncryptionMode\", qEncryptionMode); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.FlatStorage != nil {\n\n\t\t// query param FlatStorage\n\t\tvar qrFlatStorage bool\n\n\t\tif o.FlatStorage != nil {\n\t\t\tqrFlatStorage = *o.FlatStorage\n\t\t}\n\t\tqFlatStorage := swag.FormatBool(qrFlatStorage)\n\t\tif qFlatStorage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"FlatStorage\", qFlatStorage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.LastSynchronizationDate != nil {\n\n\t\t// query param LastSynchronizationDate\n\t\tvar qrLastSynchronizationDate int32\n\n\t\tif o.LastSynchronizationDate != nil {\n\t\t\tqrLastSynchronizationDate = *o.LastSynchronizationDate\n\t\t}\n\t\tqLastSynchronizationDate := swag.FormatInt32(qrLastSynchronizationDate)\n\t\tif qLastSynchronizationDate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"LastSynchronizationDate\", qLastSynchronizationDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param Name\n\tif err := r.SetPathParam(\"Name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ObjectsBaseFolder != nil {\n\n\t\t// query param ObjectsBaseFolder\n\t\tvar qrObjectsBaseFolder string\n\n\t\tif o.ObjectsBaseFolder != nil {\n\t\t\tqrObjectsBaseFolder = *o.ObjectsBaseFolder\n\t\t}\n\t\tqObjectsBaseFolder := qrObjectsBaseFolder\n\t\tif qObjectsBaseFolder != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsBaseFolder\", qObjectsBaseFolder); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsBucket != nil {\n\n\t\t// query param ObjectsBucket\n\t\tvar qrObjectsBucket string\n\n\t\tif o.ObjectsBucket != nil {\n\t\t\tqrObjectsBucket = *o.ObjectsBucket\n\t\t}\n\t\tqObjectsBucket := qrObjectsBucket\n\t\tif qObjectsBucket != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsBucket\", qObjectsBucket); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsHost != nil {\n\n\t\t// query param ObjectsHost\n\t\tvar qrObjectsHost string\n\n\t\tif o.ObjectsHost != nil {\n\t\t\tqrObjectsHost = *o.ObjectsHost\n\t\t}\n\t\tqObjectsHost := qrObjectsHost\n\t\tif qObjectsHost != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsHost\", qObjectsHost); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsPort != nil {\n\n\t\t// query param ObjectsPort\n\t\tvar qrObjectsPort int32\n\n\t\tif o.ObjectsPort != nil {\n\t\t\tqrObjectsPort = *o.ObjectsPort\n\t\t}\n\t\tqObjectsPort := swag.FormatInt32(qrObjectsPort)\n\t\tif qObjectsPort != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsPort\", qObjectsPort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsSecure != nil {\n\n\t\t// query param ObjectsSecure\n\t\tvar qrObjectsSecure bool\n\n\t\tif o.ObjectsSecure != nil {\n\t\t\tqrObjectsSecure = *o.ObjectsSecure\n\t\t}\n\t\tqObjectsSecure := swag.FormatBool(qrObjectsSecure)\n\t\tif qObjectsSecure != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsSecure\", qObjectsSecure); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsServiceName != nil {\n\n\t\t// query param ObjectsServiceName\n\t\tvar qrObjectsServiceName string\n\n\t\tif o.ObjectsServiceName != nil {\n\t\t\tqrObjectsServiceName = *o.ObjectsServiceName\n\t\t}\n\t\tqObjectsServiceName := qrObjectsServiceName\n\t\tif qObjectsServiceName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsServiceName\", qObjectsServiceName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PeerAddress != nil {\n\n\t\t// query param PeerAddress\n\t\tvar qrPeerAddress string\n\n\t\tif o.PeerAddress != nil {\n\t\t\tqrPeerAddress = *o.PeerAddress\n\t\t}\n\t\tqPeerAddress := qrPeerAddress\n\t\tif qPeerAddress != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"PeerAddress\", qPeerAddress); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SkipSyncOnRestart != nil {\n\n\t\t// query param SkipSyncOnRestart\n\t\tvar qrSkipSyncOnRestart bool\n\n\t\tif o.SkipSyncOnRestart != nil {\n\t\t\tqrSkipSyncOnRestart = *o.SkipSyncOnRestart\n\t\t}\n\t\tqSkipSyncOnRestart := swag.FormatBool(qrSkipSyncOnRestart)\n\t\tif qSkipSyncOnRestart != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"SkipSyncOnRestart\", qSkipSyncOnRestart); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StorageType != nil {\n\n\t\t// query param StorageType\n\t\tvar qrStorageType string\n\n\t\tif o.StorageType != nil {\n\t\t\tqrStorageType = *o.StorageType\n\t\t}\n\t\tqStorageType := qrStorageType\n\t\tif qStorageType != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"StorageType\", qStorageType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.VersioningPolicyName != nil {\n\n\t\t// query param VersioningPolicyName\n\t\tvar qrVersioningPolicyName string\n\n\t\tif o.VersioningPolicyName != nil {\n\t\t\tqrVersioningPolicyName = *o.VersioningPolicyName\n\t\t}\n\t\tqVersioningPolicyName := qrVersioningPolicyName\n\t\tif qVersioningPolicyName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"VersioningPolicyName\", qVersioningPolicyName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Watch != nil {\n\n\t\t// query param Watch\n\t\tvar qrWatch bool\n\n\t\tif o.Watch != nil {\n\t\t\tqrWatch = *o.Watch\n\t\t}\n\t\tqWatch := swag.FormatBool(qrWatch)\n\t\tif qWatch != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"Watch\", qWatch); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}" ]
[ "0.71977514", "0.7144965", "0.7048539", "0.70218456", "0.69966507", "0.6996071", "0.69804245", "0.6979591", "0.6970317", "0.6967027", "0.69244057", "0.6908823", "0.6904387", "0.6871789", "0.6858", "0.685726", "0.6852516", "0.6845305", "0.6845069", "0.6842634", "0.6830272", "0.68289614", "0.6821759", "0.6821216", "0.6819364", "0.6810621", "0.67932916", "0.679315", "0.6786526", "0.6781682", "0.6778117", "0.67733014", "0.6761554", "0.67607415", "0.6760125", "0.6757061", "0.67503345", "0.67445445", "0.67441946", "0.6742838", "0.6741586", "0.67347354", "0.6733209", "0.67331254", "0.6732581", "0.6726233", "0.67240244", "0.6716503", "0.6712846", "0.6709579", "0.67083675", "0.6705736", "0.67019135", "0.6698905", "0.6694261", "0.66917866", "0.6685068", "0.6677112", "0.667091", "0.6670475", "0.66704094", "0.6667543", "0.6666059", "0.66656476", "0.66630673", "0.6656782", "0.6653621", "0.6647921", "0.66460824", "0.66433585", "0.6640434", "0.66380537", "0.6635323", "0.6634569", "0.6626148", "0.6621612", "0.6620548", "0.6618122", "0.66144466", "0.6606912", "0.6606749", "0.6603745", "0.6600316", "0.65994716", "0.65960574", "0.6595418", "0.65911394", "0.6586013", "0.6582893", "0.6582741", "0.6574897", "0.6573959", "0.6569623", "0.6568269", "0.6567428", "0.6567059", "0.6565599", "0.65624714", "0.65617853", "0.65610886", "0.6557677" ]
0.0
-1
GetClosedOrders returns array of open orders
func (c *client) GetClosedOrders(query *ClosedOrdersQuery) (*CloseOrders, error) { err := query.Check() if err != nil { return nil, err } qp, err := common.QueryParamToMap(*query) if err != nil { return nil, err } resp, err := c.baseClient.Get("/orders/closed", qp) if err != nil { return nil, err } var orders CloseOrders if err := json.Unmarshal(resp, &orders); err != nil { return nil, err } return &orders, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (bc backendClient) QueryClosedOrders(addrStr, product, side string, start, end, page, perPage int) (orders []types.Order,\n\terr error) {\n\tperPageNum, err := params.CheckQueryOrdersParams(addrStr, product, side, start, end, page, perPage)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// field hideNoFill fixed by false\n\tjsonBytes, err := bc.GetCodec().MarshalJSON(\n\t\tbackendtypes.NewQueryOrderListParams(addrStr, product, side, page, perPageNum, int64(start), int64(end), false),\n\t)\n\tif err != nil {\n\t\treturn orders, utils.ErrMarshalJSON(err.Error())\n\t}\n\n\tpath := fmt.Sprintf(\"custom/%s/%s/closed\", backendtypes.QuerierRoute, backendtypes.QueryOrderList)\n\tres, _, err := bc.Query(path, jsonBytes)\n\tif err != nil {\n\t\treturn orders, utils.ErrClientQuery(err.Error())\n\t}\n\n\tif err = utils.UnmarshalListResponse(res, &orders); err != nil {\n\t\treturn orders, utils.ErrFilterDataFromListResponse(\"closed orders\", err.Error())\n\t}\n\n\treturn\n}", "func (c *Coinbene) FetchClosedOrders(symbol, latestID string) (OrdersInfo, error) {\n\tparams := url.Values{}\n\tparams.Set(\"symbol\", symbol)\n\tparams.Set(\"latestOrderId\", latestID)\n\tpath := coinbeneAPIVersion + coinbeneClosedOrders\n\tvar orders OrdersInfo\n\tfor i := int64(1); ; i++ {\n\t\ttemp := struct {\n\t\t\tData OrdersInfo `json:\"data\"`\n\t\t}{}\n\t\tparams.Set(\"pageNum\", strconv.FormatInt(i, 10))\n\t\terr := c.SendAuthHTTPRequest(exchange.RestSpot, http.MethodGet,\n\t\t\tpath,\n\t\t\tcoinbeneClosedOrders,\n\t\t\tfalse,\n\t\t\tparams,\n\t\t\t&temp,\n\t\t\tspotQueryClosedOrders)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor j := range temp.Data {\n\t\t\torders = append(orders, temp.Data[j])\n\t\t}\n\t\tif len(temp.Data) != 20 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn orders, nil\n}", "func TestGetClosedOrders(t *testing.T) {\n\tt.Parallel()\n\targs := GetClosedOrdersOptions{Trades: true, Start: \"OE4KV4-4FVQ5-V7XGPU\"}\n\t_, err := k.GetClosedOrders(context.Background(), args)\n\tif err == nil {\n\t\tt.Error(\"GetClosedOrders() Expected error\")\n\t}\n}", "func GetOpenOrders() (orders []Order, error error) {\n\tjsonData, err := doTauRequest(1, \"GET\", \"trading/myopenorders/\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GetOpenOrders->%v\", err)\n\t}\n\tlog.Tracef(\"jsonData=%s\", string(jsonData))\n\tif err := json.Unmarshal(jsonData, &orders); err != nil {\n\t\treturn nil, fmt.Errorf(\"GetOpenOrders->%v\", err)\n\t}\n\treturn orders, nil\n}", "func (bc backendClient) QueryOpenOrders(addrStr, product, side string, start, end, page, perPage int) (orders []types.Order,\n\terr error) {\n\tperPageNum, err := params.CheckQueryOrdersParams(addrStr, product, side, start, end, page, perPage)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// field hideNoFill fixed by false\n\tjsonBytes, err := bc.GetCodec().MarshalJSON(\n\t\tbackendtypes.NewQueryOrderListParams(addrStr, product, side, page, perPageNum, int64(start), int64(end), false),\n\t)\n\tif err != nil {\n\t\treturn orders, utils.ErrMarshalJSON(err.Error())\n\t}\n\n\tpath := fmt.Sprintf(\"custom/%s/%s/open\", backendtypes.QuerierRoute, backendtypes.QueryOrderList)\n\tres, _, err := bc.Query(path, jsonBytes)\n\tif err != nil {\n\t\treturn orders, utils.ErrClientQuery(err.Error())\n\t}\n\n\tif err = utils.UnmarshalListResponse(res, &orders); err != nil {\n\t\treturn orders, utils.ErrFilterDataFromListResponse(\"open orders\", err.Error())\n\t}\n\n\treturn\n}", "func (h *HUOBIHADAX) GetOpenOrders(accountID, symbol, side string, size int) ([]OrderInfo, error) {\n\ttype response struct {\n\t\tResponse\n\t\tOrders []OrderInfo `json:\"data\"`\n\t}\n\n\tvals := url.Values{}\n\tvals.Set(\"symbol\", symbol)\n\tvals.Set(\"accountID\", accountID)\n\tif len(side) > 0 {\n\t\tvals.Set(\"side\", side)\n\t}\n\tvals.Set(\"size\", fmt.Sprintf(\"%v\", size))\n\n\tvar result response\n\terr := h.SendAuthenticatedHTTPRequest(http.MethodGet, huobihadaxGetOpenOrders, vals, &result)\n\n\tif result.ErrorMessage != \"\" {\n\t\treturn nil, errors.New(result.ErrorMessage)\n\t}\n\n\treturn result.Orders, err\n}", "func (t *TauAPI) GetOpenOrders() (orders []Order, error error) {\n\tjsonData, err := t.doTauRequest(&TauReq{\n\t\tVersion: 1,\n\t\tMethod: \"GET\",\n\t\tPath: \"trading/myopenorders\",\n\t\tNeedsAuth: true,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GetOpenOrders->%v\", err)\n\t}\n\tif err := json.Unmarshal(jsonData, &orders); err != nil {\n\t\treturn nil, fmt.Errorf(\"GetOpenOrders->%v\", err)\n\t}\n\treturn orders, nil\n}", "func (h *HUOBI) GetOpenOrders(ctx context.Context, symbol currency.Pair, accountID, side string, size int64) ([]OrderInfo, error) {\n\tresp := struct {\n\t\tOrders []OrderInfo `json:\"data\"`\n\t}{}\n\n\tvals := url.Values{}\n\tsymbolValue, err := h.FormatSymbol(symbol, asset.Spot)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvals.Set(\"symbol\", symbolValue)\n\tvals.Set(\"accountID\", accountID)\n\tif len(side) > 0 {\n\t\tvals.Set(\"side\", side)\n\t}\n\tvals.Set(\"size\", strconv.FormatInt(size, 10))\n\n\terr = h.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodGet, huobiGetOpenOrders, vals, nil, &resp, false)\n\treturn resp.Orders, err\n}", "func (b *Bitmex) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error) {\n\terr := req.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tparams := OrdersRequest{\n\t\tFilter: \"{\\\"open\\\":true}\",\n\t}\n\tresp, err := b.GetOrders(ctx, &params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tformat, err := b.GetPairFormat(asset.PerpetualContract, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\torders := make([]order.Detail, len(resp))\n\tfor i := range resp {\n\t\tvar orderStatus order.Status\n\t\torderStatus, err = order.StringToOrderStatus(resp[i].OrdStatus)\n\t\tif err != nil {\n\t\t\tlog.Errorf(log.ExchangeSys, \"%s %v\", b.Name, err)\n\t\t}\n\t\tvar oType order.Type\n\t\toType, err = b.getOrderType(resp[i].OrdType)\n\t\tif err != nil {\n\t\t\tlog.Errorf(log.ExchangeSys, \"%s %v\", b.Name, err)\n\t\t}\n\t\torderDetail := order.Detail{\n\t\t\tDate: resp[i].Timestamp,\n\t\t\tPrice: resp[i].Price,\n\t\t\tAmount: resp[i].OrderQty,\n\t\t\tExecutedAmount: resp[i].CumQty,\n\t\t\tRemainingAmount: resp[i].LeavesQty,\n\t\t\tExchange: b.Name,\n\t\t\tOrderID: resp[i].OrderID,\n\t\t\tSide: orderSideMap[resp[i].Side],\n\t\t\tStatus: orderStatus,\n\t\t\tType: oType,\n\t\t\tPair: currency.NewPairWithDelimiter(resp[i].Symbol,\n\t\t\t\tresp[i].SettlCurrency,\n\t\t\t\tformat.Delimiter),\n\t\t}\n\n\t\torders[i] = orderDetail\n\t}\n\treturn req.Filter(b.Name, orders), nil\n}", "func (h *HitBTC) GetOpenOrders(ctx context.Context, currency string) ([]OrderHistoryResponse, error) {\n\tvalues := url.Values{}\n\tvalues.Set(\"symbol\", currency)\n\tvar result []OrderHistoryResponse\n\n\treturn result, h.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodGet,\n\t\tapiv2OpenOrders,\n\t\tvalues,\n\t\ttradingRequests,\n\t\t&result)\n}", "func (c *Client) OpenOrders(symbol Symbol) ([]Order, error) {\n\tparams := []func(url.Values){}\n\n\tif symbol != zeroSymbol {\n\t\tparams = append(params, param(\"symbol\", symbol))\n\t}\n\n\tresults := make([]Order, 0, 100)\n\terr := c.signedCall(&results, \"GET\", \"/api/v3/openOrders\", params...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn results, nil\n}", "func (p *Poloniex) GetOpenOrders(ctx context.Context, currency string) (OpenOrdersResponse, error) {\n\tvalues := url.Values{}\n\tvalues.Set(\"currencyPair\", currency)\n\tresult := OpenOrdersResponse{}\n\treturn result, p.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, poloniexOrders, values, &result.Data)\n}", "func (h *Hbdm) OpenOrders(symbol string, pageIndex, pageSize *int) (orders *OrdersResponse, err error) {\n\tpayload := make(map[string]interface{}, 3)\n\tif symbol != \"\" {\n\t\tpayload[\"symbol\"] = symbol\n\t}\n\tif pageIndex != nil {\n\t\tpayload[\"page_index\"] = *pageIndex\n\t}\n\tif pageSize != nil {\n\t\tpayload[\"page_size\"] = *pageSize\n\t}\n\n\tr, err := h.client.do(\"POST\", \"contract_openorders\", payload, true)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar response interface{}\n\tif err = json.Unmarshal(r, &response); err != nil {\n\t\treturn\n\t}\n\n\tif err = handleErr(response); err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(r, &orders)\n\treturn\n}", "func (api *API) GetOpenOrders(accountName string) ([]*OpenOrders, error) {\n\tvar resp []*OpenOrders\n\terr := api.call(\"market_history\", \"get_open_orders\", []string{accountName}, &resp)\n\treturn resp, err\n}", "func (k *Kraken) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error) {\n\tresp, err := k.GetOpenOrders(OrderInfoOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar orders []exchange.OrderDetail\n\tfor i := range resp.Open {\n\t\tsymbol := currency.NewPairDelimiter(resp.Open[i].Descr.Pair,\n\t\t\tk.ConfigCurrencyPairFormat.Delimiter)\n\t\torderDate := time.Unix(int64(resp.Open[i].StartTm), 0)\n\t\tside := exchange.OrderSide(strings.ToUpper(resp.Open[i].Descr.Type))\n\n\t\torders = append(orders, exchange.OrderDetail{\n\t\t\tID: i,\n\t\t\tAmount: resp.Open[i].Vol,\n\t\t\tRemainingAmount: (resp.Open[i].Vol - resp.Open[i].VolExec),\n\t\t\tExecutedAmount: resp.Open[i].VolExec,\n\t\t\tExchange: k.Name,\n\t\t\tOrderDate: orderDate,\n\t\t\tPrice: resp.Open[i].Price,\n\t\t\tOrderSide: side,\n\t\t\tCurrencyPair: symbol,\n\t\t})\n\t}\n\n\texchange.FilterOrdersByTickRange(&orders, getOrdersRequest.StartTicks,\n\t\tgetOrdersRequest.EndTicks)\n\texchange.FilterOrdersBySide(&orders, getOrdersRequest.OrderSide)\n\texchange.FilterOrdersByCurrencies(&orders, getOrdersRequest.Currencies)\n\n\treturn orders, nil\n}", "func TestGetOpenOrders(t *testing.T) {\n\tt.Parallel()\n\targs := OrderInfoOptions{Trades: true}\n\t_, err := k.GetOpenOrders(context.Background(), args)\n\tif err == nil {\n\t\tt.Error(\"GetOpenOrders() Expected error\")\n\t}\n}", "func (k *Kraken) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error) {\n\treq := GetClosedOrdersOptions{}\n\tif getOrdersRequest.StartTicks.Unix() > 0 {\n\t\treq.Start = fmt.Sprintf(\"%v\", getOrdersRequest.StartTicks.Unix())\n\t}\n\tif getOrdersRequest.EndTicks.Unix() > 0 {\n\t\treq.End = fmt.Sprintf(\"%v\", getOrdersRequest.EndTicks.Unix())\n\t}\n\n\tresp, err := k.GetClosedOrders(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar orders []exchange.OrderDetail\n\tfor i := range resp.Closed {\n\t\tsymbol := currency.NewPairDelimiter(resp.Closed[i].Descr.Pair,\n\t\t\tk.ConfigCurrencyPairFormat.Delimiter)\n\t\torderDate := time.Unix(int64(resp.Closed[i].StartTm), 0)\n\t\tside := exchange.OrderSide(strings.ToUpper(resp.Closed[i].Descr.Type))\n\n\t\torders = append(orders, exchange.OrderDetail{\n\t\t\tID: i,\n\t\t\tAmount: resp.Closed[i].Vol,\n\t\t\tRemainingAmount: (resp.Closed[i].Vol - resp.Closed[i].VolExec),\n\t\t\tExecutedAmount: resp.Closed[i].VolExec,\n\t\t\tExchange: k.Name,\n\t\t\tOrderDate: orderDate,\n\t\t\tPrice: resp.Closed[i].Price,\n\t\t\tOrderSide: side,\n\t\t\tCurrencyPair: symbol,\n\t\t})\n\t}\n\n\texchange.FilterOrdersBySide(&orders, getOrdersRequest.OrderSide)\n\texchange.FilterOrdersByCurrencies(&orders, getOrdersRequest.Currencies)\n\n\treturn orders, nil\n}", "func (c *Coinbene) GetSwapOpenOrders(symbol string, pageNum, pageSize int) (SwapOrders, error) {\n\tv := url.Values{}\n\tv.Set(\"symbol\", symbol)\n\tif pageNum != 0 {\n\t\tv.Set(\"pageNum\", strconv.Itoa(pageNum))\n\t}\n\tif pageSize != 0 {\n\t\tv.Set(\"pageSize\", strconv.Itoa(pageSize))\n\t}\n\ttype resp struct {\n\t\tData SwapOrders `json:\"data\"`\n\t}\n\tvar r resp\n\tpath := coinbeneAPIVersion + coinbeneOpenOrders\n\terr := c.SendAuthHTTPRequest(exchange.RestSwap, http.MethodGet,\n\t\tpath,\n\t\tcoinbeneOpenOrders,\n\t\ttrue,\n\t\tv,\n\t\t&r,\n\t\tcontractGetOpenOrders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.Data, nil\n}", "func (h *HUOBI) GetOrders(ctx context.Context, symbol currency.Pair, types, start, end, states, from, direct, size string) ([]OrderInfo, error) {\n\tresp := struct {\n\t\tOrders []OrderInfo `json:\"data\"`\n\t}{}\n\n\tvals := url.Values{}\n\tsymbolValue, err := h.FormatSymbol(symbol, asset.Spot)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvals.Set(\"symbol\", symbolValue)\n\tvals.Set(\"states\", states)\n\n\tif types != \"\" {\n\t\tvals.Set(\"types\", types)\n\t}\n\n\tif start != \"\" {\n\t\tvals.Set(\"start-date\", start)\n\t}\n\n\tif end != \"\" {\n\t\tvals.Set(\"end-date\", end)\n\t}\n\n\tif from != \"\" {\n\t\tvals.Set(\"from\", from)\n\t}\n\n\tif direct != \"\" {\n\t\tvals.Set(\"direct\", direct)\n\t}\n\n\tif size != \"\" {\n\t\tvals.Set(\"size\", size)\n\t}\n\n\terr = h.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodGet, huobiGetOrders, vals, nil, &resp, false)\n\treturn resp.Orders, err\n}", "func (h *HUOBIHADAX) GetOrders(symbol, types, start, end, states, from, direct, size string) ([]OrderInfo, error) {\n\ttype response struct {\n\t\tResponse\n\t\tOrders []OrderInfo `json:\"data\"`\n\t}\n\n\tvals := url.Values{}\n\tvals.Set(\"symbol\", symbol)\n\tvals.Set(\"states\", states)\n\n\tif types != \"\" {\n\t\tvals.Set(\"types\", types)\n\t}\n\n\tif start != \"\" {\n\t\tvals.Set(\"start-date\", start)\n\t}\n\n\tif end != \"\" {\n\t\tvals.Set(\"end-date\", end)\n\t}\n\n\tif from != \"\" {\n\t\tvals.Set(\"from\", from)\n\t}\n\n\tif direct != \"\" {\n\t\tvals.Set(\"direct\", direct)\n\t}\n\n\tif size != \"\" {\n\t\tvals.Set(\"size\", size)\n\t}\n\n\tvar result response\n\terr := h.SendAuthenticatedHTTPRequest(http.MethodGet, huobihadaxGetOrders, vals, &result)\n\n\tif result.ErrorMessage != \"\" {\n\t\treturn nil, errors.New(result.ErrorMessage)\n\t}\n\treturn result.Orders, err\n}", "func GetOrders() (orders []Orders, err error) {\r\n\tvar rows *sql.Rows\r\n\tif rows, err = Get(`select * from orders where deleted_at is null order by created_at desc;`); err != nil {\r\n\t\tCheckError(\"Error getting Orders.\", err, false)\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tdefer rows.Close()\r\n\tfor rows.Next() {\r\n\t\torder := Orders{}\r\n\t\tif err = rows.Scan(&order.ID, &order.DocEntry, &order.DocNum, &order.Canceled, &order.CardCode, &order.CardName, &order.VatSum, &order.DocTotal, &order.Synced, &order.CreatedBy, &order.CreatedAt, &order.UpdatedAt, &order.DeletedAt, &order.Comment, &order.Returned, &order.DiscountApprovedBy); err != nil {\r\n\t\t\tCheckError(\"Error Scanning Orders.\", err, false)\r\n\t\t} else {\r\n\t\t\torders = append(orders, order)\r\n\t\t}\r\n\t}\r\n\r\n\treturn\r\n}", "func (c *Coinbene) FetchOpenSpotOrders(symbol string) (OrdersInfo, error) {\n\tparams := url.Values{}\n\tparams.Set(\"symbol\", symbol)\n\tpath := coinbeneAPIVersion + coinbeneOpenOrders\n\tvar orders OrdersInfo\n\tfor i := int64(1); ; i++ {\n\t\ttemp := struct {\n\t\t\tData OrdersInfo `json:\"data\"`\n\t\t}{}\n\t\tparams.Set(\"pageNum\", strconv.FormatInt(i, 10))\n\t\terr := c.SendAuthHTTPRequest(exchange.RestSpot, http.MethodGet,\n\t\t\tpath,\n\t\t\tcoinbeneOpenOrders,\n\t\t\tfalse,\n\t\t\tparams,\n\t\t\t&temp,\n\t\t\tspotQueryOpenOrders)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor j := range temp.Data {\n\t\t\torders = append(orders, temp.Data[j])\n\t\t}\n\n\t\tif len(temp.Data) != 20 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn orders, nil\n}", "func (wbs *impl) Orders() orders.Interface { return wbs.ods }", "func (e *Huobi) GetOrders(stockType string) interface{} {\n\tstockType = strings.ToUpper(stockType)\n\tif _, ok := e.stockTypeMap[stockType]; !ok {\n\t\te.logger.Log(constant.ERROR, \"\", 0.0, 0.0, \"GetOrders() error, unrecognized stockType: \", stockType)\n\t\treturn false\n\t}\n\tresult, err := services.GetOrders(e.stockTypeMap[stockType] + \"usdt\")\n\tif err != nil {\n\t\te.logger.Log(constant.ERROR, \"\", 0.0, 0.0, \"GetOrders() error, \", err)\n\t\treturn false\n\t}\n\tif result.Status != \"ok\" {\n\t\te.logger.Log(constant.ERROR, \"\", 0.0, 0.0, \"GetOrders() error, \", result.ErrMsg)\n\t\treturn false\n\t}\n\torders := []Order{}\n\tcount := len(result.Data)\n\tfor i := 0; i < count; i++ {\n\t\torders = append(orders, Order{\n\t\t\tID: fmt.Sprint(result.Data[i].ID),\n\t\t\tPrice: conver.Float64Must(result.Data[i].Price),\n\t\t\tAmount: conver.Float64Must(result.Data[i].Amount),\n\t\t\tDealAmount: conver.Float64Must(result.Data[i].DealAmount),\n\t\t\tTradeType: e.tradeTypeMap[result.Data[i].TradeType],\n\t\t\tStockType: stockType,\n\t\t})\n\t}\n\treturn orders\n}", "func (c *Coinbene) GetSwapOpenOrdersByPage(symbol string, latestOrderID int64) (SwapOrders, error) {\n\tv := url.Values{}\n\tif symbol != \"\" {\n\t\tv.Set(\"symbol\", symbol)\n\t}\n\tif latestOrderID != 0 {\n\t\tv.Set(\"latestOrderId\", strconv.FormatInt(latestOrderID, 10))\n\t}\n\ttype resp struct {\n\t\tData SwapOrders `json:\"data\"`\n\t}\n\tvar r resp\n\tpath := coinbeneAPIVersion + coinbeneOpenOrdersByPage\n\terr := c.SendAuthHTTPRequest(exchange.RestSwap, http.MethodGet,\n\t\tpath,\n\t\tcoinbeneOpenOrdersByPage,\n\t\ttrue,\n\t\tv,\n\t\t&r,\n\t\tcontractOpenOrdersByPage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.Data, nil\n}", "func (c *CoinbasePro) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error) {\n\terr := req.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar respOrders []GeneralizedOrderResponse\n\tvar fPair currency.Pair\n\tfor i := range req.Pairs {\n\t\tfPair, err = c.FormatExchangeCurrency(req.Pairs[i], asset.Spot)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar resp []GeneralizedOrderResponse\n\t\tresp, err = c.GetOrders(ctx,\n\t\t\t[]string{\"open\", \"pending\", \"active\"},\n\t\t\tfPair.String())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trespOrders = append(respOrders, resp...)\n\t}\n\n\tformat, err := c.GetPairFormat(asset.Spot, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\torders := make([]order.Detail, len(respOrders))\n\tfor i := range respOrders {\n\t\tvar curr currency.Pair\n\t\tcurr, err = currency.NewPairDelimiter(respOrders[i].ProductID,\n\t\t\tformat.Delimiter)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar side order.Side\n\t\tside, err = order.StringToOrderSide(respOrders[i].Side)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar orderType order.Type\n\t\torderType, err = order.StringToOrderType(respOrders[i].Type)\n\t\tif err != nil {\n\t\t\tlog.Errorf(log.ExchangeSys, \"%s %v\", c.Name, err)\n\t\t}\n\t\torders[i] = order.Detail{\n\t\t\tOrderID: respOrders[i].ID,\n\t\t\tAmount: respOrders[i].Size,\n\t\t\tExecutedAmount: respOrders[i].FilledSize,\n\t\t\tType: orderType,\n\t\t\tDate: respOrders[i].CreatedAt,\n\t\t\tSide: side,\n\t\t\tPair: curr,\n\t\t\tExchange: c.Name,\n\t\t}\n\t}\n\treturn req.Filter(c.Name, orders), nil\n}", "func (h *HitBTC) GetActiveorders(ctx context.Context, currency string) ([]Order, error) {\n\tvar resp []Order\n\terr := h.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodGet,\n\t\torders+\"?symbol=\"+currency,\n\t\turl.Values{},\n\t\ttradingRequests,\n\t\t&resp)\n\n\treturn resp, err\n}", "func getCurrentOrders(userName string, isAdmin bool) ([]viewOrder, error) {\r\n\r\n\tviewOrderSlice := make([]viewOrder, 0)\r\n\tpizzaSlice, _ := pizzaList.GetAllPizza()\r\n\torderQSlice, err := orderQueue.GetAllOrders(userName, isAdmin)\r\n\r\n\tif err != nil {\r\n\t\treturn viewOrderSlice, err\r\n\t} else {\r\n\t\tfor idx1, val1 := range orderQSlice {\r\n\t\t\torderSlice := val1.OrderSlice\r\n\t\t\tviewOrderItemSlice := make([]viewOrderItem, 0)\r\n\r\n\t\t\tfor idx2, val2 := range orderSlice {\r\n\t\t\t\tfor _, val3 := range pizzaSlice {\r\n\t\t\t\t\tif val2.PizzaNo == val3.PizzaNo {\r\n\t\t\t\t\t\tpizzaOrder := viewOrderItem{idx2 + 1, val2.PizzaNo, val3.PizzaName, fmt.Sprintf(\"%.2f\", val3.PizzaPrice), val2.OrderQty, \"\", \"\"}\r\n\t\t\t\t\t\tviewOrderItemSlice = append(viewOrderItemSlice, pizzaOrder)\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tviewOrder := viewOrder{idx1 + 1, val1.OrderNo, viewOrderItemSlice, fmt.Sprintf(\"%.2f\", val1.TotalCost), val1.UserName}\r\n\t\t\tviewOrderSlice = append(viewOrderSlice, viewOrder)\r\n\t\t}\r\n\t}\r\n\r\n\treturn viewOrderSlice, nil\r\n}", "func FetchInvoicesClosed(r Result) []uint64 {\n\tbr, ok := r.(*BillingResult)\n\tif !ok {\n\t\tpanic(\"ERR: Fetch invoices closed from a non-billing result\")\n\t}\n\treturn br.InvoicesClosed\n}", "func getOrders(shopCode string) error {\n\n\tmethods := []string{\"gy.erp.trade.history.get\", \"gy.erp.trade.get\"}\n\tpgSize, _ := strconv.Atoi(config.Config(\"PAGE_SIZE\"))\n\n\tif err := saveOrders(pgSize, shopCode, methods); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (h *HUOBI) GetSwapOpenOrders(ctx context.Context, contractCode currency.Pair, pageIndex, pageSize int64) (SwapOpenOrdersData, error) {\n\tvar resp SwapOpenOrdersData\n\treq := make(map[string]interface{})\n\tcodeValue, err := h.FormatSymbol(contractCode, asset.CoinMarginedFutures)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\treq[\"contract_code\"] = codeValue\n\tif pageIndex != 0 {\n\t\treq[\"page_index\"] = pageIndex\n\t}\n\tif pageSize > 0 && pageSize <= 50 {\n\t\treq[\"page_size\"] = pageSize\n\t}\n\treturn resp, h.FuturesAuthenticatedHTTPRequest(ctx, exchange.RestFutures, http.MethodPost, huobiSwapOpenOrders, nil, req, &resp)\n}", "func GetOrders() ([]byte, error) {\n\tvar db, _ = sql.Open(\"sqlite3\", \"cache/users.sqlite3\")\n\tdefer db.Close()\n\tvar ou string\n\tvar ta, ts int64 \n\tq, err := db.Query(\"select ouid, chargedamount, timestamp from orders\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\t\n\tvar a []interface{}\n\t\n\tfor q.Next() {\n\t\tq.Scan(&ou, &ta, &ts)\n\t\tb := make(map[string]interface{})\t\n\t\tb[\"ouid\"] = ou\n\t\tb[\"chargedamount\"] = float64(ta)/100\n\t\t// b[\"timestamp\"] = ts\n\t\tb[\"timestamp\"] = string(time.Unix(ts, 0).Format(\"02.01.2006 15:04:05\"))\n\t\ta = append(a, b)\n\t}\n\t\n\tgetord, err := json.Marshal(a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t\treturn getord, nil\n}", "func (h *HitBTC) GetOrders(ctx context.Context, currency string) ([]OrderHistoryResponse, error) {\n\tvalues := url.Values{}\n\tvalues.Set(\"symbol\", currency)\n\tvar result []OrderHistoryResponse\n\n\treturn result, h.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodGet,\n\t\tapiV2OrderHistory,\n\t\tvalues,\n\t\ttradingRequests,\n\t\t&result)\n}", "func (company *Company) Orders() []*Order {\n\tif company == nil {\n\t\treturn nil\n\t}\n\n\treturn company.orders\n}", "func (by *Bybit) GetUSDCLargeOrders(ctx context.Context, symbol currency.Pair, limit int64) ([]USDCLargeOrder, error) {\n\tresp := struct {\n\t\tData []USDCLargeOrder `json:\"result\"`\n\t\tUSDCError\n\t}{}\n\n\tparams := url.Values{}\n\tif symbol.IsEmpty() {\n\t\treturn nil, errSymbolMissing\n\t}\n\tsymbolValue, err := by.FormatSymbol(symbol, asset.USDCMarginedFutures)\n\tif err != nil {\n\t\treturn resp.Data, err\n\t}\n\tparams.Set(\"symbol\", symbolValue)\n\n\tif limit > 0 && limit <= 100 {\n\t\tparams.Set(\"limit\", strconv.FormatInt(limit, 10))\n\t}\n\treturn resp.Data, by.SendHTTPRequest(ctx, exchange.RestUSDCMargined, common.EncodeURLValues(usdcfuturesGetLargeOrders, params), usdcPublicRate, &resp)\n}", "func (app *App) GetOrders(page, perPage int, snapshotID string) (*rpc.GetOrdersResponse, error) {\n\tordersInfos := []*zeroex.AcceptedOrderInfo{}\n\tif perPage <= 0 {\n\t\treturn &rpc.GetOrdersResponse{\n\t\t\tOrdersInfos: ordersInfos,\n\t\t\tSnapshotID: snapshotID,\n\t\t}, nil\n\t}\n\n\tvar snapshot *db.Snapshot\n\tif snapshotID == \"\" {\n\t\t// Create a new snapshot\n\t\tsnapshotID = uuid.New().String()\n\t\tvar err error\n\t\tsnapshot, err = app.db.Orders.GetSnapshot()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\texpirationTimestamp := time.Now().Add(1 * time.Minute)\n\t\tapp.snapshotExpirationWatcher.Add(expirationTimestamp, snapshotID)\n\t\tapp.muIdToSnapshotInfo.Lock()\n\t\tapp.idToSnapshotInfo[snapshotID] = snapshotInfo{\n\t\t\tSnapshot: snapshot,\n\t\t\tExpirationTimestamp: expirationTimestamp,\n\t\t}\n\t\tapp.muIdToSnapshotInfo.Unlock()\n\t} else {\n\t\t// Try and find an existing snapshot\n\t\tapp.muIdToSnapshotInfo.Lock()\n\t\tinfo, ok := app.idToSnapshotInfo[snapshotID]\n\t\tif !ok {\n\t\t\tapp.muIdToSnapshotInfo.Unlock()\n\t\t\treturn nil, ErrSnapshotNotFound{id: snapshotID}\n\t\t}\n\t\tsnapshot = info.Snapshot\n\t\t// Reset the snapshot's expiry\n\t\tapp.snapshotExpirationWatcher.Remove(info.ExpirationTimestamp, snapshotID)\n\t\texpirationTimestamp := time.Now().Add(1 * time.Minute)\n\t\tapp.snapshotExpirationWatcher.Add(expirationTimestamp, snapshotID)\n\t\tapp.idToSnapshotInfo[snapshotID] = snapshotInfo{\n\t\t\tSnapshot: snapshot,\n\t\t\tExpirationTimestamp: expirationTimestamp,\n\t\t}\n\t\tapp.muIdToSnapshotInfo.Unlock()\n\t}\n\n\tnotRemovedFilter := app.db.Orders.IsRemovedIndex.ValueFilter([]byte{0})\n\tvar selectedOrders []*meshdb.Order\n\terr := snapshot.NewQuery(notRemovedFilter).Offset(page * perPage).Max(perPage).Run(&selectedOrders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, order := range selectedOrders {\n\t\tordersInfos = append(ordersInfos, &zeroex.AcceptedOrderInfo{\n\t\t\tOrderHash: order.Hash,\n\t\t\tSignedOrder: order.SignedOrder,\n\t\t\tFillableTakerAssetAmount: order.FillableTakerAssetAmount,\n\t\t})\n\t}\n\n\tgetOrdersResponse := &rpc.GetOrdersResponse{\n\t\tSnapshotID: snapshotID,\n\t\tOrdersInfos: ordersInfos,\n\t}\n\n\treturn getOrdersResponse, nil\n}", "func (c *Coinbene) GetSwapOrderHistory(beginTime, endTime, symbol string, pageNum,\n\tpageSize int, direction, orderType string) (SwapOrders, error) {\n\tv := url.Values{}\n\tif beginTime != \"\" {\n\t\tv.Set(\"beginTime\", beginTime)\n\t}\n\tif endTime != \"\" {\n\t\tv.Set(\"endTime\", endTime)\n\t}\n\tv.Set(\"symbol\", symbol)\n\tif pageNum != 0 {\n\t\tv.Set(\"pageNum\", strconv.Itoa(pageNum))\n\t}\n\tif pageSize != 0 {\n\t\tv.Set(\"pageSize\", strconv.Itoa(pageSize))\n\t}\n\tif direction != \"\" {\n\t\tv.Set(\"direction\", direction)\n\t}\n\tif orderType != \"\" {\n\t\tv.Set(\"orderType\", orderType)\n\t}\n\n\ttype resp struct {\n\t\tData SwapOrders `json:\"data\"`\n\t}\n\n\tvar r resp\n\tpath := coinbeneAPIVersion + coinbeneClosedOrders\n\terr := c.SendAuthHTTPRequest(exchange.RestSwap, http.MethodGet,\n\t\tpath,\n\t\tcoinbeneClosedOrders,\n\t\ttrue,\n\t\tv,\n\t\t&r,\n\t\tcontractGetClosedOrders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.Data, nil\n}", "func (controller OrderController) GetOrders() *graphql.Field {\n\treturn &graphql.Field{\n\t\tType: graphql.NewList(ordertype.OrderType),\n\t\tArgs: graphql.FieldConfigArgument{\n\t\t\t\"token\": &graphql.ArgumentConfig{\n\t\t\t\tType: graphql.String,\n\t\t\t},\n\t\t\t\"skip\": &graphql.ArgumentConfig{\n\t\t\t\tType: graphql.Int,\n\t\t\t},\n\t\t\t\"limit\": &graphql.ArgumentConfig{\n\t\t\t\tType: graphql.Int,\n\t\t\t},\n\t\t},\n\t\tResolve: func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\ttoken, _ := p.Args[\"token\"].(string)\n\t\t\tskip, _ := p.Args[\"skip\"].(int)\n\t\t\tlimit, _ := p.Args[\"limit\"].(int)\n\n\t\t\tuser, _ := controller.usercase.ParseToken(p.Context, token)\n\n\t\t\torders, err := controller.ordercase.GetOrders(p.Context, user, skip, limit)\n\n\t\t\treturn orders, err\n\t\t},\n\t}\n\n}", "func getCompletedOrders(userName string, isAdmin bool) []viewOrder {\r\n\r\n\tmyCompletedOrderSlice := make([]viewOrder, 0)\r\n\r\n\tif !isAdmin {\r\n\t\ti := 0\r\n\t\tfor _, val1 := range completedOrderSlice {\r\n\t\t\tif val1.UserName == userName {\r\n\t\t\t\tmyCompletedOrderSlice = append(myCompletedOrderSlice, val1)\r\n\t\t\t\tmyCompletedOrderSlice[i].IdxNo = i + 1\r\n\t\t\t\ti++\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\treturn completedOrderSlice\r\n\t}\r\n\r\n\treturn myCompletedOrderSlice\r\n}", "func GetOrders(db *sqlx.DB) gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\n\t\tvar user1 User\n\t\tuserName, exists := c.Get(\"user\")\n\t\tif !exists {\n\t\t\tc.AbortWithError(503, errors.NewAPIError(503, \"failed to get user\", \"internal server error\", c))\n\t\t\treturn\n\t\t}\n\n\t\tdbErr := db.Get(&user1, \"SELECT * FROM gaea.user WHERE user_name=$1\", userName)\n\t\tif dbErr != nil {\n\t\t\tc.AbortWithError(503, errors.NewAPIError(503, \"failed to get user\", \"internal server error\", c))\n\t\t\treturn\n\t\t}\n\n\t\tvar memberStatus bool\n\t\tswitch {\n\t\tcase user1.Role == \"nonmember\":\n\t\t\tmemberStatus = false\n\t\tdefault:\n\t\t\tmemberStatus = true\n\t\t}\n\n\t\tvar ords []Order\n\t\tvar retOrds []Order\n\t\tvar qtyOrd int\n\n\t\terr1 := db.Get(&qtyOrd, `SELECT COUNT(*) FROM gaea.order WHERE user_name=$1`,\n\t\t\tuserName)\n\t\tif err1 != nil {\n\t\t\tfmt.Println(err1)\n\t\t\tc.AbortWithError(503, errors.NewAPIError(503, \"failed to get orders\", \"internal server error\", c))\n\t\t\treturn\n\t\t}\n\t\tif qtyOrd > 0 {\n\t\t\terr2 := db.Select(&ords, `SELECT * FROM gaea.order WHERE user_name=$1`,\n\t\t\t\tuserName)\n\t\t\tif err2 != nil {\n\t\t\t\tfmt.Println(err2)\n\t\t\t\tc.AbortWithError(503, errors.NewAPIError(503, \"failed to get orders\", \"internal server error\", c))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar amtErr error\n\n\t\t\tfor _, order := range ords {\n\t\t\t\torder.ItemQty, order.AmountTotal, amtErr = CalcOrderTotals(order.OrderId, memberStatus, db)\n\t\t\t\tif amtErr != nil {\n\t\t\t\t\tfmt.Printf(\"%s\", amtErr)\n\t\t\t\t}\n\t\t\t\tretOrds = append(retOrds, order)\n\t\t\t}\n\t\t}\n\n\t\tc.JSON(200, gin.H{\"qty\": qtyOrd, \"orders\": retOrds})\n\t}\n}", "func (s *Client) GetOrders(options *types.Options) (orders []*types.Order, err error) {\n\turl := baseURL + \"/orders\"\n\tquery := util.ParseOptions(options)\n\tsign, err := s.sign(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbody, err := s.getResponse(url, \"GET\", sign, query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(body, &orders)\n\treturn\n}", "func (v *Kounta) GetOrders(token string, company string, siteID string) ([]Order, error) {\n\tclient := &http.Client{}\n\tclient.CheckRedirect = checkRedirectFunc\n\n\tu, _ := url.ParseRequestURI(baseURL)\n\tu.Path = fmt.Sprintf(ordersURL, company, siteID)\n\turlStr := fmt.Sprintf(\"%v\", u)\n\n\tr, err := http.NewRequest(\"GET\", urlStr, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr.Header = http.Header(make(map[string][]string))\n\tr.Header.Set(\"Accept\", \"application/json\")\n\tr.Header.Set(\"Authorization\", \"Bearer \"+token)\n\n\tres, err := client.Do(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trawResBody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode == 200 {\n\t\tvar resp []Order\n\n\t\t//fmt.Println(string(rawResBody))\n\n\t\terr = json.Unmarshal(rawResBody, &resp)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn resp, nil\n\t}\n\treturn nil, fmt.Errorf(\"Failed to get Kounta Categories %s\", res.Status)\n\n}", "func (s *ApiService) GetOrders(ctx context.Context, orderId string) (ordf.ImplResponse, error) {\n\t// TODO: implement long polling on separate polling API\n\t// will need to update SDK to pass in last known state and check for change\n\torder, err := s.ordersService.GetOrder(ctx, orderId)\n\tif err != nil {\n\t\treturn ordf.Response(500, nil), err\n\t}\n\n\treturn ordf.Response(200, order), nil\n}", "func returnAllOrders(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tfmt.Fprintf(w, \"Welcome to the returnAllOrders!\")\n\tfmt.Println(\"Endpoint Hit: returnAllOrders\")\n\n\tvar orders []Orders\n\n\tresults, err := db.Query(\"select orders.id, users.username, stocks.symbol, shares from orders inner join users on orders.user_id = users.id inner join stocks on orders.stock_id = stocks.id\")\n\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tfor results.Next() {\n\t\tvar order Orders\n\t\terr = results.Scan(&order.ID, &order.Username, &order.Symbol, &order.Shares)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\torders = append(orders, order)\n\t}\n\tjson.NewEncoder(w).Encode(orders)\n}", "func (a *App) getOrders(w http.ResponseWriter, r *http.Request) {\n\tpage, err := strconv.Atoi(r.URL.Query().Get(\"page\"))\n\tif err != nil {\n\t\thelpers.RespondWithError(w, http.StatusBadRequest, \"INVALID_PAGE_NUMBER\")\n\t\treturn\n\t}\n\n\tlimit, err := strconv.Atoi(r.URL.Query().Get(\"limit\"))\n\tif err != nil {\n\t\thelpers.RespondWithError(w, http.StatusBadRequest, \"INVALID_LIMIT_NUMBER\")\n\t\treturn\n\t}\n\n\tOrders, err := models.GetOrders(a.DB, (page - 1), limit)\n\tif err != nil {\n\t\thelpers.RespondWithError(w, http.StatusInternalServerError, \"DB_CONNECTION_ERR\")\n\t\treturn\n\t}\n\tif len(Orders) == 0 {\n\t\thelpers.RespondWithError(w, http.StatusInternalServerError, \"DATA_NOT_FOUND\")\n\t\treturn\n\t}\n\thelpers.RespondWithJSON(w, http.StatusOK, Orders)\n}", "func (ob *OrderBookGroup) Get() (books []schemas.OrderBook, err error) {\n\tvar b []byte\n\tvar resp orderbook\n\tif len(ob.symbols) == 0 {\n\t\terr = errors.New(\"[POLONIEX] Symbol is empty\")\n\t\treturn\n\t}\n\n\tfor _, symb := range ob.symbols {\n\t\tsymbol := symb.OriginalName\n\t\tquery := httpclient.Params()\n\t\tquery.Set(\"command\", commandOrderBook)\n\t\tquery.Set(\"currencyPair\", symbol)\n\t\tquery.Set(\"depth\", \"200\")\n\n\t\tif b, err = ob.httpClient.Get(restURL, query, false); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif err = json.Unmarshal(b, &resp); err != nil {\n\t\t\treturn\n\t\t}\n\t\tbooks = append(books, ob.mapHTTPSnapshot(symb.Name, resp))\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\n\treturn\n}", "func (keeper *PersistentOrderKeeper) GetOrdersAtHeight(ctx sdk.Context, height int64) []*types.Order {\n\tstore := ctx.KVStore(keeper.marketKey)\n\tvar result []*types.Order\n\tstart := myposchain.ConcatKeys(\n\t\tOrderQueueKeyPrefix,\n\t\t[]byte(keeper.symbol),\n\t\t[]byte{0x0},\n\t\tint64ToBigEndianBytes(height),\n\t)\n\tend := myposchain.ConcatKeys(\n\t\tOrderQueueKeyPrefix,\n\t\t[]byte(keeper.symbol),\n\t\t[]byte{0x0},\n\t\tint64ToBigEndianBytes(height+1),\n\t)\n\titer := store.Iterator(start, end)\n\tdefer iter.Close()\n\tfor ; iter.Valid(); iter.Next() {\n\t\tikey := iter.Key()\n\t\torderID := string(ikey[len(end):])\n\t\torder := keeper.getOrder(ctx, orderID)\n\t\tresult = append(result, order)\n\t}\n\treturn result\n}", "func GetOrders(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\n\tif id == \"\" {\n\t\terrors.ErrRequiredParam(c.Writer, http.StatusBadRequest, \"order id is required\")\n\t\treturn\n\t}\n\n\torder, err := s.client.GetOrder(id)\n\tif err != nil {\n\t\ts.l.Printf(\"failed to request order information: %s\\n\", err)\n\t\treturn\n\t}\n\n\tmodels.Respond(c.Writer, order)\n\treturn\n}", "func (t *TauAPI) CloseAllOrders() error {\n\torders, err := t.GetOpenOrders()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"CloseAllOrders ->%v\", err)\n\t}\n\tfor _, o := range orders {\n\t\tif err := t.CloseOrder(o.OrderID); err != nil {\n\t\t\treturn fmt.Errorf(\"CloseAllOrders Deleting Order %d ->%v\", o.ID, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (o *OrderBook) ob(side pb.OrderSide) *OrderList {\n\tif side == pb.OrderSide_ASK {\n\t\treturn &o.Asks\n\t} else if side == pb.OrderSide_BID {\n\t\treturn &o.Bids\n\t}\n\tlog.Fatalln(\"Invalid order side.\")\n\treturn nil\n}", "func (c *Client) AllOrders(symbol Symbol) ([]Order, error) {\n\tresults := make([]Order, 0, 100)\n\terr := c.signedCall(&results, \"GET\", \"/api/v3/allOrders\", param(\"symbol\", symbol))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn results, nil\n}", "func (env Env) ListOrders(filter checkout.OrderFilter, page gorest.Pagination) (checkout.CMSOrderList, error) {\n\tdefer env.logger.Sync()\n\tsugar := env.logger.Sugar()\n\n\twhere := filter.SQLWhere()\n\tcountCh := make(chan int64)\n\tlistCh := make(chan checkout.CMSOrderList)\n\n\tgo func() {\n\t\tdefer close(countCh)\n\t\tn, err := env.countOrder(where)\n\t\tif err != nil {\n\t\t\tsugar.Error(err)\n\t\t}\n\n\t\tcountCh <- n\n\t}()\n\n\tgo func() {\n\t\tdefer close(listCh)\n\n\t\torders, err := env.listOrders(where, page)\n\n\t\tlistCh <- checkout.CMSOrderList{\n\t\t\tPagedList: pkg.PagedList{\n\t\t\t\tTotal: 0,\n\t\t\t\tPagination: gorest.Pagination{},\n\t\t\t\tErr: err,\n\t\t\t},\n\t\t\tData: orders,\n\t\t}\n\t}()\n\n\tcount, listResult := <-countCh, <-listCh\n\tif listResult.Err != nil {\n\t\treturn checkout.CMSOrderList{}, listResult.Err\n\t}\n\n\treturn checkout.CMSOrderList{\n\t\tPagedList: pkg.PagedList{\n\t\t\tTotal: count,\n\t\t\tPagination: page,\n\t\t\tErr: nil,\n\t\t},\n\t\tData: listResult.Data,\n\t}, nil\n}", "func (svc *svc) ListOrders(ctx context.Context, query model.OrderQuery) ([]model.Order, int64, error) {\n\torders, err := svc.repo.ListOrders(ctx, query)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\ttotal, err := svc.repo.CountOrders(ctx, query)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\treturn orders, total, nil\n}", "func (p *bitsharesAPI) GetLimitOrders(base, quote objects.GrapheneObject, limit int) (objects.LimitOrders, error) {\n\tif limit > GetLimitOrdersLimit {\n\t\tlimit = GetLimitOrdersLimit\n\t}\n\n\tvar result objects.LimitOrders\n\terr := p.call(p.databaseAPIID, \"get_limit_orders\", &result, base.Id(), quote.Id(), limit)\n\treturn result, err\n}", "func (p *bitsharesAPI) GetCallOrders(assetID objects.GrapheneObject, limit int) ([]objects.CallOrder, error) {\n\tif limit > GetCallOrdersLimit {\n\t\tlimit = GetCallOrdersLimit\n\t}\n\n\tvar result []objects.CallOrder\n\terr := p.call(p.databaseAPIID, \"get_call_orders\", &result, assetID.Id(), limit)\n\treturn result, err\n}", "func CloseAllOrders() error {\n\tlog.Info(\"closing all orders...\")\n\torders, err := GetOpenOrders()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"CloseAllOrders ->%v\", err)\n\t}\n\tfor _, o := range orders {\n\t\tif err := CloseOrder(o.ID); err != nil {\n\t\t\treturn fmt.Errorf(\"CloseAllOrders Deleting Order %d ->%v\", o.ID, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Coinbene) GetSwapOrderHistoryByOrderID(beginTime, endTime, symbol, status string,\n\tlatestOrderID int64) (SwapOrders, error) {\n\tv := url.Values{}\n\tif beginTime != \"\" {\n\t\tv.Set(\"beginTime\", beginTime)\n\t}\n\tif endTime != \"\" {\n\t\tv.Set(\"endTime\", endTime)\n\t}\n\tif symbol != \"\" {\n\t\tv.Set(\"symbol\", symbol)\n\t}\n\tif status != \"\" {\n\t\tv.Set(\"status\", status)\n\t}\n\tif latestOrderID != 0 {\n\t\tv.Set(\"latestOrderId\", strconv.FormatInt(latestOrderID, 10))\n\t}\n\ttype resp struct {\n\t\tData SwapOrders `json:\"data\"`\n\t}\n\n\tvar r resp\n\tpath := coinbeneAPIVersion + coinbeneClosedOrdersByPage\n\terr := c.SendAuthHTTPRequest(exchange.RestSwap, http.MethodGet,\n\t\tpath,\n\t\tcoinbeneClosedOrdersByPage,\n\t\ttrue,\n\t\tv,\n\t\t&r,\n\t\tcontractGetClosedOrdersbyPage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.Data, nil\n}", "func (keeper *PersistentGlobalOrderKeeper) GetAllOrders(ctx sdk.Context) []*types.Order {\n\tstore := ctx.KVStore(keeper.marketKey)\n\tvar result []*types.Order\n\tstart := myposchain.ConcatKeys(OrderBookKeyPrefix, []byte{0x0})\n\tend := myposchain.ConcatKeys(OrderBookKeyPrefix, []byte{0x1})\n\n\titer := store.Iterator(start, end)\n\tdefer iter.Close()\n\tfor ; iter.Valid(); iter.Next() {\n\t\torder := &types.Order{}\n\t\tkeeper.codec.MustUnmarshalBinaryBare(iter.Value(), order)\n\t\tresult = append(result, order)\n\t}\n\treturn result\n}", "func TestWsGetActiveOrders(t *testing.T) {\n\tsetupWsAuth(t)\n\tif _, err := h.wsGetActiveOrders(); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func (v *Kounta) GetOrdersComplete(token string, company string, siteID string, start string) ([]Order, error) {\n\tclient := &http.Client{}\n\tclient.CheckRedirect = checkRedirectFunc\n\n\tu, _ := url.ParseRequestURI(baseURL)\n\tu.Path = fmt.Sprintf(ordersCompleteURL, company, siteID)\n\turlStr := fmt.Sprintf(\"%v\", u)\n\n\tfmt.Println(\"u.Path \", u.Path)\n\n\t//urlStr += \"?created_gte=2018-08-28\"\n\tif start != \"\" {\n\t\turlStr += \"?start=\" + start\n\t}\n\n\t//fmt.Println(urlStr)\n\n\tr, err := http.NewRequest(\"GET\", urlStr, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr.Header = http.Header(make(map[string][]string))\n\tr.Header.Set(\"Accept\", \"application/json\")\n\tr.Header.Set(\"Authorization\", \"Bearer \"+token)\n\n\tres, err := client.Do(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trawResBody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode == 200 {\n\t\tvar resp []Order\n\n\t\tfmt.Println(res.Header[\"X-Next-Page\"])\n\n\t\t//\tfmt.Println(string(rawResBody))\n\n\t\terr = json.Unmarshal(rawResBody, &resp)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn resp, nil\n\t}\n\tfmt.Println(string(rawResBody))\n\treturn nil, fmt.Errorf(\"Failed to get Kounta Categories %s\", res.Status)\n\n}", "func (b *Bitmex) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error) {\n\terr := req.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tparams := OrdersRequest{}\n\tresp, err := b.GetOrders(ctx, &params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tformat, err := b.GetPairFormat(asset.PerpetualContract, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\torders := make([]order.Detail, len(resp))\n\tfor i := range resp {\n\t\torderSide := orderSideMap[resp[i].Side]\n\t\tvar orderStatus order.Status\n\t\torderStatus, err = order.StringToOrderStatus(resp[i].OrdStatus)\n\t\tif err != nil {\n\t\t\tlog.Errorf(log.ExchangeSys, \"%s %v\", b.Name, err)\n\t\t}\n\n\t\tpair := currency.NewPairWithDelimiter(resp[i].Symbol, resp[i].SettlCurrency, format.Delimiter)\n\n\t\tvar oType order.Type\n\t\toType, err = b.getOrderType(resp[i].OrdType)\n\t\tif err != nil {\n\t\t\tlog.Errorf(log.ExchangeSys, \"%s %v\", b.Name, err)\n\t\t}\n\n\t\torderDetail := order.Detail{\n\t\t\tPrice: resp[i].Price,\n\t\t\tAverageExecutedPrice: resp[i].AvgPx,\n\t\t\tAmount: resp[i].OrderQty,\n\t\t\tExecutedAmount: resp[i].CumQty,\n\t\t\tRemainingAmount: resp[i].LeavesQty,\n\t\t\tDate: resp[i].TransactTime,\n\t\t\tCloseTime: resp[i].Timestamp,\n\t\t\tExchange: b.Name,\n\t\t\tOrderID: resp[i].OrderID,\n\t\t\tSide: orderSide,\n\t\t\tStatus: orderStatus,\n\t\t\tType: oType,\n\t\t\tPair: pair,\n\t\t}\n\t\torderDetail.InferCostsAndTimes()\n\n\t\torders[i] = orderDetail\n\t}\n\treturn req.Filter(b.Name, orders), nil\n}", "func (p *Poloniex) GetLoanOrders(ctx context.Context, currency string) (LoanOrders, error) {\n\tresp := LoanOrders{}\n\tpath := fmt.Sprintf(\"/public?command=returnLoanOrders&currency=%s\", currency)\n\n\treturn resp, p.SendHTTPRequest(ctx, exchange.RestSpot, path, &resp)\n}", "func (trading *TradingProvider) Orders(symbols []schemas.Symbol) (orders []schemas.Order, err error) {\n\tif len(symbols) > 0 {\n\t\tfor _, symb := range symbols {\n\t\t\tordrs, err := trading.ordersBySymbol(symb.OriginalName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\torders = append(orders, ordrs...)\n\t\t}\n\t\treturn\n\t}\n\n\treturn trading.allOrders()\n}", "func (p *Poloniex) GetOpenOrdersForAllCurrencies(ctx context.Context) (OpenOrdersResponseAll, error) {\n\tvalues := url.Values{}\n\tvalues.Set(\"currencyPair\", \"all\")\n\tresult := OpenOrdersResponseAll{}\n\treturn result, p.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, poloniexOrders, values, &result.Data)\n}", "func GetCourierOrders(c buffalo.Context) error {\n\tcourier, err := GetCourierByUserID(c.Param(\"user_id\"), c)\n\tif err != nil {\n\t\treturn errors.WithStack(errors.New(\"could not find courier\"))\n\t}\n\ttx := c.Value(\"tx\").(*pop.Connection)\n\torders := &models.Orders{}\n\n\tif err := tx.Eager().Where(\"courier_id = ?\", courier.ID).All(orders); err != nil {\n\t\treturn c.Error(http.StatusInternalServerError, err)\n\t}\n\treturn c.Render(http.StatusOK, r.JSON(orders))\n}", "func (order *Order) Get(pan *Panaccess, params *url.Values) ([]Order, error) {\n\t//Everything has a limit\n\tif (*params).Get(\"limit\") == \"\" {\n\t\t(*params).Add(\"limit\", \"1000\")\n\t}\n\t//Call Function\n\tresp, err := pan.Call(\n\t\t\"getListOfOrders\",\n\t\tparams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//Retrieve all rows and parse as a slice of Subscriber\n\tvar rows GetOrdersFilterResponse\n\tbodyBytes, err := json.Marshal(resp.Answer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(bodyBytes, &rows)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !resp.Success {\n\t\treturn nil, errors.New(resp.ErrorMessage)\n\t}\n\treturn rows.OrderEntries, nil\n}", "func (m manager) AllOrders() (acmeserverless.Orders, error) {\n\t// Create a map of DynamoDB Attribute Values containing the table keys\n\t// for the access pattern PK = ORDER\n\tkm := make(map[string]*dynamodb.AttributeValue)\n\tkm[\":type\"] = &dynamodb.AttributeValue{\n\t\tS: aws.String(\"ORDER\"),\n\t}\n\n\t// Create the QueryInput\n\tqi := &dynamodb.QueryInput{\n\t\tTableName: aws.String(os.Getenv(\"TABLE\")),\n\t\tKeyConditionExpression: aws.String(\"PK = :type\"),\n\t\tExpressionAttributeValues: km,\n\t}\n\n\tqo, err := dbs.Query(qi)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\torders := make(acmeserverless.Orders, len(qo.Items))\n\n\tfor idx, ord := range qo.Items {\n\t\tstr := ord[\"OrderString\"].S\n\t\to, err := acmeserverless.UnmarshalOrder(*str)\n\t\tif err != nil {\n\t\t\tlog.Println(fmt.Sprintf(\"error unmarshalling order data: %s\", err.Error()))\n\t\t\tcontinue\n\t\t}\n\t\torders[idx] = o\n\t}\n\n\treturn orders, nil\n}", "func (c *Client) GetOrders(pageID int) *types.OrderList {\n\torders := &types.OrderList{}\n\tc.Client.Find(&orders.Items).Where(\"id >= ?\", pageID).Order(\"id\").Limit(pageSize + 1)\n\tif len(orders.Items) == pageSize+1 {\n\t\torders.NextPageID = orders.Items[len(orders.Items)-1].ID\n\t\torders.Items = orders.Items[:pageSize+1]\n\t}\n\treturn orders\n}", "func GetOrder(id int) (order Orders, err error) {\r\n\tvar rows *sql.Rows\r\n\tif rows, err = Get(fmt.Sprintf(`select * from orders o \r\n\t\tinner join ordereditems i on o.id = i.orderid \r\n\t\twhere o.id = %d and o.deleted_at is null;`, id)); err != nil {\r\n\t\tCheckError(\"Error getting Order data.\", err, false)\r\n\t\treturn Orders{}, err\r\n\t}\r\n\tdefer rows.Close()\r\n\r\n\tvar items []OrderedItems\r\n\tfor rows.Next() {\r\n\t\titem := OrderedItems{}\r\n\r\n\t\tif err = rows.Scan(&order.ID, &order.DocEntry, &order.DocNum, &order.Canceled, &order.CardCode, &order.CardName, &order.VatSum,\r\n\t\t\t&order.DocTotal, &order.Synced, &order.CreatedBy, &order.CreatedAt, &order.UpdatedAt, &order.DeletedAt, &order.Comment,\r\n\t\t\t&order.Returned, &order.DiscountApprovedBy, &item.ID, &item.OrderID, &item.ItemCode, &item.ItemName, &item.Price,\r\n\t\t\t&item.Quantity, &item.Discount, &item.SerialNumber); err != nil {\r\n\t\t\tCheckError(\"Error Scanning Order.\", err, false)\r\n\t\t} else {\r\n\t\t\titems = append(items, item)\r\n\t\t}\r\n\t}\r\n\r\n\torder.Items = items\r\n\treturn\r\n}", "func (t *TauAPI) GetMarketOrders(market string) (MarketOrders, error) {\n\tvar mo MarketOrders\n\tvar maxBid, minAsk float64\n\tjsonData, err := t.doTauRequest(&TauReq{\n\t\tVersion: 1,\n\t\tMethod: \"GET\",\n\t\tPath: \"trading/orders?market=\" + strings.ToLower(market),\n\t})\n\tif err != nil {\n\t\treturn mo, fmt.Errorf(\"TauGetMarketOrders ->%s\", err.Error())\n\t}\n\tif err := json.Unmarshal(jsonData, &mo); err != nil {\n\t\treturn mo, err\n\t}\n\tmaxBid = 0.0\n\tfor _, b := range mo.Bids {\n\t\tbid, _ := strconv.ParseFloat(b.Price.String(), 64)\n\t\tmaxBid = math.Max(bid, maxBid)\n\t}\n\tif len(mo.Asks) == 0 {\n\t\tminAsk = maxBid + 0.01\n\t} else {\n\t\tminAsk, _ = strconv.ParseFloat(mo.Asks[0].Price.String(), 64)\n\t\tfor _, a := range mo.Asks {\n\t\t\task, _ := strconv.ParseFloat(a.Price.String(), 64)\n\t\t\tminAsk = math.Min(ask, minAsk)\n\t\t}\n\t}\n\tmo.MaxBid = maxBid\n\tmo.MinAsk = minAsk\n\treturn mo, nil\n}", "func (w *ServerInterfaceWrapper) GetOrders(ctx echo.Context) error {\n\tvar err error\n\n\tctx.Set(ApiKeyAuthScopes, []string{\"\"})\n\n\t// Parameter object where we will unmarshal all parameters from the context\n\tvar params GetOrdersParams\n\t// ------------- Optional query parameter \"symbol\" -------------\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"symbol\", ctx.QueryParams(), &params.Symbol)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter symbol: %s\", err))\n\t}\n\n\t// ------------- Optional query parameter \"from\" -------------\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"from\", ctx.QueryParams(), &params.From)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter from: %s\", err))\n\t}\n\n\t// ------------- Optional query parameter \"to\" -------------\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"to\", ctx.QueryParams(), &params.To)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter to: %s\", err))\n\t}\n\n\t// ------------- Optional query parameter \"status\" -------------\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"status\", ctx.QueryParams(), &params.Status)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter status: %s\", err))\n\t}\n\n\t// ------------- Optional query parameter \"limit\" -------------\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"limit\", ctx.QueryParams(), &params.Limit)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter limit: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.GetOrders(ctx, params)\n\treturn err\n}", "func (p *bitsharesAPI) GetSettleOrders(assetID objects.GrapheneObject, limit int) ([]objects.SettleOrder, error) {\n\tif limit > GetSettleOrdersLimit {\n\t\tlimit = GetSettleOrdersLimit\n\t}\n\n\tvar result []objects.SettleOrder\n\terr := p.call(p.databaseAPIID, \"get_settle_orders\", &result, assetID.Id(), limit)\n\treturn result, err\n}", "func (it *WyvernExchangeOrdersMatchedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "func GetOrders(page int, limit int) ([]*Order, error) {\n\tvar orders []*Order\n\n\terr := db.Offset(page * limit).Limit(limit).Find(&orders).Error\n\tif err != nil && err != gorm.ErrRecordNotFound {\n\t\treturn nil, err\n\t}\n\n\treturn orders, nil\n}", "func OrdersHandler(c buffalo.Context) error {\n\ttx := c.Value(\"tx\").(*pop.Connection)\n\n\tfilters := ordersFilters{\n\t\tStartDate: time.Now().AddDate(0, -1, 0),\n\t\tEndDate: time.Now(),\n\t}\n\n\tif err := c.Bind(&filters); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind arguments\")\n\t}\n\n\tfmt.Printf(\"params: %+v\\n\", c.Params())\n\tfmt.Printf(\"filters(after bind): %+v\\n\", filters)\n\n\t// Reset times so we do not get results based on current time\n\tfilters.StartDate = time.Date(\n\t\tfilters.StartDate.Year(),\n\t\tfilters.StartDate.Month(),\n\t\tfilters.StartDate.Day(),\n\t\t0,\n\t\t0,\n\t\t0,\n\t\t0,\n\t\tfilters.StartDate.Location(),\n\t)\n\tfilters.EndDate = time.Date(\n\t\tfilters.EndDate.Year(),\n\t\tfilters.EndDate.Month(),\n\t\tfilters.EndDate.Day(),\n\t\t0,\n\t\t0,\n\t\t0,\n\t\t0,\n\t\tfilters.EndDate.Location(),\n\t)\n\n\torders := models.Orders{}\n\n\tquery := tx.Where(\"date >= ?\", filters.StartDate)\n\tquery = query.Where(\"date < ?\", filters.EndDate.AddDate(0, 0, 1)) // We want to include end of the day, meaning starting of next day\n\terr := query.All(&orders)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to fetch all the orders\")\n\t}\n\n\tc.Set(\"orders\", orders)\n\tc.Set(\"filters\", filters)\n\n\ttotalWithoutVAT := 0.0\n\ttotalWithVAT := 0.0\n\ttotalVAT := 0.0\n\tfor i := range orders {\n\n\t\tfmt.Printf(\"wut %+v\\n\", orders[i])\n\t\tif err := tx.Load(&orders[i], \"Rows\"); err != nil {\n\t\t\treturn errors.Wrap(err, \"could not load order rows\")\n\t\t}\n\t\ttotalWithoutVAT += orders[i].TotalWithoutVAT()\n\t\ttotalWithVAT += orders[i].TotalWithVAT()\n\t\ttotalVAT += orders[i].TotalVAT()\n\t}\n\n\tc.Set(\"totalWithoutVAT\", totalWithoutVAT)\n\tc.Set(\"totalWithVAT\", totalWithVAT)\n\tc.Set(\"totalVAT\", totalVAT)\n\n\treturn c.Render(200, r.HTML(\"orders.html\"))\n}", "func (r *CompanySalesOrdersCollectionRequest) Get(ctx context.Context) ([]SalesOrder, error) {\n\treturn r.GetN(ctx, 0)\n}", "func (b *Binance) GetOrdersBySymbol(symbol string) []Operation {\n\torders, err := b.client.NewListOrdersService().Symbol(symbol).\n\t\tDo(context.Background())\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn []Operation{}\n\t}\n\topr := []Operation{}\n\tfmt.Println(orders[0].Price)\n\treturn opr\n}", "func GetAllOrders(service order.Service) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\torders, err := service.GetAllOrders(r.Context())\n\t\tif err != nil {\n\t\t\tutils.RespondJSON(w, err.Code, err.Error())\n\t\t\treturn\n\t\t}\n\t\tresponse := make([]response.Order, 0)\n\t\tfor _, order := range orders {\n\t\t\tresponse = append(response, toOrderResponse(order))\n\t\t}\n\t\tutils.RespondJSON(w, http.StatusOK, response)\n\t})\n}", "func (o *OrderBook) cob(side pb.OrderSide) *OrderList {\n\tif side == pb.OrderSide_ASK {\n\t\treturn &o.Bids\n\t} else if side == pb.OrderSide_BID {\n\t\treturn &o.Asks\n\t}\n\tlog.Fatalln(\"Invalid order side.\")\n\treturn nil\n}", "func (client ModelClient) GetClosedList(ctx context.Context, appID uuid.UUID, versionID string, clEntityID uuid.UUID) (result ClosedListEntityExtractor, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ModelClient.GetClosedList\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetClosedListPreparer(ctx, appID, versionID, clEntityID)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"authoring.ModelClient\", \"GetClosedList\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetClosedListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"authoring.ModelClient\", \"GetClosedList\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetClosedListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"authoring.ModelClient\", \"GetClosedList\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (s *Store) GetAllOrders() (l []interface{}, err error) {\n\treturn s.w.Get(s.orders, models.Order{})\n}", "func (p *Poloniex) GetOpenLoanOffers(ctx context.Context) (map[string][]LoanOffer, error) {\n\ttype Response struct {\n\t\tData map[string][]LoanOffer\n\t}\n\tresult := Response{}\n\n\terr := p.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, poloniexOpenLoanOffers, url.Values{}, &result.Data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif result.Data == nil {\n\t\treturn nil, errors.New(\"there are no open loan offers\")\n\t}\n\n\treturn result.Data, nil\n}", "func (wc *WooCommerce) GetOrders(page int) ([]models.Order, error) {\n\tbody, err := wc.GetOrdersJSON(page)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result []models.Order\n\tif err := json.Unmarshal(body, &result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "func GetOrderBook(baseURL string, symbol string, limit int) *t.OrderBook {\n\tvar url strings.Builder\n\n\tfmt.Fprintf(&url, \"%s/depth?symbol=%s&limit=%d\", baseURL, symbol, limit)\n\tdata, err := h.Get(url.String())\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tvar bids, asks []t.ExOrder\n\tresult := gjson.ParseBytes(data)\n\tfor _, bid := range result.Get(\"bids\").Array() {\n\t\tb := bid.Array()\n\t\tbids = append(bids, t.ExOrder{\n\t\t\tPrice: b[0].Float(),\n\t\t\tQty: b[1].Float(),\n\t\t})\n\t}\n\tfor _, ask := range result.Get(\"asks\").Array() {\n\t\ta := ask.Array()\n\t\tasks = append(asks, t.ExOrder{\n\t\t\tPrice: a[0].Float(),\n\t\t\tQty: a[1].Float(),\n\t\t})\n\t}\n\treturn &t.OrderBook{\n\t\tSymbol: symbol,\n\t\tBids: bids,\n\t\tAsks: asks,\n\t}\n}", "func (p *Poloniex) GetOrderbook(ctx context.Context, currencyPair string, depth int) (OrderbookAll, error) {\n\tvals := url.Values{}\n\n\tif depth != 0 {\n\t\tvals.Set(\"depth\", strconv.Itoa(depth))\n\t}\n\n\toba := OrderbookAll{Data: make(map[string]Orderbook)}\n\tif currencyPair != \"\" {\n\t\tvals.Set(\"currencyPair\", currencyPair)\n\t\tresp := OrderbookResponse{}\n\t\tpath := fmt.Sprintf(\"/public?command=returnOrderBook&%s\", vals.Encode())\n\t\terr := p.SendHTTPRequest(ctx, exchange.RestSpot, path, &resp)\n\t\tif err != nil {\n\t\t\treturn oba, err\n\t\t}\n\t\tif resp.Error != \"\" {\n\t\t\treturn oba, fmt.Errorf(\"%s GetOrderbook() error: %s\", p.Name, resp.Error)\n\t\t}\n\t\tob := Orderbook{\n\t\t\tBids: make([]OrderbookItem, len(resp.Bids)),\n\t\t\tAsks: make([]OrderbookItem, len(resp.Asks)),\n\t\t}\n\t\tfor x := range resp.Asks {\n\t\t\tprice, err := strconv.ParseFloat(resp.Asks[x][0].(string), 64)\n\t\t\tif err != nil {\n\t\t\t\treturn oba, err\n\t\t\t}\n\t\t\tamt, ok := resp.Asks[x][1].(float64)\n\t\t\tif !ok {\n\t\t\t\treturn oba, common.GetTypeAssertError(\"float64\", resp.Asks[x][1], \"amount\")\n\t\t\t}\n\t\t\tob.Asks[x] = OrderbookItem{\n\t\t\t\tPrice: price,\n\t\t\t\tAmount: amt,\n\t\t\t}\n\t\t}\n\n\t\tfor x := range resp.Bids {\n\t\t\tprice, err := strconv.ParseFloat(resp.Bids[x][0].(string), 64)\n\t\t\tif err != nil {\n\t\t\t\treturn oba, err\n\t\t\t}\n\t\t\tamt, ok := resp.Bids[x][1].(float64)\n\t\t\tif !ok {\n\t\t\t\treturn oba, common.GetTypeAssertError(\"float64\", resp.Bids[x][1], \"amount\")\n\t\t\t}\n\t\t\tob.Bids[x] = OrderbookItem{\n\t\t\t\tPrice: price,\n\t\t\t\tAmount: amt,\n\t\t\t}\n\t\t}\n\t\toba.Data[currencyPair] = ob\n\t} else {\n\t\tvals.Set(\"currencyPair\", \"all\")\n\t\tresp := OrderbookResponseAll{}\n\t\tpath := fmt.Sprintf(\"/public?command=returnOrderBook&%s\", vals.Encode())\n\t\terr := p.SendHTTPRequest(ctx, exchange.RestSpot, path, &resp.Data)\n\t\tif err != nil {\n\t\t\treturn oba, err\n\t\t}\n\t\tfor currency, orderbook := range resp.Data {\n\t\t\tob := Orderbook{\n\t\t\t\tBids: make([]OrderbookItem, len(orderbook.Bids)),\n\t\t\t\tAsks: make([]OrderbookItem, len(orderbook.Asks)),\n\t\t\t}\n\t\t\tfor x := range orderbook.Asks {\n\t\t\t\tprice, err := strconv.ParseFloat(orderbook.Asks[x][0].(string), 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn oba, err\n\t\t\t\t}\n\t\t\t\tamt, ok := orderbook.Asks[x][1].(float64)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn oba, common.GetTypeAssertError(\"float64\", orderbook.Asks[x][1], \"amount\")\n\t\t\t\t}\n\t\t\t\tob.Asks[x] = OrderbookItem{\n\t\t\t\t\tPrice: price,\n\t\t\t\t\tAmount: amt,\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor x := range orderbook.Bids {\n\t\t\t\tprice, err := strconv.ParseFloat(orderbook.Bids[x][0].(string), 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn oba, err\n\t\t\t\t}\n\t\t\t\tamt, ok := orderbook.Bids[x][1].(float64)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn oba, common.GetTypeAssertError(\"float64\", orderbook.Bids[x][1], \"amount\")\n\t\t\t\t}\n\t\t\t\tob.Bids[x] = OrderbookItem{\n\t\t\t\t\tPrice: price,\n\t\t\t\t\tAmount: amt,\n\t\t\t\t}\n\t\t\t}\n\t\t\toba.Data[currency] = ob\n\t\t}\n\t}\n\treturn oba, nil\n}", "func (o *Orders) GetComposedAllOrders(db *gorm.DB, c echo.Context) (*Meta, *[]ComposedOrders, error) {\n\tcomposed_orders := []ComposedOrders{}\n\tmeta := Meta{}\n\torder_id := c.QueryParam(\"order_id\")\n\tis_late := c.QueryParam(\"is_late\")\n\tid_card := c.QueryParam(\"id_card\")\n\n\t// With pagination implemented, execute query dynamically from parameters\n\tchain := db.Debug().Model(&Orders{}).\n\t\tSelect(\n\t\t\t`orders.id`,\n\t\t\t`customers.full_name`,\n\t\t\t`customers.id_card`,\n\t\t\t`customers.mobile`,\n\t\t\t`cars.label`,\n\t\t\t`cars.car_type`,\n\t\t\t`orders.total_days`,\n\t\t\t`orders.estimated_days`,\n\t\t\t`orders.with_driver`,\n\t\t\t`orders.status`).\n\t\tJoins(\"left join customers on customers.id = orders.customer_id\").\n\t\tJoins(\"left join cars on cars.id = orders.car_id\")\n\tif order_id != \"\" {\n\t\tchain = chain.Where(\"orders.id = \" + order_id)\n\t}\n\tif is_late != \"\" {\n\t\tchain = chain.Where(fmt.Sprintf(\"orders.status = '%s'\", is_late))\n\t}\n\tif id_card != \"\" {\n\t\tchain = chain.Where(\"customers.id_card = \" + id_card)\n\t}\n\tresult := chain.Scan(&composed_orders)\n\terr := result.Error\n\tif err != nil {\n\t\treturn &Meta{}, &[]ComposedOrders{}, err\n\t}\n\t// Get the metadata\n\tmeta.GetResult(c, result.RowsAffected)\n\t// Paginate the result\n\terr = chain.Scopes(Paginate(c)).Scan(&composed_orders).Error\n\tif err != nil {\n\t\treturn &Meta{}, &[]ComposedOrders{}, err\n\t}\n\t// Manipulate and add prefix to each order ID\n\tfor i := range composed_orders {\n\t\tstr_id := strconv.Itoa(composed_orders[i].Id)\n\t\tprefix_id := fmt.Sprintf(\"%s\"+str_id, \"order-\") // add prefix\n\t\tcomposed_orders[i].Order_id = prefix_id\n\t}\n\treturn &meta, &composed_orders, err\n}", "func (o *Orders) GetAllOrders(db *gorm.DB, c echo.Context) (*[]Orders, error) {\n\torders := []Orders{}\n\t// With pagination implemented\n\terr := db.Debug().Scopes(Paginate(c)).Find(&orders).Error\n\tif err != nil {\n\t\treturn &[]Orders{}, err\n\t}\n\tfor i := range orders {\n\t\terr = db.Debug().Model(&Customers{}).Where(\"id = ?\", orders[i].Customer_id).Take(&orders[i].Customers).Error\n\t\tif err != nil {\n\t\t\treturn &[]Orders{}, err\n\t\t}\n\t\terr = db.Debug().Model(&Cars{}).Where(\"id = ?\", orders[i].Car_id).Take(&orders[i].Cars).Error\n\t\tif err != nil {\n\t\t\treturn &[]Orders{}, err\n\t\t}\n\t}\n\terr = db.Debug().Scopes(Paginate(c)).Find(&orders).Error\n\tif err != nil {\n\t\treturn &[]Orders{}, err\n\t}\n\treturn &orders, err\n}", "func (d *Db) GetOrders(name string, col string) []Order {\n\tvar query string\n\tif col != \"none\" {\n\t\tquery = \"SELECT restaurant, orderDate, details, userName, client, lastName FROM orders_view; WHERE soa.orders.\" + col + \"=\" + name\n\t} else {\n\t\tquery = \"SELECT restaurant, orderDate, details, userName, client, lastName FROM orders_view;\"\n\t}\n\tstmt, err := d.Prepare(query)\n\tif err != nil {\n\t\tfmt.Println(\"GetOrders Preperation Err: \", err)\n\t}\n\n\t// Make query with our stmt, passing in name argument\n\trows, err := stmt.Query()\n\tif err != nil {\n\t\tfmt.Println(\"GetOrders Query Err: \", err)\n\t}\n\n\t// Create User struct for holding each row's data\n\tvar client Client\n\tvar user User\n\tvar rest Restaurant\n\tvar order Order\n\tvar date string\n\tpreset := \"2006-01-02 15:04:05\"\n\t// Create slice of Client for our response\n\torders := []Order{}\n\t// Copy the columns from row into the values pointed at by r (Client)\n\tfor rows.Next() {\n\t\terr = rows.Scan(\n\t\t\t&rest.Name,\n\t\t\t&date,\n\t\t\t&order.Details,\n\t\t\t&user.Name,\n\t\t\t&client.FName,\n\t\t\t&client.LName,\n\t\t)\n\t\torder.Restaurant = rest\n\t\torder.User = user\n\t\torder.Client = client\n\t\torder.OrderDate, _ = time.Parse(preset, date)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error scanning rows: \", err)\n\t\t}\n\t\torders = append(orders, order)\n\t}\n\n\treturn orders\n}", "func GetOrderByIDs(c Client, symbol string, ID string, refID string) (*t.Order, error) {\n\tif symbol == \"\" || (ID == \"\" && refID == \"\") {\n\t\treturn nil, nil\n\t}\n\n\tvar payload, url strings.Builder\n\n\tBuildBaseQS(&payload, symbol)\n\tif refID != \"\" {\n\t\tfmt.Fprintf(&payload, \"&orderId=%s\", refID)\n\t}\n\tif ID != \"\" {\n\t\tfmt.Fprintf(&payload, \"&origClientOrderId=%s\", ID)\n\t}\n\n\tsignature := Sign(payload.String(), c.SecretKey)\n\n\tfmt.Fprintf(&url, \"%s/order?%s&signature=%s\", c.BaseURL, payload.String(), signature)\n\tdata, err := h.GetH(url.String(), NewHeader(c.ApiKey))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := gjson.ParseBytes(data)\n\n\tif r.Get(\"code\").Int() < 0 {\n\t\th.Log(\"GetOrderByIDs\", r)\n\t\treturn nil, errors.New(r.Get(\"msg\").String())\n\t}\n\n\treturn &t.Order{\n\t\tID: ID,\n\t\tRefID: refID,\n\t\tSymbol: symbol,\n\t\tStatus: r.Get(\"status\").String(),\n\t\tUpdateTime: r.Get(\"updateTime\").Int(),\n\t}, nil\n}", "func (h *Hbdm) CancelAllOrders(symbol string) (resp *CancelAllOrdersResponse, err error) {\n\tpayload := make(map[string]interface{}, 1)\n\tpayload[\"symbol\"] = symbol\n\n\tr, err := h.client.do(\"POST\", \"contract_cancelall\", payload, true)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar response interface{}\n\tif err = json.Unmarshal(r, &response); err != nil {\n\t\treturn\n\t}\n\n\tif err = handleErr(response); err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(r, &resp)\n\treturn\n\n}", "func (c *Coinbene) GetSwapOrderFills(symbol, orderID string, lastTradeID int64) (SwapOrderFills, error) {\n\tv := url.Values{}\n\tif symbol != \"\" {\n\t\tv.Set(\"symbol\", symbol)\n\t}\n\tif orderID != \"\" {\n\t\tv.Set(\"orderId\", orderID)\n\t}\n\tif lastTradeID != 0 {\n\t\tv.Set(\"lastTradedId\", strconv.FormatInt(lastTradeID, 10))\n\t}\n\ttype resp struct {\n\t\tData SwapOrderFills `json:\"data\"`\n\t}\n\n\tvar r resp\n\tpath := coinbeneAPIVersion + coinbeneOrderFills\n\terr := c.SendAuthHTTPRequest(exchange.RestSwap, http.MethodGet,\n\t\tpath,\n\t\tcoinbeneOrderFills,\n\t\ttrue,\n\t\tv,\n\t\t&r,\n\t\tcontractGetOrderFills)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.Data, nil\n}", "func (c *Client) GetUserOrders(u *User, limit, offset int) ([]*Order, error, bool) {\n\tif u == nil {\n\t\treturn nil, errors.New(\"user can't be nil\"), false\n\t}\n\n\tuserIDStr := strconv.Itoa(u.ID)\n\tlimitStr := strconv.Itoa(limit)\n\toffsetStr := strconv.Itoa(offset)\n\n\torders := &ListOrderResponse{}\n\terr := c.apiget(\"/users/\"+userIDStr+\"/orders?limit=\"+limitStr+\"&offset=\"+offsetStr, orders)\n\tif err != nil {\n\t\treturn nil, err, false\n\t}\n\n\treturn orders.Orders, nil, orders.Meta.Next == \"\"\n}", "func (m *Workbook) GetOperations()([]WorkbookOperationable) {\n return m.operations\n}", "func (o *V3SetErrorOrderInput) GetOrders() []V3OrderIntegrationError {\n\tif o == nil || o.Orders == nil {\n\t\tvar ret []V3OrderIntegrationError\n\t\treturn ret\n\t}\n\treturn *o.Orders\n}", "func GetCustomerOrders(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"NOT IMPLEMENTED\"})\n}", "func (k Keeper) SetLastClosedOrderIDs(ctx sdk.Context, orderIDs []string) {\n\tstore := ctx.KVStore(k.orderStoreKey)\n\tif len(orderIDs) == 0 {\n\t\tstore.Delete(types.RecentlyClosedOrderIDsKey)\n\t}\n\tstore.Set(types.RecentlyClosedOrderIDsKey, k.cdc.MustMarshalJSON(orderIDs)) //recentlyClosedOrderIDs\n}", "func (c *Coinbene) GetOrderbook(symbol string, size int64) (Orderbook, error) {\n\tresp := struct {\n\t\tData struct {\n\t\t\tAsks [][]string `json:\"asks\"`\n\t\t\tBids [][]string `json:\"bids\"`\n\t\t\tTime time.Time `json:\"timestamp\"`\n\t\t} `json:\"data\"`\n\t}{}\n\n\tparams := url.Values{}\n\tparams.Set(\"symbol\", symbol)\n\tparams.Set(\"depth\", strconv.FormatInt(size, 10))\n\tpath := common.EncodeURLValues(coinbeneAPIVersion+coinbeneGetOrderBook, params)\n\terr := c.SendHTTPRequest(exchange.RestSpot, path, spotOrderbook, &resp)\n\tif err != nil {\n\t\treturn Orderbook{}, err\n\t}\n\n\tprocessOB := func(ob [][]string) ([]OrderbookItem, error) {\n\t\tvar o []OrderbookItem\n\t\tfor x := range ob {\n\t\t\tvar price, amount float64\n\t\t\tamount, err = strconv.ParseFloat(ob[x][1], 64)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tprice, err = strconv.ParseFloat(ob[x][0], 64)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\to = append(o, OrderbookItem{\n\t\t\t\tPrice: price,\n\t\t\t\tAmount: amount,\n\t\t\t})\n\t\t}\n\t\treturn o, nil\n\t}\n\n\tvar s Orderbook\n\ts.Bids, err = processOB(resp.Data.Bids)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\ts.Asks, err = processOB(resp.Data.Asks)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\ts.Time = resp.Data.Time\n\treturn s, nil\n}", "func (c *Coinbene) GetSpotOrderFills(orderID string) ([]OrderFills, error) {\n\tresp := struct {\n\t\tData []OrderFills `json:\"data\"`\n\t}{}\n\tparams := url.Values{}\n\tparams.Set(\"orderId\", orderID)\n\tpath := coinbeneAPIVersion + coinbeneTradeFills\n\terr := c.SendAuthHTTPRequest(exchange.RestSpot, http.MethodGet,\n\t\tpath,\n\t\tcoinbeneTradeFills,\n\t\tfalse,\n\t\tparams,\n\t\t&resp,\n\t\tspotQueryTradeFills)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.Data, nil\n}", "func (_EtherDelta *EtherDeltaSession) Orders(arg0 common.Address, arg1 [32]byte) (bool, error) {\n\treturn _EtherDelta.Contract.Orders(&_EtherDelta.CallOpts, arg0, arg1)\n}", "func ReadOrders(fullPath string) []string {\n\tif len(fullPath) == 0 {\n\t\tfullPath = \"./orderNos.txt\"\n\t}\n\treturn readLines(fullPath)\n}" ]
[ "0.78098464", "0.75020343", "0.73238695", "0.7233305", "0.697841", "0.6964143", "0.69260305", "0.6883353", "0.66853094", "0.66811967", "0.6598984", "0.65723735", "0.6552696", "0.65305096", "0.6481294", "0.6418086", "0.640683", "0.6382544", "0.6259879", "0.61991674", "0.6179097", "0.60799295", "0.6014891", "0.59750897", "0.5968354", "0.5886922", "0.5867198", "0.58580357", "0.58282673", "0.5818075", "0.5814616", "0.5795112", "0.576387", "0.5728829", "0.5716557", "0.5690264", "0.5658056", "0.5631628", "0.5604255", "0.5556691", "0.55444884", "0.55273676", "0.551865", "0.55086493", "0.54819465", "0.5469509", "0.5453917", "0.54412854", "0.54335386", "0.5385941", "0.53688675", "0.53655815", "0.5354044", "0.5352657", "0.53513354", "0.53485346", "0.53049916", "0.5298562", "0.52975285", "0.52679163", "0.52662635", "0.5249963", "0.5239315", "0.52271086", "0.5217195", "0.5189129", "0.51865315", "0.5185767", "0.51783407", "0.5177771", "0.5176497", "0.51746863", "0.51594925", "0.51504266", "0.51433086", "0.51312613", "0.51218957", "0.5110542", "0.51085776", "0.5093838", "0.50832576", "0.5080392", "0.50467134", "0.5034182", "0.50248265", "0.50149524", "0.49971315", "0.49954087", "0.49921206", "0.49685675", "0.49591622", "0.49242732", "0.49140647", "0.49081162", "0.4905215", "0.4904173", "0.49002117", "0.48946488", "0.48941907", "0.4878635" ]
0.7399544
2
GetNamedLogger will return existing named logger or create new one if it does not exist yet namespace will be used in output format. See SetFormat()
func GetNamedLogger(namespace string) NamedLogger { if logger, ok := namedLoggers[namespace]; ok { return logger } result := &logger{ namespace: &namespace, format: defaultLogger.format, timeFormat: defaultLogger.timeFormat, output: defaultLogger.output, } namedLoggers[namespace] = result return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetLogger(pkgName string) *logrus.Logger {\n\tloggersMutex.Lock()\n\tlogger, exists := loggers[pkgName]\n\tloggersMutex.Unlock()\n\n\tif !exists {\n\t\tformatter := &LogFormatter{frm: func(entry *logrus.Entry) ([]byte, error) {\n\t\t\tdefaultFormat, e := (&logrus.TextFormatter{PadLevelText: true, TimestampFormat: \"1-2|15:04:05.000\", FullTimestamp: true}).Format(entry)\n\n\t\t\tpkg := fmt.Sprintf(\"%-10s \", pkgName)\n\n\t\t\tline := bytes.Join([][]byte{\n\t\t\t\t[]byte(pkg), defaultFormat},\n\t\t\t\t[]byte(\" \"))\n\n\t\t\treturn line, e\n\t\t}}\n\n\t\tlogger = logrus.New()\n\t\tlogger.SetFormatter(formatter)\n\n\t\tlogger.SetLevel(logrus.DebugLevel)\n\n\t\tloggersMutex.Lock()\n\t\tloggers[pkgName] = logger\n\t\tloggersMutex.Unlock()\n\t}\n\n\treturn logger\n}", "func Named(name string) *zap.Logger {\n\tinitLogger()\n\n\treturn logger.Named(name)\n}", "func GetLogger(name string) *Logger {\n\tlogger, ok := NamedLoggers.Load(name)\n\tif ok {\n\t\treturn logger\n\t}\n\tlogger, _ = NamedLoggers.Load(DEFAULT)\n\treturn logger\n}", "func GetLogger(name string, levelStr string) (*logging.Logger) {\n\tif log != nil {\n\t\treturn log\n\t}\n\tlevel := toLogLevel(levelStr)\n\tlog = logging.MustGetLogger(name)\n\tvar format = logging.MustStringFormatter(\n\t\t`%{color}%{time:15:04:05} [%{level:.4s}] %{module:6.10s} -> %{longfunc:10.10s} ▶ %{color:reset} %{message}`,\n\t)\n\tbackend := logging.NewLogBackend(os.Stdout, \"\", 0)\n\tbackendFormatter := logging.NewBackendFormatter(backend, format)\n\tlogging.SetLevel(level, \"\")\n\tlogging.SetBackend(backendFormatter)\n\n\treturn log\n}", "func Get(name string) Logger {\n\treturn loggerFactory.GetLogger(name)\n}", "func GetLogger(names ...string) *zap.SugaredLogger {\n\tlog := logger\n\tfor _, name := range names {\n\t\tlog = log.Named(name)\n\t}\n\treturn log\n}", "func NewNamedLogger(name string, bufLen int64, subname, provider, config string) error {\n\tlogger, ok := NamedLoggers.Load(name)\n\tif !ok {\n\t\tlogger = newLogger(name, bufLen)\n\t\tNamedLoggers.Store(name, logger)\n\t}\n\n\treturn logger.SetLogger(subname, provider, config)\n}", "func NewLogger(name string, options ...Option) Logger {\n\tl := &namedLogger{name: name}\n\n\toptions = append(\n\t\t// Defaults\n\t\tOptions{WithOutput(os.Stdout), UseEnvVar(\"DEBUG\")},\n\t\t// Custom options\n\t\toptions...,\n\t)\n\n\tfor _, opt := range options {\n\t\topt.apply(l)\n\t}\n\treturn l\n}", "func GetLogger(scope ...string) *Logger {\n\tif len(scope) < 1 {\n\t\treturn root\n\t}\n\tmodule := strings.Join(scope, \".\")\n\treturn &Logger{module: module, Logger: root.Logger.Named(module)}\n}", "func (s SugaredLogger) NewNamedLogger(name string) yetlog.Logger {\n\tnamedLogger := s.zapLogger.Named(name)\n\treturn SugaredLogger{\n\t\tzapLogger: namedLogger,\n\t}\n}", "func (m *LoggerManager) GetLogger(name string) *LoggerImpl {\n\tif name == DEFAULT {\n\t\tif logger := m.defaultLogger.Load(); logger != nil {\n\t\t\treturn logger\n\t\t}\n\t}\n\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\n\tlogger := m.loggers[name]\n\tif logger == nil {\n\t\tlogger = NewLoggerWithWriters(m.ctx, name)\n\t\tm.loggers[name] = logger\n\t\tif name == DEFAULT {\n\t\t\tm.defaultLogger.Store(logger)\n\t\t}\n\t}\n\n\treturn logger\n}", "func GetLogger(name string) Logger {\n\t// go through the loggerSpec and look for \"Foo=Trace\" or whatever\n\t// it will always prefer longer module names that match but also match\n\t// smaller ones for example, for module name foo.bar.baz, foo.bar=Trace will\n\t// match but foo.bar.baz=Trace will be preferred it's not smart enough to\n\t// figure out that foo.bar.ba should be ignored in preference of foo.bar but\n\t// that is a compromise that i'm willing to make for simplicity and\n\t// flexability\n\tlevel := Info\n\tlevelHint := \"\"\n\tfor _, moduleInfo := range strings.Split(loggerSpec, \":\") {\n\t\tsplitted := strings.SplitN(moduleInfo, \"=\", 2)\n\t\tif len(splitted) != 2 {\n\t\t\tcontinue\n\t\t}\n\n\t\tmoduleName := splitted[0]\n\t\tmoduleLevel := splitted[1]\n\n\t\tif len(moduleName) <= len(levelHint) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(moduleName, name) || moduleName == \"<root>\" {\n\t\t\tswitch {\n\t\t\tcase strings.EqualFold(moduleLevel, \"trace\"):\n\t\t\t\tlevel = Trace\n\t\t\tcase strings.EqualFold(moduleLevel, \"info\"):\n\t\t\t\tlevel = Info\n\t\t\tcase strings.EqualFold(moduleLevel, \"debug\"):\n\t\t\t\tlevel = Debug\n\t\t\tcase strings.EqualFold(moduleLevel, \"warning\"):\n\t\t\t\tlevel = Warning\n\t\t\tcase strings.EqualFold(moduleLevel, \"error\"):\n\t\t\t\tlevel = Error\n\t\t\tcase strings.EqualFold(moduleLevel, \"critical\"):\n\t\t\t\tlevel = Critical\n\t\t\tdefault:\n\t\t\t\tprintln(\"Warning: couldn't understand moduleName/loggerLevel\", moduleName, moduleLevel)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlevelHint = moduleName\n\t\t}\n\t}\n\n\treturn Logger{\n\t\tname: name,\n\t\tlevel: level,\n\t\twriteDescLock: &sync.RWMutex{},\n\t}\n}", "func GetLogger() *logger {\n\tdoOnce.Do(func() {\n\t\tlogSingelton = &logger{\n\t\t\tLevel: Warning,\n\t\t\tFileName: true,\n\t\t}\n\t\tlog.SetFlags(LogTypeShort)\n\t})\n\treturn logSingelton\n}", "func (self *Manager) GetLogger(name string) Logger {\n\tself.lock.Lock()\n\tdefer self.lock.Unlock()\n\tvar logger Logger\n\tnode, ok := self.loggers[name]\n\tif ok {\n\t\tswitch node.Type() {\n\t\tcase NodePlaceHolder:\n\t\t\tplaceHolder, _ := node.(*PlaceHolder)\n\t\t\tlogger = self.loggerMaker(name)\n\t\t\tlogger.SetManager(self)\n\t\t\tself.loggers[name] = logger\n\t\t\tself.fixupChildren(placeHolder, logger)\n\t\t\tself.fixupParents(logger)\n\t\tcase NodeLogger:\n\t\t\tlogger, _ = node.(*StandardLogger)\n\t\tdefault:\n\t\t\tpanic(\"invalid node type\")\n\t\t}\n\t} else {\n\t\tlogger = self.loggerMaker(name)\n\t\tlogger.SetManager(self)\n\t\tself.loggers[name] = logger\n\t\tself.fixupParents(logger)\n\t}\n\treturn logger\n}", "func NewLogger(bufLen int64, name, provider, config string) *Logger {\n\terr := NewNamedLogger(DEFAULT, bufLen, name, provider, config)\n\tif err != nil {\n\t\tCriticalWithSkip(1, \"Unable to create default logger: %v\", err)\n\t\tpanic(err)\n\t}\n\tl, _ := NamedLoggers.Load(DEFAULT)\n\treturn l\n}", "func GetLogger(pkgName string) ILogger {\n\treturn getILogger(pkgName, false)\n}", "func GetLogger(name string) *CMLogger {\n\treturn GetLoggerByChain(name, \"\")\n}", "func GetLogger(kind string) *logging.Logger {\n\n\tvar log = logging.MustGetLogger(\"example\")\n\tvar format = logging.MustStringFormatter(\n\t\t`%{color}%{time:2006-01-02_15:04:05} >%{shortfile}: %{message}%{color:reset}`,\n\t)\n\n\tbackend2 := logging.NewLogBackend(os.Stderr, \"\", 0)\n\tbackend2Formatter := logging.NewBackendFormatter(backend2, format)\n\tlogging.SetBackend(backend2Formatter)\n\n\treturn log\n}", "func GetLogger() *log.Logger { return std.GetLogger() }", "func NewLogger(name string) *logger.Logger {\n\tlgr := &logger.Logger{}\n\tlgr.SetName(name)\n\treturn lgr\n}", "func (lr *logRegistry) NewLogger(name string) logging.Logger {\n\tif _, exists := lr.mapping[name]; exists {\n\t\tpanic(fmt.Errorf(\"logger with name '%s' already exists\", name))\n\t}\n\n\tif err := checkLoggerName(name); err != nil {\n\t\tpanic(err)\n\t}\n\n\tlogger := NewLogger(name)\n\n\tlr.put(logger)\n\treturn logger\n}", "func NewLoggerName(fileName string) *LoggerService {\n\tfullFileName := getFullFileName(fileName)\n\n\tfile, err := os.OpenFile(fullFileName, os.O_RDWR|os.O_CREATE, 0755)\n\tif err != nil {\n\t\tfmt.Println(\"Error opening file:\", err)\n\t\tos.Exit(1)\n\t}\n\n\treturn &LoggerService{file}\n}", "func ReturnLogger(nameLogger string) *log.Logger {\n\tvar logger *log.Logger\n\t// if set stdin don`t use file\n\tif nstdout {\n\t\tlogger = log.New(os.Stdout, nameLogger+\": \", log.Ldate|log.Ltime|log.Lshortfile)\n\n\t} else {\n\t\tlogger = log.New(file, nameLogger+\": \", log.Ldate|log.Ltime|log.Lshortfile)\n\t\tLogger.SetOutput(file)\n\t}\n\treturn logger\n}", "func New(pluginName string) *Logger {\n\tlg := log.New(os.Stdout, \"\", log.Ldate|log.Ltime)\n\tif len(pluginName) == 0 {\n\t\treturn &Logger{logger: lg}\n\t}\n\treturn &Logger{\n\t\tprefix: fmt.Sprintf(\"[%s] \", pluginName),\n\t\tlogger: lg,\n\t}\n}", "func NewLogger(name string) Logger {\n\tlogFormat := DefaultLogFormat\n\tenvLogFormat := strings.ToUpper(os.Getenv(EnvKeyLogFormat))\n\tif envLogFormat == \"JSON\" {\n\t\tlogFormat = FormatJson\n\t}\n\tzl, lvl, _ := newZapLogger(logFormat, DefaultLogLevel)\n\tif name == \"\" {\n\t\tname = \"flogo.custom\"\n\t}\n\treturn &zapLoggerImpl{loggerLevel: lvl, mainLogger: zl.Named(name).Sugar()}\n}", "func Get(name string) Logger {\n\tregMutex.Lock()\n\tdefer regMutex.Unlock()\n\tl, ok := reg[name]\n\tif ok {\n\t\treturn l\n\t}\n\tl = New()\n\treg[name] = l\n\treturn l\n}", "func GetLogger() StimLogger {\n\tif logger == nil {\n\t\tstimLoggerCreateLock.Lock()\n\t\tdefer stimLoggerCreateLock.Unlock()\n\t\tif logger == nil {\n\t\t\tlogger = &FullStimLogger{\n\t\t\t\tcurrentLevel: InfoLevel,\n\t\t\t\thighestLevel: InfoLevel,\n\t\t\t\tdateFMT: dateFMT,\n\t\t\t\tlogQueue: make([]*logMessage, 0),\n\t\t\t\tlogfiles: hashmap.HashMap{},\n\t\t\t\tforceFlush: true,\n\t\t\t\tlogLevel: true,\n\t\t\t\tlogTime: true,\n\t\t\t\t// wql: l,\n\t\t\t\twqc: sync.NewCond(&sync.Mutex{}),\n\t\t\t}\n\t\t\t//We set logurs to debug since we are handling the filtering\n\t\t\tlogger.AddLogFile(\"STDOUT\", defaultLevel)\n\t\t\tgo logger.writeLogQueue()\n\t\t}\n\t}\n\treturn logger\n}", "func NewLogger(name, tag string) Logger {\n\tif entry, ok := loggerEntryMap[name]; ok {\n\t\treturn entry.NewLogger(tag)\n\t}\n\n\tfmt.Printf(\"Invalid logger: %s\", name)\n\treturn nil\n}", "func Get(name string) *Logger {\n\treturn loggers[name]\n}", "func Get(fullname string) *Logger {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\tif loggers != nil {\n\t\tif logger := loggers[fullname]; logger != nil {\n\t\t\treturn logger\n\t\t}\n\t}\n\t// Go down the hierarchy, creating loggers where needed\n\tparts := strings.Split(fullname, \".\")\n\tlogger := Root\n\tfor _, part := range parts {\n\t\tchild := logger.children[part]\n\t\tif child == nil {\n\t\t\tchild = newLogger(fullname, logger)\n\t\t\tif configured {\n\t\t\t\tchild.Threshold = logger.Threshold\n\t\t\t}\n\t\t\tlogger.children[part] = child\n\t\t}\n\t\tlogger = child\n\t}\n\tif loggers == nil {\n\t\tloggers = make(map[string]*Logger)\n\t}\n\tloggers[fullname] = logger\n\treturn logger\n}", "func (p *ParentLogger) NewLogger(name string) Logger {\n\tfactory := p.Factory\n\tif factory == nil {\n\t\tfactory = DefaultRegistry\n\t}\n\treturn factory.NewLogger(fmt.Sprintf(\"%s.%s\", p.Prefix, name))\n}", "func Get() *logrus.Logger {\n\treturn &logrus.Logger{\n\t\tOut: os.Stdout,\n\t\tFormatter: &logrus.TextFormatter{\n\t\t\tFullTimestamp: true,\n\t\t},\n\t}\n}", "func GetLogger(prefix string, debug bool) func(string, ...interface{}) {\n\tif debug {\n\t\tlogger := log.New(output, fmt.Sprintf(\"%s:\", prefix), log.LstdFlags)\n\n\t\treturn func(msg string, args ...interface{}) {\n\t\t\t_, file1, pos1, _ := runtime.Caller(1)\n\t\t\tlogger.Printf(\"%s:%d: %s\", filepath.Base(file1), pos1, fmt.Sprintf(msg, args...))\n\t\t}\n\t}\n\n\treturn func(msg string, args ...interface{}) {}\n}", "func GetMonkeyLogger(pkgName string) ILogger {\n\treturn getILogger(pkgName, true)\n}", "func (r *Factory) NewLogger(name string) Logger {\n\treturn r.NewDeprecatedLogger(name)\n}", "func GetLogger(debug bool) *logrus.Logger {\n\tlog := &logrus.Logger{\n\t\tOut: os.Stdout,\n\t\tLevel: logrus.InfoLevel,\n\t\tFormatter: &logrus.TextFormatter{\n\t\t\tTimestampFormat: \"2006-01-02 15:04:05\",\n\t\t\tFullTimestamp: true,\n\t\t\tForceColors: true,\n\t\t\tQuoteEmptyFields: true,\n\t\t},\n\t}\n\tif debug {\n\t\tlog.SetLevel(logrus.DebugLevel)\n\t}\n\treturn log\n}", "func GetLogger(debug bool) (*logrus.Logger, error) {\n\tlogger := logrus.StandardLogger()\n\n\tlogger.SetOutput(os.Stdout)\n\n\tformatter := logrus.TextFormatter{\n\t\tFullTimestamp: true,\n\t\tPadLevelText: true,\n\t}\n\n\tlogger.Formatter = &formatter\n\n\tif debug {\n\t\tlogger.Level = logrus.DebugLevel\n\t}\n\n\treturn logger, nil\n}", "func Logger(name string) *log.Logger {\n\treturn gly.components.getLogger(name)\n}", "func Default() Logger {\n\tdefLock.Do(func() {\n\t\tif defLogger == nil {\n\t\t\tdefLogger = New(&LoggerOptions{\n\t\t\t\tLevel: DefaultLevel,\n\t\t\t\tOutput: DefaultOutput,\n\t\t\t})\n\t\t}\n\t})\n\treturn defLogger\n}", "func newLogger() services.Logger {\n\treturn &services.SystemOutLogger{}\n}", "func GetLogger(ctx context.Context) (logCtx kitlog.Logger) {\n\tlogCtx, _ = ctx.Value(logCtxKey).(kitlog.Logger)\n\tif logCtx == nil {\n\t\tlogCtx = kitlog.NewLogfmtLogger(os.Stdout)\n\t}\n\treturn\n}", "func (c Config) GetLogger(name string) (LoggerConfig, bool) {\n\tif name == rootLoggerName {\n\t\treturn LoggerConfig{}, false\n\t}\n\n\tlogger, ok := c.Loggers[name]\n\tif ok {\n\t\tlogger.Name = name\n\t\tif logger.Output == nil {\n\t\t\tlogger.Output = map[string]OutputConfig{}\n\t\t}\n\t\treturn logger, true\n\t}\n\treturn LoggerConfig{Output: map[string]OutputConfig{}}, false\n}", "func NewLogger(name string, t *testing.T) *Logger {\n\tlogger := &Logger{\n\t\tstd: t,\n\t\tname: name,\n\t}\n\n\treturn logger\n}", "func GetLogger(config *Config) *logging.Logger {\n\tl := logging.MustGetLogger(\"logger\")\n\tlogging.SetFormatter(logging.MustStringFormatter(\"[%{level:.3s}] %{message}\"))\n\t// Setup stderr backend\n\tlogBackend := logging.NewLogBackend(os.Stderr, \"\", log.LstdFlags|log.Lshortfile)\n\tif config.Debug {\n\t\tlogBackend.Color = true\n\t}\n\t// Setup syslog backend\n\tsyslogBackend, err := logging.NewSyslogBackend(\"qconsp: \")\n\tif err != nil {\n\t\tl.Fatal(err)\n\t}\n\t// Combine them both into one logging backend.\n\tlogging.SetBackend(logBackend, syslogBackend)\n\tlogging.SetLevel(logging.DEBUG, \"logger\")\n\treturn l\n}", "func GetLogger(path ...string) Logger {\n\tif len(path) > 1 {\n\t\tpanic(\"number of paths must be 0 or 1\")\n\t}\n\tif len(path) == 0 {\n\t\tpkg, ok := getCallerPackage()\n\t\tif !ok {\n\t\t\tpanic(\"could not retrieve logger package\")\n\t\t}\n\t\tpath = []string{pkg}\n\t}\n\treturn root.GetLogger(path[0])\n}", "func GetLogger(cmp *mcmp.Component) *Logger {\n\tif l, ok := mcmp.InheritedValue(cmp, cmpKeyLogger); ok {\n\t\treturn l.(*Logger)\n\t}\n\treturn DefaultLogger\n}", "func ForPlugin(name string) PluginLogger {\n\tif logger, found := DefaultRegistry.Lookup(name); found {\n\t\tDefaultLogger.Debugf(\"using plugin logger for %q that was already initialized\", name)\n\t\treturn &ParentLogger{\n\t\t\tLogger: logger,\n\t\t\tPrefix: name,\n\t\t\tFactory: DefaultRegistry,\n\t\t}\n\t}\n\treturn NewParentLogger(name, DefaultRegistry)\n}", "func GetLog(name string) logrus.FieldLogger {\n\treturn logger.WithField(\"package\", name)\n}", "func GetLogger(namespace string) *zap.SugaredLogger {\n\treturn logger.GetLogger(fmt.Sprintf(\"%s - tests\", namespace))\n}", "func GetLogger(pkgPath string) *Logger {\n\treturn loggerFromGlobalMap(pkgPath)\n}", "func (dc *DefaultContainer) GetLogger() logger.Logger {\n\tif dc.Logger == nil {\n\t\tdc.Logger = logger.NewDefaultLogger()\n\t}\n\treturn dc.Logger\n}", "func getLogger() *logWrapper {\n\tif logwrapper == nil {\n\t\tInit()\n\t}\n\treturn logwrapper\n}", "func GetLogger(loggerName string) Logger {\n\treturn lm().getLogger(loggerName)\n}", "func NewLogger(output io.Writer, formatter formatters.Formatter) Logger {\n\treturn GoLogger{\n\t\toutput,\n\t\tformatter,\n\t}\n}", "func makeLogger(name string, logCaller bool, logToFile bool) zerolog.Logger {\n\tvar logFile = os.Stdout\n\tif logToFile {\n\t\tzerolog.SetGlobalLevel(zerolog.InfoLevel)\n\t\tlogDir := makeLogDirOrDie()\n\t\tvar err error\n\t\tlogFile, err = os.OpenFile(filepath.Join(logDir, \"fusefs.log\"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)\n\t\tpanicOnErr(err)\n\t}\n\n\toutput := zerolog.ConsoleWriter{Out: logFile, TimeFormat: time.RFC3339}\n\toutput.FormatLevel = func(i interface{}) string {\n\t\tif i == nil {\n\t\t\ti = \"na\"\n\t\t}\n\t\treturn strings.ToUpper(fmt.Sprintf(\"| %-6s|\", i))\n\t}\n\tctx := zerolog.New(output).\n\t\tWith().\n\t\tTimestamp().\n\t\tStr(\"Name\", name)\n\tif logCaller {\n\t\tctx = ctx.Caller()\n\t}\n\tl := ctx.Logger().Level(zerolog.InfoLevel)\n\treturn l\n}", "func NewLogger(isDebug bool) Logger {\n\tlogLevel := level.AllowInfo()\n\tif isDebug {\n\t\tlogLevel = level.AllowDebug()\n\t}\n\tvar l log.Logger\n\tl = log.NewLogfmtLogger(os.Stdout)\n\tl = level.NewFilter(l, logLevel)\n\tl = log.With(l, \"ts\", log.DefaultTimestampUTC, \"caller\", log.Caller(4))\n\n\treturn Logger{\n\t\tlogger: l,\n\t}\n}", "func LoggerOf(id string) *Logger {\n if id == \"\" {\n id = default_id\n }\n if _, ok := loggers[default_id]; !ok {\n nlogger := &Logger{\n logger: log.New(os.Stdout, LEVELS[DEBUG], log.Lshortfile|log.LstdFlags),\n level: DEBUG,\n id: default_id,\n }\n loggers[default_id] = nlogger\n }\n if _, ok := loggers[id]; !ok {\n loggers[default_id].Fatalf(\"logger %s not exist.\", id)\n }\n return loggers[id]\n}", "func getLogger(module string) *logrus.Logger {\n\tlg, ok := loggerCache[module]\n\tif ok {\n\t\treturn lg\n\t}\n\n\tvar logger *logrus.Logger\n\tif !theLoggerParams.init {\n\t\tlogger = logrus.New()\n\t\tlogger.ReportCaller = true\n\t} else {\n\t\tmoduleFormatter := wrapFormatter(module, theLoggerParams.formatter)\n\n\t\tlogger = logrus.New()\n\t\tlogger.Level = theLoggerParams.level\n\t\tlogger.Formatter = moduleFormatter\n\t\tlogger.ReportCaller = true\n\n\t\tif theLoggerParams.fileFlag {\n\t\t\tlogger.AddHook(newLfsHook(theLoggerParams.writer, moduleFormatter))\n\t\t}\n\t}\n\n\tloggerCache[module] = logger\n\n\treturn logger\n}", "func NewLogger(p Priority, facility, tag string) (Syslogger, error) {\n\treturn &unsupportedLogger{defaultLevel: p, facility: facility, tag: tag}, nil\n}", "func (l klogger) WithName(name string) logr.Logger {\n\tnew := l.clone()\n\tif len(l.prefix) > 0 {\n\t\tnew.prefix = l.prefix + \"/\"\n\t}\n\tnew.prefix += name\n\treturn new\n}", "func NewLogger(output io.Writer) *Logger {\n\tl := &Logger{\n\t\tmutex: &sync.Mutex{},\n\t\toutput: output,\n\t\tloggingLevel: DebugLevel,\n\t\ttimeFormat: timeFormat,\n\t\tdebugPrefix: debugPrefix,\n\t\tinfoPrefix: infoPrefix,\n\t\twarningPrefix: warningPrefix,\n\t\terrorPrefix: errorPrefix,\n\t\tfatalPrefix: fatalPrefix,\n\t\texitFunction: func() { os.Exit(1) },\n\t\thookFunction: func(prefix, message string) {},\n\t}\n\treturn l\n}", "func NewDefault() Logger {\n\treturn &defaultLogger{}\n}", "func DefaultLogger() Logger {\n\tisDefaultLoggerSet.Do(func() {\n\t\tzap.ReplaceGlobals(NewZapLogger(nil, getConsoleEncoder(), DefaultLevel))\n\t})\n\n\treturn &logger{zap.S()}\n}", "func GetLogger() Logger {\n\tif logger != nil {\n\t\treturn logger\n\t}\n\n\tpath := filepath.Join(GetDirectory().MetadataDir(), \"logs\")\n\tHandleError(mkdir(path)(), false)\n\tfilename := filepath.Join(path, logFilename)\n\n\tfp, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0777)\n\tlogger = &FileLogger{\n\t\tstdout: true,\n\t\tfile: fp,\n\t\tlvl: LogLevel,\n\t}\n\n\tif err != nil {\n\t\tlogger.Warning(err.Error())\n\t}\n\n\treturn logger\n}", "func GetLogger(logPrefix, logPath string) *log.Logger {\n\tlogInit.Do(func() {\n\t\tinitializeLogger(logPrefix, logPath)\n\t})\n\treturn logger\n}", "func GetLogger(level string) *Logger {\n\tlevelInt := LevelInt(level)\n\tpastisLogger := &Logger{level: levelInt}\n\tpastisLogger.info = nativeLogger(os.Stdout, \"INFO\", log.Ldate|log.Ltime)\n\tpastisLogger.debug = nativeLogger(os.Stdout, \"DEBUG\", log.Ldate|log.Ltime)\n\tpastisLogger.warn = nativeLogger(os.Stdout, \"WARN\", log.Ldate|log.Ltime)\n\tpastisLogger.err = nativeLogger(os.Stdout, \"ERROR\", log.Ldate|log.Ltime)\n\tpastisLogger.fatal = nativeLogger(os.Stdout, \"FATAL\", log.Ldate|log.Ltime)\n\treturn pastisLogger\n}", "func GetLogger() (Logger, error) {\n return &dummyLogger{}, nil\n}", "func NewLogger() Logger {\n\tdepth := 6\n\treturn new(&depth)\n}", "func newLogger() logger {\n\tleKey := os.Getenv(\"LOG_ENTRIES_KEY\")\n\tfmtFallback := &fmtLogger{}\n\n\tif leKey == \"\" {\n\t\treturn fmtFallback\n\t}\n\n\tle, err := le_go.Connect(leKey)\n\n\tif err != nil {\n\t\treturn fmtFallback\n\t}\n\n\tdefer le.Close()\n\n\treturn le\n}", "func (p *sdkLoggerProvider) GetLogger(module string) api.Logger {\n\treturn &sdkLogger{*p.log}\n}", "func NewLogger(l log.Logger) Output {\n\treturn &logger{\n\t\tlogger: l,\n\t}\n}", "func NewLogger(options ...func(*Logger)) *Logger {\n\t// (using options allows us to avoid creating several New* functions)\n\tdefaultLogger := &Logger{filename: DEFAULT_LOG_FILE, appender: false}\n\tfor _, option := range options {\n\t\toption(defaultLogger)\n\t}\n\treturn defaultLogger\n}", "func GetLoggerWithPrefix(prefix string) StimLogger {\n\tif prefix == \"\" {\n\t\treturn GetLogger()\n\t}\n\tif prefixLogger == nil {\n\t\tstimLoggerCreateLock.Lock()\n\t\tif prefixLogger == nil {\n\t\t\tprefixLogger = make(map[string]StimLogger)\n\t\t}\n\t\tstimLoggerCreateLock.Unlock()\n\t}\n\tstimLoggerCreateLock.Lock()\n\tdefer stimLoggerCreateLock.Unlock()\n\tif sl, ok := prefixLogger[prefix]; ok {\n\t\treturn sl\n\t}\n\tprefixLogger[prefix] = &StimPrefixLogger{stimLogger: GetLogger(), prefix: prefix}\n\treturn prefixLogger[prefix]\n}", "func NewLogger() *LoggerService {\n\tfullFileName := getFullFileName(\"default.log\")\n\n\tfile, err := os.OpenFile(fullFileName, os.O_RDWR|os.O_CREATE, 0755)\n\tif err != nil {\n\t\tfmt.Println(\"Error opening file:\", err)\n\t\tos.Exit(1)\n\t}\n\n\treturn &LoggerService{file}\n}", "func (l logger) WithName(name string) logr.Logger {\n\tnew := l.clone()\n\tif len(l.prefix) > 0 {\n\t\tnew.prefix = l.prefix + \"/\"\n\t}\n\tnew.prefix += name\n\treturn new\n}", "func Default() Logger {\n\treturn logger\n}", "func GetLogger() *logrus.Logger {\n\n\t/*\n\t\tfor creating a rotate file\n\t*/\n\t// if !debug {\n\t// \tlogLevel = logrus.ErrorLevel\n\t// }\n\t// rotateFileHook, err := logrus.NewRotateFileHook(rotatefilehook.RotateFileConfig{\n\t// \tFilename: \"logs/errors.logrus\",\n\t// \tMaxSize: 50, // megabytes\n\t// \tMaxBackups: 3,\n\t// \tMaxAge: 28, //days\n\t// \tLevel: logLevel,\n\t// \tFormatter: &logrus.JSONFormatter{\n\t// \t\tTimestampFormat: time.RFC822,\n\t// \t},\n\t// })\n\n\t// if err != nil {\n\t// \tpanic(\"Failed to initialize file rotate hook: \\n, err)\n\t// }\n\n\t// logrus.AddHook(rotateFileHook)\n\n\tonce.Do(func() {\n\t\tvar logLevel = logrus.DebugLevel\n\t\tlogrus.SetLevel(logLevel)\n\t\tlogrus.SetFormatter(&logrus.TextFormatter{\n\t\t\tFullTimestamp: true,\n\t\t\tForceColors: true,\n\t\t\tDisableColors: false,\n\t\t\tDisableLevelTruncation: true,\n\t\t\tQuoteEmptyFields: true,\n\t\t\tTimestampFormat: \"02-01-2006 15:04:05\",\n\t\t})\n\t\tlog = logrus.StandardLogger()\n\t})\n\treturn log\n}", "func (logger *Logger) GetName() string {\n\treturn logger.name\n}", "func New(name string, base logrus.Level, level []logrus.Level, dev bool) (*Logger, error) {\n\t// If Logger had been created, return nil.\n\tif Has(name) {\n\t\treturn nil, errors.New(\"Name cannot be duplicated\")\n\t}\n\n\t// Create logger.\n\tlogger := &Logger{Logger: logrus.New()}\n\n\t// Create log file in temp folder.\n\tif logFile, err := ioutil.TempFile(\"\", name+\".*.log\"); err == nil {\n\t\tlogger.Path = logFile.Name()\n\t} else {\n\t\treturn nil, errors.New(\"Cannot create log file\")\n\t}\n\n\t// Enable color logging in Windows console.\n\tlogger.Formatter = &logrus.TextFormatter{ForceColors: true}\n\tlogger.SetOutput(colorable.NewColorableStdout())\n\n\t// Update logger config.\n\tlogger.Config(base, level, dev)\n\n\t// Store logger.\n\tloggers[name] = logger\n\n\treturn logger, nil\n}", "func Getlogger() Logger {\r\n\treturn log\r\n}", "func New(logger *zerolog.Logger) log.Logger {\n\tif logger == nil {\n\t\tlg := zerolog.New(os.Stdout).With().Timestamp().Logger()\n\t\tlogger = &lg\n\t}\n\n\treturn &shim{logger: logger}\n}", "func defaultLoggerMaker(name string) Logger {\n\treturn NewStandardLogger(name, LevelNotset)\n}", "func GetInstance() *Logger {\n\tonce.Do(func() {\n\t\tinternalLogger = &Logger{\n\t\t\t// Set INFO as default level. The user can change it\n\t\t\tlevel: LogLevelInfo,\n\t\t\t// Setting Lmsgprefix preffix make the prefix to be printed before\n\t\t\t// the actual message, but after the LstdFlags (date and time)\n\t\t\terrorLogger: log.New(os.Stderr, \"ERROR: \", log.LstdFlags|log.Lmsgprefix),\n\t\t\twarnLogger: log.New(os.Stderr, \"WARNING: \", log.LstdFlags|log.Lmsgprefix),\n\t\t\tinfoLogger: log.New(os.Stderr, \"\", log.LstdFlags|log.Lmsgprefix),\n\t\t\tdebugLogger: log.New(os.Stderr, \"DEBUG: \", log.LstdFlags|log.Lmsgprefix),\n\t\t}\n\t})\n\treturn internalLogger\n}", "func New() *Logger {\n\tdefaultLogger = &Logger{\n\t\toutput: os.Stdout,\n\t\terrOutput: os.Stderr,\n\t}\n\treturn defaultLogger\n}", "func GetLogger(ctx context.Context) Logger {\n\tl, ok := ctx.Value(ctxlog{}).(Logger)\n\tif !ok {\n\t\tl = initLogger(&Config{Output: \"stdout\", Level: InfoLevel})\n\t}\n\n\treturn l\n}", "func NewStdLogger(name string, output OutPutter) Logger {\n\tif output == nil {\n\t\toutput = NewStdOutPutter(log.Default())\n\t}\n\treturn &stdLogger{\n\t\toutput: output,\n\t\tname: name,\n\t}\n}", "func NewLogger(env string, loggerName string, minLevel AtomicLevelName) (Logger, error) {\n\tdt := utils.DateTime{}\n\tdtNow := dt.Now()\n\n\tkitLogger, err := buildLogger(dtNow)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkitLogger = gokitLogger.With(kitLogger,\n\t\t\"timestamp\", gokitLogger.DefaultTimestampUTC,\n\t\t\"caller\", gokitLogger.Caller(8),\n\t\t\"process\", utils.ProcessName(),\n\t\t\"loggerName\", loggerName,\n\t\t\"env\", env,\n\t)\n\tkitLogger = level.NewFilter(kitLogger, toLevelOption(minLevel))\n\treturn &logger{\n\t\tkitLogger: kitLogger,\n\t\tenv: env,\n\t\tloggerName: loggerName,\n\t\tminLevel: minLevel,\n\t\tdateUpdated: dtNow,\n\t}, nil\n}", "func newLogger() *ServiceLogger {\n\tLogger := log.New()\n\tvar serviceLogger ServiceLogger\n\t// Log as JSON instead of the default ASCII formatter.\n\tLogger.SetFormatter(&log.JSONFormatter{})\n\n\t// Output to stdout instead of the default stderr\n\tLogger.SetOutput(os.Stdout)\n\n\t// Only log the warning severity or above.\n\tLogger.SetLevel(log.InfoLevel)\n\n\tserviceLogger.Logger = Logger\n\n\treturn &serviceLogger\n}", "func Log(name string) *logging.Logger {\n\treturn logging.MustGetLogger(name)\n}", "func NewLogger(name string, args ...string) (*Logger, error) {\n\tfile, err := parseArgs(args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newLogger(name, file, file), nil\n}", "func GLogger() *logs.Logger {\n\tif logger == nil {\n\t\t// defer creation to first call, give opportunity to customize log target\n\t\tlogger = App().Log().Logger(App().name, util.GenUniqueId())\n\t}\n\n\treturn logger\n}", "func NewLogger() *StandardLogger {\r\n\tvar baseLogger = logrus.New()\r\n\r\n\tvar standardLogger = &StandardLogger{baseLogger}\r\n\r\n\tstandardLogger.Formatter = &logrus.JSONFormatter{}\r\n\r\n\treturn standardLogger\r\n}", "func Get() logging.Logger {\n\tinitGlobal.Do(func() { global = New(os.Stdout, gol.INFO) })\n\treturn global\n}", "func (s *StanLogger) GetLogger() Logger {\n\ts.mu.RLock()\n\tl := s.log\n\ts.mu.RUnlock()\n\treturn l\n}", "func NewLogger(w io.Writer) Logger {\n\treturn &logger{\n\t\tlog0: log.New(w, \"INFO: \", log.Lshortfile),\n\t}\n}", "func GetInstance() *zerolog.Logger {\n\tonce.Do(func() {\n\t\tconfig := Config{\n\t\t\tConsoleLoggingEnabled: true,\n\t\t\tEncodeLogsAsJson: true,\n\t\t\tFileLoggingEnabled: true,\n\t\t\tDirectory: \"log\",\n\t\t\tFilename: \"service.log\",\n\t\t\tMaxSize: 10,\n\t\t\tMaxBackups: 5,\n\t\t\tMaxAge: 5,\n\t\t}\n\t\tcustomLogger = configure(config)\n\t})\n\treturn customLogger\n}", "func GetLogger() *Logger {\n\treturn &Logger{}\n}", "func newLogger(dbg bool) *lgr.Logger {\n\tif dbg {\n\t\treturn lgr.New(lgr.Msec, lgr.Debug, lgr.CallerFile, lgr.CallerFunc, lgr.LevelBraces)\n\t}\n\n\treturn lgr.New(lgr.Msec, lgr.LevelBraces)\n}", "func NewJSONLogger(service string, name string) *JSONLogger {\n\treturn NewJSONLoggerWithWriter(service, name, os.Stdout)\n}", "func NewLogger() *Logger {\n\treturn &Logger{backends: make(map[string]Backend)}\n}" ]
[ "0.6536676", "0.65023094", "0.6425858", "0.6366296", "0.6358117", "0.63137114", "0.6300415", "0.6253894", "0.62202996", "0.6210221", "0.615312", "0.6138151", "0.61098635", "0.6077276", "0.6045582", "0.5996632", "0.5974074", "0.5967905", "0.5952865", "0.5942571", "0.5907998", "0.5890956", "0.5881827", "0.5853442", "0.5814477", "0.5805449", "0.5798845", "0.5755645", "0.5710285", "0.57076305", "0.56969506", "0.5675171", "0.5672076", "0.5663287", "0.56630653", "0.5638026", "0.5631474", "0.5619071", "0.5603584", "0.5576125", "0.5556804", "0.5550931", "0.5542809", "0.55343604", "0.55326957", "0.55314183", "0.5512481", "0.55004555", "0.548868", "0.5478254", "0.54776406", "0.54621494", "0.546093", "0.5454191", "0.5451389", "0.54464823", "0.5422809", "0.54013133", "0.539664", "0.53906584", "0.53858644", "0.5360947", "0.5359101", "0.5356352", "0.53547215", "0.5348978", "0.5337972", "0.53338945", "0.5325242", "0.5321653", "0.5318126", "0.5317624", "0.531577", "0.53111166", "0.53077805", "0.5293669", "0.52861375", "0.5283038", "0.52807504", "0.5277007", "0.5276679", "0.52707994", "0.5266885", "0.5265276", "0.52600646", "0.5244934", "0.5242964", "0.5239059", "0.52373797", "0.5221547", "0.52189577", "0.5214454", "0.52140504", "0.5212081", "0.5207299", "0.5206939", "0.5204515", "0.52020454", "0.5197858", "0.519504" ]
0.7850478
0
SetLevel sets logging level where logging output will include all levels lower than currently set default level is INFO
func SetLevel(level Level) { loggingLevel = level }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SetLevel(lev Level) {\n\tstdLogger.SetLevel(lev)\n}", "func SetLevel(v string) {\n\tlog.SetLevel(v)\n}", "func SetLevel(lvl Level) {\n\tdefaultLogger.SetLevel(lvl)\n}", "func SetLevel(l string) {\n\tswitch l {\n\tcase \"verbose\":\n\t\tlvl = ver\n\tcase \"debug\":\n\t\tlvl = deb\n\tcase \"info\":\n\t\tlvl = inf\n\tcase \"warning\":\n\t\tlvl = war\n\tcase \"error\":\n\t\tlvl = err\n\tcase \"fatal\":\n\t\tlvl = fat\n\tcase \"off\":\n\t\tlvl = off\n\tdefault:\n\t\tFatalf(\"Invalid logging level '%s'!\", l)\n\t}\n}", "func SetLevel(level Level) {\n\tlog.setLevel(level)\n}", "func SetLevel(l zapcore.Level) {\n\tLogger.atom.SetLevel(l)\n}", "func SetLevel(level loggers.Level) {\n\tGetLogger().SetLevel(level)\n}", "func (l *Logger) SetLevel (n int) {\n\tl.level = n\n}", "func SetLevel(l LogLevel) {\n\tlogger.level = l\n}", "func (l *Logger) SetLevel(level int) {\n\tif level < Error || level > Debug {\n\t\tpanic(level)\n\t}\n\tl.level = level\n}", "func SetLevel(l int) {\n\tlevel = l\n}", "func SetLevel(l int) {\n\tlevel = l\n}", "func (stimLogger *FullStimLogger) SetLevel(level Level) {\n\tstimLogger.currentLevel = level\n\thl := level\n\tfor kv := range stimLogger.logfiles.Iter() {\n\t\tlgr := kv.Value.(*logFile)\n\t\tif lgr.logLevel > hl {\n\t\t\thl = lgr.logLevel\n\t\t}\n\t}\n\tstimLogger.highestLevel = hl\n}", "func SetLevel(lvl string) {\n\tatom.SetLevel(getLoggerLevel(lvl))\n}", "func (l *XORMLogBridge) SetLevel(lvl core.LogLevel) {\n}", "func (l *TestLog) SetLevel(level int) {\n\tl.verbosity = level\n}", "func SetLevel(l int) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tlevel = l\n}", "func (l *Logger) SetLevel(level int) {\n\tl.level = level\n}", "func (l *EchoLogrus) SetLevel(lvl log.Lvl) {\n\tswitch lvl {\n\tcase log.DEBUG:\n\t\tl.Logger.SetLevel(logrus.DebugLevel)\n\tcase log.WARN:\n\t\tl.Logger.SetLevel(logrus.WarnLevel)\n\tcase log.ERROR:\n\t\tl.Logger.SetLevel(logrus.ErrorLevel)\n\tcase log.INFO:\n\t\tl.Logger.SetLevel(logrus.InfoLevel)\n\tdefault:\n\t\tlogrus.Warnf(\"Unknown level: %v\", lvl)\n\t\tl.Logger.SetLevel(logrus.WarnLevel)\n\t}\n}", "func WithLevel(l Level, v ...interface{}) {\n\tif l > DefaultLevel {\n\t\treturn\n\t}\n\tlog(v...)\n}", "func SetLevel(level Level) {\n\tdefaultLevel = int(level)\n}", "func SetLevel(level int) {\n\tlogrus.SetLevel(logrus.Level(level))\n}", "func SetLevel(lvl string) {\n\tlevel, err := logrus.ParseLevel(lvl)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tlog.Level = level\n}", "func SetLevel(l Level) {\n\tDefaultLevel = l\n}", "func SetLogLevel(l int) {\n level = l\n}", "func SetLevel(l Level) {\n\tlevel = l\n}", "func SetLevel(l Level) {\n\tlevel = l\n}", "func (d *LevelWrapper) SetLevel(level Level) {\n\td.LogLevel = level\n}", "func (l *Logger) SetLevel(v string) {\n\tswitch v {\n\tcase \"debug\", \"DEBUG\":\n\t\tl.Level = logrus.DebugLevel\n\tcase \"info\", \"INFO\":\n\t\tl.Level = logrus.InfoLevel\n\tcase \"warning\", \"WARNING\":\n\t\tl.Level = logrus.WarnLevel\n\tcase \"error\", \"ERROR\":\n\t\tl.Level = logrus.ErrorLevel\n\tcase \"fatal\", \"FATAL\":\n\t\tl.Level = logrus.FatalLevel\n\tcase \"panic\", \"PANIC\":\n\t\tl.Level = logrus.PanicLevel\n\t}\n}", "func (logger *Logger) SetLevel(level string) {\n\tlogger.level = LevelInt(level)\n}", "func (l *Logger) SetLevel(level Level) {\n\tsetLevel(l.logger, level)\n}", "func (l *Logger) SetLevel(lvl Level) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tl.Level = lvl\n}", "func (logger *Logger) SetLevel(level logging.LogLevel) {\n\tlogger.access.Lock()\n\tdefer logger.access.Unlock()\n\tlogger.level = level\n}", "func (l *ModuleLeveled) SetLevel(level logging.Level, module string) {\n\tl.levels[module] = level\n}", "func SetLoglevel(level int) {\n\tloglevel = level\n}", "func (f *FileHandler) SetLevel(l LogLevel) {\n\tf.min = l\n\tf.max = l\n}", "func (l *Logger) SetLevel(lev Level) {\n\tif lev != l.lev {\n\t\tl.mu.Lock()\n\t\tl.lev = lev\n\t\tl.mu.Unlock()\n\t}\n}", "func SetLevel(level Level) {\n\tfilterLevel = level\n}", "func (l *Logger) SetLevel(level Level) {\n\tl.mu.Lock()\n\tl.level = level\n\tl.mu.Unlock()\n}", "func SetLevel(level Level) {\n\tgolevel = level\n}", "func SetLevel(lvs ...Level) {\n\tl.SetLevel(lvs...)\n}", "func SetLevel(level string) error {\n\tlevel = strings.ToLower(level)\n\tlvl, err := zerolog.ParseLevel(level)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tzerolog.SetGlobalLevel(lvl)\n\treturn nil\n}", "func (log *logging) setLevel(level Level) {\n\tlog.level = level\n}", "func SetLevel(level Level) {\n\tstd.mu.Lock()\n\tdefer std.mu.Unlock()\n\tstd.level = level\n}", "func SetLevel(lvl *Level) {\n\tif err := wrappedLogger.level.UnmarshalText([]byte(lvl.String())); err != nil {\n\t\twrappedLogger.zap.Warn(fmt.Sprintf(\"error setting lot level: %s\", err))\n\t}\n}", "func SetLevel(lv Level) {\n\tcurrentLevel = lv\n\tcfg.Level.SetLevel(lv)\n}", "func SetLevel(level Level) {\n\tlconf.FilterLevel = level\n}", "func (r *Factory) SetLevel(name string, l Level) {\n\tr.Lock()\n\tdefer r.Unlock()\n\tr.setLevel(name, l)\n\tr.refreshLoggers()\n}", "func SetLevel(level Level) {\n\troot.SetLevel(level)\n}", "func SetLevel(l int) {\n\tatomic.StoreInt32(&level, int32(l))\n}", "func (logger *Logger) SetLevel(level Level) {\n\tif level.isValid() {\n\t\tlogger.level = level\n\t}\n}", "func SetLevel(level logrus.Level) {\n\tlogrus.SetLevel(level)\n}", "func (lw *LogWriter) SetLevel(l Level) {\n\tlw.lvl = l\n}", "func (b *Logger) SetLevel(level Level) *Logger {\n\tatomic.StoreUint32((*uint32)(&b.level), uint32(level))\n\treturn b\n}", "func SetLogLevel(l string) {\n\tif l == \"\" {\n\t\tl = \"info\"\n\t}\n\t// fmt.Fprintln(os.Stderr, \"setting log level\", l)\n\tlvl := logLevels.Info\n\tfor i := range LevelSpecs {\n\t\tif LevelSpecs[i].Name[:1] == l[:1] {\n\t\t\tlvl = LevelSpecs[i].ID\n\t\t}\n\t}\n\tcurrentLevel.Store(lvl)\n}", "func SetLogLevel(level int) {\n\tif level > len(logrus.AllLevels)-1 {\n\t\tlevel = len(logrus.AllLevels) - 1\n\t} else if level < 0 {\n\t\tlevel = 0\n\t}\n\tlogrus.SetLevel(logrus.AllLevels[level])\n}", "func (w *LevelWriter) SetLevel(s string) bool {\n\t// levels contains the first character of the levels in descending order\n\tconst levels = \"TDIWEF\"\n\tswitch strings.ToUpper(s) {\n\tcase \"TRACE\":\n\t\tw.level.Store(levels[0:])\n\t\treturn true\n\tcase \"DEBUG\":\n\t\tw.level.Store(levels[1:])\n\t\treturn true\n\tcase \"INFO\":\n\t\tw.level.Store(levels[2:])\n\t\treturn true\n\tcase \"WARN\":\n\t\tw.level.Store(levels[3:])\n\t\treturn true\n\tcase \"ERROR\":\n\t\tw.level.Store(levels[4:])\n\t\treturn true\n\tcase \"FATAL\":\n\t\tw.level.Store(levels[5:])\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func SetLevel(level Level, module string) {\n\tdefaultBackend.SetLevel(level, module)\n}", "func setLoggingLevel(logLevel string) error {\n\n\tswitch logLevel {\n\tcase LogLevelDisabled:\n\t\tzerolog.SetGlobalLevel(loggingLevels[LogLevelDisabled])\n\tcase LogLevelPanic:\n\t\tzerolog.SetGlobalLevel(loggingLevels[LogLevelPanic])\n\tcase LogLevelFatal:\n\t\tzerolog.SetGlobalLevel(loggingLevels[LogLevelFatal])\n\tcase LogLevelError:\n\t\tzerolog.SetGlobalLevel(loggingLevels[LogLevelError])\n\tcase LogLevelWarn:\n\t\tzerolog.SetGlobalLevel(loggingLevels[LogLevelWarn])\n\tcase LogLevelInfo:\n\t\tzerolog.SetGlobalLevel(loggingLevels[LogLevelInfo])\n\tcase LogLevelDebug:\n\t\tzerolog.SetGlobalLevel(loggingLevels[LogLevelDebug])\n\tcase LogLevelTrace:\n\t\tzerolog.SetGlobalLevel(loggingLevels[LogLevelTrace])\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid option provided: %v\", logLevel)\n\t}\n\n\t// signal that a case was triggered as expected\n\treturn nil\n\n}", "func (hnd *Handlers) SetLogLevel() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvalue := bone.GetValue(r, \"level\")\n\t\tif value == \"\" {\n\t\t\thnd.writeErrorResponse(w, \"must supply a level between 0 and 5\")\n\t\t\treturn\n\t\t}\n\n\t\tlevel, err := strconv.Atoi(value)\n\t\tif err != nil {\n\t\t\tlog.Warn(\"attempt to set log level to invalid value: %s, ignored...\", level)\n\t\t\thnd.writeErrorResponse(w, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif level < 0 {\n\t\t\tlevel = 0\n\t\t}\n\n\t\tif level > 5 {\n\t\t\tlevel = 5\n\t\t}\n\n\t\tlog.SetLevel(level)\n\n\t\tfmt.Fprintf(w, \"{\\\"%s\\\":\\\"%d\\\"}\\n\\r\", \"loglevel\", log.GetLevel())\n\t}\n}", "func (handler *ConsoleLogHandler) Level() LogLevel {\r\n return AllLogLevels\r\n}", "func SetLogLevel(level Level) {\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\tlogLevel = level\n}", "func (*Logger) UpdateLevel(_ string) {\n\t// Nop\n}", "func SetLevel(ctx context.Context, logLevelStr string) {\n\tif setter, ok := ctx.Value(setLogLevelContextKey{}).(func(string)); ok {\n\t\tsetter(logLevelStr)\n\t}\n}", "func (m Meta) SetLevel(lvl Level) {\n\tm.lvl.Store(int32(lvl))\n}", "func SetLogLevel(logLevel logrus.Level) {\n\tDefaultLogger.SetLevel(logLevel)\n}", "func SetLogLevel(level string) {\n\tswitch level {\n\tcase \"debug\":\n\t\tlog.SetLevel(log.DebugLevel)\n\tcase \"info\":\n\t\tlog.SetLevel(log.InfoLevel)\n\tcase \"warning\":\n\t\tlog.SetLevel(log.WarnLevel)\n\tcase \"error\":\n\t\tlog.SetLevel(log.ErrorLevel)\n\tcase \"fatal\":\n\t\tlog.SetLevel(log.FatalLevel)\n\tcase \"panic\":\n\t\tlog.SetLevel(log.PanicLevel)\n\tdefault:\n\t\tlog.SetLevel(log.InfoLevel)\n\t\tmsg := \"Unknown level, \" + level\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"InputPlugin\": \"systemctl\",\n\t\t}).Error(msg)\n\t}\n}", "func (log *Logger) UpdateLevel(level string) {\n\tlog.Logger.SetLevel(parseLevel(level))\n\tlog.discordrusIntegration()\n}", "func SetLoglevel(loglevel string) {\n\tif loglevel == \"panic\" {\n\t\tlog.SetLevel(log.PanicLevel)\n\t\tlog.SetReportCaller(false)\n\t} else if loglevel == \"fatal\" {\n\t\tlog.SetLevel(log.FatalLevel)\n\t\tlog.SetReportCaller(false)\n\t} else if loglevel == \"warn\" {\n\t\tlog.SetLevel(log.WarnLevel)\n\t\tlog.SetReportCaller(false)\n\t} else if loglevel == \"info\" {\n\t\tlog.SetLevel(log.InfoLevel)\n\t\tlog.SetReportCaller(false)\n\t} else if loglevel == \"debug\" {\n\t\tlog.SetLevel(log.DebugLevel)\n\t\tlog.SetReportCaller(true)\n\t} else if loglevel == \"trace\" {\n\t\tlog.SetLevel(log.TraceLevel)\n\t\tlog.SetReportCaller(true)\n\t}\n}", "func (o MethodSettingsSettingsOutput) LoggingLevel() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v MethodSettingsSettings) *string { return v.LoggingLevel }).(pulumi.StringPtrOutput)\n}", "func Level(lvl logging.Level) Option {\n\treturn func(w *Writer) {\n\t\tw.lvl = lvl\n\t}\n}", "func Level(level string) Option {\n\treturn func(logger *logrus.Logger) {\n\t\tlevel, err := logrus.ParseLevel(level)\n\t\t// No need to handle the error here, just don't update the log level\n\t\tif err == nil {\n\t\t\tlogger.SetLevel(level)\n\t\t}\n\t}\n}", "func (l PkgLogger) SetLogLevelInfo() {\n\tconfig := zap.NewDevelopmentConfig()\n\tconfig.Level.SetLevel(zap.InfoLevel)\n\n\tl.loggerImpl, _ = config.Build()\n}", "func SetLoggingLevel(level logging.Level) {\n\tlogging.SetLevel(level, \"libsteg\")\n}", "func SetLogLevel(l int) {\n\tif l < LevelError {\n\t\tlevel = LevelError\n\t\tlogTag(\"WRN\", Mixer, \"Log Level '%d' too low, forcing to %s (%d)\", l, levelMap[level], level)\n\t} else if l > LevelVerbose {\n\t\tlevel = LevelVerbose\n\t\tlogTag(\"WRN\", Mixer, \"Log Level '%d' too high, forcing to %s (%d)\", l, levelMap[level], level)\n\t} else {\n\t\tlevel = l\n\t\tDebug(Mixer, \"Log Level set to %s (%d)\", levelMap[level], l)\n\t}\n}", "func SetLogLevel(logLevel string) {\n\tif logLevel != \"\" {\n\t\tlvl, err := logrus.ParseLevel(logLevel)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Unable to parse logging level: %s\", logLevel)\n\t\t\tlogrus.Error(\"Acceptable log levels are: debug, info, warning, panic, and fatal.\")\n\t\t}\n\t\tlogrus.SetLevel(lvl)\n\t} else {\n\t\tlogrus.SetLevel(logrus.InfoLevel)\n\t}\n}", "func setLevel(logrusLevel logrus.Level) int32 {\n\treturn int32(logrusLevel)\n}", "func SetLogLevel(level string) {\r\n\tclog.SetLogLevel(level)\r\n}", "func setLogLevel(level string) {\n\tif level == \"\" {\n\t\treturn\n\t}\n\tswitch level {\n\tcase \"DEBUG\":\n\t\tlogLevel = DEBUG\n\t\tlogrus.SetLevel(logrus.DebugLevel)\n\tcase \"INFO\":\n\t\tlogLevel = INFO\n\t\tlogrus.SetLevel(logrus.InfoLevel)\n\tcase \"WARN\":\n\t\tlogLevel = WARN\n\t\tlogrus.SetLevel(logrus.WarnLevel)\n\tcase \"ERROR\":\n\t\tlogLevel = ERROR\n\t\tlogrus.SetLevel(logrus.ErrorLevel)\n\tcase \"FATAL\":\n\t\tlogLevel = FATAL\n\t\tlogrus.SetLevel(logrus.FatalLevel)\n\tcase \"PANIC\":\n\t\tlogLevel = PANIC\n\t\tlogrus.SetLevel(logrus.PanicLevel)\n\t}\n}", "func SetLogLevel(lvl logrus.Level) {\n\tLog.Level = lvl\n}", "func (l *Logger) SetLevel(levelName string) *Logger {\n\tl.mu.Lock()\n\tl.Level = getLevelByName(levelName)\n\tl.mu.Unlock()\n\treturn l\n}", "func (_Votes *VotesTransactor) SetLevel(opts *bind.TransactOpts, level uint8) (*types.Transaction, error) {\n\treturn _Votes.contract.Transact(opts, \"setLevel\", level)\n}", "func SetLogLevel(logLevel int) {\n\tlogging.SetLevel(logging.Level(logLevel), mainLoggerName)\n}", "func SetLogLevel(lvl Level) {\n\tLog.Level = lvl\n}", "func SetLevel(s, level string) (*Levels, error) {\n\tfound, logger := validSubLogger(s)\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"logger %v not found\", s)\n\t}\n\tlogger.Levels = splitLevel(level)\n\n\treturn &logger.Levels, nil\n}", "func (s *IndicesStatsService) Level(level string) *IndicesStatsService {\n\ts.level = level\n\treturn s\n}", "func (log *Logger) UpdateLevel(level string) {\n\t// Nop\n}", "func (a *Admin) SetLoggerLevel(_ *http.Request, args *SetLoggerLevelArgs, _ *api.EmptyReply) error {\n\ta.Log.Debug(\"API called\",\n\t\tzap.String(\"service\", \"admin\"),\n\t\tzap.String(\"method\", \"setLoggerLevel\"),\n\t\tlogging.UserString(\"loggerName\", args.LoggerName),\n\t\tzap.Stringer(\"logLevel\", args.LogLevel),\n\t\tzap.Stringer(\"displayLevel\", args.DisplayLevel),\n\t)\n\n\tif args.LogLevel == nil && args.DisplayLevel == nil {\n\t\treturn errNoLogLevel\n\t}\n\n\tvar loggerNames []string\n\tif len(args.LoggerName) > 0 {\n\t\tloggerNames = []string{args.LoggerName}\n\t} else {\n\t\t// Empty name means all loggers\n\t\tloggerNames = a.LogFactory.GetLoggerNames()\n\t}\n\n\tfor _, name := range loggerNames {\n\t\tif args.LogLevel != nil {\n\t\t\tif err := a.LogFactory.SetLogLevel(name, *args.LogLevel); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif args.DisplayLevel != nil {\n\t\t\tif err := a.LogFactory.SetDisplayLevel(name, *args.DisplayLevel); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func WithLevel(logLevel Level) LogOption {\n\treturn withLevel(logLevel)\n}", "func SetLogLevel(level colog.Level) {\n\tlogWriter.SetMinLevel(level)\n}", "func (logger *Logger) SetLogLevel(level string) {\n\tswitch level {\n\tcase \"fatal\":\n\t\tlogger.LogLevel = FatalLevel\n\tcase \"error\":\n\t\tlogger.LogLevel = ErrorLevel\n\tcase \"warn\":\n\t\tlogger.LogLevel = WarnLevel\n\tcase \"info\":\n\t\tlogger.LogLevel = InfoLevel\n\tcase \"debug\":\n\t\tlogger.LogLevel = DebugLevel\n\tdefault:\n\t\tlogger.LogLevel = TraceLevel\n\t}\n}", "func setLogLevel(l *logger.Logger, level int) {\n\tswitch level {\n\tcase Error:\n\t\tl.SetLevel(logger.ErrorLevel)\n\tcase Warn:\n\t\tl.SetLevel(logger.WarnLevel)\n\tcase Info:\n\t\tl.SetLevel(logger.InfoLevel)\n\tdefault:\n\t\tl.SetLevel(logger.DebugLevel)\n\t}\n}", "func SetLogLevel(level log.LogLevel) {\n\tlogger.Level = level\n}", "func Level() int {\n\treturn level\n}", "func (m *CompetenceMutation) SetLevel(i int) {\n\tm.level = &i\n\tm.addlevel = nil\n}", "func SetDebugLevel() {\n\tlogLevel = logrus.DebugLevel\n}", "func (o *CreateEventPayloadActions) SetLevel(v string) {\n\to.Level = v\n}", "func (l *ModuleLevels) SetLevel(module string, level api.Level) {\n\tif l.levels == nil {\n\t\tl.levels = make(map[string]api.Level)\n\t}\n\tl.levels[module] = level\n}", "func (e Fields) SetLevel(level Level) Fields {\n\te[FieldLevel] = level\n\treturn e\n}", "func SetLogLevel(level zapcore.Level) {\n\tif level == TraceLevel {\n\t\tIsTraceLevel = true\n\t\tlevel = zapcore.DebugLevel\n\t}\n\tatom.SetLevel(level)\n}" ]
[ "0.78907955", "0.786664", "0.78348315", "0.77113134", "0.77010286", "0.76823086", "0.76129746", "0.7549361", "0.75365704", "0.75057507", "0.7493658", "0.7493658", "0.7454497", "0.7452784", "0.7352687", "0.73410594", "0.73276097", "0.7316712", "0.7308717", "0.72946274", "0.72888476", "0.72391367", "0.716487", "0.7158403", "0.71375257", "0.71240944", "0.71240944", "0.712385", "0.7116592", "0.7104855", "0.7104535", "0.7083329", "0.7058551", "0.70491594", "0.70339614", "0.70197177", "0.701775", "0.69919276", "0.69904596", "0.6956228", "0.69551176", "0.6946151", "0.6939541", "0.6932596", "0.69039387", "0.68916285", "0.68741244", "0.6869207", "0.6861579", "0.6845442", "0.68356913", "0.67735136", "0.6766109", "0.67490643", "0.6722822", "0.6712175", "0.6675767", "0.6668935", "0.6651543", "0.66098875", "0.6605629", "0.6544758", "0.6527252", "0.6526135", "0.65139616", "0.6503971", "0.6497829", "0.6490896", "0.6474712", "0.646701", "0.64576334", "0.64393514", "0.64385635", "0.6437069", "0.641914", "0.64103633", "0.6409375", "0.6404584", "0.6403373", "0.638064", "0.6359674", "0.6346068", "0.634428", "0.63433814", "0.6335905", "0.6323404", "0.6321983", "0.6317217", "0.6307541", "0.63043517", "0.6301618", "0.62862796", "0.6283488", "0.62689483", "0.625505", "0.62501115", "0.6238394", "0.6238058", "0.6220677", "0.62199974" ]
0.7731801
3
SetTimeFormat follows standard Golang time formatting for default logger
func SetTimeFormat(format string) { *defaultLogger.timeFormat = format }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SetTimeFormat(format string) {\n\tLogger.SetTimeFormat(format)\n}", "func (mlog *MultiLogger) SetTimeFormat(layout string) {\n\tmlog.timeFormat = layout\n}", "func (l *Logger) SetTimeFormat(timeFormat string) {\n\tl.timeFormat = timeFormat\n}", "func (glogger *GLogger) SetLogTimeFormat(logTimeFormat string) {\n\tif glogger.isNil() {\n\t\tglogger.logTimeFormat = logTimeFormat\n\t}\n}", "func TestSetFormat(t *testing.T) {\n\ttestFormat := \"15:04\"\n\tout := strings.Builder{}\n\tSetOutput(&out)\n\tSetLevelStr(\"FATAL\")\n\tSetTimeFormat(testFormat)\n\tt.Run(\"test setting of time format\", func(t *testing.T) {\n\t\tcurrentTime := time.Now().Format(testFormat)\n\t\tprintAllLevels(\"test format\")\n\t\tif strings.Count(out.String(), \" \"+currentTime+\" \") != 2 {\n\t\t\tt.Errorf(\"Log should contain time in format '%s':\\n%v\", testFormat, out.String())\n\t\t}\n\t})\n\tSetTimeFormat(DefaultTimeFormat)\n}", "func (m *MailboxSettings) SetTimeFormat(value *string)() {\n err := m.GetBackingStore().Set(\"timeFormat\", value)\n if err != nil {\n panic(err)\n }\n}", "func SetFormat(format LogFormat) {\n\tswitch format {\n\tcase FORMAT_CONSOLE:\n\t\tl = log.With().Caller().Logger().Output(zerolog.ConsoleWriter{\n\t\t\tOut: os.Stderr,\n\t\t\tTimeFormat: \"15:04:05.000Z\",\n\t\t})\n\tcase FORMAT_JSON:\n\t\tl = log.With().Caller().Logger().Output(os.Stderr)\n\t}\n}", "func SetFormat(format string) {\n\tif format != FormatDateTime && format != FormatTimeOnly && format != FormatDateOnly {\n\t\tformat = FormatDefault\n\t}\n\n\tlogFormat = format\n}", "func (l *Logger) SetFormat(v string) {\n\tswitch v {\n\tcase \"json\":\n\t\tl.Formatter = &JSONFormatter{\n\t\t\tIgnoreFields: []string{\"ctx\"},\n\t\t\tTimestampFormat: time.RFC3339,\n\t\t}\n\tcase \"text\":\n\t\tl.Formatter = &TextFormatter{\n\t\t\tIgnoreFields: []string{\"ctx\"},\n\t\t\tTimestampFormat: time.RFC3339,\n\t\t}\n\t}\n}", "func WithTimeFormat(s string) Option {\n\treturn func(c *config) {\n\t\tc.TimeFormat = s\n\t}\n}", "func WithTimeFormat(s string) Option {\n\treturn func(c *config) {\n\t\tc.TimeFormat = s\n\t}\n}", "func (l *Log) FormatTime() string {\n\tif l.Logger.TimeFormat == \"\" {\n\t\treturn \"\"\n\t}\n\treturn l.Time.Format(l.Logger.TimeFormat)\n}", "func WithTimeFormat(tfmt string) func(*Impl) {\n\treturn func(l *Impl) {\n\t\tl.tfmt = tfmt\n\t}\n}", "func (l *Logger) TimeFormat() string {\n\treturn l.timeFormat\n}", "func SetFormat(v string) {\n\tlog.SetFormat(v)\n}", "func setLogTime() {\n\tlog.SetFlags(log.Lshortfile | log.LstdFlags)\n\n}", "func (c *ColumnBase) SetTimeFormat(timeFormat string) ColumnI {\n\tc.timeFormat = timeFormat\n\treturn c.this()\n}", "func (l *Locale) FormatTime(datetime dates.DateTime) string {\n\treturn datetime.Format(l.TimeFormatGo)\n}", "func WithTimeFormat(timeFormat string) EscapeFormatterOption {\n\treturn func(f *EscapeFormatter) {\n\t\tf.timeFormat = timeFormat\n\t}\n}", "func (rw *RemoteTimeWriter) InitFormat(s string) {\n\trw.logInfo.SFormat = s\n}", "func (t *Time) Format() error {\n\t// todo\n\treturn nil\n}", "func (h *Hook) SetFormat(format string) *Hook {\n\th.template = template.Must(template.New(\"log_parser\").Parse(format))\n\treturn h\n}", "func FormatTime(t time.Time) string {\n\treturn fmt.Sprintf(`\"%s\"`, t.UTC().Format(GerritTimestampLayout))\n}", "func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetTimeFormat(v time.Time) *InputService2TestShapeInputService2TestCaseOperation1Input {\n\ts.TimeFormat = &v\n\treturn s\n}", "func timeFormatter(t time.Time) string {\n\treturn time.Now().Format(time.RFC822)\n}", "func SetTimestampFormat(_tsFormat string) {\n\tglobalTsFormat = _tsFormat\n}", "func fmtTime(tp *time.Time) string {\n\tif tp == nil {\n\t\treturn \"\"\n\t}\n\n\treturn tp.UTC().Format(time.RFC3339)\n}", "func (c *Config) SetTimeOptions(format string, location *time.Location) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tif c.timeFormat != format && format != \"\" {\n\t\tc.timeFormat = format\n\t}\n\tif location != nil && c.location != location {\n\t\tc.location = location\n\t}\n}", "func LogTime(loc *time.Location, format, delimiter, msg string) string {\n\tt := time.Now().In(loc).Format(format)\n\treturn t + delimiter + msg\n}", "func FormatTime(t time.Time) string {\n\treturn t.Format(\"2006-01-02 15:04:05\")\n}", "func WithTimeFormat(timeformat string) Configurator {\n\treturn func(app *Application) {\n\t\tapp.config.TimeFormat = timeformat\n\t}\n}", "func formatLog() {\n\tFormatter := new(log.TextFormatter)\n\tFormatter.TimestampFormat = \"02-01-2006 15:04:05\"\n\tFormatter.FullTimestamp = true\n\tlog.SetFormatter(Formatter)\n}", "func (c *Config) SetTime(k string, t time.Time) {\n\tc.SetString(k, t.Format(time.RFC3339))\n}", "func formatTime(t time.Time) string {\n\treturn fmt.Sprintf(\"%04d%02d%02d%02d%02d\", t.Year(), t.Month(),\n\t\tt.Day(), t.Hour(), t.Minute())\n}", "func SetFormat(formatSpec string) logging.Formatter {\n\tif formatSpec == \"\" {\n\t\tformatSpec = defaultFormat\n\t}\n\treturn logging.MustStringFormatter(formatSpec)\n}", "func timeFormat(i interface{}) string {\n\tif i == nil {\n\t\treturn \"\"\n\t}\n\n\treturn fmt.Sprintf(\"%s\", i)\n}", "func formatTime(t time.Time) string {\n\treturn t.UTC().Format(\"2006-01-02T15:04:05Z\")\n}", "func formatTime(ts, now time.Time) string {\n\tif d := ts.Sub(now); -12*time.Hour < d && d < 12*time.Hour {\n\t\treturn ts.Format(\"3:04 PM\")\n\t} else {\n\t\treturn ts.Format(\"Jan 2, 2006\")\n\t}\n}", "func formatSASTimeWithDefaultFormat(t *time.Time) string {\n\treturn formatSASTime(t, sasTimeFormat) // By default, \"yyyy-MM-ddTHH:mm:ssZ\" is used\n}", "func timeFmt(w io.Writer, x interface{}, format string) {\n\t// note: os.Dir.Mtime_ns is in uint64 in ns!\n\ttemplate.HTMLEscape(w, strings.Bytes(time.SecondsToLocalTime(int64(x.(uint64)/1e9)).String()))\n}", "func setLogFormat(format string) {\n\n\tswitch format {\n\tcase \"TEXT\":\n\t\tlogrus.SetFormatter(&logrus.TextFormatter{})\n\tcase \"JSON\":\n\t\tlogrus.SetFormatter(&logrus.JSONFormatter{})\n\tdefault:\n\t\t//We are going to begin using Kibana for logging, Kibana requires logs outputted as JSON to build dashboards for\n\t\tlogrus.SetFormatter(&logrus.JSONFormatter{})\n\t}\n}", "func Format(format string, t time.Time) string {\n\tfn := func(match string) string {\n\t\treturn repl(match, t)\n\t}\n\treturn fmtRe.ReplaceAllStringFunc(format, fn)\n}", "func (s *Stopwatch) SetStringFormat(f func(time.Duration) string) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\ts.format = f\n}", "func (w *Writer) Time(t time.Time, layout string) {\n\tw.buf = t.AppendFormat(w.buf, layout)\n}", "func (w *Weather) SetTime(t time.Time) {\n\tstr := t.Format(\"Mon 15:04\")\n\tw.clock.SetText(str)\n}", "func (l *Logger) SetDateFormat(format string) {\n\tl.dateFormat = format\n}", "func (t *TimeFormat) Set(s string) error {\n\tswitch s {\n\tcase \"unix-epoch\", \"0\":\n\t\t*t = FormatUnixEpoch\n\tcase \"rfc3339\", \"1\":\n\t\t*t = FormatRFC3339\n\tdefault:\n\t\treturn errors.New(`invalid TimeFormat: \"` + s + `\"`)\n\t}\n\treturn nil\n}", "func formatTime(t time.Time) string {\n\tif t.Unix() < 1 {\n\t\t// It's more confusing to display the UNIX epoch or a zero value than nothing\n\t\treturn \"\"\n\t}\n\t// Return ISO_8601 time format GH-3806\n\treturn t.Format(\"2006-01-02T15:04:05Z07:00\")\n}", "func FormatTmsp(num int) string {\n\treturn \"date_format(?,'%Y-%m-%d %H:%i:%s.%f')\"\n}", "func (t Time) Format(ft string) string {\n\tp := epoch.Add(time.Second * time.Duration(t))\n\tif ft == \"\" {\n\t\tft = \"02 Jan 2006 15:04:05\"\n\t}\n\treturn p.In(time.UTC).Format(ft)\n}", "func init() {\n\tlogFormat = FormatDefault\n}", "func formatTime(t time.Time) string {\n\tzone, _ := t.Zone()\n\t// NOTE: Tried to use time#Format(), but it is very weird implementation.\n\t// Third-party libraries seem not to be maintained.\n\treturn fmt.Sprintf(\n\t\t\"%d%02d%02d_%02d%02d_%02d_%06d_%s\",\n\t\tt.Year(), t.Month(), t.Day(),\n\t\tt.Hour(), t.Minute(),\n\t\tt.Second(),\n\t\tt.Nanosecond() / 1000,\n\t\tzone,\n\t)\n}", "func formatTime(t timeofday.TimeOfDay, tmp []byte) []byte {\n\t// time.Time's AppendFormat does not recognize 2400, so special case it accordingly.\n\tif t == timeofday.Time2400 {\n\t\treturn []byte(pgTime2400Format)\n\t}\n\treturn t.ToTime().AppendFormat(tmp, pgTimeFormat)\n}", "func SabreTimeNowFmt() string {\n\treturn time.Now().Format(StandardTimeFormatter)\n}", "func timeToFormat(t int64, f string) string {\n\tutc, err := time.LoadLocation(\"UTC\")\n\tif err != nil {\n\t\tlog.Println(\"time.LoadLocation failed:\", err)\n\t\treturn \"\"\n\t}\n\tparsedTime := time.Unix(t, 0)\n\treturn escape(parsedTime.In(utc).Format(f))\n}", "func FormatTime(theTime time.Time, layout string) (r string) {\n\tif theTime.IsZero() {\n\t\treturn \"\"\n\t}\n\n\treturn theTime.Format(layout)\n}", "func SetLogFormat(logFormat LogFormat) {\n\tDefaultLogger.SetFormatter(GetFormatter(logFormat))\n}", "func Format(t time.Time) string {\n\treturn t.Format(\"2006-01-02T15:04:05.999999999Z07:00\")\n}", "func formatTime(second int) string {\n\thh := second / 3600\n\tmm := second % 3600 / 60\n\tss := second % 60\n\treturn fmt.Sprintf(\"%02d:%02d:%02d\", hh, mm, ss)\n}", "func Time(time time.Time, formats ...string) got.HTML {\n\tlayout := \"Jan 2, 2006 15:04\"\n\tif len(formats) > 0 {\n\t\tlayout = formats[0]\n\t}\n\tvalue := fmt.Sprintf(time.Format(layout))\n\treturn got.HTML(Escape(value))\n}", "func timeString(t time.Time, c *color.Color) string {\n\treturn c.SprintfFunc()(t.Format(\"2006-01-02 15:04 MST\"))\n}", "func SetFormat(t string) {\n\tprinter.Format = t\n}", "func SetFormat(t string) {\n\tprinter.Format = t\n}", "func (k *Key) TimeFormat(format string) (time.Time, error) {\n\treturn time.Parse(format, k.String())\n}", "func SetTimeStampFormatsISO8601Local(configuration *iotmaker_db_mongodb_config.Configuration) {\n\tconfiguration.SystemLog.TimeStampFormat = iotmaker_db_mongodb_config.KTimeStampFormatISO8601Local\n}", "func (tf timeFormatter) Format(t time.Time) string {\n\tif tf {\n\t\treturn t.Format(time.RFC3339)\n\t}\n\treturn fmt.Sprintf(\"%s ago\", units.HumanDuration(time.Now().UTC().Sub(t.UTC())))\n}", "func FormatTime(fmtTimeStampz string, sqlTypeName string, t time.Time) (v interface{}) {\n\tswitch sqlTypeName {\n\tcase types.Time:\n\t\ts := t.Format(\"2006-01-02 15:04:05\") // time.RFC3339\n\t\tv = s[11:19]\n\tcase types.Date:\n\t\tv = t.Format(\"2006-01-02\")\n\tcase types.DateTime, types.TimeStamp, types.Varchar: // !DarthPestilane! format time when sqlTypeName is schemas.Varchar.\n\t\tv = t.Format(\"2006-01-02 15:04:05\")\n\tcase types.TimeStampz:\n\t\tif fmtTimeStampz != \"\" {\n\t\t\t// dialect.URI().DBType == types.MSSQL ? \"2006-01-02T15:04:05.9999999Z07:00\"\n\t\t\tv = t.Format(fmtTimeStampz)\n\t\t} else {\n\t\t\t// if dialect.URI().DBType == types.MSSQL {\n\t\t\t// \tv = t.Format(\"2006-01-02T15:04:05.9999999Z07:00\")\n\t\t\t// } else {\n\t\t\tv = t.Format(time.RFC3339Nano)\n\t\t}\n\tcase types.BigInt, types.Int:\n\t\tv = t.Unix()\n\tdefault:\n\t\tv = t\n\t}\n\treturn\n}", "func (this *UdpHandler) SetTimestampFormat(format string) {\n\tthis.timestampFormat = format\n}", "func (c *Console) SetTimestampFormat(format string) {\n\tc.timestampFormat = format\n}", "func (rcv *impl) SetFormat(format string) Interface { rcv.TplText = format; return rcv }", "func FormatTime(seconds int) string {\n\tvar (\n\t\thour = toTimeString(seconds / 3600)\n\t\tminute = toTimeString(seconds % 3600 / 60)\n\t\tsecond = toTimeString(seconds % 60)\n\t)\n\treturn fmt.Sprintf(\"%s:%s:%s\", hour, minute, second)\n}", "func (l *Logger) SetFormat(format string) {\n\tl.template = template.Must(template.New(\"negroni_parser\").Parse(format))\n}", "func (llp *LogLineParsed) SetTime(newTime time.Time) {\n\thour, min, sec := newTime.Clock()\n\tllp.StampSeconds = hour*60*60 + min*60 + sec\n}", "func (t *Time) FormatTo(format string) *Time {\n\tt.Time = NewFromStr(t.Format(format)).Time\n\treturn t\n}", "func TimeValueFormatter(v interface{}) string {\n\treturn TimeValueFormatterWithFormat(v, DefaultDateFormat)\n}", "func FmtTime(t time.Time) string {\n\tif t == (time.Time{}) {\n\t\treturn \"\"\n\t}\n\treturn t.Format(\"2006-01-02 15:04\")\n}", "func SetTime(ct int) {\n\tcurrenttime = ct\n}", "func FormatTime(t time.Time) string {\n\tyear, month, day := t.Date()\n\tif year < 1 || year > 9999 {\n\t\treturn t.Format(TimeFormatLayout)\n\t}\n\thour, min, sec := t.Clock()\n\tmillisecond := t.Nanosecond() / 1e6\n\n\tyear100 := year / 100\n\tyear1 := year % 100\n\tmillisecond100 := millisecond / 100\n\tmillisecond1 := millisecond % 100\n\n\tvar result [23]byte\n\tresult[0], result[1], result[2], result[3] = digits10[year100], digits01[year100], digits10[year1], digits01[year1]\n\tresult[4] = '-'\n\tresult[5], result[6] = digits10[month], digits01[month]\n\tresult[7] = '-'\n\tresult[8], result[9] = digits10[day], digits01[day]\n\tresult[10] = ' '\n\tresult[11], result[12] = digits10[hour], digits01[hour]\n\tresult[13] = ':'\n\tresult[14], result[15] = digits10[min], digits01[min]\n\tresult[16] = ':'\n\tresult[17], result[18] = digits10[sec], digits01[sec]\n\tresult[19] = '.'\n\tresult[20], result[21], result[22] = digits01[millisecond100], digits10[millisecond1], digits01[millisecond1]\n\treturn string(result[:])\n}", "func (s *Stopwatch) SetFormatter(formatter func(time.Duration) string) {\n\ts.Lock()\n\ts.formatter = formatter\n\ts.Unlock()\n}", "func format(t time.Time) time.Time {\n\treturn t.In(DatabaseLocation).Truncate(TruncateOff)\n}", "func (l *Logger) formatHeader(buf *[]byte, t time.Time, file string, line int) {\n\t*buf = append(*buf, l.prefix...)\n\tif l.flag&(Ldate|Ltime|Lmicroseconds) != 0 {\n\t\tif l.flag&LUTC != 0 {\n\t\t\tt = t.UTC()\n\t\t}\n\t\tif l.flag&Ldate != 0 {\n\t\t\tyear, month, day := t.Date()\n\t\t\titoa(buf, year, 4)\n\t\t\t*buf = append(*buf, '/')\n\t\t\titoa(buf, int(month), 2)\n\t\t\t*buf = append(*buf, '/')\n\t\t\titoa(buf, day, 2)\n\t\t\t*buf = append(*buf, ' ')\n\t\t}\n\t\tif l.flag&(Ltime|Lmicroseconds) != 0 {\n\t\t\thour, min, sec := t.Clock()\n\t\t\titoa(buf, hour, 2)\n\t\t\t*buf = append(*buf, ':')\n\t\t\titoa(buf, min, 2)\n\t\t\t*buf = append(*buf, ':')\n\t\t\titoa(buf, sec, 2)\n\t\t\tif l.flag&Lmicroseconds != 0 {\n\t\t\t\t*buf = append(*buf, '.')\n\t\t\t\titoa(buf, t.Nanosecond()/1e3, 6)\n\t\t\t}\n\t\t\t*buf = append(*buf, ' ')\n\t\t}\n\t}\n\tif l.flag&(Lshortfile|Llongfile) != 0 {\n\t\tif l.flag&Lshortfile != 0 {\n\t\t\tshort := file\n\t\t\tfor i := len(file) - 1; i > 0; i-- {\n\t\t\t\tif file[i] == '/' {\n\t\t\t\t\tshort = file[i+1:]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfile = short\n\t\t}\n\t\t*buf = append(*buf, file...)\n\t\t*buf = append(*buf, ':')\n\t\titoa(buf, line, -1)\n\t\t*buf = append(*buf, \": \"...)\n\t}\n}", "func (params *JourneyParams)SetTime(t time.Time){\n\tparams.Time=GetTimeFormat(t)\n}", "func (t *timeDataType) Format(val interface{}) (interface{}, error) {\n\ttVal := val.(time.Time)\n\tfor _, format := range t.formatters {\n\t\ttVal = format(tVal)\n\t}\n\treturn tVal, nil\n}", "func main() {\n p := fmt.Println\n\n // Here’s a basic example of formatting a time according to RFC3339.\n t := time.Now()\n p(t.Format(\"2006-01-02T15:04:05Z07:00\"))\n\n // Format uses an example-based layout approach; it takes a formatted \n // version of the reference time Mon Jan 2 15:04:05 MST 2006 to determine \n // the general pattern with which to format the given time. The example \n // time must be exactly as shown: the year 2006, 15 for the hour, Monday \n // for the day of the week, etc. Here are a few more examples of time \n // formatting.\n p(t.Format(\"3:04PM\"))\n p(t.Format(\"Mon Jan _2 15:04:05 2006\"))\n p(t.Format(\"2006-01-02T15:04:05.999999-07:00\"))\n\n // For purely numeric representations you can also use standard \n // string formatting with the extracted components of the time value.\n fmt.Printf(\"%d-%02d-%02dT%02d:%02d:%02d-00:00\\n\",\n t.Year(), t.Month(),t.Day(),\n t.Hour(), t.Minute(), t.Second())\n\n // Time parsing uses the same example-based approach as Formating. \n // These examples parse times rendered with some of the layouts used above.\n withNanos := \"2006-01-02T15:04:05.999999999-07:00\"\n t1, e := time.Parse(withNanos,\n \"2012-11-01T22:08:41.117442+00:00\")\n p(t1)\n kitchen := \"3:04PM\"\n t2, e := time.Parse(kitchen, \"8:41PM\")\n p(t2)\n\n // Parse will return an error on malformed input explaining the \n // parsing problem.\n ansic := \"Mon Jan _2 15:04:05 2006\"\n _, e = time.Parse(ansic, \"8:41PM\")\n p(e)\n\n // There are several predefined formats that you can use for both \n // formatting and parsing.\n p(t.Format(time.Kitchen))\n}", "func printf(format string, args ...interface{}) {\n\tok := logLevel <= 1\n\n\tif ok {\n\t\tif !logNoTime {\n\t\t\ttimestampedFormat := strings.Join([]string{time.Now().Format(ISO8601Format), format}, \" \")\n\t\t\tlogger.Printf(timestampedFormat, args...)\n\t\t} else {\n\t\t\tlogger.Printf(format, args...)\n\t\t}\n\t}\n}", "func Format(t time.Time, format string) string {\n\treturn NewBeijing().Format(t, format)\n}", "func STime(t time.Time) string {\n\t_, month, day := t.Date()\n\thour, minute, second := t.Clock()\n\treturn fmt.Sprintf(\"%02d%02d %02d:%02d:%02d\", int(month), day, hour, minute, second)\n}", "func (t TimeInfo) Format(f string) string {\n\n\tr := []rune(f)\n\tvar s string\n\tfor _, v := range r {\n\t\tswitch v {\n\t\tcase 'Y':\n\t\t\ts += t.Year\n\t\tcase 'm':\n\t\t\ts += t.Month\n\t\tcase 'd':\n\t\t\ts += t.Day\n\t\tcase 'H':\n\t\t\ts += t.Hour\n\t\tcase 'i':\n\t\t\ts += t.Minute\n\t\tcase 's':\n\t\t\ts += t.Second\n\t\tdefault:\n\t\t\ts += string(v)\n\n\t\t}\n\t}\n\n\treturn s\n\n}", "func (ns *Namespace) Format(layout string, v interface{}) (string, error) {\n\tt, err := cast.ToTimeE(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn t.Format(layout), nil\n}", "func TimeValueFormatterWithFormat(v interface{}, dateFormat string) string {\n\tif typed, isTyped := v.(time.Time); isTyped {\n\t\treturn typed.Format(dateFormat)\n\t}\n\tif typed, isTyped := v.(int64); isTyped {\n\t\treturn time.Unix(0, typed).Format(dateFormat)\n\t}\n\tif typed, isTyped := v.(float64); isTyped {\n\t\treturn time.Unix(0, int64(typed)).Format(dateFormat)\n\t}\n\treturn \"\"\n}", "func FormatDatetime(time time.Time) string {\n\treturn time.Format(\"2006/01/02 15:04:05\")\n}", "func timeDisplay(t time.Time) string {\n\tif t.IsZero() {\n\t\treturn \"\"\n\t}\n\treturn t.Format(\"3:04pm\")\n}", "func (s *Setting) SetAsDefaultFormat() {\n\tif s.Type == Logger {\n\t\ts.Format = DefaultLoggerFormatMessage\n\t} else if s.Type == Printer {\n\t\ts.Format = DefaultPrinterFormatMessage\n\t}\n}", "func formatSASTime(t *time.Time, format string) string {\n\tif format != \"\" {\n\t\treturn t.Format(format)\n\t}\n\treturn t.Format(sasTimeFormat) // By default, \"yyyy-MM-ddTHH:mm:ssZ\" is used\n}", "func (as *AppStatusHandler) setTime() {\n\tas.Lock()\n\tdefer as.Unlock()\n\ttimeNow := time.Now()\n\t// Uptime is to be deprecated 19/03/2019\n\tas.state.Uptime = timeNow.Unix()\n\tas.state.StartTime = timeNow.Unix()\n\tas.state.StartTimeHuman = timeNow.Format(\"Mon Jan 2 2006 - 15:04:05 -0700 MST\")\n}", "func DebugTime(format string, args ...interface{}) {\n\tif logger == nil {\n\t\treturn\n\t}\n\tif trackingStart {\n\t\ttrackingStart = false\n\t\targs = append(args, time.Since(trackingT0))\n\t\tDebug(format+\": elapsed %s\", args...)\n\t} else {\n\t\ttrackingStart = true\n\t\ttrackingT0 = time.Now()\n\t\tDebug(format, args...)\n\t}\n}", "func SetDefaultLogFormat() {\n\tDefaultLogger.SetFormatter(GetFormatter(DefaultLogFormat))\n}", "func (t *Time) Format(format string) string {\n\trunes := []rune(format)\n\tbuffer := bytes.NewBuffer(nil)\n\tfor i := 0; i < len(runes); {\n\t\tswitch runes[i] {\n\t\tcase '\\\\':\n\t\t\tif i < len(runes)-1 {\n\t\t\t\tbuffer.WriteRune(runes[i+1])\n\t\t\t\ti += 2\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\treturn buffer.String()\n\t\t\t}\n\t\tcase 'W':\n\t\t\tbuffer.WriteString(strconv.Itoa(t.WeeksOfYear()))\n\t\tcase 'z':\n\t\t\tbuffer.WriteString(strconv.Itoa(t.DayOfYear()))\n\t\tcase 't':\n\t\t\tbuffer.WriteString(strconv.Itoa(t.DaysInMonth()))\n\t\tcase 'U':\n\t\t\tbuffer.WriteString(strconv.FormatInt(t.Unix(), 10))\n\t\tdefault:\n\t\t\tif runes[i] > 255 {\n\t\t\t\tbuffer.WriteRune(runes[i])\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif f, ok := formats[byte(runes[i])]; ok {\n\t\t\t\tresult := t.Time.Format(f)\n\t\t\t\t// Particular chars should be handled here.\n\t\t\t\tswitch runes[i] {\n\t\t\t\tcase 'j':\n\t\t\t\t\tfor _, s := range []string{\"=j=0\", \"=j=\"} {\n\t\t\t\t\t\tresult = strings.Replace(result, s, \"\", -1)\n\t\t\t\t\t}\n\t\t\t\t\tbuffer.WriteString(result)\n\t\t\t\tcase 'G':\n\t\t\t\t\tfor _, s := range []string{\"=G=0\", \"=G=\"} {\n\t\t\t\t\t\tresult = strings.Replace(result, s, \"\", -1)\n\t\t\t\t\t}\n\t\t\t\t\tbuffer.WriteString(result)\n\t\t\t\tcase 'u':\n\t\t\t\t\tbuffer.WriteString(strings.Replace(result, \"=u=.\", \"\", -1))\n\t\t\t\tcase 'w':\n\t\t\t\t\tbuffer.WriteString(weekMap[result])\n\t\t\t\tcase 'N':\n\t\t\t\t\tbuffer.WriteString(strings.Replace(weekMap[result], \"0\", \"7\", -1))\n\t\t\t\tcase 'S':\n\t\t\t\t\tbuffer.WriteString(formatMonthDaySuffixMap(result))\n\t\t\t\tdefault:\n\t\t\t\t\tbuffer.WriteString(result)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbuffer.WriteRune(runes[i])\n\t\t\t}\n\t\t}\n\t\ti++\n\t}\n\treturn buffer.String()\n}", "func (e Fields) SetTime(unix int64) Fields {\n\te[FieldTime] = unix\n\treturn e\n}", "func formatTimestamp(t time.Time, milli bool) string {\n\tif milli {\n\t\treturn fmt.Sprintf(\"%d.%03d\", t.Unix(), t.Nanosecond()/1000000)\n\t}\n\n\treturn fmt.Sprintf(\"%d\", t.Unix())\n}" ]
[ "0.83446497", "0.8004469", "0.7848419", "0.74778205", "0.7378692", "0.73391044", "0.69315016", "0.6906441", "0.6903391", "0.67805415", "0.67805415", "0.67570585", "0.6718086", "0.67086655", "0.6520503", "0.6479341", "0.6444903", "0.6416095", "0.63977253", "0.636315", "0.6311025", "0.63005704", "0.62488717", "0.6241578", "0.61955917", "0.61800945", "0.6148313", "0.6100397", "0.60838413", "0.60746026", "0.6063075", "0.60616857", "0.60582906", "0.60462666", "0.6019379", "0.5969618", "0.5908682", "0.5899252", "0.58778596", "0.58711123", "0.5862972", "0.58564967", "0.5854751", "0.58400655", "0.582008", "0.5818096", "0.5817715", "0.58133566", "0.5805204", "0.5790085", "0.5785432", "0.57682836", "0.57638544", "0.57478756", "0.5745831", "0.5740177", "0.57296693", "0.57197285", "0.57076794", "0.5679249", "0.56555444", "0.5636123", "0.5636123", "0.5631953", "0.5604917", "0.55784583", "0.5575331", "0.5574417", "0.5564408", "0.5560382", "0.55501395", "0.55489075", "0.5548713", "0.55372816", "0.5537088", "0.5520273", "0.55141264", "0.5509275", "0.5508409", "0.55055875", "0.55014116", "0.5496911", "0.5473889", "0.5451473", "0.544163", "0.5436503", "0.54178226", "0.54163283", "0.5413231", "0.5397011", "0.539182", "0.5385659", "0.5378574", "0.5375767", "0.5372122", "0.53665316", "0.5363888", "0.5358166", "0.53520995", "0.535068" ]
0.8603188
0
SetHandler sets output for default logger
func SetHandler(w io.Writer) { output.output = w }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SetHandler(h LoggingHandler) {\n\tcurrentHandler = h\n}", "func (rl *RevelLogger) SetHandler(h LogHandler) {\n\trl.Logger.SetHandler(callHandler(h.Log))\n}", "func (rl *RevelLogger) SetHandler(h LogHandler) {\n\trl.Logger.SetHandler(h)\n}", "func SetLogHandler(handler LogHandler) {\n\tcurrentLogHandler = handler\n\n\tC._tanker_set_log_handler()\n}", "func SetDefaultHandler(handler log15.Handler) {\n\tdefaultHandler = log15.SyncHandler(handler)\n\tL.SetHandler(defaultHandler)\n}", "func defaultHandler(ctx context.Context, input *HandlerInput) {\n\tinput.logger.doPrint(ctx, input)\n}", "func SetLogger(printLog, isSilent bool) {\n\tlog.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)\n\n\tl := &lumberjack.Logger{\n\t\tFilename: path.Join(cfg.LogDir, \"gou.log\"),\n\t\tMaxSize: 5, // megabytes\n\t\tMaxBackups: 10,\n\t\tMaxAge: 28, //days\n\t}\n\tswitch {\n\tcase isSilent:\n\t\tfmt.Println(\"logging is discarded\")\n\t\tlog.SetOutput(ioutil.Discard)\n\tcase printLog:\n\t\tfmt.Println(\"outputs logs to stdout and \", cfg.LogDir)\n\t\tm := io.MultiWriter(os.Stdout, l)\n\t\tlog.SetOutput(m)\n\tdefault:\n\t\tfmt.Println(\"output logs to \", cfg.LogDir)\n\t\tlog.SetOutput(l)\n\t}\n}", "func SetLogger(l *log.Logger) {\n StdOutLogger = l\n}", "func SetMiddlewareLogger(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Printf(\"\\n%s %s%s %s\", r.Method, r.Host, r.RequestURI, r.Proto)\n\t\tnext(w, r)\n\t}\n}", "func SetLoggerMiddleware(l *log.Entry) func(stdhttp.Handler) stdhttp.Handler {\n\treturn func(next stdhttp.Handler) stdhttp.Handler {\n\t\treturn stdhttp.HandlerFunc(func(w stdhttp.ResponseWriter, r *stdhttp.Request) {\n\t\t\tctx := r.Context()\n\t\t\tctx = log.Set(ctx, l)\n\t\t\tr = r.WithContext(ctx)\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "func initHandlerFor(c *CompositeMultiHandler, output, basePath string, options *LogOptions) {\n\tif options.Ctx != nil {\n\t\toptions.SetExtendedOptions(\n\t\t\t\"noColor\", !options.Ctx.BoolDefault(\"log.colorize\", true),\n\t\t\t\"smallDate\", options.Ctx.BoolDefault(\"log.smallDate\", true),\n\t\t\t\"maxSize\", options.Ctx.IntDefault(\"log.maxsize\", 1024*10),\n\t\t\t\"maxAge\", options.Ctx.IntDefault(\"log.maxage\", 14),\n\t\t\t\"maxBackups\", options.Ctx.IntDefault(\"log.maxbackups\", 14),\n\t\t\t\"compressBackups\", !options.Ctx.BoolDefault(\"log.compressBackups\", true),\n\t\t)\n\t}\n\n\toutput = strings.TrimSpace(output)\n\tif funcHandler, found := LogFunctionMap[output]; found {\n\t\tfuncHandler(c, options)\n\t} else {\n\t\tswitch output {\n\t\tcase \"\":\n\t\t\tfallthrough\n\t\tcase \"off\":\n\t\t// No handler, discard data\n\t\tdefault:\n\t\t\t// Write to file specified\n\t\t\tif !filepath.IsAbs(output) {\n\t\t\t\toutput = filepath.Join(basePath, output)\n\t\t\t}\n\n\t\t\tif err := os.MkdirAll(filepath.Dir(output), 0755); err != nil {\n\t\t\t\tlog.Panic(err)\n\t\t\t}\n\n\t\t\tif strings.HasSuffix(output, \"json\") {\n\t\t\t\tc.SetJSONFile(output, options)\n\t\t\t} else {\n\t\t\t\t// Override defaults for a terminal file\n\t\t\t\toptions.SetExtendedOptions(\"noColor\", true)\n\t\t\t\toptions.SetExtendedOptions(\"smallDate\", false)\n\t\t\t\tc.SetTerminalFile(output, options)\n\t\t\t}\n\t\t}\n\t}\n}", "func TestLogger_SetHandler(t *testing.T) {\n\tassert := asst.New(t)\n\n\tlogger := NewFunctionLogger(nil)\n\tth := NewTestHandler()\n\tlogger.SetHandler(th)\n\tlogger.Info(\"hello logger\")\n\tassert.True(th.HasLog(InfoLevel, \"hello logger\"))\n\t// TODO: test time ...\n}", "func SetLogger() {\n\tlogFile = handleLogFile()\n\tcfg := config.GetConf()\n\tl := logrus.New()\n\tl.SetFormatter(&logrus.TextFormatter{})\n\tl.SetReportCaller(true)\n\tl.SetLevel(parseLevel(cfg.Global.LogLevel))\n\tl.SetOutput(logFile)\n\tlogHandle = l\n\tlogEntry = logrus.NewEntry(logHandle)\n}", "func SetMiddleWareLogger(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// fmt.Println(\"\")\n\t\tlog.Printf(\"%s %s%s %s\", r.Method, r.Host, r.RequestURI, r.Proto)\n\t\tnext(w, r)\n\t}\n}", "func SetOutput(w io.Writer, tag string) {\n\tbaseLogger = newJSONLogger(newWriterLogger(w, tag), syslog.LOG_DEBUG, -1)\n}", "func SetOutput(level LogLevel, w io.Writer) func(*Logger) {\n\treturn func(l *Logger) {\n\t\tswitch level {\n\t\tcase Info:\n\t\t\tl.logInfo.SetOutput(w)\n\t\tcase Notice:\n\t\t\tl.logNotice.SetOutput(w)\n\t\tcase Warning:\n\t\t\tl.logWarning.SetOutput(w)\n\t\tcase Debug:\n\t\t\tl.logDebug.SetOutput(w)\n\t\tcase Trace:\n\t\t\tl.logTrace.SetOutput(w)\n\t\tcase Error:\n\t\t\tl.logError.SetOutput(w)\n\t\tcase Critical:\n\t\t\tl.logCritical.SetOutput(w)\n\t\tcase All:\n\t\t\tl.logInfo.SetOutput(w)\n\t\t\tl.logNotice.SetOutput(w)\n\t\t\tl.logWarning.SetOutput(w)\n\t\t\tl.logDebug.SetOutput(w)\n\t\t\tl.logTrace.SetOutput(w)\n\t\t\tl.logError.SetOutput(w)\n\t\t\tl.logCritical.SetOutput(w)\n\t\t}\n\t}\n}", "func SetWriter(w io.Writer) {\n\tlogger.SetOutput(w)\n}", "func (_m *MockHTTPServerInterface) SetHandler(_a0 http.Handler) {\n\t_m.Called(_a0)\n}", "func (logger *Logger) SetOutput(level string, w io.Writer, flag int) {\n\tlevelNum := LevelInt(level)\n\tswitch {\n\tcase INFO == levelNum:\n\t\tlogger.info = nativeLogger(w, level, flag)\n\tcase DEBUG == levelNum:\n\t\tlogger.debug = nativeLogger(w, level, flag)\n\tcase WARN == levelNum:\n\t\tlogger.warn = nativeLogger(w, level, flag)\n\tcase ERROR == levelNum:\n\t\tlogger.err = nativeLogger(w, level, flag)\n\tcase FATAL == levelNum:\n\t\tlogger.fatal = nativeLogger(w, level, flag)\n\tdefault:\n\t}\n}", "func SetLogger(l Logger) {\n\tmainLogger = l\n}", "func (hr *HttpRequest) SetToDefaultResponseHandler() {\n\thr.handlers = []ResponseStatusHandler{handler()}\n}", "func (m *MultiServer) SetLogger(f LoggerFunc) {\n\tm.logmu.Lock()\n\tdefer m.logmu.Unlock()\n\tm.logger = f\n}", "func SetHandler(key string, f func([]string) string) {\n\n\t_, ok := commandMap[key]\n\tif ok {\n\t\tfmt.Println(\"overriding handler:\", key)\n\t}\n\tcommandMap[key] = f\n}", "func SetDefault(log Logger) {\n\tdefLogger = log\n}", "func SetLogger(ctx context.Context, logger *logrus.Entry) {\n\tfields := rootlessLog.Data\n\trootlessLog = logger.WithFields(fields)\n}", "func (c *LogConfig) SetLogger() {\n\tif c == nil || c.Logfile == \"\" {\n\t\tInfof(\"Sending log messages to stdout since no log file specified.\")\n\t\treturn\n\t}\n\tfmt.Printf(\"Sending log messages to: %s\\n\", c.Logfile)\n\tl := &lumberjack.Logger{\n\t\tFilename: c.Logfile,\n\t\tMaxSize: c.MaxSize, // megabytes\n\t\tMaxAge: c.MaxAge, //days\n\t}\n\tlog.SetOutput(l)\n\tlogger = stdLogger{l}\n}", "func SetLogger(logger logger) {\n\tlog = logger\n}", "func LoggingHandler(writer http.ResponseWriter, request *http.Request) {\n\tif loggerInfo == nil {\n\t\tnoLoggersTemplate.Execute(writer, nil)\n\t\treturn\n\t}\n\tif err := loggersTemplate.Execute(writer, struct {\n\t\tAllLevels []logging.Level\n\t\tColours map[logging.Level]string\n\t\tModuleLevels map[string]logging.Level\n\t}{\n\t\tAllLevels: []logging.Level{\n\t\t\tlogging.DEBUG,\n\t\t\tlogging.INFO,\n\t\t\tlogging.NOTICE,\n\t\t\tlogging.WARNING,\n\t\t\tlogging.ERROR,\n\t\t\tlogging.CRITICAL,\n\t\t},\n\t\tColours: map[logging.Level]string{\n\t\t\tlogging.DEBUG: \"info\",\n\t\t\tlogging.INFO: \"secondary\",\n\t\t\tlogging.NOTICE: \"success\",\n\t\t\tlogging.WARNING: \"warning\",\n\t\t\tlogging.ERROR: \"danger\",\n\t\t\tlogging.CRITICAL: \"danger\",\n\t\t},\n\t\tModuleLevels: loggerInfo.ModuleLevels(),\n\t}); err != nil {\n\t\tlog.Errorf(\"%s\", err)\n\t}\n}", "func (l *SyncLog) SetWriter(w io.Writer) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tif handler, ok := w.(Handler); ok {\n\t\tl.handler = handler\n\t\tl.istty = isatty(handler.Fd())\n\t}\n\tl.out = w\n}", "func SetLogger(l StdLogger) {\n\tlogger = &prefixLogger{StdLogger: l, prefix: \"zerodt:\"}\n}", "func SetLogger(l Logger) {\n\t_, isDefault := l.(*logger)\n\tif isDefault && oakLogger != nil {\n\t\t// The user set the logger themselves,\n\t\t// don't reset to the default logger\n\t\treturn\n\t}\n\toakLogger = l\n\tError = l.Error\n\tWarn = l.Warn\n\tInfo = l.Info\n\tVerb = l.Verb\n\t// If this logger supports the additional functionality described\n\t// by the FullLogger interface, enable those functions. Otherwise\n\t// they are NOPs. (the default logger supports these functions.)\n\tif fl, ok := l.(FullLogger); ok {\n\t\tfullOakLogger = fl\n\t\tFileWrite = fl.FileWrite\n\t\tGetLogLevel = fl.GetLogLevel\n\t\tSetDebugFilter = fl.SetDebugFilter\n\t\tSetDebugLevel = fl.SetDebugLevel\n\t\tCreateLogFile = fl.CreateLogFile\n\t}\n}", "func DefaultHandler() log15.Handler {\n\treturn defaultHandler\n}", "func SetOutput() {\n\tlogLevel := parseLogLevel()\n\tlog.SetReportCaller(log.DebugLevel <= logLevel)\n\tlog.StandardLogger().Hooks = make(log.LevelHooks)\n\tlog.AddHook(\n\t\t&writer.Hook{\n\t\t\tWriter: mustGetLogWriter(config.Get().Logging.Internal.LoggerConf, \"mytoken.log\"),\n\t\t\tLogLevels: minLogLevelToLevels(logLevel),\n\t\t},\n\t)\n\tlog.SetOutput(io.Discard)\n}", "func Handler(fn http.Handler) http.Handler {\n\treturn logger{fn}\n}", "func (b *ASCIIOverTCP) Logger(l Logger) {\n\tb.Handler.Logger = l\n}", "func SetLogOutput(w io.Writer) {\n\tlogger = log.New(w, \"\", log.Lshortfile+log.Lmicroseconds)\n}", "func SetLogger(logger Logger) {\n\tDefaultTarget.SetLogger(logger)\n}", "func logged(h http.Handler) http.Handler {\n\tswitch config.LogFile {\n\tcase \"\":\n\t\treturn h\n\tcase \"stdout\":\n\t\treturn loggingHandler(os.Stdout, h)\n\tdefault:\n\t\tlogFile, err := os.OpenFile(config.LogFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn loggingHandler(logFile, h)\n\t}\n}", "func loggingHandler(h http.Handler) http.Handler {\n\treturn loggingHandlerFunc(h.ServeHTTP)\n}", "func setLogger(filename *string) error {\n\n\tfn := defaultLoggingFile\n\tif filename != nil && strings.TrimSpace(*filename) != \"\" {\n\t\tfn = *filename\n\t}\n\n\tlogFile, err := os.OpenFile(fn, os.O_RDWR, 0740)\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn err\n\t\t}\n\n\t\tlogFile, err = os.Create(fn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.SetOutput(logFile)\n\tlog.SetReportCaller(true)\n\treturn nil\n}", "func (b *mConf) setLogger() {\n\tLog = &log.Logger{}\n\n\twriter := os.Stdout\n\n\tif b.m.Log.ToFile {\n\t\tif f, err := os.OpenFile(b.m.Log.Filename, os.O_WRONLY|os.O_CREATE, 0755); err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"err\": err,\n\t\t\t\t\"file name\": b.m.Log.Filename,\n\t\t\t}).Error(\"Fail to create log file\")\n\t\t} else {\n\t\t\twriter = f // to file\n\t\t}\n\t}\n\n\t// set log formatter, JSON or plain text\n\n\tif b.m.Log.JSON {\n\t\tLog.Handler = json.New(writer)\n\t} else {\n\t\tLog.Handler = text.New(writer)\n\t}\n\n\t// set debug level\n\tif b.m.Log.Debug {\n\t\tLog.Level = log.DebugLevel\n\t} else {\n\t\tLog.Level = log.InfoLevel\n\t}\n}", "func SetLogger(l LevelledLogger) {\n\tlogger = &logPrefixer{log: l}\n}", "func (d *dispatcher) SetHandler(handler http.Handler) {\n\td.handler = handler\n}", "func SetLogger(logger *log.Logger) {\n\tmainServer.SetLogger(logger)\n}", "func SetLogger(l utils.Logger) {\n\tlog = l\n}", "func SetOutput(w io.Writer) {\n\tlogging.mu.Lock()\n\tdefer logging.mu.Unlock()\n\tfor s := severity.FatalLog; s >= severity.InfoLog; s-- {\n\t\trb := &redirectBuffer{\n\t\t\tw: w,\n\t\t}\n\t\tlogging.file[s] = rb\n\t}\n}", "func Handler(next http.Handler, l ...*log.Logger) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tpw := makePipeWriter(w)\n\t\tt1 := time.Now()\n\t\tnext.ServeHTTP(&pw, r)\n\t\tt2 := time.Now()\n\t\tif len(l) > 0 {\n\t\t\tl[0].Printf(\"%s %q %d %d %v\\n\",\n\t\t\t\tr.Method, r.URL.String(), pw.Status(), pw.Bytes(), t2.Sub(t1))\n\t\t} else {\n\t\t\tlog.Printf(\"%s %q %d %d %v\\n\",\n\t\t\t\tr.Method, r.URL.String(), pw.Status(), pw.Bytes(), t2.Sub(t1))\n\t\t}\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func SetLogger(logger Logger) {\n\tlog = logger\n}", "func (l *Logger) SetOutput(level LogLevel, w io.Writer) {\n\tswitch level {\n\tcase Info:\n\t\tl.logInfo.SetOutput(w)\n\tcase Notice:\n\t\tl.logNotice.SetOutput(w)\n\tcase Warning:\n\t\tl.logWarning.SetOutput(w)\n\tcase Debug:\n\t\tl.logDebug.SetOutput(w)\n\tcase Trace:\n\t\tl.logTrace.SetOutput(w)\n\tcase Error:\n\t\tl.logError.SetOutput(w)\n\tcase Critical:\n\t\tl.logCritical.SetOutput(w)\n\tcase All:\n\t\tl.logInfo.SetOutput(w)\n\t\tl.logNotice.SetOutput(w)\n\t\tl.logWarning.SetOutput(w)\n\t\tl.logDebug.SetOutput(w)\n\t\tl.logTrace.SetOutput(w)\n\t\tl.logError.SetOutput(w)\n\t\tl.logCritical.SetOutput(w)\n\t}\n}", "func SetOutput(w io.Writer) {\n\tlogger.SetOutput(w)\n}", "func (s *Server) SetHandler(handler http.Handler) {\n\ts.dispatcher.SetHandler(handler)\n}", "func SetLogger(logLevelVar string) {\n\tlevel, err := log.ParseLevel(logLevelVar)\n\tif err != nil {\n\t\tlevel = log.InfoLevel\n\t}\n\tlog.SetLevel(level)\n\n\tlog.SetReportCaller(true)\n\tcustomFormatter := new(log.TextFormatter)\n\tcustomFormatter.TimestampFormat = \"2006-01-02 15:04:05\"\n\tcustomFormatter.QuoteEmptyFields = true\n\tcustomFormatter.FullTimestamp = true\n\tcustomFormatter.CallerPrettyfier = func(f *runtime.Frame) (string, string) {\n\t\trepopath := strings.Split(f.File, \"/\")\n\t\tfunction := strings.Replace(f.Function, \"go-pkgdl/\", \"\", -1)\n\t\treturn fmt.Sprintf(\"%s\\t\", function), fmt.Sprintf(\" %s:%d\\t\", repopath[len(repopath)-1], f.Line)\n\t}\n\n\tlog.SetFormatter(customFormatter)\n\tfmt.Println(\"Log level set at \", level)\n}", "func SetLogger(l logger.Logger) {\n\tlog = l\n}", "func SetLogger(logger *logging.Logger) {\n\tlog = logger\n}", "func logSetOutput(iowr io.Writer) {\n\tlogt.SetOutput(iowr)\n\tlogOutputCur = iowr\n}", "func (l *Logger) SetOutput(v interface{}) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tswitch v.(type) {\n\t\tcase string:\n\t\t\tl.Filename = v.(string)\n\t\t\tl.openFile()\n\t\t\tl.closeFile()\n\t\tcase *os.File:\n\t\t\tl.out = v.(io.Writer)\n\t\tcase *bytes.Buffer:\n\t\t\tl.out = v.(io.Writer)\n\t\tdefault:\n\t\t\tpanic(\"expecting a filename or an io.Writer in the first argument\")\n\t}\n}", "func defaultHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"INFO: Default Handler called from %s. Please try alternative methods such as \\n %s\", r.RemoteAddr, handlerStrings)\n}", "func SetLogger(l logr.Logger) {\n\tsingleton.Propagate(l)\n}", "func SetLogger(logName string, conf *conf.LogConfiguration) error {\n\tLogger.lock.Lock()\n\tdefer Logger.lock.Unlock()\n\tif log, ok := logAdapters[logName]; ok {\n\t\tlg := log()\n\t\tlg.Init(conf)\n\t\tLogger.outputs[logName] = lg\n\t\treturn nil\n\t} else {\n\t\treturn fmt.Errorf(\"logs: unknown log type %q (forgotten Register?)\", logName)\n\t}\n}", "func (p *TSimpleServer) SetLogger(logger Logger) {\n\tp.logger = logger\n}", "func (d *Domain) SetHandler(fn func(\n\td *Domain,\n\tw http.ResponseWriter,\n\tr *http.Request)) {\n\td.handler = fn\n}", "func SetLogger(l Logger) {\n\tdLog.Fulfill(l)\n}", "func SetLogger(logger Logger) error {\n\t// currentlog := logger\n\treturn nil\n}", "func SetLogger(lg Logger) {\n\tlogger = lg\n}", "func SetLogger(l Logger) {\n\tlog = l\n}", "func SetLogger(logger Logger) {\n\tif logger == nil {\n\t\tlog = noopLogger{}\n\t} else {\n\t\tlog = logger\n\t}\n}", "func setLogging(p string) error {\n\tvar backends []logging.Backend\n\tif !options.Options.Kernel.Is(\"quiet\") {\n\t\tnormal := logging.NewLogBackend(os.Stdout, \"\", 0)\n\t\tbackends = append(backends, normal)\n\t}\n\n\tif err := redirect(p); err == nil {\n\t\tbackends = append(backends,\n\t\t\tlogging.NewLogBackend(output, \"\", 0),\n\t\t)\n\t}\n\n\tlevel := logging.GetLevel(\"\")\n\tlogging.SetBackend(backends...)\n\tlogging.SetLevel(level, \"\")\n\treturn nil\n}", "func LogHandler(next http.Handler) http.Handler {\n\tblue := color.New(color.FgBlue).SprintFunc()\n\tcyan := color.New(color.FgCyan).SprintFunc()\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Println(blue(r.Method) + \" :: \" + cyan(r.RequestURI))\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func (h *Handlers) SetHandler(r fasthttp.RequestHandler) *Handlers {\n\tc := &Handlers{}\n\tc.Handler = r\n\tc.Wrapper = h.Wrapper\n\treturn c\n}", "func SetLogger(log interface{}) {\n\tvar entry logger.LogEntry\n\n\tswitch log.(type) {\n\tcase *zap.Logger:\n\t\tlog, ok := log.(*zap.Logger)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tentry = logger.NewZap(log)\n\tcase *logrus.Logger:\n\t\tlog, ok := log.(*logrus.Logger)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tentry = logger.NewLogrus(log)\n\tdefault:\n\t\treturn\n\t}\n\n\tLoggerV3 = entry.WithFields(loggerV3Fields)\n}", "func SetLogger(logger logrus.FieldLogger) {\n\tlog = logger\n}", "func SetLogger(logger logrus.FieldLogger) {\n\tlog = logger\n}", "func (drc *DummyRectificationClient) SetLogger(l logging.LogSink) {\n\tl.Warnf(\"dummy begin\")\n\tdrc.logger = l\n}", "func (db RDB) SetLogger(w io.Writer) {\n\tflags := log.Ldate | log.Lmicroseconds | log.Lshortfile\n\tdb._log = log.New(w, \"\", flags)\n}", "func (server *Server) SetLogger(loggerInstance logger.Logger) {\n\tlogger.Init(loggerInstance)\n}", "func SetLogger(customLogger log.StdLogger) {\n\tlog.SetLogger(customLogger)\n}", "func SetLogger(l *log.Logger) {\n\tLog = l\n}", "func SetLogger(l *logger.Logger) {\n\tlog = l\n}", "func loggingHandler(writer io.Writer, next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\t// Create a response wrapper:\n\n\t\t// switch out response writer for a recorder\n\t\t// for all subsequent handlers\n\t\tc := httptest.NewRecorder()\n\n\t\tnext.ServeHTTP(c, req)\n\t\t// log\n\t\tresp := c.Result()\n\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\n\t\t// copy everything from response recorder\n\t\t// to actual response writer\n\t\tfor k, v := range c.HeaderMap {\n\t\t\tw.Header()[k] = v\n\t\t}\n\t\tw.WriteHeader(c.Code)\n\t\tc.Body.WriteTo(w)\n\n\t\t// write log information\n\t\thost, _, err := net.SplitHostPort(req.RemoteAddr)\n\t\tif err != nil {\n\t\t\thost = req.RemoteAddr\n\t\t}\n\t\tusername := \"-\"\n\t\tif url.User != nil {\n\t\t\tif name := req.URL.User.Username(); name != \"\" {\n\t\t\t\tusername = name\n\t\t\t}\n\t\t}\n\n\t\tfmt.Fprintf(writer, \"%s - %s [%v] \\\"%s %s %s\\\" %d %d\\n\", host, username, time.Now().Format(timeFMT), req.Method, req.RequestURI, req.Proto, resp.StatusCode, len(body))\n\t})\n}", "func loggingHandler(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tp := r.URL.Path\n\t\tnext.ServeHTTP(w, r)\n\t\tlog.Printf(\"%s %s\", r.Method, p)\n\t})\n}", "func SetStdLogger() {\n\tlogger, _ := logging.GetLogger(\"default\")\n\tlog.SetOutput(logging.NewInfoLogWriter(logger))\n\tlog.SetFlags(0)\n}", "func SetLogger(l Logger) {\n\tlogger = l\n}", "func SetLogger(l Logger) {\n\tlogger = l\n}", "func SetLogger(l Logger) {\n\tlogger = l\n}", "func SetLogger(l Logger) {\n\tlogger = l\n}", "func (s *Segment) SetHandler(handler http.HandlerFunc) {\n\ts.handler = handler\n}", "func (l *Logger) SetLogger(adapter string, config string) error {\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\tif log, ok := adapters[adapter]; ok {\n\t\tlg := log()\n\t\tif err := lg.Init(config); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tl.outputs[adapter] = lg\n\t\tl.adapter = adapter\n\t} else {\n\t\tpanic(\"log: unknown adapter \\\"\" + adapter + \"\\\" (forgotten register?)\")\n\t}\n\treturn nil\n}", "func (m Middleware) LoggingHandler(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\t//FIXME: broken\n\tt1 := time.Now()\n\tnext.ServeHTTP(rw, r)\n\tt2 := time.Now()\n\tlog.Printf(\"[%s] %q %v\", r.Method, r.URL.String(), t2.Sub(t1))\n\tnext(rw, r)\n}", "func SetOutput(v string) {\n\tlog.SetOutput(v)\n}", "func (s *Conn) SetLogger(fn func(LogEvent)) {\n\ts.logEventFn = fn\n}", "func SetLogger(logger internal.Logging) {\n\tinternal.Logger = logger\n}", "func SetOutput(w io.Writer) {\n\tlog.SetOutput(w)\n}", "func (l *Logger) SetOutput(v string) {\n\tswitch v {\n\tcase \"none\":\n\t\tl.Out = ioutil.Discard\n\tcase \"stdout\":\n\t\tl.Out = os.Stdout\n\tcase \"stderr\":\n\t\tl.Out = os.Stderr\n\t}\n}", "func SetLogger(l log.Logger) {\n\tlogger = l\n}", "func SetLogger(l log.Logger) {\n\tlogger = l\n}", "func SetLogger(logger *logrus.Logger) {\n\tlog = logger\n}", "func (l *Logger) SetOutput(w io.Writer) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tl.lg.SetOutput(w)\n}", "func logHandler(wrapped fetchbot.Handler) fetchbot.Handler {\n\treturn fetchbot.HandlerFunc(func(ctx *fetchbot.Context, res *http.Response, err error) {\n\t\tif err == nil {\n\t\t\tlogger.Info.Printf(\"%s [%d] %s - %s\", ctx.Cmd.Method(), res.StatusCode, ctx.Cmd.URL(), res.Header.Get(\"Content-Type\"))\n\t\t}\n\t\twrapped.Handle(ctx, res, err)\n\t})\n}", "func (hnd *Handlers) SetLogLevel() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvalue := bone.GetValue(r, \"level\")\n\t\tif value == \"\" {\n\t\t\thnd.writeErrorResponse(w, \"must supply a level between 0 and 5\")\n\t\t\treturn\n\t\t}\n\n\t\tlevel, err := strconv.Atoi(value)\n\t\tif err != nil {\n\t\t\tlog.Warn(\"attempt to set log level to invalid value: %s, ignored...\", level)\n\t\t\thnd.writeErrorResponse(w, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif level < 0 {\n\t\t\tlevel = 0\n\t\t}\n\n\t\tif level > 5 {\n\t\t\tlevel = 5\n\t\t}\n\n\t\tlog.SetLevel(level)\n\n\t\tfmt.Fprintf(w, \"{\\\"%s\\\":\\\"%d\\\"}\\n\\r\", \"loglevel\", log.GetLevel())\n\t}\n}", "func SetLogger(log interface{}) {\n\tvar entry logger.LogEntry\n\n\tswitch log.(type) {\n\tcase *zap.Logger:\n\t\tlog, ok := log.(*zap.Logger)\n\t\tif !ok {\n\n\t\t\treturn\n\t\t}\n\t\tentry = logger.NewZap(log)\n\tcase *logrus.Logger:\n\t\tlog, ok := log.(*logrus.Logger)\n\t\tif !ok {\n\n\t\t\treturn\n\t\t}\n\t\tentry = logger.NewLogrus(log)\n\tdefault:\n\n\t\treturn\n\t}\n\n\tBuilderLog = entry.WithFields(builderLogFields)\n}" ]
[ "0.73482513", "0.7272976", "0.7165659", "0.712639", "0.6723481", "0.6519488", "0.6403237", "0.63986504", "0.6384786", "0.6318756", "0.6312752", "0.628093", "0.6277271", "0.6276965", "0.6205787", "0.6197738", "0.61665475", "0.6165746", "0.61164564", "0.6115205", "0.6082817", "0.6079738", "0.6065666", "0.6060989", "0.6051596", "0.60241145", "0.60019636", "0.5993617", "0.59738714", "0.5963595", "0.5962139", "0.5957423", "0.59519285", "0.5950941", "0.594524", "0.5938812", "0.5937048", "0.5927144", "0.59236354", "0.59196436", "0.5913384", "0.5911393", "0.5903777", "0.59022874", "0.5889924", "0.58853453", "0.5872563", "0.5870051", "0.586823", "0.58649194", "0.5863055", "0.5851243", "0.5850667", "0.5849881", "0.58462584", "0.58327234", "0.58320785", "0.5831307", "0.5825697", "0.5818205", "0.58116955", "0.5808049", "0.58071196", "0.58063346", "0.5799104", "0.57899207", "0.57879746", "0.5768439", "0.57456917", "0.57444483", "0.5732902", "0.5732902", "0.57194084", "0.5713458", "0.5700676", "0.5692822", "0.5688785", "0.5688149", "0.56800014", "0.56798077", "0.5675976", "0.5672725", "0.5672725", "0.5672725", "0.5672725", "0.5667928", "0.56528485", "0.56494015", "0.564168", "0.5639801", "0.5633957", "0.563284", "0.5622711", "0.5620289", "0.5620289", "0.5602797", "0.5599627", "0.55944693", "0.5593054", "0.5591541" ]
0.75998396
0
Log is a generic method that will write to default logger and can accept custom logging levels
func Log(lvl Level, msg ...interface{}) { log(defaultLogger, lvl, msg...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Log(level Level, v ...interface{}) {\n\tstdLogger.Log(level, fmt.Sprint(v...))\n}", "func Log(logger log.Logger, begin time.Time, err error, additionalKVs ...interface{}) {\n\tpc, _, _, _ := runtime.Caller(1)\n\tcaller := strings.Split(runtime.FuncForPC(pc).Name(), \".\")\n\tdefaultKVs := []interface{}{\n\t\t\"method\", caller[len(caller)-2],\n\t\t\"took\", time.Since(begin),\n\t\t\"success\", fmt.Sprint(err == nil),\n\t}\n\n\tif err != nil {\n\t\tdefaultKVs = append(defaultKVs, \"err\")\n\t\tdefaultKVs = append(defaultKVs, err)\n\t\tlevel.Error(logger).Log(defaultKVs...)\n\t} else {\n\t\tlevel.Info(logger).Log(append(defaultKVs, additionalKVs...)...)\n\t}\n}", "func Log(level logrus.Level, args ...interface{}) {\n\tif mLogger.StdLogger != nil {\n\t\tmLogger.StdLogger.Log(level, args...)\n\t}\n\n\tif mLogger.FileLogger != nil {\n\t\tmLogger.FileLogger.Log(level, args...)\n\t}\n}", "func (v *MultiLogger) Log(level logrus.Level, args ...interface{}) {\n\tif v.StdLogger != nil {\n\t\tv.StdLogger.Log(level, args...)\n\t}\n\n\tif v.FileLogger != nil {\n\t\tv.FileLogger.Log(level, args...)\n\t}\n}", "func Log(values map[string]interface{}) {\n\t_, ok := values[LevelKey]\n\tif !ok {\n\t\tvalues[LevelKey] = LevelInfo\n\t}\n\n\tfor _, l := range loggers {\n\t\tl.Log(values)\n\t}\n}", "func (l Logger) Log(level int, strings ...interface{}) {\n\tswitch level {\n\tcase ERROR:\n\t\tl.ErrorLogger.Println(strings...)\n\tcase WARNING:\n\t\tif l.LogLevel >= 1 {\n\t\t\tl.WarningLogger.Println(strings...)\n\t\t}\n\tcase INFO:\n\t\tif l.LogLevel == 2 {\n\t\t\tl.InfoLogger.Println(strings...)\n\t\t}\n\t}\n}", "func (c *T) Log(args ...interface{})", "func (logger *Logger) Log(level Level, v ...interface{}) {\n\t// Don't delete this calling. The calling is used to keep the same\n\t// calldepth for all the logging functions. The calldepth is used to\n\t// get runtime information such as line number, function name, etc.\n\tlogger.log(level, v...)\n}", "func (l *logHandler) Log(logLevel, depth int, args ...interface{}) {\n\tif logLevel <= l.logLevel {\n\t\targs = append([]interface{}{levels[logLevel]}, args...)\n\t\tl.w.Output(depth, fmt.Sprintln(args...))\n\t}\n}", "func (l *logWrapper) Log(logLevel, depth int, args ...interface{}) {\n\tif logLevel <= l.logLevel {\n\t\targs = append([]interface{}{levels[logLevel]}, args...)\n\t\tlog.Output(depth, fmt.Sprintln(args...))\n\t}\n}", "func (a *delegate) Log(lvl level.LogLevel, format string, args ...interface{}) {\n\t// Validate the passed in level\n\tif ok, err := lvl.IsValid(); !ok {\n\t\tpanic(err)\n\t}\n\n\tswitch lvl {\n\tcase level.EMERGENCY:\n\t\tfallthrough\n\tcase level.ALERT:\n\t\tfallthrough\n\tcase level.CRITICAL:\n\t\ta.Fatalf(format, args...)\n\tcase level.ERROR:\n\t\ta.Panicf(format, args...)\n\tcase level.WARNING:\n\t\tfallthrough\n\tcase level.NOTICE:\n\t\tfallthrough\n\tcase level.INFO:\n\t\tfallthrough\n\tcase level.DEBUG:\n\t\ta.Printf(format, args...)\n\t}\n}", "func (l *Logger) Log(lvl LogLevel, a ...interface{}) {\r\n\tl.logInternal(lvl, 4, a...)\r\n}", "func (l *Logger) log(level int64, v string) { l.doMsg(level, v) }", "func (s *SilentLogger) Log(v ...interface{}) {}", "func (d *DefaultLogger) Log(v ...interface{}) {\n\tif d.LogEnabled() {\n\t\tlog.Println(v...)\n\t}\n}", "func (l *Logger) Log(level string, data map[string]interface{}, format string, args ...interface{}) {\n\tswitch level {\n\tcase kinesis.LevelDebug, kinesis.LevelInfo:\n\t\tlog.WithData(data).Debug().Write(format, args...)\n\tcase kinesis.LevelError:\n\t\tlog.WithData(data).Write(format, args...)\n\t}\n}", "func Log(level string) {\n\tutil.SetLevelString(level)\n}", "func Log(logger Logger, kvs ...interface{}) {\n\tif logger == nil {\n\t\treturn\n\t}\n\tlogger.Log(kvs...)\n}", "func (lg Logger) Log(level Level, v ...interface{}) {\n\tif level >= lg.level {\n\t\tlg.json.Timestamp = time.Now().Format(\"2006-01-02 15:04:05\")\n\t\tlg.json.Level = levelToString()[level]\n\t\tlg.json.Data = make(map[string]interface{})\n\t\tvar n = len(v)\n\t\tfor i := 0; i < n; i = i + 2 {\n\t\t\tif str, ok := v[i].(string); ok {\n\t\t\t\tlg.json.Data[str] = v[i+1]\n\t\t\t} else {\n\t\t\t\tpanic(\"json key must be a string\")\n\t\t\t}\n\t\t}\n\n\t\tlg.logger.Encode(lg.json)\n\t}\n}", "func Log(lType LogType, a ...interface{}) {\n\tif lType < logLevel {\n\t\treturn\n\t}\n\tlTime := \"[\" + time.Now().Format(time.RFC3339) + \"]\"\n\tlLevel := \"\"\n\tswitch lType {\n\tcase Debug:\n\t\tlLevel = \"[Debug]\"\n\tcase Info:\n\t\tlLevel = \"[Info]\"\n\tcase Failure:\n\t\tlLevel = \"[Failure]\"\n\tdefault:\n\t\tlLevel = \"[Debug]\"\n\t}\n\tfmt.Println(lTime, lLevel, a)\n\tif logToFile {\n\t\tlog.Println(lLevel, a)\n\t}\n}", "func (rf *Raft) Log(level LogLevel, a ...interface{}) {\n\tif !rf.killed() && level >= SetLogLevel {\n\t\tpc, _, ln, _ := runtime.Caller(1)\n\t\trp := regexp.MustCompile(\".+\\\\.([a-zA-Z]+)\")\n\t\tfuncName := rp.FindStringSubmatch(runtime.FuncForPC(pc).Name())[1]\n\t\tst := \"F\"\n\t\tif rf.state == Leader {\n\t\t\tst = \"L\"\n\t\t} else if rf.state == Candidate {\n\t\t\tst = \"C\"\n\t\t}\n\t\tdata := append([]interface{}{level, \"[ Server\", rf.me, \"- term\", rf.currentTerm, st, \"]\", \"[\", funcName, ln, \"]\"}, a...)\n\t\tfmt.Println(data...)\n\t}\n}", "func Log(logLvl int, v ...interface{}) {\n\tif LogLevel >= logLvl {\n\t\tDoLog(3, logLvl, fmt.Sprint(v...))\n\t}\n}", "func (l DefaultSDKLogger) Log(logLevel int, format string, v ...interface{}) error {\n\tlogger := l.getLoggerForLevel(logLevel)\n\tlogger.Output(4, fmt.Sprintf(format, v...))\n\treturn nil\n}", "func (a *Adapter) Log(level gomol.LogLevel, attrs *gomol.Attrs, msg string, args ...interface{}) error {\n\tif !a.shouldJournal(level) {\n\t\treturn a.base.Log(level, attrs, msg, args...)\n\t}\n\n\treturn a.LogWithTime(level, a.clock.Now(), attrs, msg, args...)\n}", "func (w KitWrapper) Log(keyvals ...interface{}) error {\n\tconst msg = \"log.KitWrapper\"\n\tswitch zapcore.Level(w) {\n\tdefault:\n\t\t// for unknown values, fallback to info level.\n\t\tfallthrough\n\tcase zapcore.InfoLevel:\n\t\tInfow(msg, keyvals...)\n\tcase zapcore.DebugLevel:\n\t\tDebugw(msg, keyvals...)\n\tcase zapcore.ErrorLevel:\n\t\tErrorw(msg, keyvals...)\n\tcase zapcore.PanicLevel:\n\t\tPanicw(msg, keyvals...)\n\tcase zapcore.FatalLevel:\n\t\tFatalw(msg, keyvals...)\n\tcase ZapNopLevel:\n\t\t// do nothing\n\t}\n\treturn nil\n}", "func Log(skip int, level Level, format string, v ...interface{}) {\n\tl, ok := NamedLoggers.Load(DEFAULT)\n\tif ok {\n\t\tl.Log(skip+1, level, format, v...)\n\t}\n}", "func (l *Logger) Log(level syslog.Priority, msg string, kv ...interface{}) (err error) {\n\tif l.Does(level) {\n\t\terr = l.log(level, msg, kv...)\n\t}\n\treturn\n}", "func (l prefixer) Log(f string, v ...interface{}) {\n\tLog(\n\t\tl.Target,\n\t\tl.FormatSpecifierPrefix+f,\n\t\tv...,\n\t)\n}", "func (l *Logger) Log(level LogLevel, messageFormat string, messageArgs ...interface{}) {\n\tif l == nil || level == Off || l.level > level {\n\t\treturn\n\t}\n\n\tl.logger.Print(l.timezone+label(level), fmt.Sprintf(messageFormat, messageArgs...))\n}", "func (a *adapter) Log(kvs ...interface{}) error {\n\tlogger := a.Logger.WithOptions(zap.AddCallerSkip(1)).Sugar()\n\tlevel, msg, entry := prepareEntry(kvs)\n\tswitch level {\n\tcase \"debug\":\n\t\tlogger.Debugw(msg, entry...)\n\tcase \"info\":\n\t\tlogger.Infow(msg, entry...)\n\tcase \"warn\":\n\t\tlogger.Warnw(msg, entry...)\n\tcase \"error\":\n\t\tlogger.Errorw(msg, entry...)\n\t}\n\treturn nil\n}", "func (g *Gate) Log(kvs ...interface{}) {\n\tif !g.Disabled() {\n\t\tg.Logger.Log(kvs...)\n\t}\n}", "func (h *FileHandler) Log(lv Level, d D) {\n\tmsg, err := json.Marshal(d)\n\tif err != nil {\n\t\treturn\n\t}\n\tswitch lv {\n\tcase _debugLevel:\n\t\th.logger.Debug(string(msg))\n\tcase _infoLevel:\n\t\th.logger.Info(string(msg))\n\tcase _warnLevel:\n\t\th.logger.Warn(string(msg))\n\tcase _errorLevel:\n\t\th.logger.Error(string(msg))\n\tcase _fatalLevel:\n\t\th.logger.Critical(string(msg))\n\tdefault:\n\t}\n}", "func Log(fmt string, args ...interface{}) {}", "func Log(logger log.Logger, level string, messages ...string) {\n\tmessage := strings.Join(messages, \" \")\n\n\tswitch level {\n\tcase config.Debug:\n\t\tlogger.Debug(\"\\n\"+timestamp(), \"[\"+level+\" ] \", message)\n\tcase config.Info:\n\t\tlogger.Info(\"\\n\"+timestamp(), \"[\"+level+\" ] \", message)\n\tcase config.Error:\n\t\tlogger.Error(\"\\n\"+timestamp(), \"[\"+level+\" ] \", message)\n\tcase config.Fatal:\n\t\tlogger.Fatal(\"\\n\"+timestamp(), \"[\"+level+\" ] \", message)\n\tdefault:\n\t\treturn\n\t}\n}", "func (s *severity) Log(details ...Jsonable) {\n\t_, _ = log(s, details...)\n}", "func (kv *KVServer) Log(level LogLevel, a ...interface{}) {\n\tif !kv.killed() && level >= SetLogLevel {\n\t\tpc, _, ln, _ := runtime.Caller(1)\n\t\trp := regexp.MustCompile(\".+\\\\.([a-zA-Z]+)\")\n\t\tfuncName := rp.FindStringSubmatch(runtime.FuncForPC(pc).Name())[1]\n\t\tdata := append([]interface{}{level, \"[ KV\", kv.me, \"]\", \"[\", funcName, ln, \"]\"}, a...)\n\t\tfmt.Println(data...)\n\t}\n}", "func (l LogrusGoKitLogger) Log(keyvals ...interface{}) error {\n\tfields, level, msg := l.extractLogElements(keyvals...)\n\n\tentry := l.WithFields(fields)\n\tentry.Log(level, msg)\n\n\treturn nil\n}", "func (l *Logger) log(level LogLevel, message interface{}) {\n\n\tnow := time.Now()\n\tvar logType string\n\tswitch level {\n\tcase DEBUG:\n\t\tlogType = \"[DEBUG]\"\n\t\tbreak\n\tcase WARNING:\n\t\tlogType = \"[WARNING]\"\n\t\tbreak\n\tcase ERROR:\n\t\tlogType = \"[ERROR]\"\n\t\tbreak\n\tdefault:\n\t\tlogType = \"[INFO]\"\n\t\tbreak\n\n\t}\n\t// format the output in a somewhat friendly way\n\tfmt.Printf(\"[%s] - [%s]\\t[%+v]\\n\", logType, now, message)\n\n}", "func (c *Client) Log(lvl level, message string, extra map[string]string) error {\n\tfor _, o := range c.cfg.Outputs {\n\t\terr := o.output(newLogBody(lvl.toString(), message, extra))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (self *RotateLog) Log(lvl int, callDepth int, format string, v ...interface{}) error {\n\tif lvl < self.lvl {\n\t\treturn nil\n\t}\n\n\tlvlStr := fmt.Sprintf(\"[%s]\", LogLvls[lvl])\n\tcontent := fmt.Sprintf(format, v...)\n\toutput := lvlStr + content\n\n\treturn self.logger.Output(callDepth, fmt.Sprintln(output))\n}", "func doLog(level string, format string, v ...interface{}) {\n\tmsg := formatLog(level, format, v...)\n\tdoRawLog(msg)\n}", "func (lgr) Log(v ...interface{}) {\n\tlog.Println(v...)\n}", "func Log(v ...interface{}) {\n\tlogger.Print(v...)\n}", "func (l *JSONLogger) Log(level string, format string, args ...interface{}) {\n\tpayload := payload{\n\t\ttime.Now(),\n\t\tlevel,\n\t\tl.service,\n\t\tl.name,\n\t\tfmt.Sprintf(format, args...),\n\t}\n\tenc, _ := json.Marshal(payload)\n\tfmt.Fprintf(l.writer, \"%s\\n\", enc)\n}", "func (c *B) Log(args ...interface{})", "func WithLevel(l Level, v ...interface{}) {\n\tif l > DefaultLevel {\n\t\treturn\n\t}\n\tlog(v...)\n}", "func (s SmudgeLogger) Log(level smudge.LogLevel, a ...interface{}) (n int, err error) {\n\tstr := strings.TrimSuffix(fmt.Sprintln(a...), \"\\n\")\n\tswitch level {\n\tcase smudge.LogFatal:\n\t\tlog.Fatal().Msg(str)\n\tcase smudge.LogInfo:\n\t\tlog.Info().Msg(str)\n\tcase smudge.LogError:\n\t\tlog.Error().Msg(str)\n\tcase smudge.LogWarn:\n\t\tlog.Warn().Msg(str)\n\tdefault:\n\t\tlog.Debug().Msg(str)\n\t}\n\treturn 0, nil\n}", "func (t t) Log(args ...interface{}) {\n\tfmt.Println(args...)\n}", "func (log *Logger) Log(level int, source, message string) {\n\t// Create a vector long enough to not require resizing\n\tvar logto vector.StringVector\n\tlogto.Resize(0, len(log.filterLevels))\n\n\t// Determine if any logging will be done\n\tfor filt := range log.filterLevels {\n\t\tif level >= log.filterLevels[filt] {\n\t\t\tlogto.Push(filt)\n\t\t}\n\t}\n\n\t// Only log if a filter requires it\n\tif len(logto) > 0 {\n\t\t// Make the log record\n\t\trec := newLogRecord(level, source, message)\n\n\t\t// Dispatch the logs\n\t\tfor _, filt := range logto {\n\t\t\tlw := log.filterLogWriters[filt]\n\t\t\tif lw.Good() {\n\t\t\t\tlw.LogWrite(rec)\n\t\t\t}\n\t\t}\n\t}\n}", "func (aspect LogAspect) Log(level logLevel, format string, items ...interface{}) {\n\tfor _, logger := range aspect.loggers[level] {\n\t\tlogger.Printf(format, items...)\n\t}\n\tfor _, logger := range all.loggers[level] {\n\t\tlogger.Printf(format, items...)\n\t}\n}", "func (l Logger) Log(loglevel pgx.LogLevel, msg string, data map[string]interface{}) {\n\tvar ev *zerolog.Event\n\tswitch loglevel {\n\tcase pgx.LogLevelDebug:\n\t\tev = l.Debug()\n\tcase pgx.LogLevelError:\n\t\tev = l.Error()\n\tcase pgx.LogLevelInfo:\n\t\tev = l.Info()\n\tcase pgx.LogLevelWarn:\n\t\tev = l.Warn()\n\tdefault:\n\t\tev = l.Debug()\n\t}\n\tfor k, v := range data {\n\t\tif k == \"time\" {\n\t\t\tcontinue\n\t\t}\n\t\tev = ev.Interface(k, v)\n\t}\n\tev.Msg(msg)\n}", "func (pgxLogAdaptor) Log(ctx context.Context, level pgx.LogLevel, msg string, data map[string]interface{}) {\n\tswitch level {\n\tcase pgx.LogLevelTrace:\n\tcase pgx.LogLevelDebug:\n\tcase pgx.LogLevelInfo:\n\tcase pgx.LogLevelWarn:\n\t\tsklog.Warningf(\"pgx - %s %v\", msg, data)\n\tcase pgx.LogLevelError:\n\t\tsklog.Warningf(\"pgx - %s %v\", msg, data)\n\tcase pgx.LogLevelNone:\n\t}\n}", "func Log(format string, v ...interface{}) {\n\tfor _, l := range Loggers {\n\t\tl.Log(format, v...)\n\t}\n}", "func (l StdLogger) Log(s string) {\n\tif l.Logger != nil {\n\t\tl.Logger.Println(s)\n\t} else {\n\t\tlog.Println(s)\n\t}\n}", "func (l *LoggerAsWriter) Log(msg string) {\n\tfor _, logger := range l.ourLoggers {\n\t\t// Set the skip to reference the call just above this\n\t\t_ = logger.Log(1, l.level, msg)\n\t}\n}", "func (l *littr) Log(v int, s interface{}) {\n\t// Check logging level\n\tif v > l.v {\n\t\treturn\n\t}\n\tt := time.Now()\n\tfmt.Printf(\"%v%v\\n\", t.Format(\"15:04:05 \"), s)\n}", "func Log(t *testing.T, args ...interface{}) {\n\tDoLog(t, 2, os.Stdout, args...)\n}", "func (logger *Logger) Log(msg string) {\n\tlogger.logGenericArgs(msg, nil, nil, 1)\n}", "func (l *Logger) Log(lv Level, file string, line int, msg string, args ...interface{}) {\n\tif lv < l.level || lv > CritLevel {\n\t\treturn\n\t}\n\n\tr := recordPool.Get().(*Record)\n\tr.level = lv\n\tr.time = now()\n\tr.file = file\n\tr.line = line\n\tr.message = msg\n\tr.args = args\n\n\tfor _, handler := range l.handlers {\n\t\thandler.Handle(r)\n\t}\n\n\trecordPool.Put(r)\n}", "func (d *dispatcher) log(fmt string, v ...interface{}) {\n\tif d.logger != nil {\n\t\td.logger.Printf(fmt, v...)\n\t}\n}", "func (cLogger CustomLogger) Log(args ...interface{}) error {\n\treturn log.With(loggerInstance, \"caller\", getCallerInfo()).Log(args...)\n}", "func (nl *noopLogger) Log(keyvals ...interface{}) error {\n\treturn nil\n}", "func (r *reporter) Log(args ...interface{}) {\n\tr.logs.log(fmt.Sprint(args...))\n}", "func Log(message, priority string) {\n\tswitch {\n\tcase priority == \"debug\":\n\t\tif os.Getenv(\"ENVOY_DEBUG\") != \"\" {\n\t\t\tlog.Print(message)\n\t\t}\n\tdefault:\n\t\tlog.Print(message)\n\t}\n}", "func (pm *pathManager) Log(level logger.Level, format string, args ...interface{}) {\n\tpm.parent.Log(level, format, args...)\n}", "func (log logger) Log(keyvals ...interface{}) error {\n\tif !log.IsLoggerDateValid() {\n\t\tlog.Reload()\n\t}\n\treturn log.kitLogger.Log(keyvals...)\n}", "func (l eventlog) Log(context interface{}, name string, message string, data ...interface{}) {}", "func Log(ctx context.Context, keyvals ...interface{}) error {\n\treturn ReqLogger(ctx).Log(keyvals...)\n}", "func Log(evs ...Event) {\n\tif l := DefaultLogger(); l != nil {\n\t\tl.Log(evs...)\n\t}\n}", "func (l *Logger) log(calloffset int, lvl Level, template string, fmtArgs []interface{}, fields []Field) {\n\tif !l.core.Enabled(lvl) {\n\t\tswitch lvl {\n\t\tcase PanicLevel:\n\t\t\tpanic(messagef(template, fmtArgs...))\n\t\tcase FatalLevel:\n\t\t\tos.Exit(1)\n\t\t}\n\t\treturn\n\t}\n\n\te := Entry{\n\t\tLevel: lvl,\n\t\tTime: time.Now(),\n\t\tMessage: messagef(template, fmtArgs...),\n\t\tFields: fields,\n\t\tLoggerName: l.name,\n\t\tCtx: l.ctx,\n\t}\n\n\tif l.addCaller {\n\t\te.Caller = NewEntryCaller(runtime.Caller(l.callerSkip + calloffset))\n\t}\n\n\tif err := l.core.Write(e); err != nil {\n\t\t// TODO: handle internal log errors\n\t}\n\n\t// PanicLevel and FatalLevel require additional operations\n\tswitch lvl {\n\tcase PanicLevel:\n\t\tpanic(e.Message)\n\tcase FatalLevel:\n\t\tos.Exit(1)\n\t}\n}", "func Log(messagelevel LogLevel, message interface{}) {\n\tlogMessageLevelMutex.RLock()\n\tdefer logMessageLevelMutex.RUnlock()\n\n\tif messagelevel <= logMessageLevel {\n\t\tlog.Printf(\"%v: %v\\n\", messagelevel, message)\n\t}\n}", "func (l *testLogger) Log(keyvals ...interface{}) error {\n\tn := (len(keyvals) + 1) / 2 // +1 to handle case when len is odd\n\tm := make(map[string]interface{}, n)\n\tfor i := 0; i < len(keyvals); i += 2 {\n\t\tk := keyvals[i]\n\t\tvar v interface{} = ErrMissingValue\n\t\tif i+1 < len(keyvals) {\n\t\t\tv = keyvals[i+1]\n\t\t}\n\t\tl.merge(m, k, v)\n\t}\n\n\tlevel := m[\"level\"]\n\tdelete(m, \"level\")\n\tif level == \"debug\" {\n\t\tl.debugs = append(l.debugs, m)\n\t} else if level == \"error\" {\n\t\tl.errors = append(l.errors, m)\n\t}\n\n\treturn nil\n}", "func TestDefaultLog(t *testing.T) {\n\n\tlogrus.SetLevel(logrus.TraceLevel)\n\n\tlog.GetLogger(\"default\").WithField(\"test\", \"DefaultLog\").Info(\"Hello\")\n\tlog.GetLogger(\"default\").WithField(\"test\", \"DefaultLog\").Debug(\"Hello\")\n\tlog.GetLogger(\"default\").WithField(\"test\", \"DefaultLog\").Trace(\"Hello\")\n\tlog.GetLogger(\"default\").WithField(\"test\", \"DefaultLog\").Warning(\"Hello\")\n\tlog.GetLogger(\"default\").WithField(\"test\", \"DefaultLog\").Error(\"Hello\")\n}", "func (ctx *Context) Log(format string, values ...interface{}) {\n\tctx.Logf(format+\"\\n\", values...)\n}", "func (l *Logger) Log(now time.Time, level string, msg string, ctx []Field) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\twriteTimestamp(l.w, now)\n\tl.w.WriteByte(' ')\n\twriteLevel(l.w, level)\n\tl.w.WriteByte(' ')\n\twriteMessage(l.w, msg)\n\n\tfor _, f := range l.context {\n\t\tl.w.WriteByte(' ')\n\t\tf.WriteTo(l.w)\n\t}\n\n\tfor _, f := range ctx {\n\t\tl.w.WriteByte(' ')\n\t\tf.WriteTo(l.w)\n\t}\n\n\tl.w.WriteByte('\\n')\n\n\tl.w.Flush()\n}", "func Log(l robot.LogLevel, m string, v ...interface{}) bool {\n\tbotLogger.Lock()\n\tcurrlevel := botLogger.level\n\tlogger := botLogger.l\n\tbotLogger.Unlock()\n\tprefix := logLevelToStr(l) + \":\"\n\tmsg := prefix + \" \" + m\n\tif len(v) > 0 {\n\t\tmsg = fmt.Sprintf(msg, v...)\n\t}\n\tif local && l >= errorThreshold {\n\t\tbotStdOutLogger.Print(msg)\n\t}\n\tif l >= currlevel || l == robot.Audit {\n\t\tif l == robot.Fatal {\n\t\t\tlogger.Fatal(msg)\n\t\t} else {\n\t\t\tif botStdOutLogging && l >= errorThreshold {\n\t\t\t\tbotStdErrLogger.Print(msg)\n\t\t\t} else {\n\t\t\t\tlogger.Print(msg)\n\t\t\t}\n\t\t\ttsMsg := fmt.Sprintf(\"%s %s\\n\", time.Now().Format(\"Jan 2 15:04:05\"), msg)\n\t\t\tbotLogger.Lock()\n\t\t\tbotLogger.buffer[botLogger.buffLine] = tsMsg\n\t\t\tbotLogger.buffLine = (botLogger.buffLine + 1) % (buffLines - 1)\n\t\t\tbotLogger.Unlock()\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "func (sl *StoreLogger) LogWrite(level ConfigLevel, key string, val interface{}) {\n\tlogLine := fmt.Sprintf(\"%s%s: writing level=%v key=%s val=%s\", time.Now().UTC().Format(TIME_FORMAT), LOG_NAME, level, key, val)\n\tsl.Log.Print(logLine)\n}", "func (i *Interactor) Log(msg string, args ...interface{}) {\n\ti.Logger.Log(msg, args...)\n}", "func (_m *T) Log(args ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, args...)\n\t_m.Called(_ca...)\n}", "func CustomizeLog(loglevel int, message string) {\n\tswitch loglevel {\n\tcase 0:\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"message\": message,\n\t\t}).Error(\"\")\n\tcase 1:\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"message\": message,\n\t\t}).Warn(\"\")\n\tcase 2:\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"message\": message,\n\t\t}).Info(\"\")\n\tdefault:\n\t\tglog.Errorf(\"invalid loglevel: %d for message: %s\", loglevel, message)\n\t}\n}", "func Log(v ...interface{}) {\n\tif verbose {\n\t\tVLogger.Print(v...)\n\t}\n}", "func Log(t testing.TestingT, args ...interface{}) {\n\tif tt, ok := t.(helper); ok {\n\t\ttt.Helper()\n\t}\n\n\tDoLog(t, 2, os.Stdout, args...)\n}", "func Log(s string, v ...interface{}) {\n\tif debug {\n\t\tlog.Debug().Msgf(s, v...)\n\t}\n}", "func (f LoggerFunc) Log(keyvals ...interface{}) error {\n\treturn f(keyvals...)\n}", "func (f LoggerFunc) Log(keyvals ...interface{}) error {\n\treturn f(keyvals...)\n}", "func (f LoggerFunc) Log(keyvals ...interface{}) error {\n\treturn f(keyvals...)\n}", "func Logger(c context.Context) loggers.Advanced", "func Log(v ...interface{}) {\n\tlog.Output(2, prefix+fmt.Sprint(v...))\n}", "func Log(level int, s string) {\n\tif level == LogLevelError {\n\t\tfmt.Println(\"[E!] \" + s)\n\t} else if level == LogLevelDefault {\n\t\tfmt.Println(\"[ ] \" + s)\n\t}\n}", "func Log(message string) {\n\tlogLock.RLock()\n\tdefer logLock.RUnlock()\n\tok := logLevel <= 1\n\n\tif ok {\n\t\tprint(message)\n\t}\n}", "func (m *MultiServer) Log(level int, msg string) {\n\tm.logmu.RLock()\n\tif m.logger != nil {\n\t\tm.logger(level, msg)\n\t}\n\tm.logmu.RUnlock()\n}", "func (l *Logger) Log(lv Level, file string, line int, msg string, args ...interface{}) {\n\tr := recordPool.Get().(*Record)\n\tr.level = lv\n\tif fastTimer.isRunning {\n\t\tr.date = fastTimer.date\n\t\tr.time = fastTimer.time\n\t} else {\n\t\tr.tm = now()\n\t}\n\tr.file = file\n\tr.line = line\n\tr.message = msg\n\tr.args = args\n\n\tfor _, h := range l.handlers {\n\t\tif !h.Handle(r) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\trecordPool.Put(r)\n}", "func (a *Adapter) log(ctx context.Context, logLevel string, message string, options ...interface{}) {\n\n\t// check whether the message should be logged\n\tif !a.isLoggable(logLevel) {\n\t\treturn\n\t}\n\n\tm := a.formatMessage(ctx, logLevel, message, options...)\n\n\ta.toConsole(m)\n\ta.toFile(m)\n}", "func (env *Env) log(enabled bool, v ...interface{}) {\n\tLog := _drv.Cfg().Log\n\tif !Log.IsEnabled(enabled) {\n\t\treturn\n\t}\n\tif len(v) == 0 {\n\t\tLog.Logger.Infof(\"%v %v\", env.sysName(), callInfo(1))\n\t} else {\n\t\tLog.Logger.Infof(\"%v %v %v\", env.sysName(), callInfo(1), fmt.Sprint(v...))\n\t}\n}", "func Log(handle Handle, args ...interface{}) error {\n\treturn defaultLogWriter.Log(handle, args...)\n}", "func (e *Huobi) Log(msgs ...interface{}) {\n\te.logger.Log(constant.INFO, \"\", 0.0, 0.0, msgs...)\n}", "func (c Context) Log(level int, msg, source string) {\n\tif level > c.LogLevel {\n\t\treturn\n\t}\n\n\tif !c.HasFlag(\"__logs\") {\n\t\tc.Flag(\"__logs\", []LogEntry{})\n\t}\n\n\tuseColors := os.Getenv(\"LOG_COLORS\") == \"true\"\n\n\tvar (\n\t\telapsed,\n\t\tformattedSource,\n\t\tformattedLevel,\n\t\tid string\n\t)\n\n\tif useColors {\n\t\telapsed = aurora.Green(fmt.Sprintf(\"+%dms\", c.Elapsed())).Bold().String()\n\t\tformattedSource = aurora.Blue(source).String()\n\t\tid = aurora.Magenta(c.Identifier).Bold().String()\n\t} else {\n\t\telapsed = fmt.Sprintf(\"+%dms\", c.Elapsed())\n\t\tformattedSource = source\n\t\tid = c.Identifier\n\t}\n\n\tswitch level {\n\tcase 30:\n\t\tif useColors {\n\t\t\tformattedLevel = aurora.Blue(\"INFO\").String()\n\t\t} else {\n\t\t\tformattedLevel = \"INFO\"\n\t\t}\n\tcase 40:\n\t\tif useColors {\n\t\t\tformattedLevel = aurora.Cyan(\"DEBUG\").String()\n\t\t} else {\n\t\t\tformattedLevel = \"DEBUG\"\n\t\t}\n\tcase 50:\n\t\tif useColors {\n\t\t\tformattedLevel = aurora.Gray(\"TRACE\").String()\n\t\t} else {\n\t\t\tformattedLevel = \"TRACE\"\n\t\t}\n\tcase 20:\n\t\tif useColors {\n\t\t\tformattedLevel = aurora.Brown(\"WARN\").String()\n\t\t} else {\n\t\t\tformattedLevel = \"WARN\"\n\t\t}\n\tcase 10:\n\t\tif useColors {\n\t\t\tformattedLevel = aurora.Red(\"ERROR\").String()\n\t\t} else {\n\t\t\tformattedLevel = \"ERROR\"\n\t\t}\n\tdefault:\n\t\tif useColors {\n\t\t\tformattedLevel = aurora.Gray(\"CLVL \" + strconv.Itoa(level)).String()\n\t\t} else {\n\t\t\tformattedLevel = \"CLVL \" + strconv.Itoa(level)\n\t\t}\n\t}\n\n\tfmt.Printf(\"[%s | %s | %s] %s %s\\n\", elapsed, formattedSource, id, formattedLevel, msg)\n\n\tlogEntry := LogEntry{\n\t\tElapsed: c.Elapsed(),\n\t\tSource: source,\n\t\tLevel: level,\n\t\tMessage: msg,\n\t}\n\n\tif c.bot.eventHandler != nil {\n\t\tc.bot.eventChan <- Event{\n\t\t\tType: EVLog,\n\t\t\tLog: &logEntry,\n\t\t\tContext: &c,\n\t\t}\n\t}\n\n\tc.logMutex.Lock()\n\tlogArr := c.GetFlag(\"__logs\").([]LogEntry)\n\tlogArr = append(logArr, logEntry)\n\tc.Flag(\"__logs\", logArr)\n\tc.logMutex.Unlock()\n}", "func Log(message, targetMode string) {\n\n\tif _, ok := acceptedLogModes[LOG_MODE_NONE]; ok {\n\t\treturn\n\t}\n\n\tif _, ok := acceptedLogModes[targetMode]; ok {\n\t\tfmt.Println(message)\n\t}\n\n}", "func (lc StdoutLogger) Log(text string) {\n\tlc(text)\n}", "func (log *Logger) intLogf(level int, format string, args ...interface{}) {\n\t// Create a vector long enough to not require resizing\n\tvar logto vector.StringVector\n\tlogto.Resize(0, len(log.filterLevels))\n\n\t// Determine if any logging will be done\n\tfor filt := range log.filterLevels {\n\t\tif level >= log.filterLevels[filt] {\n\t\t\tlogto.Push(filt)\n\t\t}\n\t}\n\n\t// Only log if a filter requires it\n\tif len(logto) > 0 {\n\t\t// Determine caller func\n\t\tpc, _, lineno, ok := runtime.Caller(2)\n\t\tsrc := \"\"\n\t\tif ok {\n\t\t\tsrc = fmt.Sprintf(\"%s:%d\", runtime.FuncForPC(pc).Name(), lineno)\n\t\t}\n\n\t\t// Make the log record\n\t\trec := newLogRecord(level, src, fmt.Sprintf(format, args...))\n\n\t\t// Dispatch the logs\n\t\tfor _, filt := range logto {\n\t\t\tlog.filterLogWriters[filt].LogWrite(rec)\n\t\t}\n\t}\n}" ]
[ "0.715193", "0.7146359", "0.7124372", "0.7007673", "0.6997413", "0.6973293", "0.6935028", "0.69177014", "0.6892381", "0.68864584", "0.686102", "0.68603563", "0.6796642", "0.67755", "0.67739147", "0.6758528", "0.6748753", "0.6734863", "0.67129326", "0.668416", "0.6673071", "0.66595364", "0.6654103", "0.66387796", "0.66374", "0.662525", "0.66246116", "0.66056544", "0.659897", "0.65662736", "0.6523062", "0.65112484", "0.6494316", "0.64735115", "0.64608896", "0.6458053", "0.6455012", "0.64256805", "0.6421739", "0.64200765", "0.641745", "0.6417085", "0.64151335", "0.6390872", "0.6380786", "0.6376551", "0.63678944", "0.63597375", "0.63589483", "0.63468474", "0.6326482", "0.6316789", "0.62957835", "0.629028", "0.6282612", "0.6276445", "0.6275805", "0.6263696", "0.6245917", "0.62456095", "0.6230528", "0.6220924", "0.62085366", "0.62056977", "0.62015647", "0.61674577", "0.61664134", "0.61581343", "0.61541706", "0.61532027", "0.61442524", "0.6142034", "0.61304253", "0.61253214", "0.6106401", "0.6105731", "0.61020863", "0.6099184", "0.6094987", "0.6093391", "0.60801846", "0.60800695", "0.6076171", "0.607044", "0.607044", "0.607044", "0.6062285", "0.6047153", "0.6042343", "0.6041382", "0.6030418", "0.6029794", "0.6027326", "0.6026535", "0.6023677", "0.60086364", "0.6008173", "0.59987575", "0.5995372", "0.59894055" ]
0.67545015
16
Logf is just like Log, but with formatting
func Logf(lvl Level, format string, a ...interface{}) { log(defaultLogger, lvl, fmt.Sprintf(format, a...)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *T) Logf(format string, args ...interface{})", "func verboseLogf(format string, a ...any) {\n\tverboseLog(fmt.Sprintf(format, a...))\n}", "func Logf(format string, args ...interface{}) {\n\tstdLog.Logf(format, args...)\n}", "func logf(level string, format string, args ...interface{}) {\n\tfmt.Fprintf(ginkgo.GinkgoWriter, nowStamp()+\": \"+level+\": \"+format+\"\\n\", args...)\n}", "func (c *B) Logf(format string, args ...interface{})", "func Logf(format string, a ...interface{}) {\n\tfmt.Fprintf(GinkgoWriter, \"INFO: \"+format+\"\\n\", a...)\n}", "func Logf(t *testing.T, format string, args ...interface{}) {\n\tDoLog(t, 2, os.Stdout, fmt.Sprintf(format, args...))\n}", "func logf(format string, v ...interface{}) {\n\tlog.Printf(format+\"\\n\", v...)\n}", "func (c *Context) Logf(format string, args ...interface{}) {\n\tc.T.Logf(format, args...)\n}", "func Logf(t *testing.T, format string, args ...interface{}) {\n\tlogfFunc(t, noStackOffset, \"\\n\"+format, args...)\n}", "func Logf(format string, args ...interface{}) (n int, err error) {\n\treturn fmt.Fprintf(ginkgo.GinkgoWriter, format+\"\\n\", args...)\n}", "func infoLogf(format string, v ...interface{}) {\n\t// if source info is enabled, prepend the foramt string with source information\n\tif enableSourceInfo {\n\t\tformat = strings.Join([]string{getSourceInfo(), format}, s)\n\t}\n\n\tlog.Printf(format, v...)\n}", "func Logf(format string, v ...interface{}) {\n\tlog.Output(2, prefix+fmt.Sprintf(format, v...))\n}", "func (l *Logger) Printf(format string, v ...interface{}) { l.lprintf(INFO, format, v...) }", "func Logf(t testing.TestingT, format string, args ...interface{}) {\n\tif tt, ok := t.(helper); ok {\n\t\ttt.Helper()\n\t}\n\n\tDoLog(t, 2, os.Stdout, fmt.Sprintf(format, args...))\n}", "func logf(format string, args ...interface{}) {\n\tif testing.Verbose() {\n\t\tlog.Printf(format, args...)\n\t}\n}", "func logf(format string, args ...interface{}) {\n\tglobalLoggerLock.Lock()\n\tdefer globalLoggerLock.Unlock()\n\tif globalLogger != nil {\n\t\tglobalLogger.Output(2, fmt.Sprintf(format, args...))\n\t}\n}", "func logf(_ context.Context, format string, args ...interface{}) {\n\tlog.Printf(format, args...)\n}", "func (*Logger) DiscordGoLogf(_, _ int, _ string, _ ...interface{}) {\n\t// Nop\n}", "func (lgr) Logf(format string, v ...interface{}) {\n\tlog.Printf(format, v...)\n}", "func Log(fmt string, args ...interface{}) {}", "func logf(t Type, wait bool, msg string, args []interface{}, meta map[string]interface{}) string {\n\treturn log(t, wait, fmt.Sprintf(msg, args...), meta)\n}", "func Printf(format string, a ...interface{}) { writeLog(fmt.Sprintf(format, a...)) }", "func Logf(level int, format string, v ...interface{}) {\n\tif currentlog.level <= level {\n\t\tif v != nil {\n\t\t\tfmt.Printf(format, v...)\n\t\t\tfmt.Println(\"\")\n\t\t} else {\n\t\t\tfmt.Println(format)\n\t\t}\n\n\t}\n}", "func (l *Logger) HandlerLogf(w http.ResponseWriter, r *http.Request, format string, a ...interface{}) {\r\n\tl.timeReset()\r\n\tdefer l.logInternal(DebugLevel, 4, fmt.Sprintf(format, a...))\r\n}", "func Logf(logger Logger, format string, kvs ...interface{}) {\n\tLog(logger, fmt.Sprintf(format, kvs...))\n}", "func Logf(s string, v ...interface{}) {\n\tlogger.Printf(s, v...)\n}", "func (_m *T) Logf(format string, args ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, format)\n\t_ca = append(_ca, args...)\n\t_m.Called(_ca...)\n}", "func Logf(level int, format string, a ...interface{}) {\n\tmessage := fmt.Sprintf(format, a...)\n\tLog(level, message)\n}", "func Logf(level Level, format string, v ...interface{}) {\n\tstdLogger.Log(level, fmt.Sprintf(format, v...))\n}", "func (c *BaseClient) Logf(format string, a ...interface{}) {\n\tlog.Printf(\"[%v]: %v\", c.id, fmt.Sprintf(format, a...))\n}", "func (s *Step) Logf(message string, args ...interface{}) {\n\tif s.verbose {\n\t\tfmt.Fprintf(writer, \" %s %s %s\\n\", time.Now().Format(time.RFC3339), s.test, fmt.Sprintf(message, args...))\n\t}\n}", "func Logf(ctx context.Context, format string, args ...interface{}) {\n\tgetLogger(ctx).Printf(format, args...)\n}", "func (c *NATSTestClient) Logf(format string, v ...interface{}) {\n\tif c.l != nil {\n\t\tc.l.Log(fmt.Sprintf(format, v...))\n\t}\n}", "func (m *memStats) logf(format string, args ...interface{}) {\n\tfmt.Printf(\"%s%s\", m.repeat(\" \", m.indent), fmt.Sprintf(format, args...))\n}", "func (r *reporter) Logf(format string, args ...interface{}) {\n\tr.logs.log(fmt.Sprintf(format, args...))\n}", "func logf(format string, a ...interface{}) {\n\tif strings.HasSuffix(format, \"\\n\") {\n\t\tfmt.Fprintf(writer, format, a...)\n\t} else {\n\t\tfmt.Fprintf(writer, format+\"\\n\", a...)\n\t}\n}", "func Log(v ...any) {\n\tvar b strings.Builder\n\tfor i := 0; i < len(v); i++ {\n\t\tif i != 0 {\n\t\t\tb.WriteByte(' ')\n\t\t}\n\t\tb.WriteString(\"%v\")\n\t}\n\tLogf(b.String(), v...)\n}", "func logf(format string, a ...interface{}) {\n\tif !*flagVerbose {\n\t\treturn\n\t}\n\n\tlog.Printf(format, a...)\n}", "func (l *Logger) Logf(format string, args ...interface{}) {\n\t// to align call depth between (*Logger).Logf() and, for example, Printf()\n\tl.logf(format, args...)\n}", "func (ctx *Context) Logf(format string, values ...interface{}) {\n\t_, _ = fmt.Fprintf(ctx.App().Writer, format, values...)\n}", "func logf(format string, args ...interface{}) {\n\tif len(args) == 0 {\n\t\tfmt.Print(format)\n\t\treturn\n\t}\n\tfmt.Printf(format, args...)\n}", "func (s Scenario) Logf(fmt string, args ...interface{}) {\n\tlog.Printf(fmt, args...)\n}", "func Logf(format string, v ...any) {\n\tDefaultLogger(format, v...)\n}", "func (ctx *Context) Log(format string, values ...interface{}) {\n\tctx.Logf(format+\"\\n\", values...)\n}", "func Logf(levelName, format string, args ...interface{}) {\n\tNewDefaultEntry().Logf(levelName, format, args...)\n}", "func fmtLogger(msg string, args ...interface{}) {\n\tfmt.Printf(msg, args...)\n\tfmt.Println()\n}", "func Logf(logLvl int, format string, v ...interface{}) {\n\tif LogLevel >= logLvl {\n\t\tDoLog(3, logLvl, fmt.Sprintf(format, v...))\n\t}\n}", "func printf(format string, args ...interface{}) {\n\tok := logLevel <= 1\n\n\tif ok {\n\t\tif !logNoTime {\n\t\t\ttimestampedFormat := strings.Join([]string{time.Now().Format(ISO8601Format), format}, \" \")\n\t\t\tlogger.Printf(timestampedFormat, args...)\n\t\t} else {\n\t\t\tlogger.Printf(format, args...)\n\t\t}\n\t}\n}", "func (log *Logger) Logf(level int, format string, args ...interface{}) {\n\tlog.intLogf(level, format, args...)\n}", "func Logf(format string, args ...interface{}) {\n\tlogLock.RLock()\n\tdefer logLock.RUnlock()\n\tok := logLevel <= 1\n\n\tif ok {\n\t\tprintf(format, args...)\n\t}\n}", "func Printf(format string, v ...interface{}) {\n\tlog.Output(2, prefix+fmt.Sprintf(format, v...))\n}", "func (l *Logger) Debugf(format string, v ...interface{}) { l.lprintf(DEBUG, format, v...) }", "func (l prefixer) Log(f string, v ...interface{}) {\n\tLog(\n\t\tl.Target,\n\t\tl.FormatSpecifierPrefix+f,\n\t\tv...,\n\t)\n}", "func Logf(format string, v ...interface{}) {\n\tdefaultLogger.Log(infoLogging, format, v...)\n}", "func Log(format string, a ...interface{}) {\n\ts := fmt.Sprintf(format, a...)\n\ts = fmt.Sprintf(\"%v: %s\", time.Now().Format(\"2006-01-02T15:04:05.000\"), s)\n\tfmt.Println(s)\n}", "func (log *Logger) intLogf(level int, format string, args ...interface{}) {\n\t// Create a vector long enough to not require resizing\n\tvar logto vector.StringVector\n\tlogto.Resize(0, len(log.filterLevels))\n\n\t// Determine if any logging will be done\n\tfor filt := range log.filterLevels {\n\t\tif level >= log.filterLevels[filt] {\n\t\t\tlogto.Push(filt)\n\t\t}\n\t}\n\n\t// Only log if a filter requires it\n\tif len(logto) > 0 {\n\t\t// Determine caller func\n\t\tpc, _, lineno, ok := runtime.Caller(2)\n\t\tsrc := \"\"\n\t\tif ok {\n\t\t\tsrc = fmt.Sprintf(\"%s:%d\", runtime.FuncForPC(pc).Name(), lineno)\n\t\t}\n\n\t\t// Make the log record\n\t\trec := newLogRecord(level, src, fmt.Sprintf(format, args...))\n\n\t\t// Dispatch the logs\n\t\tfor _, filt := range logto {\n\t\t\tlog.filterLogWriters[filt].LogWrite(rec)\n\t\t}\n\t}\n}", "func (logger *Logger) Printf(format string, args ...interface{}) {\n\tlogger.std.Logf(format, args...)\n}", "func (l *defaultLogger) privateLogf(lv Level, format string, fmtArgs []interface{}) {\n\tif l.level > lv {\n\t\treturn\n\t}\n\tlevel := lv.toString()\n\tbuf := bytebufferpool.Get()\n\t_, _ = buf.WriteString(level) //nolint:errcheck // It is fine to ignore the error\n\n\tif len(fmtArgs) > 0 {\n\t\t_, _ = fmt.Fprintf(buf, format, fmtArgs...)\n\t} else {\n\t\t_, _ = fmt.Fprint(buf, fmtArgs...)\n\t}\n\t_ = l.stdlog.Output(l.depth, buf.String()) //nolint:errcheck // It is fine to ignore the error\n\tbuf.Reset()\n\tbytebufferpool.Put(buf)\n\tif lv == LevelFatal {\n\t\tos.Exit(1) //nolint:revive // we want to exit the program when Fatal is called\n\t}\n}", "func Printf(format string, v ...interface{}) {\n\tlogger.Printf(format, v...)\n}", "func (mock *MockLogger) Printf(format string, v ...interface{}) {\n\tmock.appendToLog(fmt.Sprintf(format, v...))\n}", "func (f Freckle) log(msg string, data ...interface{}) {\n\tif f.debug {\n\t\tlog.Printf(\"DEBUG: %s\", fmt.Sprintf(msg, data...))\n\t}\n}", "func (entry *Entry) Logf(level Level, format string, args ...interface{}) {\n\t(*lrs.Entry)(entry).Logf((lrs.Level)(level), format, args)\n}", "func (m *Monitor) logf(format string, v ...interface{}) {\n\tm.cctx.ll.Printf(m.iface+\": \"+format, v...)\n}", "func Printf(format string, args ...interface{}) {\n\tlogger.Printf(format, args...)\n}", "func Printf(format string, args ...interface{}) {\n\tlogger.Printf(format, args...)\n}", "func Printf(format string, args ...interface{}) {\n\tlogger.Printf(format, args...)\n}", "func (l Logger) Logf(format string, args ...interface{}) {\n\tl.J.Printf(format, args...)\n}", "func Debugf(format string, args ...interface{}) { logRaw(LevelDebug, 2, format, args...) }", "func (o Options) logf(format string, arguments ...interface{}) {\n\tif o.Logger != nil {\n\t\to.Logger.Printf(format, arguments...)\n\t}\n}", "func Logf(format string, v ...interface{}) {\n\tif verbose {\n\t\tVLogger.Printf(format, v...)\n\t}\n}", "func Printf(format string, args ...interface{}) {\n\tLogger.Printf(format, args...)\n}", "func (l *Log) Printf(format string, v ...interface{}) {\n\tl.append(lInfo, fmt.Sprintf(format, v...))\n}", "func (c *Cron) logf(format string, args ...interface{}) {\n\tif c.ErrorLog != nil {\n\t\tc.ErrorLog.Errorf(format, args...)\n\t} else {\n\t\tlog.Printf(format, args...)\n\t}\n}", "func Printf(msg string, v ...interface{}) {\n\tLogger.Infof(msg, v...)\n}", "func (l *log)Infof(format string, args ...interface{}) {\n fmt.Printf(format, args...)\n}", "func Logf(ctx context.Context, s string, v ...interface{}) {\n\tlogf, ok := ctx.Value(loggerKey).(func(string, ...interface{}))\n\tif !ok {\n\t\tlogf = log.Printf\n\t}\n\tlogf(s, v...)\n}", "func Debugf(format string, params ...interface{}){\n log.Debugf(format, params)\n}", "func (l *testingLogger) Debugf(format string, args ...interface{}) {\n\tl.t.Logf(format, args...)\n}", "func (e *Engine) Logf(format string, a ...interface{}) {\n\ts := fmt.Sprintf(format, a...)\n\tsc := bufio.NewScanner(strings.NewReader(s))\n\tfor sc.Scan() {\n\t\te.log.Println(sc.Text())\n\t}\n}", "func Printf(format string, args ...interface{}) {\n\tstdLog.Printf(format, args...)\n}", "func debugLog(c context.Context, str *string, format string, args ...interface{}) {\n\tprefix := clock.Now(c).UTC().Format(\"[15:04:05.000] \")\n\t*str += prefix + fmt.Sprintf(format+\"\\n\", args...)\n}", "func (l *testingLogger) Infof(format string, args ...interface{}) {\n\tl.t.Logf(format, args...)\n}", "func (db *fakeDB) printf(format string, params ...any) {\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\tdb.log = append(db.log, fmt.Sprintf(format, params...))\n}", "func (d *D) Log(format string, a ...interface{}) {\n\tif !d.config.Debug || d.config.L == nil {\n\t\treturn\n\t}\n\n\td.config.L.Printf(format, a...)\n}", "func Log(msg string, a ...interface{}) {\n formatted := fmt.Sprintf(msg, a...)\n logger.Println(fmt.Sprintf(\"\\033[34;1mINFO:\\033[0m %s\", formatted))\n}", "func (StdLogger) Debugf(format string, v ...interface{}) {}", "func Log(format string, a ...interface{}) {\n\ta, w := extractLoggerArgs(format, a...)\n\tfmt.Fprintf(w, label(format, \"\"), a...)\n}", "func Printf(template string, args ...interface{}) {\n\tlog.Infof(template, args...)\n}", "func logFn(l log.Level, msg string, a ...interface{}) {\n\tlog.Logf(logger(), l, msg, a...)\n}", "func (s *SilentLogger) Logf(f string, v ...interface{}) {}", "func ulog(format string, a ...interface{}) {\n\tp := fmt.Sprintf(format, a...)\n\tlog.Print(p)\n\tif Uhura.DebugToScreen {\n\t\tfmt.Print(p)\n\t}\n}", "func (l *Logger) lprintf(lv Level, format string, v ...interface{}) {\n\t_ = l.Output(lv, 4, fmt.Sprintf(format, v...))\n}", "func Logf(format string, args ...interface{}) {\n\tpanic(msg{Default, fmt.Sprintf(format, args...)})\n}", "func logInfo(format string, v ...interface{}) {\n\ts := fmt.Sprintf(format, v...)\n\tlogger.Println(s)\n}", "func (ses *Ses) logF(enabled bool, format string, v ...interface{}) {\n\tLog := _drv.Cfg().Log\n\tif !Log.IsEnabled(enabled) {\n\t\treturn\n\t}\n\tif len(v) == 0 {\n\t\tLog.Logger.Infof(\"%v %v\", ses.sysName(), callInfo(2))\n\t} else {\n\t\tLog.Logger.Infof(\"%v %v %v\", ses.sysName(), callInfo(2), fmt.Sprintf(format, v...))\n\t}\n}", "func Logf(level logrus.Level, format string, args ...interface{}) {\n\tif mLogger.StdLogger != nil {\n\t\tmLogger.StdLogger.Logf(level, format, args...)\n\t}\n\n\tif mLogger.FileLogger != nil {\n\t\tmLogger.FileLogger.Logf(level, format, args...)\n\t}\n}", "func Printf(format string, v ...interface{}) { std.lprintf(INFO, format, v...) }", "func Debugf(format string, v ...interface{}) { std.lprintf(DEBUG, format, v...) }", "func (l thundraLogger) Printf(format string, v ...interface{}) {\n\tif logLevelId > infoLogLevelId {\n\t\treturn\n\t}\n\tlogManager.recentLogLevel = infoLogLevel\n\tlogManager.recentLogLevelId = infoLogLevelId\n\tadditionalCalldepth = 1\n\tl.Logger.Printf(format, v)\n}" ]
[ "0.7650748", "0.7465684", "0.74493384", "0.7433169", "0.7407501", "0.7359252", "0.7254635", "0.7196539", "0.7193993", "0.7190672", "0.717673", "0.71669", "0.71653306", "0.7150722", "0.7074802", "0.70746446", "0.70575976", "0.7041564", "0.7032145", "0.7015256", "0.6986061", "0.6975286", "0.6965522", "0.695654", "0.69557685", "0.6943569", "0.69282067", "0.6926085", "0.6920319", "0.6917371", "0.6908401", "0.6891523", "0.6885777", "0.6859044", "0.68530685", "0.685072", "0.6850475", "0.6843758", "0.6831787", "0.6829449", "0.6820897", "0.6819196", "0.681853", "0.68125033", "0.6811371", "0.6810057", "0.67836034", "0.6760593", "0.6745373", "0.6742058", "0.6741071", "0.67371505", "0.67347556", "0.67183805", "0.6710367", "0.6704237", "0.66948116", "0.6688948", "0.66822124", "0.66764843", "0.6647758", "0.6642834", "0.662889", "0.6623238", "0.6618637", "0.6618637", "0.6618637", "0.661847", "0.6611881", "0.6609405", "0.6604115", "0.6602652", "0.6600673", "0.66000324", "0.65755534", "0.6574754", "0.6568098", "0.656527", "0.6561793", "0.65531623", "0.6537102", "0.6529434", "0.6528888", "0.6528657", "0.65269554", "0.6522329", "0.65192866", "0.65191174", "0.6513611", "0.65052235", "0.64948523", "0.64920723", "0.6490662", "0.6490158", "0.6489386", "0.648801", "0.6486401", "0.6485272", "0.64848566", "0.6484847" ]
0.6954022
25
Debug is a logging method that will write to default logger with DEBUG level
func Debug(msg ...interface{}) { log(defaultLogger, DEBUG, msg...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *DummyLogger) Debug(format string) {}", "func (dl *defaultLogger) Debug(msg string) {\n\tdl.Print(msg)\n}", "func (l *MessageLogger) Debug(msg string) { l.logger.Debug(msg) }", "func (lg *Logger) Debug(args ...interface{}) {\n if lg.level <= DEBUG {\n lg.logger.SetPrefix(LEVELS[DEBUG])\n lg.logger.Println(args...)\n }\n}", "func Debug(args ...interface{}) {\n\tdefaultLogger.Debug(args...)\n}", "func (l nullLogger) Debug(msg string, ctx ...interface{}) {}", "func (logger *Logger) Debug(args ...interface{}) {\n\tlogger.std.Log(append([]interface{}{\"Debug\"}, args...)...)\n}", "func (stimLogger *FullStimLogger) Debug(message ...interface{}) {\n\tif stimLogger.highestLevel >= DebugLevel {\n\t\tif stimLogger.setLogger == nil {\n\t\t\tif stimLogger.forceFlush {\n\t\t\t\tstimLogger.writeLogs(stimLogger.formatString(DebugLevel, debugMsg, message...))\n\t\t\t} else {\n\t\t\t\tstimLogger.formatAndLog(DebugLevel, debugMsg, message...)\n\t\t\t}\n\t\t} else {\n\t\t\tstimLogger.setLogger.Debug(message...)\n\t\t}\n\t}\n}", "func Debug(format string, v ...interface{}) {\n\tif logger.Debug {\n\t\tdoLog(\"DEBUG\", format, v...)\n\t}\n}", "func Debug(message string) {\n\tif logLevel >= 1 {\n\t\tlogger.Printf(\"DEBUG %s\", message)\n\t}\n}", "func (l *Logger) Debug(v ...interface{}) { l.lprint(DEBUG, v...) }", "func Debug(args ...interface{}) {\n\tDefaultLogger.Debug(args...)\n}", "func (customLogger *CustomLogger) Debug(message string) {\n\tcustomLogger.logger.Debug(message)\n}", "func (l *logHandler) Debug(args ...interface{}) {\n\tl.Log(LogDebug, 3, args...)\n}", "func (sl *SysLogger) Debug(info, msg string) {\n\tlog.Println(\"[DEBUG]\", sl.tag, info, msg)\n}", "func (l *BasicLogger) Debug(msg string) {\n\tl.appendLogEvent(level.DebugLevel, msg)\n}", "func (cLogger CustomLogger) Debug(args ...interface{}) {\n\tlevel.Debug(log.With(loggerInstance, \"caller\", getCallerInfo())).Log(args...)\n}", "func (logger *Logger) Debug(args ...interface{}) {\n\tlogger.logPrint(L_DEBUG, args...)\n\tlogger.Flush()\n}", "func (l *Logger) Debug(message string) {\n\tl.LogWithLevel(message, \"debug\")\n}", "func (l *Logger) Debug(args ...interface{}) {\n\tl.lock()\n\tdefer l.unlock()\n\tl.logger.Debug(args...)\n}", "func Debug(msg string) {\n log.Debug(msg)\n}", "func (z *Logger) Debug(args ...interface{}) {\n\tz.SugaredLogger.Debug(args...)\n}", "func (l *Logger) Debug(args ...interface{}) {\n\tif l.IsEnabledFor(DebugLevel) {\n\t\tfile, line := Caller(1) // deeper caller will be more expensive\n\t\tl.Log(DebugLevel, file, line, \"\", args...)\n\t}\n}", "func Debug(msg string, args ...interface{}) {\n\tdefaultLogger.Debug(msg, args...)\n}", "func (l *logWrapper) Debug(args ...interface{}) {\n\tl.Log(LogDebug, 3, args...)\n}", "func Debug(ctx context.Context, args ...interface{}) {\n\tGetLogger().Log(ctx, loggers.DebugLevel, 1, args...)\n}", "func (l *Logger) Debug(message string) {\n\tstdLog.Debug(message)\n}", "func (logger *Logger) Debug(v ...interface{}) {\n\tif logger.level >= 4 {\n\t\tlogger.log.Output(2, fmt.Sprintf(\"[DEBUG] %s\\n\", v...))\n\t}\n}", "func Debug(v ...interface{}) {\n\tif enableDebug {\n\t\tinfoLog(v...)\n\t}\n}", "func Debug(v ...interface{}) {\n\tm := fmt.Sprint(v...)\n\tdefaultLogger.Log(debugLogging, \"%s\", m)\n}", "func (l *Logger) Debug(v ...interface{}) {\n\tif l.debugEnabled {\n\t\tl.NewEntry().Print(DEBUG, v...)\n\t}\n}", "func (l *logrusLogger) Debug(msg string) {\n\tl.l.Debug(msg)\n}", "func (l *Logger) Debug(values ...interface{}) {\n\tif l.loggingLevel > DebugLevel {\n\t\treturn\n\t}\n\tl.log(l.debugPrefix, fmt.Sprint(values...))\n}", "func (v *MultiLogger) Debug(args ...interface{}) {\n\tv.Self().Log(logrus.DebugLevel, args...)\n}", "func Debug(msg string, v ...interface{}) {\n\tDefaultLogger.Debug(msg, v...)\n}", "func (l *Logger) Debug(level uint8, v ...interface{}) {\n\tl.logger.Log(sprint(v...))\n}", "func (slog stdLogger) Debug(s string) {\n\tif logger.Logger != nil {\n\t\tlogger.Write([]byte(\" DEBUG \" + s))\n\t} else {\n\t\tlog.Printf(\" DEBUG \" + s)\n\t}\n}", "func Debug(message interface{}) {\n\tglobalLogger.Debug(message)\n}", "func (l Logger) Debug(msg ...interface{}) {\n\tif l.Level <= log.DebugLevel {\n\t\tl.logger.Print(append([]interface{}{\"[DEBUG] \"}, msg...)...)\n\t}\n}", "func (nl *NullLogger) LogDebug(m ...interface{}) {\n}", "func Debug(args ...interface{}) {\r\n\tLogger.Debug(\"\", args)\r\n}", "func (l *Log) Debug(args ...interface{}) {\n\tl.logger.Debug(args...)\n}", "func Debug(v ...interface{}) {\n\tif jl.level != INFO {\n\t\tvar s string\n\t\tjl.stdlog.SetPrefix(\"[DEBUG] \")\n\t\tif jl.flag == LstdFlags|Lshortfile {\n\t\t\ts = generateStdflagShortFile()\n\t\t}\n\n\t\ts = s + fmt.Sprintln(v...)\n\t\tjl.stdlog.Print(s)\n\t}\n}", "func (l *comLogger) Debug(msg string) {\n\tl.Log(Debug, msg)\n}", "func Debug(ctx ...interface{}) {\n\tlogNormal(debugStatus, time.Now(), ctx...)\n}", "func (l *Logger) Debug(message string) {\n\tl.printLogMessage(keptnLogMessage{Timestamp: time.Now(), Message: message, LogLevel: \"DEBUG\"})\n}", "func (CryptoMachineLogger) Debug(message string, args ...interface{}) {\n\tlog.Debugf(message, args...)\n}", "func Debug(args ...interface{}) {\n\tLogger.Debug(args...)\n}", "func (l *Logger) Debug(msg string) {\n\t// check if level is in config\n\t// if not, return\n\tif DEBUG&l.levels == 0 {\n\t\treturn\n\t}\n\te := Entry{Level: DEBUG, Message: msg}\n\n\te.enc = BorrowEncoder(l.w)\n\n\t// if we do not require a context then we\n\t// format with formatter and return.\n\tif l.contextName == \"\" {\n\t\tl.beginEntry(e.Level, msg, e)\n\t\tl.runHook(e)\n\t} else {\n\t\tl.openEntry(e.enc)\n\t}\n\n\tl.closeEntry(e)\n\tl.finalizeIfContext(e)\n\n\te.enc.Release()\n}", "func Debug(args ...interface{}) {\n\tLog(logrus.DebugLevel, args...)\n}", "func Debug(args ...interface{}) {\n\tlogger.Debug(args...)\n}", "func Debug(args ...interface{}) {\n\tlogger.Debug(args...)\n}", "func Debug(args ...interface{}) {\n\tlogger.Debug(args...)\n}", "func Debug(args ...interface{}) {\n\tlogger.Debug(args...)\n}", "func (l typeLogger) Debug(format string, v ...interface{}) {\n\tif l.level <= logDebug {\n\t\tmessage := fmt.Sprintf(format, v...)\n\t\tl.logger.Printf(\" %s%s%s : %s (%s)\", colorDebug, tagDebug, colorClear, message, getCallerPosition())\n\t}\n}", "func Debug(msg string){\n\tif IsDebug() {\n\t\tlog.Println(msg)\n\t}\n}", "func (logger *Logger) Debug(msg string, extras ...map[string]string) error {\n\tif DebugLevel >= logger.LogLevel {\n\t\treturn logger.Log(msg, DebugLevel, extras...)\n\t}\n\treturn nil\n}", "func (l *Logger) Debug(v ...interface{}) {\n\tif l.loglevel <= sDebug {\n\t\tl.output(sDebug, 0, fmt.Sprint(v...))\n\t} else {\n\t\treturn\n\t}\n}", "func (l *Logger) Debug(v ...interface{}) {\n\tl.Log(fmt.Sprintln(v...), Ldebug, 0)\n}", "func (ctx *Context) Debug(level int) {\n\tif level < logNone {\n\t\tlevel = logNone\n\t} else if level > logDebug {\n\t\tlevel = logDebug\n\t}\n\n\tctx.logLevel = level\n\n\t// If the log level is set to debug, then add the file info to the flags\n\tvar flags = log.LstdFlags | log.Lmsgprefix\n\tif level == logDebug {\n\t\tflags |= log.Lshortfile\n\t}\n\tctx.logger.SetFlags(flags)\n}", "func debug(format string, args ...interface{}) {\n\tif debugOn {\n\t\tlog.Printf(\"DEBUG: \"+format, args...)\n\t}\n}", "func (l *LvLogger) Debug(v ...interface{}) {\n\tif l.level > Debug {\n\t\treturn\n\t}\n\n\tl.inner.Output(2, fmt.Sprint(v...))\n}", "func (l *Logger) Debug(args ...interface{}) {\n\tkitlevel.Debug(l.Log).Log(args...)\n}", "func (logger *Logger) Debug(s string) {\n\tif DEBUG >= logger.level {\n\t\tlogger.debug.Print(s)\n\t}\n}", "func Debug(format string, v ...interface{}) {\n\tif LogLevel() <= 0 {\n\t\tlog.Printf(\"DEBUG: \"+format, v...)\n\t}\n}", "func (l *Logger) Debug(v ...interface{}) {\n\tif l.debug {\n\t\tl.log.Output(l.calldepth, header(\"DBG\", fmt.Sprint(v...)))\n\t}\n}", "func (l *thundraLogger) Debug(v ...interface{}) {\n\tif logLevelId > debugLogLevelId {\n\t\treturn\n\t}\n\tlogManager.recentLogLevel = debugLogLevel\n\tlogManager.recentLogLevelId = debugLogLevelId\n\tl.Output(2, fmt.Sprint(v...))\n}", "func (l *LoggerService) Debug(message string, values ...interface{}) {\n\tlog.Printf(\"[DEBUG] \"+message+\"\\n\", values...)\n}", "func Debug(msg string, args ...interface{}) {\n\tDefaultLog.Debug(msg, args...)\n}", "func (w *Writer) Debug(m string) error {}", "func (l *Logger) Debug(v ...interface{}) {\n\tif l.staticOptions.Debug {\n\t\t_ = l.Output(2, fmt.Sprint(v...))\n\t}\n}", "func Debug(v ...interface{}) {\n\tstdLogger.Log(DebugLevel, fmt.Sprint(v...))\n}", "func Debug(args ...interface{}) {\n LoggerOf(default_id).Debug(args...)\n}", "func (r *Record) Debug(args ...interface{}) {\n\tr.Log(DebugLevel, args...)\n}", "func Debug(msg ...interface{}) {\n\tif LevelDebug >= logLevel {\n\t\tsyslog.Println(\"D:\", msg)\n\t}\n}", "func Debug(v ...interface{}) {\n\tif LogLevel >= 4 {\n\t\tDoLog(3, DEBUG, fmt.Sprint(v...))\n\t}\n}", "func (l *Logger) Debug(a ...interface{}) {\n\tif l.Level() >= Debug {\n\t\tl.logDebug.Print(a...)\n\t}\n}", "func (l Logger) Debug(msg ...interface{}) {\n\tif l.Level <= log.DebugLevel {\n\t\tout := fmt.Sprint(append([]interface{}{l.DebugColor.Sprint(\"DEBUG: \")}, msg...)...)\n\t\tout = checkEnding(out)\n\t\tfmt.Fprint(l.DebugOut, out)\n\t}\n}", "func Debug(format string, v ...interface{}) {\n\tLeveledLogger(level.Debug, format, v...)\n}", "func Debug(ctx context.Context, v ...interface{}) {\n\tlog := ExtractLogger(ctx)\n\tlog.Debug(v...)\n}", "func Debug(msg string, fields ...zapcore.Field) {\n\tdefaultLogger.Debug(msg, fields...)\n}", "func (l *Impl) Debug(format string, args ...interface{}) {\n\tl.write(\"DEBUG\", format, args...)\n}", "func (s SugaredLogger) Debug(message string, fields ...interface{}) {\n\ts.zapLogger.Debugw(message, fields...)\n}", "func Debug(ctx context.Context, msg string, params ...interface{}) {\n\tif l := DefaultLogger(); l != nil {\n\t\tif ll, ok := l.(LeveledLogger); ok {\n\t\t\tll.Debug(ctx, msg, params...)\n\t\t} else {\n\t\t\tl.Log(Eventf(DebugSeverity, ctx, msg, params...))\n\t\t}\n\t}\n}", "func Debug() *Logger {\n\treturn debugLogger\n}", "func Debug(v ...interface{}) {\n\tLogger.Debug(v...)\n}", "func Debug(v ...interface{}) {\n\tLogger.Debug(v...)\n}", "func (l *Logger) Debug(a ...interface{}) {\n\tif l.Verbosity < VerbosityLevelVerbose {\n\t\treturn\n\t}\n\n\tl.logInStyle(debugString, cyan, a...)\n}", "func Debug(v ...interface{}) {\n\tlogger.Debug(v...)\n}", "func (l LoggerFunc) Debug(format string, args ...interface{}) {\n\tl(format, args...)\n}", "func (l *Logger) Debug(args ...interface{}) {\n\t_, file, line, _ := runtime.Caller(1) // deeper caller will be more expensive\n\tl.Log(DebugLevel, file, line, \"\", args...)\n}", "func Debug(args ...interface{}) {\n\tlog.Debug(args...)\n}", "func Debug(args ...interface{}) {\n\tlog.Debug(args...)\n}", "func (g GrcpGatewayLogger) Debug(msg string) {\n\tif g.logger.silent(DebugLevel) {\n\t\treturn\n\t}\n\te := g.logger.header(DebugLevel)\n\tif g.logger.Caller > 0 {\n\t\t_, file, line, _ := runtime.Caller(g.logger.Caller)\n\t\te.caller(file, line, g.logger.FullpathCaller)\n\t}\n\te.Context(g.context).Msg(msg)\n}", "func Debug(log string, v ...interface{}) {\n\tsyslog.Printf(\"DEBUG \"+log, v...)\n}", "func Debug(format string, a ...interface{}) {\n\tif currentLogger == nil {\n\t\treturn\n\t}\n\tcurrentLogger.output(currentPool, _DebugLevel, format, a...)\n}", "func (l *Log) Debug(v ...interface{}) {\n\tif l.Level >= logLevelDebug {\n\t\tl.LogDN.Output(2, fmt.Sprintln(\" Debug \", v))\n\t}\n}", "func (l *Logger) Debug(msg string, args ...interface{}) {\n\tl.z.Debugw(msg, args...)\n}", "func Debug(msg string) {\n\t// log level 1\n\tif logLevel <= 1 {\n\t\tfmt.Println(brightwhite + \"[debug]\\t\" + white + msg + logTime())\n\t}\n}", "func (l *ZapLogger) Debug(format string) {\n\tl.logger.Debug(format)\n}" ]
[ "0.8394137", "0.8068538", "0.8031376", "0.7936025", "0.79251146", "0.7919184", "0.7883123", "0.78764147", "0.7855846", "0.7848257", "0.78476185", "0.7830866", "0.78259045", "0.7823811", "0.78036433", "0.77995366", "0.7789543", "0.7783647", "0.77640736", "0.77594656", "0.7751425", "0.77456725", "0.7743595", "0.7743354", "0.7737713", "0.7737474", "0.77326465", "0.7725938", "0.7715123", "0.76820606", "0.7678736", "0.76764476", "0.7675958", "0.7674322", "0.7661501", "0.765745", "0.76562566", "0.76378685", "0.7630068", "0.76281077", "0.7617428", "0.7614408", "0.76093453", "0.76064605", "0.7606301", "0.7606214", "0.76061714", "0.7599801", "0.7588358", "0.75875455", "0.7574642", "0.7574642", "0.7574642", "0.7574642", "0.7574496", "0.75708044", "0.7570006", "0.75654024", "0.7555263", "0.7550467", "0.754352", "0.7540976", "0.7525863", "0.75251967", "0.7517852", "0.75145", "0.751218", "0.75091445", "0.7506143", "0.7493038", "0.7486151", "0.74785656", "0.74781406", "0.74775594", "0.74770486", "0.7474309", "0.7473793", "0.747365", "0.7471084", "0.7460528", "0.7456425", "0.7450301", "0.7442912", "0.7441938", "0.7432865", "0.7428991", "0.7428991", "0.7424446", "0.7422421", "0.74200654", "0.7419458", "0.7413571", "0.7413571", "0.74132156", "0.7402029", "0.7401812", "0.7397658", "0.73872155", "0.7384325", "0.73794734" ]
0.7956397
3
Debugf is just like Debug, but with formatting
func Debugf(format string, a ...interface{}) { log(defaultLogger, DEBUG, fmt.Sprintf(format, a...)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func logDebugf(format string, v ...interface{}) {\n\tif cmdline.Debug {\n\t\tlog.Printf(format, v...)\n\t}\n}", "func Debugf(msg string, args ...interface{}) {\n log.Debugf(msg, args...)\n}", "func Debugf(format string, v ...interface{}) { std.lprintf(DEBUG, format, v...) }", "func Debugf(format string, args ...interface{}) {\n\tlogging.Debugf(format, args...)\n}", "func Debugf(format string, args ...interface{}) { logRaw(LevelDebug, 2, format, args...) }", "func logDebugf(info string, msg string, fields ...interface{}) {\n\tif logutil.GetSkip1Logger().Core().Enabled(zap.DebugLevel) {\n\t\tfields = append(fields, info)\n\t\tlogutil.Debugf(msg+\" %s\", fields...)\n\t}\n}", "func Debugf(format string, a ...interface{}) {\n\tDefault.Debugf(format, a...)\n}", "func Debugf(template string, args ...interface{}) {\n\tCurrent.Debugf(template, args...)\n}", "func Debugf(format string, args ...interface{}) {\n\tLog.Debugf(format, args)\n}", "func Debugf(format string, args ...interface{}) {\n\tLog.Debugf(format, args...)\n}", "func Debugf(format string, args ...interface{}) {\n\tLog.Debugf(format, args...)\n}", "func (a *App) LogDebugf(template string, args ...interface{}) {\n\ta.logger.Debugf(template, args...)\n}", "func Debugf(format string, params ...interface{}){\n log.Debugf(format, params)\n}", "func Debugf(format string, args ...interface{}) {\n\tGlobalLogger().Debugf(format, args...)\n}", "func (l *Logger) Debugf(format string, v ...interface{}) { l.lprintf(DEBUG, format, v...) }", "func Debugf(format string, args ...interface{}) {\n\tLogger.Debugf(format, args...)\n}", "func Debugf(ctx context.Context, format string, v ...interface{}) {\n\tlog := ExtractLogger(ctx)\n\tlog.Debugf(format, v...)\n}", "func Debugf(template string, args ...interface{}) {\n\tlogger.Sugar().Debugf(template, args...)\n}", "func Debugf(format string, args ...interface{}) {\n\tlogger.Debugf(format, args...)\n}", "func Debugf(format string, args ...interface{}) {\n\tlogger.Debugf(format, args...)\n}", "func Debugf(msg string, v ...interface{}) string {\n\treturn logr.Debugf(msg, v...)\n}", "func Debugf(template string, args ...interface{}) {\n\tlog.Debugf(template, args...)\n}", "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tlog.WithFields(utils.GetCommonMetaFromCtx(ctx)).Debugf(format, args...)\n}", "func Debugf(format string, v ...interface{}) {\n\tlog.Debugf(format, v...)\n}", "func Debugf(format string, args ...interface{}) {\n\tdefaultLogger.Debugf(format, args...)\n}", "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tglobal.Debugf(ctx, format, args...)\n}", "func Debugf(format string, a ...interface{}) {\n\tsimlog.Debugf(format, a...)\n}", "func (logger MockLogger) Debugf(template string, args ...interface{}) {\n\tlogger.Sugar.Debugf(template, args)\n}", "func (n *Node) LogDebugf(template string, args ...interface{}) {\n\tn.log.Debugf(template, args...)\n}", "func Debugf(format string, v ...interface{}) {\n\tlogger.Debugf(format, v...)\n}", "func Debugf(format string, params ...interface{}) {\n\tDefaultLogger.Debugf(format, params...)\n}", "func Debugf(format string, v ...interface{}) {\n\tDefaultTarget.Debugf(format, v...)\n}", "func (z *Logger) Debugf(format string, args ...interface{}) {\n\tz.SugaredLogger.Debugf(format, args...)\n}", "func Debugf(msg string, v ...interface{}) {\n\tLogger.Debugf(msg, v...)\n}", "func Debugf(f string, args ...interface{}) {\n\tplog.Debugf(f, args...)\n}", "func (l *Logger) Debugf(format string, args ...interface{}) {\r\n\tl.logger.Debugf(format, args...)\r\n}", "func (DefaultLogger) Debugf(format string, p ...interface{}) {\n\tlog.Debugf(format, p)\n}", "func Debugf(format string, args ...interface{}) {\n\tNewDefaultEntry().Debugf(format, args...)\n}", "func (s *Structured) Debugf(format string, args ...interface{}) {\n\tlogrus.Debugf(format, args...)\n}", "func StdDebugf(ctx context.Context, metadata interface{}, err error, format string, args ...interface{}) {\n\tdebugLogger.StdDebugf(GetCtxRequestID(ctx), GetCtxID(ctx), err, metadata, format, args...)\n}", "func Debugf(format string, v ...interface{}) {\n\tDebug(fmt.Sprintf(format, v...))\n}", "func Debugf(template string, args ...interface{}) {\n\tDefaultLogger.Debugf(template, args...)\n}", "func Debugf(format string, args ...interface{}) {\n\tif defaultLgr == nil {\n\t\treturn\n\t}\n\tdefaultLgr.Debugf(format, args...)\n}", "func Debugf(format string, args ...interface{}) {\n\tlogWithFilename().Debugf(format, args...)\n}", "func Debugf(format string, v ...interface{}) {\n\tWithLevelf(LevelDebug, format, v...)\n}", "func (StdLogger) Debugf(format string, v ...interface{}) {}", "func (l *Log) Debugf(format string, a ...any) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tl.impl.Debugf(format, a...)\n\n\tl.t.Helper()\n\tl.t.Log(string(stripNewLineEnding(l.buf.Bytes())))\n\tl.buf.Reset()\n}", "func (n *nopLogger) Debugf(format string, v ...interface{}) {}", "func Debugf(format string, args ...interface{}) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tif level < Debug {\n\t\treturn\n\t}\n\n\tmsg := fmt.Sprintf(\"DEBUG: %s\", format)\n\tif len(args) > 0 {\n\t\tmsg = fmt.Sprintf(msg, args...)\n\t}\n\n\tlog.Println(msg)\n}", "func Debugf(format string, a ...interface{}) {\n\tDebugln(fmt.Sprintf(format, a...))\n}", "func Debugf(format string, v ...interface{}) {\n\tif Debug {\n\t\tWarnf(format, v...)\n\t}\n}", "func Debugf(format string, a ...interface{}) {\n\tlogDebugf(&loggers.Loggers[0], format, a...)\n}", "func Debugf(format string, args ...interface{}) {\n\tif logger != nil && level <= veldt.Debug {\n\t\tlogger.Debugf(prefix+format, args...)\n\t} else {\n\t\tveldt.Debugf(prefix+format, args...)\n\t}\n}", "func (l *Logger) Debugf(format string, log ...interface{}) {\n\tl.instance.Debugf(format, log...)\n}", "func (l *ZapLogger) Debugf(format string, args ...interface{}) {\n\tl.logger.Debugf(format, args...)\n}", "func Debugf(message string, v ...interface{}) {\n\tglobalLogger.Debugf(message, v...)\n}", "func (l *stubLogger) Debugf(format string, args ...interface{}) {}", "func (l *Log) Debugf(format string, args ...interface{}) {\n\tl.logger.Debugf(format, args...)\n}", "func (e *Entry) Debugf(format string, args ...interface{}) {\n\te.Entry.Debugf(format, args...)\n}", "func (l *NamedLogger) Debugf(format string, params ...interface{}) {\n\tformat, params = l.convert(format, params)\n\tl.Logger.Debugf(format, params...)\n}", "func (l *Logger) Debugf(format string, args ...interface{}) {\n\tl.lock()\n\tdefer l.unlock()\n\tl.logger.Debugf(format, args...)\n}", "func Debugf(format string, v ...interface{}) {\n\tif enableDebug {\n\t\tinfoLogf(format, v...)\n\t}\n}", "func Debugf(format string, v ...interface{}) {\n\tif std.level >= DebugLevel {\n\t\tstd.Output(std.callDepth, fmt.Sprintf(format, v...), DebugLevel)\n\t}\n}", "func (z *ZapLogWrapper) Debugf(format string, args ...interface{}) {\n\tz.l.Debugf(format, args...)\n}", "func Debugf(format string, v ...interface{}) {\n\tstdLogger.Log(DebugLevel, fmt.Sprintf(format, v...))\n}", "func Debugf(format string, v ...interface{}) {\n\tif debugon {\n\t\tInfof(debugprefix+format, v...)\n\t}\n}", "func (l *Logger) Debugf(template string, args ...interface{}) {\n\tl.safeExec(func() {\n\t\tl.inner.Debugf(template, args...)\n\t})\n}", "func (d *DummyLogger) Debugf(format string, args ...interface{}) {}", "func Debugf(group string, format string, any ...interface{}) {\n\tfmt.Print(gray(group) + \" \")\n\tfmt.Printf(gray(format), any...)\n}", "func (a CompatLoggerAdapter) Debugf(format string, v ...interface{}) {\n\ta.Printf(\"DEBUG: \"+format, v...)\n}", "func (d *LevelWrapper) Debugf(format string, args ...interface{}) {\n\tif d.DebugEnabled() {\n\t\td.Logger.Debugf(format, args...)\n\t}\n}", "func Debugf(format string, args ...interface{}) {\n\tlogger.Debug(fmt.Sprintf(format, args...))\n}", "func Debugf(format string, vars ...interface{}) {\n\tif level > None && level <= Debug {\n\t\tlogger.Printf(strings.Join([]string{\"DEBUG\", format}, \" \"), vars...)\n\t}\n}", "func (l NullLogger) Debugf(format string, params ...interface{}) {\n}", "func Tracef(format string, args ...interface{}) {\n\tlogging.Debugf(format, args...)\n}", "func Debugf(format string, args ...interface{}) {\n\tif glog.V(debug) {\n\t\tglog.InfoDepth(1, fmt.Sprintf(\"DEBUG: \"+format, args...)) // 1 == depth in the stack of the caller\n\t}\n}", "func Debugf(template string, args ...interface{}) {\n\terrorLogger.Debugf(template, args...)\n}", "func Debugf(format string, args ...interface{}) {\n\tDebugfFile(token.Position{}, format, args...)\n}", "func Debugf(f string, vals ...interface{}) {\n\tline := lineInfo(8)\n\tfmt.Printf(fmt.Sprintf(\"%s: \", line)+f, vals...)\n}", "func (l *XORMLogBridge) Debugf(format string, v ...interface{}) {\n\tlog.Debugf(format, v...)\n}", "func _debugf(format string, args ...interface{}) {\n\tif v(1) {\n\t\targs = append([]interface{}{_caller(2)}, args...)\n\t\tfmt.Printf(\"%s: \"+format+\"\\n\", args...)\n\t}\n}", "func Debugf(format string, args ...interface{}) {\n\tif logger.Level >= logrus.DebugLevel {\n\t\tentry := logger.WithFields(logrus.Fields{\"file\": fileInfo(2)})\n\t\tentry.Debugf(format, args...)\n\t}\n}", "func Debug(args ...interface{}) {\n\tif defaultLgr == nil {\n\t\treturn\n\t}\n\tdefaultLgr.Debugf(strings.TrimSpace(strings.Repeat(\"%+v \", len(args))), args...)\n}", "func (e *Entry) Debugf(format string, v ...interface{}) {\n\tif LogLevelDebug >= e.logger.Level {\n\t\te.logger.printf(LogLevelDebug, e.Context, format, v...)\n\t}\n}", "func Debugf(format string, data ...interface{}) {\n\tif *Debug {\n\t\tlog.Printf(format, data...)\n\t}\n}", "func (l PlainLogger) Debugf(format string, a ...interface{}) {\n\tif !l.IsDebugEnabled() {\n\t\treturn\n\t}\n\n\tif !strings.HasSuffix(format, \"\\n\") {\n\t\tformat += \"\\n\"\n\t}\n\n\t_, _ = fmt.Fprintf(l.debug, format, a...)\n}", "func Debug(f interface{}, v ...interface{}) {\n\tvar format string\n\tswitch f.(type) {\n\tcase string:\n\t\tformat = f.(string)\n\t\tlog.Debugf(format, v...)\n\tdefault:\n\t\tformat = fmt.Sprint(f)\n\t\tif len(v) == 0 {\n\t\t\tlog.Debug(format)\n\t\t\treturn\n\t\t}\n\t\tformat += strings.Repeat(\" %v\", len(v))\n\t\tlog.Debugf(format, v...)\n\t}\n}", "func (log *Log) Debugf(format string, a ...interface{}) {\n\tlog.printf(DEBUG, format, a...)\n}", "func Debugf(format string, args ...interface{}) {\n\txlog.SetFormatter(&logrus.JSONFormatter{})\n\txlog.SetLevel(logrus.DebugLevel)\n\n\txlog.Debugf(format, args...)\n}", "func Debugf(format string, v ...interface{}) {\n\tif debug {\n\t\tairshipLog.Printf(format, v...)\n\t}\n}", "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tinternal.Logf(ctx, logging.Debug, format, args...)\n}", "func (c *Client) Debugf(format string, v ...interface{}) {\n\tlog.Printf(\"[DEBUG] %s\", fmt.Sprintf(format, v...))\n}", "func (log *log) Debugf(f string, a ...interface{}) {\n\tf = log.attachPrefix(f)\n\tlogger.DebugfDepth(1, f, a...)\n}", "func (l *Logger) Debugf(format string, v ...interface{}) {\n\tl.Log(DebugLevel, fmt.Sprintf(format, v...))\n}", "func (l *Logger) Debugf(format string, a ...interface{}) {\r\n\tl.logInternal(DebugLevel, 4, fmt.Sprintf(format, a...))\r\n}", "func (l *Logger) Debugf(msg string, args ...interface{}) {\n\tl.sgLogger.Debugf(msg, args...)\n\t_ = l.lg.Sync()\n}", "func (l *Logger) Debugf(format string, v ...interface{}) {\n\tl.Debug(fmt.Sprintf(format, v...))\n}", "func Debugf(format string, v ...interface{}) {\n\tif jl.level != INFO {\n\t\tvar s string\n\t\tjl.stdlog.SetPrefix(\"[DEBUG] \")\n\t\tif jl.flag == LstdFlags|Lshortfile {\n\t\t\ts = generateStdflagShortFile()\n\t\t}\n\n\t\tjl.stdlog.Printf(s+format, v...)\n\t}\n}", "func Debugf(format string, args ...interface{}) {\n\tl.Debug().Msgf(format, args...)\n}", "func Debugf(format string, v ...interface{}) {\n\toutputf(LevelDebug, format, v)\n}" ]
[ "0.7937078", "0.7888452", "0.7887577", "0.7783828", "0.7766632", "0.77656317", "0.776186", "0.7752277", "0.774962", "0.7739914", "0.7739914", "0.77300787", "0.77287483", "0.7713661", "0.77002853", "0.767599", "0.7668205", "0.7661708", "0.76466393", "0.76466393", "0.7643199", "0.7623318", "0.7622177", "0.7608257", "0.7597038", "0.75955844", "0.7593423", "0.75677526", "0.7567323", "0.7557782", "0.7549793", "0.7525045", "0.7508957", "0.7502974", "0.7498292", "0.7492019", "0.7490879", "0.747701", "0.74731314", "0.7468082", "0.74400187", "0.74347687", "0.74174184", "0.7402478", "0.73908347", "0.7381896", "0.73745453", "0.73732394", "0.73708224", "0.7369429", "0.7369327", "0.7361615", "0.73587096", "0.7356568", "0.73530024", "0.7346488", "0.7341605", "0.7336697", "0.7333117", "0.73255134", "0.73214394", "0.7313313", "0.73113585", "0.7301333", "0.72992516", "0.72765166", "0.72738326", "0.72720313", "0.72481835", "0.7233955", "0.7229917", "0.7227394", "0.72045135", "0.72015595", "0.719815", "0.71954", "0.71938837", "0.71844876", "0.71795094", "0.71755534", "0.7172594", "0.7170341", "0.716574", "0.7159614", "0.71578395", "0.7152698", "0.71427023", "0.7128813", "0.7126821", "0.71267736", "0.71261185", "0.71218944", "0.7116909", "0.7113004", "0.7111437", "0.710787", "0.7107555", "0.70966107", "0.70887566", "0.7088311" ]
0.72255725
72
Info is a logging method that will write to default logger with INFO level
func Info(msg ...interface{}) { log(defaultLogger, INFO, msg...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *DummyLogger) Info(format string) {}", "func Info(args ...interface{}) {\n\tdefaultLogger.Info(args...)\n}", "func (dl *defaultLogger) Info(msg string) {\n\tdl.Print(msg)\n}", "func (customLogger *CustomLogger) Info(message string) {\n\tcustomLogger.logger.Info(message)\n}", "func (logger *Logger) Info(args ...interface{}) {\n\tlogger.std.Log(append([]interface{}{\"Info\"}, args...)...)\n}", "func (l *MessageLogger) Info(msg string) { l.logger.Info(msg) }", "func Info(msg string, args ...interface{}) {\n\tdefaultLogger.Info(msg, args...)\n}", "func Info(args ...interface{}) {\n\tDefaultLogger.Info(args...)\n}", "func (l *Logger) Info(message string) {\n\tstdLog.Info(message)\n}", "func Info(ctx context.Context, args ...interface{}) {\n\tGetLogger().Log(ctx, loggers.InfoLevel, 1, args...)\n}", "func (l *Logger) Info(args ...interface{}) {\n\tl.lock()\n\tdefer l.unlock()\n\tl.logger.Info(args...)\n}", "func (slog stdLogger) Info(s string) {\n\tif logger.Logger != nil {\n\t\tlogger.Write([]byte(\" INFO \" + s))\n\t} else {\n\t\tlog.Printf(\" INFO \" + s)\n\t}\n}", "func (l *Logger) Info(v ...interface{}) {\n\tif l.loglevel <= sInfo {\n\t\tl.output(sInfo, 0, fmt.Sprint(v...))\n\t} else {\n\t\treturn\n\t}\n}", "func (l *wrappedLogger) Info(msg string, v ...interface{}) {\n\tif l.syslog {\n\t\terr := l.syslogWriter.Info(fmt.Sprintf(msg, v...))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else if Verbose {\n\t\tl.stdWriter.Printf(\"[INFO ] \"+msg, v...)\n\t}\n}", "func (logger *Logger) Info(args ...interface{}) {\n\tlogger.logPrint(L_INFO, args...)\n}", "func (l *Logger) Info(message string) {\n\tl.LogWithLevel(message, \"info\")\n}", "func (l Logger) Info(msg ...interface{}) {\n\tif l.Level <= log.InfoLevel {\n\t\tout := fmt.Sprint(msg...)\n\t\tout = checkEnding(out)\n\t\tfmt.Fprint(l.InfoOut, out)\n\t}\n}", "func Info(v ...interface{}) {\n\tstdLogger.Log(InfoLevel, fmt.Sprint(v...))\n}", "func (l Log) Info(msg string) {\n\tl.log(\"INFO\", msg)\n}", "func (l *Logger) Info(values ...interface{}) {\n\tif l.loggingLevel > InfoLevel {\n\t\treturn\n\t}\n\tl.log(l.infoPrefix, fmt.Sprint(values...))\n}", "func (l *Logger) Info(args ...interface{}) {\n\tkitlevel.Info(l.Log).Log(args...)\n}", "func Info(args ...interface{}) {\r\n\tLogger.Info(\"\", args)\r\n}", "func (z *Logger) Info(args ...interface{}) {\n\tz.SugaredLogger.Info(args...)\n}", "func (l *loggerWrapper) Info(args ...interface{}) {\n\tl.logger.Info(sprint(args...))\n}", "func Info(message string) {\n\tlogger.Printf(\"INFO %s\", message)\n}", "func (l Logger) Info(message string) {\n\tl.internalLogger.Info(message)\n}", "func (gl GoaLogger) Info(msg string, data ...interface{}) {\n\tev := gl.logger.Info()\n\tgl.log(ev, msg, data...)\n}", "func (l nullLogger) Info(msg string, ctx ...interface{}) {}", "func Info(format string, v ...interface{}) {\n\tLeveledLogger(level.Info, format, v...)\n}", "func (l *BasicLogger) Info(msg string) {\n\tl.appendLogEvent(level.InfoLevel, msg)\n}", "func Info(args ...interface{}) {\n\tLogger.Info(args...)\n}", "func (sl *SysLogger) Info(info, msg string) {\n\tlog.Println(\"[INFO]\", sl.tag, info, msg)\n}", "func Info(message interface{}) {\n\tglobalLogger.Info(message)\n}", "func (l *Log) Info(args ...interface{}) {\n\tl.logger.Info(args...)\n}", "func Info(msg string) {\n log.Info(msg)\n}", "func (v *MultiLogger) Info(args ...interface{}) {\n\tv.Self().Log(logrus.InfoLevel, args...)\n}", "func (logger *Logger) Info(v ...interface{}) {\n\tif logger.level >= 3 {\n\t\tlogger.log.Output(2, fmt.Sprintf(\"[INFO] %s\\n\", v...))\n\t}\n}", "func (l *Logger) Info(v ...interface{}) {\n\tl.NewEntry().Print(INFO, v...)\n}", "func (l *Logger) Info(v ...interface{}) {\n\tl.Log(fmt.Sprintln(v...), Linfo, 0)\n}", "func (l *Logger) Info(v ...interface{}) {\n\tl.Log(InfoLevel, fmt.Sprint(v...))\n}", "func Info(format string, v ...interface{}) {\n\tDefaultLogger.Info(format, v...)\n}", "func Info(args ...interface{}) {\n\tlogger.Info(args...)\n}", "func Info(args ...interface{}) {\n\tlogger.Info(args...)\n}", "func Info(args ...interface{}) {\n\tlogger.Info(args...)\n}", "func Info(args ...interface{}) {\n\tlogger.Info(args...)\n}", "func Info(args ...interface{}) {\n\tlogger.Info(args...)\n}", "func (l Logger) Info(msg ...interface{}) {\n\tif l.Level <= log.InfoLevel {\n\t\tl.logger.Print(append([]interface{}{\"[INFO] \"}, msg...)...)\n\t}\n}", "func (l *comLogger) Info(msg string) {\n\tl.Log(Info, msg)\n}", "func Info(v ...interface{}) {\n\tLogger.Info(v...)\n}", "func (l ServiceLogger) Info(message string) {\n\tl.Logger.Info(message)\n}", "func (l *Logger) Info(message string) {\n\tl.printLogMessage(keptnLogMessage{Timestamp: time.Now(), Message: message, LogLevel: \"INFO\"})\n}", "func (l *LvLogger) Info(v ...interface{}) {\n\tif l.level > Info {\n\t\treturn\n\t}\n\n\tl.inner.Output(2, fmt.Sprint(v...))\n}", "func (l *logWrapper) Info(args ...interface{}) {\n\tl.Log(LogInfo, 3, args...)\n}", "func (lg *Logger) Info(args ...interface{}) {\n if lg.level <= INFO {\n lg.logger.SetPrefix(LEVELS[INFO])\n lg.logger.Println(args...)\n }\n}", "func Info(format string, a ...interface{}) {\n\tif currentLogger == nil {\n\t\treturn\n\t}\n\tcurrentLogger.output(currentPool, _InfoLevel, format, a...)\n}", "func (logger *Logger) Info(msg string, extras ...map[string]string) error {\n\tif InfoLevel >= logger.LogLevel {\n\t\treturn logger.Log(msg, InfoLevel, extras...)\n\t}\n\treturn nil\n}", "func (cLogger CustomLogger) Info(args ...interface{}) {\n\tlevel.Info(log.With(loggerInstance, \"caller\", getCallerInfo())).Log(args...)\n}", "func (logger *Logger) Info(format string, a ...interface{}) {\n\tlogger.log(Info, format, a...)\n}", "func (stimLogger *FullStimLogger) Info(message ...interface{}) {\n\tif stimLogger.highestLevel >= InfoLevel {\n\t\tif stimLogger.setLogger == nil {\n\t\t\tif stimLogger.forceFlush {\n\t\t\t\tstimLogger.writeLogs(stimLogger.formatString(InfoLevel, infoMsg, message...))\n\t\t\t} else {\n\t\t\t\tstimLogger.formatAndLog(InfoLevel, infoMsg, message...)\n\t\t\t}\n\t\t} else {\n\t\t\tstimLogger.setLogger.Debug(message...)\n\t\t}\n\t}\n}", "func Info(ctx context.Context, logCat LogCat, v ...interface{}) {\n\tdefaultLogger.Info(ctx, logCat, v...)\n}", "func (l *Logger) Info(log ...interface{}) {\n\tl.instance.Info(log...)\n}", "func (l *Logger) Info(a ...interface{}) {\n\tif l.Level() >= Info {\n\t\tl.logInfo.Print(a...)\n\t}\n}", "func (l *Logger) Info(v ...interface{}) {\n\tif l.LogToStdout {\n\t\tlog.Print(v...)\n\t}\n\tif l.LogToSystemLog {\n\t\tl.SystemLog.Info(fmt.Sprint(v...))\n\t}\n}", "func (l typeLogger) Info(format string, v ...interface{}) {\n\tif l.level <= logInfo {\n\t\tmessage := fmt.Sprintf(format, v...)\n\t\tl.logger.Printf(\" %s%s%s : %s (%s)\", colorInfo, tagInfo, colorClear, message, getCallerPosition())\n\t}\n}", "func (l *Logger) INFO(msg string) {\n\tdefer l.Zap.Sync()\n\tl.Zap.Info(msg)\n}", "func (l *Logger) Info(args ...interface{}) {\n\tif l.IsEnabledFor(InfoLevel) {\n\t\tfile, line := Caller(1)\n\t\tl.Log(InfoLevel, file, line, \"\", args...)\n\t}\n}", "func (logger *Logger) Info(s string) {\n\tif INFO >= logger.level {\n\t\tlogger.info.Print(s)\n\t}\n}", "func Info(args ...interface{}) {\n\tLog(logrus.InfoLevel, args...)\n}", "func (l *Logger) Info(v ...interface{}) {\n\tl.Infof(\"%s\", fmt.Sprintln(v...))\n}", "func Info(v ...interface{}) {\n\tlogger.Info(v...)\n}", "func Info(format string, v ...interface{}) {\n\tdoLog(\"INFO\", format, v...)\n}", "func Info(msg string, fields ...zapcore.Field) {\n\tdefaultLogger.Info(msg, fields...)\n}", "func ExampleInfo() {\n\tsetup()\n\tlog.Info().Msg(\"hello world\")\n\n\t// Output: {\"level\":\"info\",\"time\":1199811905,\"message\":\"hello world\"}\n}", "func Info(logger log.Logger) log.Logger {\n\treturn log.WithPrefix(logger, severityKey, LevelInfo)\n}", "func (l *logHandler) Info(args ...interface{}) {\n\tl.Log(LogInfo, 3, args...)\n}", "func Info(msg string, args ...interface{}) {\n\tDefaultLog.Info(msg, args...)\n}", "func Info(format string, v ...interface{}) {\n\tLog(1, INFO, format, v...)\n}", "func Info(v ...interface{}) {\n\tinfoLogger.Print(v...)\n}", "func Info(ctx context.Context, v ...interface{}) {\n\tlog := ExtractLogger(ctx)\n\tlog.Info(v...)\n}", "func (l *logrusLogger) Info(msg string) {\n\tl.l.Info(msg)\n}", "func (l *Logger) Info(a ...interface{}) {\r\n\tl.logInternal(InfoLevel, 4, a...)\r\n}", "func Info(args ...interface{}) {\n\tlogger.Sugar().Info(args...)\n}", "func (logger *NLog) Info(format string, v ...interface{}) {\n\tlogger.rwm.RLock()\n\tdefer logger.rwm.RUnlock()\n\n\tif logger.info != nil {\n\t\tlogger.info.Output(3, fmt.Sprintln(fmt.Sprintf(format, v...)))\n\t}\n}", "func Info(message string, params ...interface{}) {\n\n\tdefer sugarLogger.Sync()\n\tsugarLogger.Infow(\n\t\tmessage,\n\t\tparams...,\n\t)\n}", "func (nl *NullLogger) LogInfo(m ...interface{}) {\n}", "func Info() *Logger {\n\treturn infoLogger\n}", "func Info(data ...interface{}) {\n\tif loggerInstance == nil {\n\t\treturn\n\t}\n\n\tloggerInstance.Info(data...)\n}", "func (l *Logger) Info(v ...interface{}) {\n\tl.log.Output(l.calldepth, header(\"INF\", fmt.Sprint(v...)))\n}", "func Info(message interface{}) {\n\tlogging.Info(message)\n}", "func LogInfo(message string) {\n\tgetLogger().Printf(\"[Info]: %s\", message)\n}", "func (l *Logger) Info(a ...interface{}) {\n\tif l.Verbosity <= VerbosityLevelQuiet {\n\t\treturn\n\t}\n\n\tl.logInStyle(infoString, blue, a...)\n}", "func (l *Lgr) Info(args ...interface{}) {\n l.Logger.Info(args...)\n}", "func (l Log) Info(format string, args ...interface{}) {\n\tl.Logger.Sugar().Infof(format, args...)\n}", "func Info(ctx context.Context, msg string, params ...interface{}) {\n\tif l := DefaultLogger(); l != nil {\n\t\tif ll, ok := l.(LeveledLogger); ok {\n\t\t\tll.Info(ctx, msg, params...)\n\t\t} else {\n\t\t\tl.Log(Eventf(InfoSeverity, ctx, msg, params...))\n\t\t}\n\t}\n}", "func (l *ZapLogger) Info(format string) {\n\tl.logger.Info(format)\n}", "func Info(args ...interface{}) {\n\tlog.Info(args...)\n}", "func Info(args ...interface{}) {\n\tlog.Info(args...)\n}", "func Info(msg string, fields ...Field) {\n\tgetLogger().Info(msg, fields...)\n}", "func (l *Logger) Info(messageFormat string, messageArgs ...interface{}) {\n\tl.Log(Info, messageFormat, messageArgs...)\n}", "func Info(ctx context.Context, msg string, args ...Args) {\n\tL(ctx).Log(NewEntry(LevelInfo, msg, args...))\n}" ]
[ "0.83797425", "0.82837796", "0.82781523", "0.82490706", "0.8245891", "0.82405514", "0.8196222", "0.8173531", "0.8151679", "0.81377375", "0.8133649", "0.8130233", "0.8119637", "0.8116358", "0.8114632", "0.8111277", "0.80998075", "0.80872995", "0.8081327", "0.8081279", "0.80691504", "0.80639136", "0.80633366", "0.8062382", "0.80576634", "0.80536216", "0.8051255", "0.8051219", "0.8048233", "0.8034888", "0.80277157", "0.8017542", "0.80156", "0.8015204", "0.8011734", "0.80006915", "0.79948884", "0.7990257", "0.79901147", "0.7988863", "0.7986912", "0.79852986", "0.79852986", "0.79852986", "0.79852986", "0.79852986", "0.7964725", "0.7948403", "0.79429346", "0.7942379", "0.79401714", "0.79326344", "0.7929322", "0.7928921", "0.7925243", "0.7923826", "0.7919617", "0.79178166", "0.7914845", "0.7913647", "0.79095477", "0.79057807", "0.7905776", "0.79056823", "0.79019314", "0.79002845", "0.7894259", "0.78935504", "0.7877867", "0.78769755", "0.7871109", "0.78665066", "0.7865651", "0.7864724", "0.78583145", "0.7857422", "0.78572404", "0.7853099", "0.7847294", "0.78351235", "0.783131", "0.7826216", "0.7822167", "0.7805019", "0.7800792", "0.7798497", "0.77951336", "0.77899885", "0.77828664", "0.7775271", "0.7771103", "0.77702695", "0.7761744", "0.7760885", "0.7756376", "0.7754595", "0.7754595", "0.77543795", "0.77502173", "0.7743946" ]
0.83868563
0
Infof is just like Info, but with formatting
func Infof(format string, a ...interface{}) { log(defaultLogger, INFO, fmt.Sprintf(format, a...)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (l *log)Infof(format string, args ...interface{}) {\n fmt.Printf(format, args...)\n}", "func lInfof(format string, v ...interface{}) {\n\tinfoLogger.Printf(format, v...)\n}", "func (*traceLogger) Infof(msg string, args ...any) { log.Infof(msg, args...) }", "func Infof(msg string, args ...interface{}) {\n log.Infof(msg, args...)\n}", "func Infof(format string, args ...interface{}) {\n\tlogging.Infof(format, args...)\n}", "func Infof(format string, params ...interface{}){\n log.Infof(format, params)\n}", "func Infof(format string, a ...interface{}) {\n\tDefault.Infof(format, a...)\n}", "func Infof(ctx context.Context, format string, args ...interface{}) {\n\tlog.Infof(ctx, format, args...)\n}", "func (l *Lgr) Infof(format string, args ...interface{}) {\n l.Logger.Infof(format, args...)\n}", "func Infof(format string, args ...interface{}) {\n\tlogger.Infof(format, args...)\n}", "func Infof(format string, args ...interface{}) {\n\tlogger.Infof(format, args...)\n}", "func Infof(format string, args ...interface{}) {\n\tlogger.Infof(format, args...)\n}", "func Infof(format string, v ...interface{}) {\n\tlog.Infof(format, v...)\n}", "func Infof(format string, args ...interface{}) {\n\tLog.Infof(format, args...)\n}", "func Infof(format string, args ...interface{}) {\n\tLog.Infof(format, args...)\n}", "func Infof(format string, v ...interface{}) {\n\tlogger.Infof(format, v...)\n}", "func Infof(format string, args ...interface{}) {\n\tLog.Infof(format, args)\n}", "func LogInfof(format string, fields ...interface{}) {\n\tmsg := fmt.Sprintf(format, fields...)\n\tgetLogger().Printf(\"[Info]: %s\", msg)\n}", "func Infof(format string, args ...interface{}) {\n\tLogger.Infof(format, args...)\n}", "func Infof(ctx context.Context, format string, v ...interface{}) {\n\tlog := ExtractLogger(ctx)\n\tlog.Infof(format, v...)\n}", "func Infof(format string, args ...interface{}) {\n\tdefaultLogger.Infof(format, args...)\n}", "func Infof(format string, args ...interface{}) {\n\tGlobalLogger().Infof(format, args...)\n}", "func Infof(msg string, v ...interface{}) string {\n\treturn logr.Infof(msg, v...)\n}", "func (l *NamedLogger) Infof(format string, params ...interface{}) {\n\tformat, params = l.convert(format, params)\n\tl.Logger.Infof(format, params...)\n}", "func Infof(format string, params ...interface{}) {\n\tDefaultLogger.Infof(format, params...)\n}", "func (l *Logger) Infof(format string, args ...interface{}) {\r\n\tl.logger.Infof(format, args...)\r\n}", "func Info(format string, args ...interface{}) {\n\tlog.Infof(format, args...)\n}", "func (entry *Entry) Infof(format string, args ...interface{}) {\n\tentry.e.Infof(format, args...)\n}", "func (z *Logger) Infof(format string, args ...interface{}) {\n\tz.SugaredLogger.Infof(format, args...)\n}", "func (DefaultLogger) Infof(format string, p ...interface{}) {\n\tlog.Infof(format, p)\n}", "func Info(v ...interface{}) {\n\tInfof(\"%s\", fmt.Sprintln(v...))\n}", "func Infof(ctx context.Context, format string, args ...interface{}) {\n\tlog.WithFields(utils.GetCommonMetaFromCtx(ctx)).Infof(format, args...)\n}", "func Info(f interface{}, v ...interface{}) {\n\tvar format string\n\tswitch f.(type) {\n\tcase string:\n\t\tformat = f.(string)\n\t\tlog.Infof(format, v...)\n\tdefault:\n\t\tformat = fmt.Sprint(f)\n\t\tif len(v) == 0 {\n\t\t\tlog.Info(format)\n\t\t\treturn\n\t\t}\n\t\tformat += strings.Repeat(\" %v\", len(v))\n\t\tlog.Infof(format, v...)\n\t}\n}", "func (l *ZapLogger) Infof(format string, args ...interface{}) {\n\tl.logger.Infof(format, args...)\n}", "func (l redactLogger) Infof(format string, args ...interface{}) {\n\tl.logger.Infof(\"%s\", redact.Sprintf(format, args...).Redact())\n}", "func (l *loggerWrapper) Infof(format string, args ...interface{}) {\n\tl.sugar.Infof(sprintf(format, args...))\n}", "func Infof(template string, args ...interface{}) {\n\tCurrent.Infof(template, args...)\n}", "func (d *DummyLogger) Info(format string) {}", "func (l *XORMLogBridge) Infof(format string, v ...interface{}) {\n\tlog.Infof(format, v...)\n}", "func Infof(msg string, v ...interface{}) {\n\tLogger.Infof(msg, v...)\n}", "func (l *Logger) Infof(fmt string, args ...interface{}) {\n}", "func (d *DummyLogger) Infof(format string, args ...interface{}) {}", "func (l *GrpcLog) Infof(format string, args ...interface{}) {\n\t// l.SugaredLogger.Infof(format, args...)\n}", "func (l *Logger) Infof(format string, log ...interface{}) {\n\tl.instance.Infof(format, log...)\n}", "func (l *loggerAdapter) Infof(msg string, args ...interface{}) {\n\tl.getLogger().Infof(msg, args...)\n}", "func (z *ZapLogWrapper) Infof(format string, args ...interface{}) {\n\tz.l.Infof(format, args...)\n}", "func Infof(message string, v ...interface{}) {\n\tglobalLogger.Infof(message, v...)\n}", "func Infof(f string, args ...interface{}) {\n\tplog.Infof(f, args...)\n}", "func (l *Log) Infof(format string, args ...interface{}) {\n\tl.logger.Infof(format, args...)\n}", "func (l *stubLogger) Infof(format string, args ...interface{}) {}", "func Infof(format string, args ...interface{}) { logRaw(LevelInfo, 2, format, args...) }", "func Infof(format string, args ...interface{}) {\n\tNewDefaultEntry().Infof(format, args...)\n}", "func Infof(format string, args ...interface{}) {\n\tif defaultLgr == nil {\n\t\treturn\n\t}\n\tdefaultLgr.Infof(format, args...)\n}", "func Infof(template string, args ...interface{}) {\n\tlog.Infof(template, args...)\n}", "func Infof(ctx context.Context, logCat LogCat, format string, v ...interface{}) {\n\tdefaultLogger.Infof(ctx, logCat, format, v...)\n}", "func Infof(format string, args ...interface{}) {\n\tif logger != nil && level <= veldt.Info {\n\t\tlogger.Infof(prefix+format, args...)\n\t} else {\n\t\tveldt.Infof(prefix+format, args...)\n\t}\n}", "func StdInfof(ctx context.Context, metadata interface{}, err error, format string, args ...interface{}) {\n\tinfoLogger.StdInfof(GetCtxRequestID(ctx), GetCtxID(ctx), err, metadata, format, args...)\n}", "func (d *LevelWrapper) Infof(format string, args ...interface{}) {\n\tif d.InfoEnabled() {\n\t\td.Logger.Infof(format, args...)\n\t}\n}", "func Infof(format string, args ...interface{}) {\n\tlogWithFilename().Infof(format, args...)\n}", "func (l *Logger) Infof(format string, args ...interface{}) {\n\tl.lock()\n\tdefer l.unlock()\n\tl.logger.Infof(format, args...)\n}", "func Info(args ...interface{}) {\n\tif defaultLgr == nil {\n\t\treturn\n\t}\n\tdefaultLgr.Infof(strings.TrimSpace(strings.Repeat(\"%+v \", len(args))), args...)\n}", "func Infof(template string, args ...interface{}) {\n\tlogger.Sugar().Infof(template, args...)\n}", "func Infof(format string, v ...interface{}) {\n\tinfoLogf(format, v...)\n}", "func (s Slog) Infof(format string, a ...interface{}) {\n\tfmt.Printf(format, a)\n\tlog.V(log.Level(s)).Infof(format, a)\n}", "func Infof(logger *log.Logger, format string, args ...interface{}) {\n\tif logger != nil {\n\t\tlogger.Infof(format, args...)\n\t}\n}", "func (l NullLogger) Infof(format string, params ...interface{}) {\n}", "func (l Logger) Infof(s string, args ...interface{}) {\n\tx := fmt.Sprintf(s, args...)\n\tlog.Infof(fmtSpec, callerInfo(), l, x)\n}", "func (m *ConfigManager) Infof(format string, args ...interface{}) {\n\tglog.Infof(format, args...)\n}", "func Infof(format string, v ...interface{}) {\n\t_ = info.Output(2, fmt.Sprintf(format, v...))\n}", "func Infof(format string, v ...interface{}) {\n\tWithLevelf(LevelInfo, format, v...)\n}", "func Infof(ctx context.Context, format string, args ...interface{}) {\n\tinternal.Logf(ctx, logging.Info, format, args...)\n}", "func (l *Logger) Infof(format string, v ...interface{}) {\n\tl.Info(fmt.Sprintf(format, v...))\n}", "func Infof(format string, a ...interface{}) {\n\tInfoln(fmt.Sprintf(format, a...))\n}", "func (logger MockLogger) Infof(template string, args ...interface{}) {\n\tlogger.Sugar.Infof(template, args)\n}", "func Infof(template string, args ...interface{}) {\n\tDefaultLogger.Infof(template, args...)\n}", "func (l typeLogger) Info(format string, v ...interface{}) {\n\tif l.level <= logInfo {\n\t\tmessage := fmt.Sprintf(format, v...)\n\t\tl.logger.Printf(\" %s%s%s : %s (%s)\", colorInfo, tagInfo, colorClear, message, getCallerPosition())\n\t}\n}", "func (l *Logger) Infof(format string, v ...interface{}) {\n\tl.Log(InfoLevel, fmt.Sprintf(format, v...))\n}", "func Infof(format string, v ...interface{}) {\n\tif std.level >= InfoLevel {\n\t\tstd.Output(std.callDepth, fmt.Sprintf(format, v...), InfoLevel)\n\t}\n}", "func (l *Logger) Infof(format string, a ...interface{}) {\r\n\tl.logInternal(InfoLevel, 4, fmt.Sprintf(format, a...))\r\n}", "func (l *Log) Infof(format string, v ...interface{}) {\n\tl.append(lInfo, fmt.Sprintf(format, v...))\n}", "func (n *Node) LogInfof(template string, args ...interface{}) {\n\tn.log.Infof(template, args...)\n}", "func (logger *Logger) Infof(format string, args ...interface{}) {\n\tlogger.std.Logf(\"Info\"+format, args...)\n}", "func Infof(format string, args ...interface{}) {\r\n\tif *gloged {\r\n\t\tglog.Infof(format, args...)\r\n\t} else {\r\n\t\tlog.Printf(format, args...)\r\n\t}\r\n}", "func (l *BasicLogger) Infof(format string, vargs ...interface{}) {\n\tl.appendLogEvent(level.InfoLevel, fmt.Sprintf(format, vargs...))\n}", "func Info(text string, args ...interface{}) {\n\tlogger.Infof(text, args...)\n}", "func Infof(format string, v ...interface{}) {\n\tstdLogger.Log(InfoLevel, fmt.Sprintf(format, v...))\n}", "func (l *Logger) Infof(format string, v ...interface{}) {\n\tl.Output(2, fmt.Sprint(infoPrefix, fmt.Sprintf(format, v...)))\n}", "func (l Log) Info(format string, args ...interface{}) {\n\tl.Logger.Sugar().Infof(format, args...)\n}", "func (e *Entry) Infof(format string, v ...interface{}) {\n\tif LogLevelInfo >= e.logger.Level {\n\t\te.logger.printf(LogLevelInfo, e.Context, format, v...)\n\t}\n}", "func Infof(format string, args ...interface{}) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tif level < Info {\n\t\treturn\n\t}\n\n\tmsg := fmt.Sprintf(\"INFO: %s\", format)\n\tif len(args) > 0 {\n\t\tmsg = fmt.Sprintf(msg, args...)\n\t}\n\n\tlog.Println(msg)\n}", "func Infof(template string, args ...interface{}) {\n\terrorLogger.Infof(template, args...)\n}", "func (l *Logger) Infof(format string, v ...interface{}) {\n\tmsg := fmt.Sprintf(format, v...)\n\tl.logger.Printf(msg)\n}", "func Info(format string, a ...interface{}) {\n\tprefix := blue(info)\n\tlog.Println(prefix, fmt.Sprintf(format, a...))\n}", "func Infof(format string, a ...interface{}) {\n\tlogInfof(&loggers.Loggers[0], format, a...)\n}", "func Infof(format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tlogf(\"INFO\", msg)\n}", "func (l *Log) Infof(format string, v ...interface{}) {\n\tl.appender.Append(lInfo, fmt.Sprintf(format, v...))\n}", "func Infof(format string, args ...interface{}) {\n\ts := fmt.Sprintf(format, args...)\n\tinfoLogger.Output(outputCallDepth, s) // nolint\n}", "func (l *EcsLogger) Infof(format string, v ...interface{}) {\n\t_ = level.Info(l).Log(\"msg\", fmt.Sprintf(format, v...))\n}", "func (it *Logger) Infof(format string, params ...interface{}) {\n\tit.generate(nil, it, Info, format, params...)\n}", "func (l *Logger) Info(v ...interface{}) {\n\tl.Infof(\"%s\", fmt.Sprintln(v...))\n}" ]
[ "0.8391864", "0.8310668", "0.8030343", "0.8001378", "0.7980694", "0.7978601", "0.7974095", "0.7963634", "0.79368216", "0.7905213", "0.7905213", "0.7905213", "0.790414", "0.7897103", "0.7897103", "0.7889659", "0.78882056", "0.7862157", "0.78521776", "0.7824772", "0.78216326", "0.78202504", "0.7818918", "0.78099865", "0.7805431", "0.780101", "0.77906513", "0.77851146", "0.77734095", "0.7769577", "0.7760929", "0.77472806", "0.7729061", "0.772689", "0.77203375", "0.7701593", "0.7687939", "0.7679765", "0.766609", "0.7664661", "0.7648102", "0.76360184", "0.76305157", "0.76294684", "0.7625349", "0.7623094", "0.7622889", "0.76221263", "0.76134354", "0.7605123", "0.7594962", "0.7573322", "0.7567307", "0.75535375", "0.75173473", "0.7492824", "0.7489496", "0.7480466", "0.7470194", "0.74607134", "0.7448837", "0.7448827", "0.7443683", "0.7439041", "0.7429226", "0.7424685", "0.74241495", "0.7410299", "0.7409817", "0.7405968", "0.7396097", "0.7395167", "0.7383614", "0.7375365", "0.7372345", "0.73715025", "0.7365743", "0.7364756", "0.7359859", "0.7358754", "0.73576957", "0.73566216", "0.7341536", "0.7341284", "0.7339955", "0.7339737", "0.73382944", "0.7332393", "0.7328457", "0.73270315", "0.7299221", "0.7292137", "0.7289493", "0.7287776", "0.7287749", "0.7280547", "0.727734", "0.727349", "0.7265728", "0.72645074" ]
0.72858816
95
Warn is a logging method that will write to default logger with WARNING level
func Warn(msg ...interface{}) { log(defaultLogger, WARNING, msg...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (l *Logger) Warn(v ...interface{}) { l.lprint(WARN, v...) }", "func (l *MessageLogger) Warn(msg string) { l.logger.Warn(msg) }", "func (l *Logger) Warn(v ...interface{}) {\n\tif l.loglevel <= sWarning {\n\t\tl.output(sWarning, 0, fmt.Sprint(v...))\n\t} else {\n\t\treturn\n\t}\n}", "func (d *DummyLogger) Warning(format string) {}", "func (l Logger) Warn(msg ...interface{}) {\n\tif l.Level <= log.WarnLevel {\n\t\tl.logger.Print(append([]interface{}{\"[WARNING] \"}, msg...)...)\n\t}\n}", "func (l Logger) Warn(msg ...interface{}) {\n\tif l.Level <= log.WarnLevel {\n\t\tout := l.WarnColor.Sprint(append([]interface{}{\"WARNING: \"}, msg...)...)\n\t\tout = checkEnding(out)\n\t\tfmt.Fprint(l.WarnOut, out)\n\t}\n}", "func (l *Logger) Warn(v ...interface{}) {\n\tl.Log(fmt.Sprintln(v...), Lwarn, 0)\n}", "func (l typeLogger) Warn(format string, v ...interface{}) {\n\tif l.level <= logWarning {\n\t\tmessage := fmt.Sprintf(format, v...)\n\t\tl.logger.Printf(\"%s%s%s: %s (%s)\", colorWarning, tagWarning, colorClear, message, getCallerPosition())\n\t}\n}", "func (l *Logger) Warn(v ...interface{}) {\n\tl.NewEntry().Print(WARN, v...)\n}", "func ExampleWarn() {\n\tsetup()\n\tlog.Warn().Msg(\"hello world\")\n\n\t// Output: {\"level\":\"warn\",\"time\":1199811905,\"message\":\"hello world\"}\n}", "func (l *Logger) Warn(v ...interface{}) {\n\tl.Log(WarnLevel, fmt.Sprint(v...))\n}", "func (l *Logger) WARN(msg string) {\n\tdefer l.Zap.Sync()\n\tl.Zap.Warn(msg)\n}", "func (logger *Logger) Warn(v ...interface{}) {\n\tif logger.level >= 2 {\n\t\tlogger.log.Output(2, fmt.Sprintf(\"[WARN] %s\\n\", v...))\n\t}\n}", "func lWarn(v ...interface{}) {\n\t/* #nosec */\n\t_ = warnLogger.Output(2, fmt.Sprintln(v...)) //Following log package, ignoring error value\n}", "func (logger *Logger) Warn(args ...interface{}) {\n\tlogger.std.Log(append([]interface{}{\"Warn\"}, args...)...)\n}", "func (l *Logger) Warnln(v ...interface{}) { l.lprintln(WARN, v...) }", "func Warn(v ...interface{}) {\n\tstdLogger.Log(WarnLevel, fmt.Sprint(v...))\n}", "func Warn(msg string, args ...interface{}) {\n\tdefaultLogger.Warn(msg, args...)\n}", "func (l *Logger) Warn(message string) {\n\tstdLog.Warn(message)\n}", "func Warn(args ...interface{}) {\n\tdefaultLogger.Warn(args...)\n}", "func (l *Logger) Warn(v ...interface{}) {\n\tif l.LogToStdout {\n\t\tlog.Print(v...)\n\t}\n\tif l.LogToSystemLog {\n\t\tl.SystemLog.Warning(fmt.Sprint(v...))\n\t}\n}", "func (l *wrappedLogger) Warning(msg string, v ...interface{}) {\n\tif l.syslog {\n\t\terr := l.syslogWriter.Warning(fmt.Sprintf(msg, v...))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tl.stdWriter.Printf(\"[WARNING] \"+msg, v...)\n\t}\n}", "func (dl *defaultLogger) Warn(msg string) {\n\tdl.Print(msg)\n}", "func (lg *Logger) Warning(args ...interface{}) {\n if lg.level <= WARNING {\n lg.logger.SetPrefix(LEVELS[WARNING])\n lg.logger.Println(args...)\n }\n}", "func (l *Logger) Warning(args ...interface{}) {\n\tl.lock()\n\tdefer l.unlock()\n\tl.logger.Warning(args...)\n}", "func (l *sdkLogger) Warn(v ...interface{}) {\n\tl.Warning(v)\n}", "func (l *loggerWrapper) Warning(args ...interface{}) {\n\tl.logger.Warn(sprint(args...))\n}", "func Warn(format string, v ...interface{}) {\n\tLeveledLogger(level.Warn, format, v...)\n}", "func Warn(args ...interface{}) {\n\tDefaultLogger.Warn(args...)\n}", "func (z *Logger) Warn(args ...interface{}) {\n\tz.SugaredLogger.Warn(args...)\n}", "func (l logger) Warn(ctx context.Context, msg string, data ...interface{}) {\n\tif l.LogLevel >= Warn {\n\t\tl.Printf(l.warnStr+msg, data...)\n\t}\n}", "func (slog stdLogger) Warning(s string) {\n\tif logger.Logger != nil {\n\t\tlogger.Write([]byte(\" WARNING \" + s))\n\t} else {\n\t\tlog.Printf(\" WARNING \" + s)\n\t}\n}", "func Warn(ctx context.Context, args ...interface{}) {\n\tGetLogger().Log(ctx, loggers.WarnLevel, 1, args...)\n}", "func (l ServiceLogger) Warn(message string) {\n\tl.Logger.Warn(message)\n}", "func Warn(format string, v ...interface{}) {\n\tif LogLevel() <= 2 {\n\t\tlog.Printf(\"WARN: \"+format, v...)\n\t}\n}", "func Warn(message interface{}) {\n\tglobalLogger.Warn(message)\n}", "func (l *thundraLogger) Warn(v ...interface{}) {\n\tif logLevelId > warnLogLevelId {\n\t\treturn\n\t}\n\tlogManager.recentLogLevel = warnLogLevel\n\tlogManager.recentLogLevelId = warnLogLevelId\n\tl.Output(2, fmt.Sprint(v...))\n}", "func (l *Log) Warn(args ...interface{}) {\n\tl.logger.Warn(args...)\n}", "func (l Logger) Warning(message string) {\n\tl.internalLogger.Warn(message)\n}", "func Warning(args ...interface{}) {\n LoggerOf(default_id).Warning(args...)\n}", "func (l *Logger) Warn(message string) {\n\tl.LogWithLevel(message, \"warn\")\n}", "func (l *Logger) Warn(args ...interface{}) {\n\tkitlevel.Warn(l.Log).Log(args...)\n}", "func (l *GrpcLog) Warning(args ...interface{}) {\n\tl.SugaredLogger.Warn(args...)\n}", "func (l *LvLogger) Warn(v ...interface{}) {\n\tif l.level > Warn {\n\t\treturn\n\t}\n\n\tl.inner.Output(2, fmt.Sprint(v...))\n}", "func (l *Lgr) Warn(args ...interface{}) {\n l.Logger.Warn(args...)\n}", "func (logger *Logger) Warning(args ...interface{}) {\n\tlogger.std.Log(append([]interface{}{\"Warning\"}, args...)...)\n}", "func LogWarn(context string, module string, info string) {\n log.Warn().\n Str(\"Context\", context).\n Str(\"Module\", module).\n Msg(info)\n}", "func (l *Logger) Warn(fields Fields) {\n\tl.add(Warning, fields)\n}", "func Warn(msg ...interface{}) {\n\tif LevelWarn >= logLevel {\n\t\tsyslog.Println(\"W:\", msg)\n\t}\n}", "func Warn(args ...interface{}) {\r\n\tLogger.Warn(\"\", args)\r\n}", "func (l *BasicLogger) Warn(msg string) {\n\tl.appendLogEvent(level.WarnLevel, msg)\n}", "func (cLogger CustomLogger) Warn(args ...interface{}) {\n\tlevel.Warn(log.With(loggerInstance, \"caller\", getCallerInfo())).Log(args...)\n}", "func (logger *Logger) Warning(args ...interface{}) {\n\tlogger.logPrint(L_WARNING, args...)\n}", "func (l *Logger) WARN(msg string, kv ...interface{}) {\n\tlvl := syslog.LOG_WARN\n\tif l.Does(lvl) {\n\t\tl.log(lvl, msg, kv...)\n\t}\n}", "func Warn() *Logger {\n\treturn warnLogger\n}", "func Warn(v ...interface{}) {\n\tLogger.Warn(v...)\n}", "func (v *MultiLogger) Warning(args ...interface{}) {\n\tv.Warn(args...)\n}", "func Warning(msg string, args ...interface{}) {\n\tif level&WARN != 0 {\n\t\twriteMessage(\"WRN\", msg, args...)\n\t}\n}", "func (s SugaredLogger) Warn(message string, fields ...interface{}) {\n\ts.zapLogger.Warnw(message, fields...)\n}", "func (l *Logger) Warn(args ...interface{}) {\n\tif l.IsEnabledFor(WarnLevel) {\n\t\tfile, line := Caller(1)\n\t\tl.Log(WarnLevel, file, line, \"\", args...)\n\t}\n}", "func (l *Logger) Warning(values ...interface{}) {\n\tif l.loggingLevel > WarningLevel {\n\t\treturn\n\t}\n\tl.log(l.warningPrefix, fmt.Sprint(values...))\n}", "func (logger *Logger) Warn(s string) {\n\tif WARN >= logger.level {\n\t\tlogger.warn.Print(s)\n\t}\n}", "func Warn(ctx context.Context, logCat LogCat, v ...interface{}) {\n\tdefaultLogger.Warn(ctx, logCat, v...)\n}", "func Warn(format string, v ...interface{}) {\n\tDefaultLogger.Warn(format, v...)\n}", "func (l gormLogger) Warn(ctx context.Context, msg string, data ...interface{}) {\n\tif l.LogLevel >= logger.Warn {\n\t\t//l.Printf(l.warnStr+msg, append([]interface{}{utils.FileWithLineNum()}, data...)...)\n\t\tlog := l.getLogger(ctx)\n\t\tlog.Logf(loggerCore.WarnLevel, l.warnStr+msg, append([]interface{}{utils.FileWithLineNum()}, data...)...)\n\t}\n}", "func Warn(v ...interface{}) {\n\tif level <= LevelWarning {\n\t\tTorbitLogger.Printf(\"[W] %v\\n\", v)\n\t}\n}", "func Warning(format string, v ...interface{}) {\n\tdoLog(\"WARNING\", format, v...)\n}", "func (logger *Logger) Warning(msg string, extras ...map[string]string) error {\n\tif WarnLevel >= logger.LogLevel {\n\t\treturn logger.Log(msg, WarnLevel, extras...)\n\t}\n\treturn nil\n}", "func (l *Logger) Warn(log ...interface{}) {\n\tl.instance.Warn(log...)\n}", "func (l Mylog) Warn(ctx context.Context, msg string, data ...interface{}) {\n\tl.ServiceLog.Warn(msg, data)\n\t//if l.LogLevel >= Warn {\n\t//\tl.Printf(l.warnStr+msg, append([]interface{}{utils.FileWithLineNum()}, data...)...)\n\t//}\n}", "func (l *Logger) Warn(a ...interface{}) {\n\tif l.Verbosity <= VerbosityLevelQuiet {\n\t\treturn\n\t}\n\n\tl.logInStyle(warningString, yellow, a...)\n}", "func Warn(err error, args ...interface{}) {\n\tlogger.WithError(err).Warn(args...)\n}", "func (logger *Logger) Warning(format string, a ...interface{}) {\n\tlogger.log(Warning, format, a...)\n}", "func Warning(args ...interface{}) {\n\tlogger.Warning(args...)\n}", "func Warning(v ...interface{}) {\n\tlogger.Warning(v...)\n}", "func Warn(msg string, fields ...zap.Field) {\n\tglobalLoggerWarp().Warn(msg, fields...)\n}", "func (n Noop) Warn(args ...interface{}) {\n\tpanic(\"noop log\")\n}", "func LogWarn(args ...interface{}) {\n\tlog.WithFields(logFields).Warn(args...)\n}", "func Warn(msg string, fields ...Field) {\n\tgetLogger().Warn(msg, fields...)\n}", "func Warn(msg string, fields map[string]interface{}) error {\n\treturn defaultLogger.Log(LvWarn, msg, fields)\n}", "func (l *Logger) Warn(msg string, args ...interface{}) {\n\tl.z.Warnw(msg, args...)\n}", "func (log Logger) Warn(message string, fields ...Data) {\n\tlog.log(log.zl.Warn(), message, fields...)\n}", "func Warn(args ...interface{}) {\n\tlogger.Warn(args...)\n}", "func Warn(args ...interface{}) {\n\tlogger.Warn(args...)\n}", "func Warn(args ...interface{}) {\n\tlogger.Warn(args...)\n}", "func Warn(log string, v ...interface{}) {\n\tsyslog.Printf(\"WARN \"+log, v...)\n}", "func (stimLogger *FullStimLogger) Warn(message ...interface{}) {\n\tif stimLogger.highestLevel >= WarnLevel {\n\t\tif stimLogger.setLogger == nil {\n\t\t\tif stimLogger.forceFlush {\n\t\t\t\tstimLogger.writeLogs(stimLogger.formatString(WarnLevel, warnMsg, message...))\n\t\t\t} else {\n\t\t\t\tstimLogger.formatAndLog(WarnLevel, warnMsg, message...)\n\t\t\t}\n\t\t} else {\n\t\t\tstimLogger.setLogger.Warn(message...)\n\t\t}\n\t}\n}", "func Warn(v ...interface{}) { std.lprint(WARN, v...) }", "func Warn(v ...interface{}) {\n\tif LogLevel >= 2 {\n\t\tDoLog(3, WARN, fmt.Sprint(v...))\n\t}\n}", "func (sl *SysLogger) Warning(info, msg string) {\n\tlog.Println(\"[WARNING]\", sl.tag, info, msg)\n}", "func Warn(v ...interface{}) string {\n\treturn logr.Warn(v...)\n}", "func Warn(msg ...interface{}) {\n\tCurrent.Warn(msg...)\n}", "func (l *Logger) Warning(a ...interface{}) {\n\tif l.Level() >= Warning {\n\t\tl.logWarning.Print(a...)\n\t}\n}", "func Warn(format string, v ...interface{}) {\n\tLog(1, WARN, format, v...)\n}", "func (logger *Logger) Warn(a ...any) {\n\tlogger.echo(nil, level.Warn, formatPrint, a...)\n}", "func (l *BasicLogger) Warn(message string, fields Fields) {\n\tl.Logger.WithFields(logrus.Fields(fields)).Warn(message)\n}", "func Warn(msg string, fields ...zapcore.Field) {\n\tinitLogger()\n\n\tlogger.Warn(msg, fields...)\n}", "func Warn(format string, a ...interface{}) {\n\tif currentLogger == nil {\n\t\treturn\n\t}\n\tcurrentLogger.output(currentPool, _WarnLevel, format, a...)\n}", "func Warn(l interface{}) {\n\tlog.WithFields(log.Fields{\n\t\t\"SERVICE\": \"WINGO\",\n\t}).Warnln(l)\n}", "func Warning(args ...interface{}) {\n\tLogger.Warning(args...)\n}" ]
[ "0.8193787", "0.8023521", "0.79738945", "0.7881181", "0.78809106", "0.78585875", "0.7825159", "0.774579", "0.774015", "0.7716772", "0.7709174", "0.7690986", "0.76858497", "0.76778233", "0.76506484", "0.7643709", "0.7643335", "0.7639111", "0.76330876", "0.7622793", "0.7590641", "0.75894606", "0.75854903", "0.75847816", "0.7576767", "0.75695896", "0.75502044", "0.75451356", "0.754139", "0.7539137", "0.75380135", "0.75315344", "0.75313216", "0.751413", "0.75102663", "0.7504159", "0.7491721", "0.7484785", "0.74773395", "0.74760705", "0.74749017", "0.7470076", "0.7469755", "0.746148", "0.7460339", "0.74571234", "0.745156", "0.74508303", "0.7450645", "0.74487764", "0.744664", "0.7442546", "0.7439904", "0.74332786", "0.74302447", "0.7427646", "0.74141204", "0.741115", "0.74054873", "0.7403477", "0.73985374", "0.7393854", "0.739296", "0.73923904", "0.73902375", "0.7389541", "0.73894036", "0.73866636", "0.73859376", "0.73857147", "0.7385491", "0.7377254", "0.7348216", "0.7344941", "0.734346", "0.7342745", "0.7341045", "0.7340442", "0.73381454", "0.7334666", "0.73345137", "0.7331883", "0.73303187", "0.73303187", "0.73303187", "0.73294497", "0.7324313", "0.73242253", "0.7320739", "0.7312407", "0.7310818", "0.7308551", "0.73035526", "0.7303469", "0.7301259", "0.72940046", "0.729364", "0.7288123", "0.7284708", "0.7283767" ]
0.79517454
3
Warnf is just like Warn, but with formatting
func Warnf(format string, a ...interface{}) { log(defaultLogger, WARNING, fmt.Sprintf(format, a...)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Warnf(format string, v ...interface{}) { std.lprintf(WARN, format, v...) }", "func (l *Logger) Warnf(format string, v ...interface{}) { l.lprintf(WARN, format, v...) }", "func Warnf(format string, args ...interface{}) {\n\tl.Warn().Msgf(format, args...)\n}", "func Warnf(format string, a ...interface{}) {\n\tWarnln(fmt.Sprintf(format, a...))\n}", "func Warnf(format string, v ...interface{}) {\n\tWithLevelf(LevelWarn, format, v...)\n}", "func Warnf(format string, v ...interface{}) {\n\tif std.level >= WarnLevel {\n\t\tstd.Output(std.callDepth, fmt.Sprintf(format, v...), WarnLevel)\n\t}\n}", "func Warnf(format string, a ...interface{}) {\n\tDefault.Warnf(format, a...)\n}", "func (l *Logger) Warnf(format string, v ...interface{}) {\n\tl.Log(WarnLevel, fmt.Sprintf(format, v...))\n}", "func Warnf(format string, args ...interface{}) {\n\tlogger.Warn(fmt.Sprintf(format, args...))\n}", "func (l *Logger) Warnf(format string, v ...interface{}) {\n\tl.NewEntry().Printf(WARN, format, v...)\n}", "func Warnf(format string, v ...interface{}) {\n\tstdLogger.Log(WarnLevel, fmt.Sprintf(format, v...))\n}", "func Warnf(format string, vars ...interface{}) {\n\tif level > None && level <= Warn {\n\t\tlogger.Printf(strings.Join([]string{\"WARN\", format}, \" \"), vars...)\n\t}\n}", "func (l *Logger) Warnf(format string, v ...interface{}) {\n\tl.Output(2, fmt.Sprint(warnPrefix, fmt.Sprintf(format, v...)))\n}", "func (l *EcsLogger) Warnf(format string, v ...interface{}) {\n\t_ = level.Warn(l).Log(\"msg\", fmt.Sprintf(format, v...))\n}", "func Warnf(format string, v ...interface{}) {\n\toutputf(LevelWarn, format, v...)\n}", "func (e *Entry) Warnf(msg string, v ...interface{}) {\n\te.Warn(fmt.Sprintf(msg, v...))\n}", "func (l *LvLogger) Warnf(format string, v ...interface{}) {\n\tif l.level > Warn {\n\t\treturn\n\t}\n\n\tl.inner.Output(2, fmt.Sprintf(format, v...))\n}", "func (e *Entry) Warnf(format string, v ...interface{}) {\n\tif LogLevelWarn >= e.logger.Level {\n\t\te.logger.printf(LogLevelWarn, e.Context, format, v...)\n\t}\n}", "func (msg msgstream) Warnf(format string, a ...interface{}) {\n\tmsg.Msg(LvlWarning, format, a...)\n}", "func (r *Reporter) Warnf(format string, args ...interface{}) {\n\tmessage := r.printf(format, args)\n\tfmt.Fprintf(os.Stdout, \"%s%s\\n\", warnPrefix, message)\n}", "func (l *stubLogger) Warnf(format string, args ...interface{}) {}", "func (l *Logger) Warnf(format string, v ...interface{}) {\n\tif l.loglevel <= sWarning {\n\t\tl.output(sWarning, 0, fmt.Sprintf(format, v...))\n\t} else {\n\t\treturn\n\t}\n}", "func (logger *Logger) Warnf(format string, a ...any) {\n\tlogger.echo(nil, level.Warn, format, a...)\n}", "func (l *Logger) Warnf(format string, v ...interface{}) {\n\tstdLog.Warnf(format, v)\n}", "func (logger *Logger) Warnf(format string, args ...interface{}) {\n\tlogger.std.Logf(\"Warn\"+format, args...)\n}", "func (DefaultLogger) Warnf(format string, p ...interface{}) {\n\tlog.Warnf(format, p)\n}", "func (c Context) Warnf(format string, args ...interface{}) {\n\tc.Log(20, fmt.Sprintf(format, args...), GetCallingFunction())\n}", "func Warnf(format string, v ...interface{}) {\n\tlog.Warnf(format, v...)\n}", "func (l *scLogger) Warnf(format string, args ...interface{}) {\n\tl.log.Warn().Msgf(format, args...)\n}", "func Warnf(format string, args ...interface{}) {\n\tlogger.Warnf(format, args...)\n}", "func Warnf(format string, args ...interface{}) {\n\tlogger.Warnf(format, args...)\n}", "func Warnf(format string, args ...interface{}) {\n\tlogger.Warnf(format, args...)\n}", "func (l *BasicLogger) Warnf(format string, vargs ...interface{}) {\n\tl.appendLogEvent(level.WarnLevel, fmt.Sprintf(format, vargs...))\n}", "func Warnf(format string, v ...interface{}) {\n\tif format == \"\" {\n\t\treturn\n\t}\n\tif format[len(format)-1] != '\\n' {\n\t\tformat += \"\\n\"\n\t}\n\tfmt.Fprintf(Stderr, format, v...)\n}", "func (l Logger) Warnf(template string, args ...interface{}) {\n\tif l.Level <= log.WarnLevel {\n\t\tout := l.WarnColor.Sprintf(\"WARNING: \"+template, args...)\n\t\tout = checkEnding(out)\n\t\tfmt.Fprint(l.WarnOut, out)\n\t}\n}", "func Warnf(format string, args ...interface{}) {\n\tLog.Warnf(format, args...)\n}", "func Warnf(format string, args ...interface{}) {\n\tLog.Warnf(format, args...)\n}", "func Warnf(format string, params ...interface{}) {\n\tDefaultLogger.Warnf(format, params...)\n}", "func Warnf(format string, args ...interface{}) {\n\tGlobalLogger().Warnf(format, args...)\n}", "func Warnf(format string, args ...interface{}) {\n\tlogging.Warnf(format, args...)\n}", "func Warnf(msg string, v ...interface{}) string {\n\treturn logr.Warnf(msg, v...)\n}", "func Warnf(ctx context.Context, format string, args ...interface{}) {\n\tlog.WithFields(utils.GetCommonMetaFromCtx(ctx)).Warnf(format, args...)\n}", "func Warnf(format string, args ...interface{}) {\n\tdefaultLogger.Warnf(format, args...)\n}", "func (it *Logger) Warnf(format string, params ...interface{}) {\n\tit.generate(nil, it, Warn, format, params...)\n}", "func (l *Logger) Warnf(format string, v ...interface{}) {\n\tif l.LogToStdout {\n\t\tlog.Printf(format, v...)\n\t}\n\tif l.LogToSystemLog {\n\t\tl.SystemLog.Warning(fmt.Sprintf(format, v...))\n\t}\n}", "func Warnf(ctx context.Context, format string, args ...interface{}) {\n\tglobal.Warnf(ctx, format, args...)\n}", "func (l *Lgr) Warnf(format string, args ...interface{}) {\n l.Logger.Warnf(format, args...)\n}", "func (l *Logger) Warnf(format string, args ...interface{}) {\r\n\tl.logger.Warnf(format, args...)\r\n}", "func (s *StanLogger) Warnf(format string, v ...interface{}) {\n\ts.executeLogCall(func(logger Logger, format string, v ...interface{}) {\n\t\tlogger.Warnf(format, v...)\n\t}, format, v...)\n}", "func Warnf(msg string, v ...interface{}) {\n\tif lvl <= war {\n\t\tl.Printf(\"[WARN ]: \"+msg, v...)\n\t}\n}", "func (logger *Logger) Warnf(format string, v ...interface{}) {\n\tif WARN >= logger.level {\n\t\tlogger.warn.Printf(format, v...)\n\t}\n}", "func (l *LevelLog) Warnf(format string, v ...interface{}) {\n\tl.logger.SetPrefix(\"WARN: \")\n\tl.logger.Printf(format, v...)\n}", "func (t *TextLogger) Warnf(format string, args ...interface{}) {\n\tt.writeLine(t.wErr, warnPrefix, fmt.Sprintf(format, args...))\n}", "func Warnf(template string, args ...interface{}) {\n\tWarn(fmt.Sprintf(template, args...))\n}", "func (rl *RevelLogger) Warnf(msg string, param ...interface{}) {\n\trl.Warn(fmt.Sprintf(msg, param...))\n}", "func (rl *RevelLogger) Warnf(msg string, param ...interface{}) {\n\trl.Warn(fmt.Sprintf(msg, param...))\n}", "func (w *Writer) Warnf(format string, args ...interface{}) {\n\tw.log(\"warn\", format, args...)\n}", "func Warnf(format string, args ...interface{}) {\n\tNewDefaultEntry().Warnf(format, args...)\n}", "func (z *Logger) Warnf(format string, args ...interface{}) {\n\tz.SugaredLogger.Warnf(format, args...)\n}", "func (entry *Entry) Warnf(format string, args ...interface{}) {\n\tentry.e.Warnf(format, args...)\n}", "func (log *logger) Warnf(format string, args ...interface{}) slf.Tracer {\n\treturn log.logf(format, slf.LevelWarn, args...)\n}", "func Warnf(format string, v ...interface{}) error {\n\treturn outputf(os.Stdout, LevelWarn, format, v...)\n}", "func (l *Log) Warnf(format string, args ...interface{}) {\n\tl.logger.Warnf(format, args...)\n}", "func Warnf(msg string, fields ...interface{}) {\n\tGetSkip1Logger().Warn(fmt.Sprintf(msg, fields...))\n}", "func Warnf(format string, args ...interface{}) {\n\twarndeps(sentry.CaptureMessage, 3, format, args...)\n}", "func Warnf(data string, v ...interface{}) {\n\twarnLogger.Printf(data, v...)\n}", "func Warnf(format string, args ...interface{}) {\n\troot.entry.Warnf(format, args...)\n}", "func (l *Logger) Warnf(format string, values ...interface{}) {\n\tif l.level >= LogLevelInfo {\n\t\tvalues = append([]interface{}{addFileLinePrefix(\"\")}, values...)\n\t\tl.warnLogger.Printf(\"%s \"+format, values...)\n\t}\n}", "func (l *NamedLogger) Warnf(format string, params ...interface{}) {\n\tformat, params = l.convert(format, params)\n\tl.Logger.Warnf(format, params...)\n}", "func (l *sdkLogger) Warnf(format string, v ...interface{}) {\n\tl.Warningf(format, v)\n}", "func (l *Logr) Warnf(msg string, v ...interface{}) string {\n\treturn logf(W, false, msg, v, l.meta)\n}", "func (l *Logger) Warnf(format string, log ...interface{}) {\n\tl.instance.Warnf(format, log...)\n}", "func (l *Logs) WarnF(format string, v ...interface{}) {\n\tl.warnings++\n\tif configuration.LogLevel >= 2 {\n\t\tlog.Printf(\"[WARN][\"+l.funcName+\"] \"+format, v...)\n\t}\n}", "func (e *Entry) Warnf(format string, args ...interface{}) {\n\te.entry.Warnf(format, args...)\n}", "func (lgr *lager) Warnf(msg string, v ...interface{}) {\n\tlgr.logf(Warn, msg, v...)\n}", "func (l LoggerFunc) Warnf(format string, args ...interface{}) {\n\tl(format, args...)\n}", "func Warnf(format string, args ...interface{}) {\n\tif logger != nil && level <= veldt.Warn {\n\t\tlogger.Warnf(prefix+format, args...)\n\t} else {\n\t\tveldt.Warnf(prefix+format, args...)\n\t}\n}", "func Warnf(msg string, v ...interface{}) {\n\tLogger.Warnf(msg, v...)\n}", "func Warnf(message string, v ...interface{}) {\n\tglobalLogger.Warnf(message, v...)\n}", "func (l *zapLog) Warnf(format string, args ...interface{}) {\n\tif l.logger.Core().Enabled(zapcore.WarnLevel) {\n\t\tl.logger.Warn(fmt.Sprintf(format, args...))\n\t}\n}", "func (l Logger) Warnf(template string, args ...interface{}) {\n\tif l.Level <= log.WarnLevel {\n\t\tl.logger.Printf(\"[WARNING] \"+template, args...)\n\t}\n}", "func Warnf(format string, args ...interface{}) {\n\tlogTo(context.TODO(), LevelWarn, KeyAll, format, args...)\n}", "func Warnf(template string, args ...interface{}) {\n\tlog.Warnf(template, args...)\n}", "func Warnf(template string, args ...interface{}) {\n\tCurrent.Warnf(template, args...)\n}", "func Warningf(format string, args ...interface{}) {\n\tWarnf(format, args...)\n}", "func Warnf(format string, args ...interface{}) {\n\tLogf(logrus.WarnLevel, format, args...)\n}", "func Warnf(template string, args ...interface{}) {\n\tDefaultLogger.Warnf(template, args...)\n}", "func (z *ZapLogWrapper) Warnf(format string, args ...interface{}) {\n\tz.l.Warnf(format, args...)\n}", "func Warnf(logFile *LogFileName, format string, v ...interface{}) {\n\tif (*logFile).logLevel >= L_WARN {\n\t\t(*logFile).info.Printf(format, v)\n\t}\n}", "func Warnf(template string, args ...interface{}) {\n\tL().log(2, WarnLevel, template, args, nil)\n}", "func Warnf(template string, args ...interface{}) {\n\tlogger.Sugar().Warnf(template, args...)\n}", "func (d *LevelWrapper) Warnf(format string, args ...interface{}) {\n\tif d.WarnEnabled() {\n\t\td.Logger.Warnf(format, args...)\n\t}\n}", "func Warnf(format string, v ...interface{}) {\n\tjasonLog.output(2, levelWarn, format, v...)\n}", "func Warnf(ctx context.Context, logCat LogCat, format string, v ...interface{}) {\n\tdefaultLogger.Warnf(ctx, logCat, format, v...)\n}", "func Warnf(format string, args ...interface{}) {\n\tlogWithFilename().Warnf(format, args...)\n}", "func Warningf(format string, args ...interface{}) { logRaw(LevelWarning, 2, format, args...) }", "func (d *DummyLogger) Warningf(format string, args ...interface{}) {}", "func Warnf(template string, args ...interface{}) {\n\terrorLogger.Warnf(template, args...)\n}", "func (l *testingLogger) Warnf(format string, args ...interface{}) {\n\tl.t.Logf(format, args...)\n}", "func (_m *Logger) Warnf(fmt string, args ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, fmt)\n\t_ca = append(_ca, args...)\n\t_m.Called(_ca...)\n}" ]
[ "0.8882867", "0.88435394", "0.86102724", "0.8556104", "0.84770346", "0.84662986", "0.8466242", "0.84621537", "0.8415996", "0.84066606", "0.8402819", "0.8380459", "0.83775127", "0.836579", "0.83619547", "0.8359381", "0.8334334", "0.83280987", "0.83237195", "0.8319787", "0.8293676", "0.8291031", "0.82835835", "0.8275656", "0.827127", "0.82696337", "0.82691956", "0.82558644", "0.82518184", "0.824323", "0.824323", "0.824323", "0.82386035", "0.82366115", "0.8231146", "0.8229661", "0.8229661", "0.8225125", "0.82232064", "0.8218014", "0.82170016", "0.8213391", "0.81973934", "0.81900376", "0.81893605", "0.81887686", "0.8188266", "0.81876725", "0.81778955", "0.8161556", "0.8156854", "0.81530267", "0.81465685", "0.81433874", "0.81421775", "0.81421775", "0.81325006", "0.81265026", "0.812029", "0.8093895", "0.8084238", "0.80801886", "0.8074218", "0.8066093", "0.80474097", "0.8045845", "0.804135", "0.8028147", "0.8027625", "0.8026869", "0.801401", "0.8008745", "0.8003861", "0.8002275", "0.8001212", "0.8000902", "0.79952943", "0.79938644", "0.79898375", "0.79896617", "0.79868484", "0.7960321", "0.793908", "0.790064", "0.7867462", "0.7866755", "0.7866651", "0.7855323", "0.7846608", "0.7844097", "0.78439647", "0.7839168", "0.7831262", "0.7831259", "0.78056985", "0.78004897", "0.77995235", "0.77875245", "0.77805614", "0.7771662" ]
0.84311163
8
Fatal is a logging method that will write to default logger with Fatal level, and then terminate program with exist code 1
func Fatal(msg ...interface{}) { log(defaultLogger, FATAL, msg...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Fatal(args ...interface{}) {\n LoggerOf(default_id).Fatal(args...)\n}", "func (logger *Logger) Fatal(args ...interface{}) {\n\tlogger.std.Log(append([]interface{}{\"Fatal\"}, args...)...)\n\tpanic(args[0])\n}", "func (l *Logger) Fatal(v ...interface{}) { l.lprint(FATAL, v...) }", "func Fatal(format string, v ...interface{}) {\n\tLog(1, FATAL, format, v...)\n\tClose()\n\tos.Exit(1)\n}", "func (l *BasicLogger) Fatal(msg string) {\n\tl.appendLogEvent(level.FatalLevel, msg)\n\tos.Exit(1)\n}", "func (xlog *Logger) Fatal(v ...interface{}) {\n\tlog.Std.Output(xlog.ReqId, log.Lfatal, 2, fmt.Sprint(v...))\n\tos.Exit(1)\n}", "func Fatal(v ...interface{}) {\n\tstdLogger.Log(FatalLevel, fmt.Sprint(v...))\n\tos.Exit(1)\n}", "func (l *Log) Fatal(v ...interface{}) {\n\tif l.Level >= logLevelFatal {\n\t\tl.LogWF.Output(2, fmt.Sprintln(\" Fatal \", v))\n\t}\n\tos.Exit(255)\n}", "func (stimLogger *FullStimLogger) Fatal(message ...interface{}) {\n\tif stimLogger.highestLevel >= FatalLevel {\n\t\tif stimLogger.setLogger == nil {\n\t\t\tstimLogger.writeLogs(stimLogger.formatString(FatalLevel, fatalMsg, message...))\n\t\t} else {\n\t\t\tstimLogger.setLogger.Fatal(message...)\n\t\t}\n\t\tos.Exit(5)\n\t}\n}", "func (l *Logger) Fatal(v ...interface{}) {\n\tl.Log(FatalLevel, fmt.Sprint(v...))\n\tos.Exit(1)\n}", "func (logger *Logger) Fatal(v ...interface{}) {\n\tlogger.log.Output(2, fmt.Sprintf(\"[FATAL] %s\\n\", v...))\n\tos.Exit(1)\n}", "func (l *Logger) Fatal(values ...interface{}) {\n\tif l.loggingLevel > FatalLevel {\n\t\treturn\n\t}\n\tl.log(l.fatalPrefix, fmt.Sprint(values...))\n\tl.exitFunction()\n}", "func (l typeLogger) Fatal(format string, v ...interface{}) {\n\tmessage := fmt.Sprintf(format, v...)\n\tl.logger.Printf(\" %s%s%s : %s (%s)\", colorFatal, tagFatal, colorClear, message, getCallerPosition())\n\tos.Exit(1)\n}", "func (l *Logger) Fatal(v ...interface{}) {\n\tl.output(sFatal, 0, fmt.Sprint(v...))\n\tos.Exit(1)\n}", "func Fatal(args ...interface{}) {\n\tdefaultLogger.Fatal(args...)\n}", "func (l *logHandler) Fatal(args ...interface{}) {\n\tl.Log(LogFatal, 3, args...)\n\tpanic(\"Fatal error occured\")\n}", "func Fatal(v ...interface{}) {\n\t// Send to Output instead of Fatal to allow us to increase the output depth by 1 to make sure the correct file is displayed\n\tfatalLogger.Output(2, fmt.Sprint(v...))\n\tos.Exit(1)\n}", "func Fatal(args ...interface{}) {\n\tDefaultLogger.Fatal(args...)\n}", "func Fatal(v ...interface{}) {\n\tif !running {\n\t\treturn\n\t}\n\n\tif message := decorateAppLogEntry(FATAL, v); message != \"\" {\n\t\tdoAppLogWrite(message)\n\t\tos.Exit(1)\n\t}\n}", "func (l *Logger) Fatal(msg string) {\n\tif FATAL&l.levels == 0 {\n\t\treturn\n\t}\n\te := Entry{\n\t\tLevel: FATAL,\n\t\tMessage: msg,\n\t}\n\n\te.enc = BorrowEncoder(l.w)\n\n\t// if we do not require a context then we\n\t// format with formatter and return.\n\tif l.contextName == \"\" {\n\t\tl.beginEntry(e.Level, msg, e)\n\t\tl.runHook(e)\n\t} else {\n\t\tl.openEntry(e.enc)\n\t}\n\n\tl.closeEntry(e)\n\tl.finalizeIfContext(e)\n\n\te.enc.Release()\n\n\tl.exit(1)\n}", "func (l *Logger) Fatal(v ...interface{}) {\n\tl.Output(2, fmt.Sprint(v...))\n\tos.Exit(1)\n}", "func (l Logger) Fatal(msg ...interface{}) {\n\tif l.Level <= log.FatalLevel {\n\t\tout := l.FatalColor.Sprint(append([]interface{}{\"FATAL: \"}, msg...)...)\n\t\tout = checkEnding(out)\n\t\tfmt.Fprint(l.FatalOut, out)\n\t\tos.Exit(1)\n\t}\n}", "func (l *Logger) Fatal(v ...interface{}) {\n\tl.Error(v...)\n\tos.Exit(1)\n}", "func Fatal(args ...interface{}) {\n\tfatalLog.Output(CallDepth, fmt.Sprint(args...))\n\t// Todo: check if we need to flush here.\n\tos.Exit(1)\n}", "func (l *LvLogger) Fatal(v ...interface{}) {\n\tl.inner.Output(2, fmt.Sprint(v...))\n\tos.Exit(1)\n}", "func Fatal(args ...interface{}) {\n\tlogger.Fatal(args...)\n}", "func Fatal(args ...interface{}) {\n\tlogger.Fatal(args...)\n}", "func (lg *Logger) Fatal(args ...interface{}) {\n if lg.level <= FATAL {\n lg.logger.SetPrefix(LEVELS[FATAL])\n lg.logger.Fatalln(args...)\n }\n}", "func (lw *LogWriter) Fatal(actor, event string, attrs map[string]string) {\n\tif lw.lvl > LevelFatal {\n\t\treturn\n\t}\n\tlw.output(lw.we, LevelFatal, actor, event, attrs)\n\tos.Exit(1)\n}", "func Fatal(v ...interface{}) {\n\tstd.Output(std.callDepth, fmt.Sprint(v...), FatalLevel)\n\tos.Exit(1)\n}", "func (logger *Logger) Fatal(msg string, extras ...map[string]string) error {\n\tif FatalLevel >= logger.LogLevel {\n\t\treturn logger.Log(msg, FatalLevel, extras...)\n\t}\n\treturn nil\n}", "func (l dclLogger) Fatal(args ...interface{}) {\n\tlog.Fatal(args...)\n}", "func (l dclLogger) Fatal(args ...interface{}) {\n\tlog.Fatal(args...)\n}", "func (rl *RevelLogger) Fatal(msg string, ctx ...interface{}) {\n\trl.Crit(msg, ctx...)\n\tos.Exit(1)\n}", "func (rl *RevelLogger) Fatal(msg string, ctx ...interface{}) {\n\trl.Crit(msg, ctx...)\n\tos.Exit(1)\n}", "func lFatal(v ...interface{}) {\n\t/* #nosec */\n\t_ = errLogger.Output(2, fmt.Sprintln(v...)) //Following log package, ignoring error value\n\tos.Exit(1)\n}", "func Fatal(args ...interface{}) {\n\tlogWithFilename().Fatal(args...)\n}", "func Fatal(msg string) {\r\n\tif (currentLogLevel > fatal_level.value) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfmt.Fprintf(os.Stderr, adjustLog(fatal_level.name, msg))\r\n}", "func Fatal(a ...interface{}) {\n\tcolor.Set(color.FgRed)\n\tdefer color.Unset()\n\tfatalLogger.Println(a...)\n\tos.Exit(1)\n}", "func (l *Logger) Fatal(v ...interface{}) {\n\tl.Log(fmt.Sprintln(v...), Lfatal, Trace|Exit)\n}", "func (sl *SysLogger) Fatal(info, msg string) {\n\tlog.Println(\"[FATAL]\", sl.tag, info, msg)\n}", "func (z *Logger) Fatal(args ...interface{}) {\n\tz.SugaredLogger.Fatal(args...)\n}", "func Fatal(v ...interface{}) {\n Std.Output(LevelFatal, CallDepth, sout(v...))\n os.Exit(1)\n}", "func Fatal(args ...interface{}) {\n\terrorLogger.Fatal(args...)\n}", "func Fatal(format string, v ...interface{}) {\n\tlog.Fatalf(format, v...)\n\tos.Exit(1)\n}", "func Fatal(text string) {\n\tprintLog(\"fatal\", text)\n}", "func Fatal(args ...interface{}) {\n\tLog(logrus.FatalLevel, args...)\n\tcallExitFunc(1)\n}", "func (l *logger) Fatal(args ...interface{}) {\n\tl.entry.Fatal(args...)\n}", "func (l *GlogLogger) Fatal(ctx context.Context, format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\t// #nosec G104\n\tglog.ErrorDepth(1, msg)\n\tos.Exit(1)\n}", "func (customLogger *CustomLogger) Fatal(message string) {\n\tcustomLogger.logger.Fatal(message)\n}", "func (l *Logger) Fatal(args ...interface{}) {\n\tl.lock()\n\tdefer l.unlock()\n\tl.logger.Fatal(args...)\n}", "func (l *Logger) Fatal(v ...interface{}) {\n\tl.logger.Fatalf(\"%s\", l.prefix+fmt.Sprintln(v...))\n}", "func Fatal(args ...interface{}) {\n\tlogging.print(severity.FatalLog, logging.logger, logging.filter, args...)\n}", "func (l *Logger) Fatal(a ...interface{}) {\r\n\tl.logInternal(ErrorLevel, 4, a...)\r\n\tif l.Options.Testing {\r\n\t\treturn\r\n\t}\r\n\tos.Exit(0)\r\n}", "func (dl *defaultLogger) Fatal(msg string) {\n\tdl.Logger.Fatal(msg)\n}", "func (l *logWrapper) Fatal(args ...interface{}) {\n\tl.Log(LogFatal, 3, args...)\n\tpanic(\"Fatal error occured\")\n}", "func Fatal(data []byte) {\n\tlog.Fatal(\"FATAL: \", string(data))\n}", "func Fatal(format string, v ...interface{}) {\n\tLeveledLogger(level.Fatal, format, v...)\n}", "func (v *MultiLogger) Fatal(args ...interface{}) {\n\tv.Self().Log(logrus.FatalLevel, args...)\n\tcallExitFunc(1)\n}", "func (log *logger) Fatal(message string) {\n\tlog.log(slf.LevelFatal, message)\n}", "func Fatal(msg string, fields ...zapcore.Field) {\n\tinitLogger()\n\n\tlogger.Fatal(msg, fields...)\n}", "func Fatal(msg string) {\n\tif lvl <= fat {\n\t\tl.Fatal(\"[FATAL]: \" + msg)\n\t}\n}", "func Fatal(msg ...interface{}) {\n\tsyslog.Fatalln(\"F:\", msg)\n}", "func (v Verbosity) Fatal(args ...interface{}) {\n\tif v {\n\t\tfatalLog.Output(CallDepth+1, fmt.Sprint(args...))\n\t}\n}", "func Fatal(msg string, args ...interface{}) {\n\tDefaultLog.Fatal(msg, args...)\n}", "func (l *Log) Fatal(args ...interface{}) {\n\tl.logger.Fatal(args...)\n}", "func Fatal(format string, v ...interface{}) {\n\tif LogLevel() <= 4 {\n\t\tlog.Printf(\"FATAL: \"+format, v...)\n\t}\n}", "func (l *Logger) Fatal(v ...interface{}) {\n\tl.log.Output(l.calldepth, header(\"FTL\", fmt.Sprint(v...)))\n\tos.Exit(1)\n}", "func (l *GrpcLog) Fatal(args ...interface{}) {\n\tl.SugaredLogger.Fatal(args...)\n}", "func Fatal(v ...interface{}) {\n\toutput(LevelFatal, v)\n\tos.Exit(1)\n}", "func Fatal(v ...interface{}) { std.lprint(FATAL, v...) }", "func Fatal(ctx context.Context, msg string, args ...Args) {\n\tL(ctx).Log(NewEntry(LevelFatal, msg, args...))\n}", "func (logger *Logger) Fatal(a ...any) {\n\tlogger.echo(nil, level.Fatal, formatPrint, a...)\n\texit(logger.fatalStatusCode)\n}", "func Fatal(args ...interface{}) {\n\tlog.Fatal(args...)\n}", "func Fatal(args ...interface{}) {\n\tlog.Fatal(args...)\n}", "func Fatal(args ...interface{}) {\n\tglobal.Fatal(args...)\n}", "func Fatal(message interface{}) {\n\tglobalLogger.Fatal(message)\n}", "func Fatal(v ...interface{}) {\n\tlogger.Fatal(v...)\n}", "func Fatal(v ...interface{}) {\n\tlogger.Fatal(v...)\n}", "func (l Logger) Fatal(args ...interface{}) {\n\tlog.SetOutput(os.Stderr)\n\tlog.Fatal(args...)\n}", "func Fatal(ctx context.Context, logCat LogCat, v ...interface{}) {\n\tdefaultLogger.Fatal(ctx, logCat, v...)\n}", "func Fatal(msg ...interface{}) {\n\trunAdapters(ErrorLog, LineOut, msg...)\n\tos.Exit(-1)\n}", "func Fatal(msg string, fields ...zapcore.Field) {\n\tdefaultLogger.Fatal(msg, fields...)\n}", "func Fatal(format string, args ...interface{}) {\n\tdo(FATAL, format, args...)\n\tos.Exit(1)\n}", "func Fatal(ctx context.Context, args ...interface{}) {\n\tlog.WithFields(utils.GetCommonMetaFromCtx(ctx)).Fatal(args...)\n}", "func Fatal(msg ...interface{}) {\n\tCurrent.Fatal(msg...)\n}", "func Fatal(log string, v ...interface{}) {\n\tsyslog.Fatalf(\"FATAL \"+log, v...)\n}", "func (l *loggerWrapper) Fatal(args ...interface{}) {\n\tl.logger.Fatal(sprint(args...))\n}", "func Fatal(v ...interface{}) {\n\tLogger.Fatal(v...)\n}", "func (z *ZapLogWrapper) Fatal(args ...interface{}) {\n\tz.l.Fatal(args...)\n}", "func Fatal(v ...interface{}) {\n\terrLogger.Fatal(v...)\n}", "func Fatal(v ...interface{}) {\n\toutput(LevelFatal, v...)\n}", "func (l Logger) Fatal(msg ...interface{}) {\n\tif l.Level <= log.FatalLevel {\n\t\tl.logger.Fatal(append([]interface{}{\"[FATAL] \"}, msg...)...)\n\t}\n}", "func Fatal(l interface{}) {\n\tlog.WithFields(log.Fields{\n\t\t\"SERVICE\": \"WINGO\",\n\t}).Fatalln(l)\n}", "func (logger *Logger) Ffatal(w io.Writer, a ...any) {\n\tlogger.echo(w, level.Fatal, formatPrint, a...)\n\texit(logger.fatalStatusCode)\n}", "func (l Logger) Fatal(err error, args ...interface{}) {\n\tl.internalLogger.Fatalf(\"Fatal Error: %s | Info: %s\", err.Error(), args)\n}", "func Fatal(ctx context.Context, msg string, fields ...zap.Field) {\n\tFromContext(ctx).WithOptions(zap.AddCallerSkip(1)).Fatal(msg, fields...)\n}", "func (r *reporter) Fatal(args ...interface{}) {\n\tr.Fail()\n\tpanic(fmt.Sprint(args...))\n}", "func (lh *logHandler) Fatal(data ...interface{}) {\n\tif lh.fatal == nil {\n\t\treturn\n\t}\n\tlh.fatal.Fatalln(data...)\n}", "func Fatal(v ...interface{}) {\n\tcheckInit()\n\ts := fmt.Sprint(v...)\n\tstd.Report(s)\n\tlog.Fatal(s)\n}" ]
[ "0.80874497", "0.7992285", "0.7977663", "0.7968011", "0.79488784", "0.793839", "0.7930906", "0.7919421", "0.79039764", "0.78980607", "0.78654456", "0.786376", "0.784841", "0.782763", "0.7821862", "0.78063834", "0.77954954", "0.7781454", "0.7775414", "0.7768921", "0.7747429", "0.7743809", "0.7739307", "0.77330446", "0.77311456", "0.7715302", "0.7715302", "0.77108073", "0.77087057", "0.7704048", "0.76998454", "0.76898074", "0.76898074", "0.76827383", "0.76827383", "0.7675722", "0.7675404", "0.76600564", "0.76571286", "0.76555735", "0.76549137", "0.76394945", "0.7634765", "0.76343286", "0.7623548", "0.76172554", "0.7612629", "0.7610598", "0.7609442", "0.7607466", "0.7606497", "0.76053494", "0.7601294", "0.7600427", "0.75846505", "0.75840527", "0.7581268", "0.7573515", "0.75717777", "0.75699943", "0.7544119", "0.7543882", "0.7534252", "0.75272036", "0.7526639", "0.7526072", "0.7522747", "0.75223255", "0.7520363", "0.7517786", "0.75146276", "0.7506771", "0.7503314", "0.7502567", "0.7502567", "0.7498934", "0.7494699", "0.74941885", "0.74941885", "0.74853295", "0.7485318", "0.7485312", "0.74772227", "0.7473198", "0.7466382", "0.74603313", "0.74518967", "0.74490446", "0.7431906", "0.7426276", "0.7419162", "0.7414826", "0.74141604", "0.74082774", "0.7393276", "0.737163", "0.73706377", "0.73695016", "0.7367779", "0.735791" ]
0.7750984
20
Fatalf is just like Fatal, but with formatting
func Fatalf(format string, a ...interface{}) { log(defaultLogger, FATAL, fmt.Sprintf(format, a...)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Fatalf(format string, v ...interface{}) { std.lprintf(FATAL, format, v...) }", "func Fatalf(format string, v ...interface{}) {\n Std.Output(LevelFatal, CallDepth, fmt.Sprintf(format, v...))\n os.Exit(1)\n}", "func Fatalf(format string, a ...interface{}) {\n\tFatalln(fmt.Sprintf(format, a...))\n}", "func (c *T) Fatalf(format string, args ...interface{})", "func (s *scanner) Fatalf(format string, args ...interface{}) {\n\ts.T.Fatalf(\"%s: %s\", s.pos(), fmt.Sprintf(format, args...))\n}", "func Fatalf(format string, args ...interface{}) {\n LoggerOf(default_id).Fatalf(format, args...)\n}", "func Fatalf(format string, v ...interface{}) {\n\tstd.Output(std.callDepth, fmt.Sprintf(format, v...), FatalLevel)\n\tos.Exit(1)\n}", "func (c *B) Fatalf(format string, args ...interface{})", "func Fatalf(format string, args ...interface{}) {\n\tFatalfFile(token.Position{}, format, args...)\n}", "func Fatal(f interface{}, v ...interface{}) {\n\tvar format string\n\tswitch f.(type) {\n\tcase string:\n\t\tformat = f.(string)\n\t\tlog.Fatalf(format, v...)\n\tdefault:\n\t\tformat = fmt.Sprint(f)\n\t\tif len(v) == 0 {\n\t\t\tlog.Fatal(format)\n\t\t\treturn\n\t\t}\n\t\tformat += strings.Repeat(\" %v\", len(v))\n\t\tlog.Fatalf(format, v...)\n\t}\n}", "func Fatalf(template string, args ...interface{}) {\n\tFatal(fmt.Sprintf(template, args...))\n}", "func Fatalf(format string, a ...interface{}) {\n\tfmt.Fprintf(os.Stderr, format, a...)\n\tos.Exit(1)\n}", "func Fatalf(format string, a ...interface{}) {\n\tPrintf(format, a...)\n\tos.Exit(1)\n}", "func Fatalf(format string, args ...interface{}) {\n\tglobal.Fatalf(format, args...)\n}", "func Fatalf(format string, a ...interface{}) {\n\tDefault.Errorf(format, a...)\n\tos.Exit(1)\n}", "func (l *Logger) Fatalf(format string, v ...interface{}) { l.lprintf(FATAL, format, v...) }", "func Fatalf(format string, v ...interface{}) {\n\tcheckInit()\n\ts := fmt.Sprintf(format, v...)\n\tstd.Report(s)\n\tlog.Fatal(s)\n}", "func Fatalf(format string, v ...interface{}) {\n\tfmt.Fprintf(os.Stderr, format, v...)\n\tos.Exit(1)\n}", "func Fatalf(format string, args ...interface{}) {\n\ts := fmt.Sprintf(format, args...)\n\tfatalLogger.Output(outputCallDepth, s) // nolint\n\tos.Exit(1)\n}", "func Fatalf(format string, v ...interface{}) {\n\tPrintf(format, v...)\n\tos.Exit(1)\n}", "func Fatalf(format string, args ...interface{}) {\n\n\tvar buf bytes.Buffer\n\tfmt.Fprintf(&buf, format, args...)\n\tif buf.Bytes()[buf.Len()-1] != '\\n' {\n\t\tbuf.WriteByte('\\n')\n\t}\n\tfatalLog.Output(CallDepth, buf.String())\n\tos.Exit(1)\n}", "func Fatalf(data string, v ...interface{}) {\n\t// Send to Output instead of Fatal to allow us to increase the output depth by 1 to make sure the correct file is displayed\n\tfatalLogger.Output(2, fmt.Sprintf(data, v...))\n\tos.Exit(1)\n}", "func Fatalf(format string, args ...interface{}) {\n\tGlobalLogger().Fatalf(format, args...)\n}", "func Fatalf(template string, args ...interface{}) {\n\tCurrent.Fatalf(template, args...)\n}", "func Fatal(v ...interface{}) {\n\tFatalf(\"%s\", fmt.Sprintln(v...))\n}", "func (r *reporter) Fatalf(format string, args ...interface{}) {\n\tr.Fatal(fmt.Sprintf(format, args...))\n}", "func Fatal(format string, v ...interface{}) {\n\tlog.Fatalf(format + \"\\n\", v ...)\n}", "func Fatalf(format string, args ...interface{}) {\n\tdefaultLogger.Fatalf(format, args...)\n}", "func StdFatalf(ctx context.Context, metadata interface{}, err error, format string, args ...interface{}) {\n\tfatalLogger.StdFatalf(GetCtxRequestID(ctx), GetCtxID(ctx), err, metadata, format, args...)\n}", "func (l redactLogger) Fatalf(format string, args ...interface{}) {\n\tl.logger.Fatalf(\"%s\", redact.Sprintf(format, args...).Redact())\n}", "func Fatalf(format string, args ...interface{}) {\n\tlog.Fatalf(format, args...)\n}", "func (logger *Logger) Fatalf(format string, args ...interface{}) {\n\tlogger.std.Logf(\"Fatal\"+format, args...)\n}", "func logFatalf(format string, args ...interface{}) {\n\tif _, file, line, ok := runtime.Caller(1); ok {\n\t\tfmt.Printf(\"%s.%d: \", file, line)\n\t}\n\tfmt.Printf(format, args...)\n\tif format != \"\" && format[len(format)-1] != '\\n' {\n\t\tfmt.Println()\n\t}\n\tos.Exit(1)\n}", "func Fatalf(format string, args ...interface{}) {\n\tlogg.Fatalf(format, args...)\n}", "func Fatalf(format string, v ...interface{}) {\n\toutputf(LevelFatal, format, v...)\n}", "func Fatalf(format string, v ...interface{}) {\n\tlog.Fatalf(format, v...)\n}", "func Fatalf(format string, v ...interface{}) {\n\tlog.Fatalf(format, v...)\n}", "func Fatalf(template string, args ...interface{}) {\n\tlog.Fatalf(template, args...)\n}", "func Fatalf(format string, args ...interface{}) {\n\tLog.Fatalf(format, args)\n}", "func Fatalf(format string, args ...interface{}) {\n\tlogging.Fatalf(format, args...)\n}", "func (g GinkgoTestReporter) Fatalf(format string, args ...interface{}) {\n\tFail(fmt.Sprintf(format, args))\n}", "func Fatalf(format string, args ...interface{}) {\n\tstd.Context(\"fatal\").Errorf(format, args...)\n\tos.Exit(1)\n}", "func Fatalf(format string, args ...interface{}) {\n\tsentry.CaptureMessage(fmt.Sprintf(format, args...))\n\tlog.Fatalf(format, args...)\n}", "func Fatalf(format string, args ...interface{}) {\n\tsentry.CaptureMessage(fmt.Sprintf(format, args...))\n\tlog.Fatalf(format, args...)\n}", "func Fatalf(format string, args ...interface{}) {\n\tlogger.Fatalf(format, args...)\n}", "func Fatalf(format string, args ...interface{}) {\n\tw := io.MultiWriter(os.Stdout, os.Stderr)\n\tif runtime.GOOS == \"windows\" {\n\t\t// The SameFile check below doesn't work on Windows.\n\t\t// stdout is unlikely to get redirected though, so just print there.\n\t\tw = os.Stdout\n\t} else {\n\t\toutf, _ := os.Stdout.Stat()\n\t\terrf, _ := os.Stderr.Stat()\n\t\tif outf != nil && errf != nil && os.SameFile(outf, errf) {\n\t\t\tw = os.Stderr\n\t\t}\n\t}\n\tfmt.Fprintf(w, \"Fatal: \"+format+\"\\n\", args...)\n\tos.Exit(1)\n}", "func Fatalf(template string, args ...interface{}) {\n\tDefaultLogger.Fatalf(template, args...)\n}", "func Fatalf(format string, v ...interface{}) {\n\terrLogger.Fatalf(format, v...)\n}", "func (c *Cmd) Fatalf(format string, v ...interface{}) {\n\tfmt.Fprintf(c.Stderr, format, v...)\n\tfmt.Fprintln(c.Stderr)\n\tc.Exit(1)\n}", "func Fatal(t *testing.T, msg string, args ...interface{}) {\n\tm := fmt.Sprintf(msg, args...)\n\tt.Fatal(fmt.Sprintf(\"\\t %-80s\", m), Failed)\n}", "func Fatalf(format string, v ...interface{}) {\n\tstdLogger.Log(FatalLevel, fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "func Fatalf(format string, args ...interface{}) {\n\tlog.Fatal(append([]interface{}{format}, args...))\n}", "func Fatalf(format string, a ...interface{}) {\n\tlogFatalf(&loggers.Loggers[0], format, a...)\n}", "func Fatalf(format string, v ...interface{}) {\n\tlogger.Fatalf(format, v...)\n}", "func Fatal(format string, args ...interface{}) {\n\tlog.Fatalf(format, args...)\n}", "func Fatalf(format string, args ...interface{}) {\n\tif defaultLgr == nil {\n\t\treturn\n\t}\n\tdefaultLgr.Fatalf(format, args...)\n}", "func Fatalf(format string, v ...interface{}) {\n\toutputf(LevelFatal, format, v)\n\tos.Exit(1)\n}", "func (l *logger) Fatalf(format string, args ...interface{}) {\n\tl.entry.Fatalf(format, args...)\n}", "func FatalF(format string, v ...interface{}) { // nolint\n\te := makeErrors()\n\thasErr := e.hasErrPrintf(format, v...)\n\tif !hasErr {\n\t\treturn\n\t}\n\te.ex.Exit(255)\n}", "func Fatalf(format string, args ...interface{}) {\n\tlogWithFilename().Fatalf(format, args...)\n}", "func Fatalf(format string, a ...interface{}) {\n\tstr := fmt.Sprintf(format, a...)\n\tDefaultWithFields(LogDetails{}).Fatal(str)\n}", "func (l *Logger) Fatalf(format string, v ...interface{}) {\n\tl.Output(2, fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "func Fatalf(message string, args ...interface{}) {\n\tif len(args) > 0 {\n\t\t_, _ = fmt.Fprintf(os.Stderr, message+\"\\n\", args...)\n\t} else {\n\t\t_, _ = fmt.Fprintln(os.Stderr, message)\n\t}\n\tos.Exit(1)\n}", "func (hd *Hal) Fatalf(format string, args ...interface{}) {\n\tlog.Fatalf(format, args...)\n}", "func Fatalf(template string, args ...interface{}) {\n\terrorLogger.Fatalf(template, args...)\n}", "func (l *Logger) Fatalf(format string, values ...interface{}) {\n\tvalues = append([]interface{}{addFileLinePrefix(\"\")}, values...)\n\tl.errorLogger.Fatalf(\"%s \"+format, values...)\n}", "func Fatal(args ...interface{}) {\n\tif defaultLgr == nil {\n\t\treturn\n\t}\n\tdefaultLgr.Fatalf(strings.TrimSpace(strings.Repeat(\"%+v \", len(args))), args...)\n}", "func Fatalf(format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tlogf(\"FAIL\", msg)\n\tginkgo.Fail(nowStamp()+\": \"+msg, 1)\n}", "func Fatalf(format string, v ...interface{}) {\n\tWithLevelf(LevelFatal, format, v...)\n\tos.Exit(1)\n}", "func (s *scanner) Fatal(args ...interface{}) {\n\ts.T.Fatalf(\"%s: %s\", s.pos(), fmt.Sprint(args...))\n}", "func Fatalf(format string, v ...interface{}) {\n\tairshipLog.Fatalf(format, v...)\n}", "func (ts *TestStruct) Fatalf(msg string, args ...interface{}) {\n\tts.Fatal(fmt.Sprintf(msg, args...))\n}", "func (s *StanLogger) Fatalf(format string, v ...interface{}) {\n\ts.executeLogCall(func(log Logger, format string, v ...interface{}) {\n\t\tlog.Fatalf(format, v...)\n\t}, format, v...)\n}", "func Fatal(v ...interface{}) { std.lprint(FATAL, v...) }", "func (r *reporter) Fatalf(format string, args ...interface{}) {\n\tr.Errorf(format, args...)\n\truntime.Goexit()\n}", "func (t *ThrottleTerminal) Fatalf(format string, a ...interface{}) {\n\tif t.unterminatedLine {\n\t\tfmt.Fprintf(os.Stderr, \"\\n\")\n\t\tt.unterminatedLine = false\n\t}\n\tlog.Fatalf(format, a...)\n}", "func Fatalf(format string, args ...interface{}) {\n\tlogging.printf(severity.FatalLog, logging.logger, logging.filter, format, args...)\n}", "func fatal(format string, a ...interface{}) {\n\tfmt.Fprintf(os.Stderr, \"\\033[31;1m\\nerror: %v\\033[0m\\n\\n\", fmt.Sprintf(format, a...))\n\tos.Exit(1)\n}", "func Fatalf(exitCode int, format string, params ...interface{}) {\n\tDefaultLogger.Fatalf(exitCode, format, params)\n}", "func Fatalf(msg string, args ...interface{}) {\n\tfmt.Fprintf(os.Stderr, \"Error: %s\\n\", fmt.Sprintf(msg, args...))\n\tos.Exit(-1)\n}", "func Fatalf(s string) {\n\tcolor.New(color.FgRed).Fprintln(os.Stderr, s)\n\tos.Exit(1)\n}", "func (l *Logger) Fatalf(format string, a ...interface{}) {\r\n\tl.Fatal(fmt.Sprintf(format, a...))\r\n}", "func (l *Logger) Fatalf(format string, v ...interface{}) {\n\tl.Output(2, fmt.Sprint(fatalPrefix, fmt.Sprintf(format, v...)))\n\tos.Exit(1)\n}", "func Fatalf(s string, v ...interface{}) {\n\tlogger.Fatalf(s, v...)\n}", "func (c *Context) Fatalf(format string, args ...interface{}) {\n\tc.T.Fatalf(format, args...)\n}", "func (l *LvLogger) Fatalf(format string, v ...interface{}) {\n\tl.inner.Output(2, fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "func (l *Logger) Fatalf(format string, args ...interface{}) {\r\n\tl.logger.Fatalf(format, args...)\r\n}", "func (l *Logger) Fatalf(format string, v ...interface{}) {\n\tl.Errorf(format, v...)\n\tos.Exit(1)\n}", "func Fatalf(format string, values ...interface{}) {\n\tif logger != nil {\n\t\tlogWithLogger(\"FATAL\", format, values...)\n\t\treturn\n\t}\n\tlog.Fatalf(format, values...)\n}", "func Fatalf(ctx context.Context, logCat LogCat, format string, v ...interface{}) {\n\tdefaultLogger.Fatalf(ctx, logCat, format, v...)\n}", "func Fatalf(ctx context.Context, format string, args ...interface{}) {\n\ttraceInfo := utils.GetTraceInfoFromCtx(ctx)\n\tlog.WithFields(map[string]interface{}{\n\t\t\"trace_id\": traceInfo.TraceID,\n\t})\n\tlog.WithFields(utils.GetCommonMetaFromCtx(ctx)).Fatalf(format, args...)\n}", "func Fatalf(message string, v ...interface{}) {\n\tglobalLogger.Fatalf(message, v...)\n}", "func (l *Logger) Fatalf(format string, v ...interface{}) {\n\tl.output(sFatal, 0, fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "func Fatalf(format string, args ...interface{}) {\n\tlogger.Crit(fmt.Sprintf(format, args...))\n}", "func (l *Logger) Fatalf(format string, v ...interface{}) {\n\tl.log.Output(l.calldepth, header(\"FTL\", fmt.Sprintf(format, v...)))\n\tos.Exit(1)\n}", "func (l *Logger) Fatalf(format string, v ...interface{}) {\n\tl.Log(FatalLevel, fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "func (s StdLogger) Fatalf(format string, v ...interface{}) {\n\ts.l.Fatalf(prepend(format), v...)\n}", "func (l loggerType) Fatalf(format string, args ...interface{}) {\n\tloggerMutex.Lock()\n\tdefer loggerMutex.Unlock()\n\n\tline := l.prefix(\"FATAL\") + fmt.Sprintf(format, args...)\n\tif !strings.HasSuffix(line, \"\\n\") {\n\t\tline += \"\\n\"\n\t}\n\tl.out.Write([]byte(line))\n\tlog.Fatalln(args...)\n}", "func (l *GrpcLog) Fatalf(format string, args ...interface{}) {\n\tl.SugaredLogger.Fatalf(format, args...)\n}", "func (l dclLogger) Fatalf(format string, args ...interface{}) {\n\tlog.Fatalf(fmt.Sprintf(\"[DEBUG][DCL FATAL] %s\", format), args...)\n}" ]
[ "0.8241426", "0.82028383", "0.8178716", "0.80724066", "0.8011806", "0.7954912", "0.7907353", "0.7901075", "0.78703904", "0.7866126", "0.7848349", "0.78288454", "0.7824473", "0.7808295", "0.7797607", "0.7792774", "0.77689403", "0.7758911", "0.77472705", "0.774189", "0.7718443", "0.7717246", "0.77013654", "0.7701365", "0.77007335", "0.7694119", "0.7678999", "0.766014", "0.7658913", "0.7652909", "0.76426584", "0.7639366", "0.7637637", "0.763478", "0.76231027", "0.7620241", "0.7620241", "0.7613764", "0.7603544", "0.7603377", "0.7601831", "0.75958645", "0.7591227", "0.7591227", "0.7583187", "0.75753754", "0.7570227", "0.75693357", "0.75669634", "0.756111", "0.7557769", "0.7547392", "0.75467914", "0.75354975", "0.7525296", "0.75213444", "0.7508161", "0.7504494", "0.7495664", "0.7492601", "0.7491609", "0.7489469", "0.74875253", "0.74837977", "0.7483711", "0.74825096", "0.74689543", "0.7461429", "0.7461012", "0.7459045", "0.7454897", "0.74514776", "0.74484545", "0.7440967", "0.74376625", "0.7435904", "0.74254", "0.74235874", "0.74186206", "0.74148065", "0.73762214", "0.7374404", "0.7363453", "0.73566294", "0.7355005", "0.7354774", "0.73468834", "0.73414433", "0.7339625", "0.7335296", "0.7329408", "0.73260283", "0.73106956", "0.73084515", "0.73070157", "0.7306159", "0.73003054", "0.7294806", "0.7292897", "0.72728014" ]
0.7412648
80
String returns the string representation
func (s DescribeCasesInput) String() string { return awsutil.Prettify(s) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s CreateAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s Library) String() string {\n\tres := make([]string, 5)\n\tres[0] = \"ID: \" + reform.Inspect(s.ID, true)\n\tres[1] = \"UserID: \" + reform.Inspect(s.UserID, true)\n\tres[2] = \"VolumeID: \" + reform.Inspect(s.VolumeID, true)\n\tres[3] = \"CreatedAt: \" + reform.Inspect(s.CreatedAt, true)\n\tres[4] = \"UpdatedAt: \" + reform.Inspect(s.UpdatedAt, true)\n\treturn strings.Join(res, \", \")\n}", "func (s CreateCanaryOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r Info) String() string {\n\tJSON, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn string(JSON)\n}", "func (s ReEncryptOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateFHIRDatastoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String() string {\n\toutput := output{\n\t\tRerun: Rerun,\n\t\tVariables: Variables,\n\t\tItems: Items,\n\t}\n\tvar err error\n\tvar b []byte\n\tif Indent == \"\" {\n\t\tb, err = json.Marshal(output)\n\t} else {\n\t\tb, err = json.MarshalIndent(output, \"\", Indent)\n\t}\n\tif err != nil {\n\t\tmessageErr := Errorf(\"Error in parser. Please report this output to https://github.com/drgrib/alfred/issues: %v\", err)\n\t\tpanic(messageErr)\n\t}\n\ts := string(b)\n\treturn s\n}", "func (s CreateQuickConnectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r *Registry) String() string {\n\tout := make([]string, 0, len(r.nameToObject))\n\tfor name, object := range r.nameToObject {\n\t\tout = append(out, fmt.Sprintf(\"* %s:\\n%s\", name, object.serialization))\n\t}\n\treturn strings.Join(out, \"\\n\\n\")\n}", "func (s CreateSceneOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateSafetyRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateLanguageModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o QtreeCreateResponse) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "func (r SendAll) String() string {\n\tJSON, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn string(JSON)\n}", "func (r ReceiveAll) String() string {\n\tJSON, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn string(JSON)\n}", "func (enc *simpleEncoding) String() string {\n\treturn \"simpleEncoding(\" + enc.baseName + \")\"\n}", "func (s CreateDatabaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (z Zamowienium) String() string {\n\tjz, _ := json.Marshal(z)\n\treturn string(jz)\n}", "func (s CreateHITTypeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProgramOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProjectVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateEntityOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Addshifttraderequest) String() string {\n \n \n \n \n o.AcceptableIntervals = []string{\"\"} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (r Rooms) String() string {\n\tjr, _ := json.Marshal(r)\n\treturn string(jr)\n}", "func (s CreateUseCaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (i Info) String() string {\n\ts, _ := i.toJSON()\n\treturn s\n}", "func (o *Botversionsummary) String() string {\n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (e ExternalCfps) String() string {\n\tje, _ := json.Marshal(e)\n\treturn string(je)\n}", "func (s CreateTrustStoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String() string {\n\treturn fmt.Sprintf(\n\t\t\"AppVersion = %s\\n\"+\n\t\t\t\"VCSRef = %s\\n\"+\n\t\t\t\"BuildVersion = %s\\n\"+\n\t\t\t\"BuildDate = %s\",\n\t\tAppVersion, VCSRef, BuildVersion, Date,\n\t)\n}", "func (s CreateDataLakeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateSolutionVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s GetSceneOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (i NotMachine) String() string { return toString(i) }", "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s StartPipelineReprocessingOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateDatastoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateSequenceStoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Adjustablelivespeakerdetection) String() string {\n \n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s CreateRateBasedRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r Resiliency) String() string {\n\tb, _ := json.Marshal(r)\n\treturn string(b)\n}", "func (s RestoreFromRecoveryPointOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o QtreeCreateResponseResult) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "func (s CreateWaveOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateRoomOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateBotLocaleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DeleteAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (z Zamowienia) String() string {\n\tjz, _ := json.Marshal(z)\n\treturn string(jz)\n}", "func (i *Info) String() string {\n\tb, _ := json.Marshal(i)\n\treturn string(b)\n}", "func (s ProcessingFeatureStoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ExportProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r RoomOccupancies) String() string {\n\tjr, _ := json.Marshal(r)\n\treturn string(jr)\n}", "func (r *InterRecord) String() string {\n\tbuf := r.Bytes()\n\tdefer ffjson.Pool(buf)\n\n\treturn string(buf)\n}", "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateLayerOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Coretype) String() string {\n \n \n \n \n \n o.ValidationFields = []string{\"\"} \n \n o.ItemValidationFields = []string{\"\"} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s CreateModelCardOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s NetworkPathComponentDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Limitchangerequestdetails) String() string {\n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (t Terms) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "func (g GetObjectOutput) String() string {\n\treturn helper.Prettify(g)\n}", "func (s StartContactEvaluationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Interactionstatsalert) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (o *Digitalcondition) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "func (r RoomOccupancy) String() string {\n\tjr, _ := json.Marshal(r)\n\treturn string(jr)\n}", "func (d *Diagram) String() string { return toString(d) }", "func (o *Outboundroute) String() string {\n \n \n \n \n o.ClassificationTypes = []string{\"\"} \n \n \n o.ExternalTrunkBases = []Domainentityref{{}} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s CreateCodeRepositoryOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateActivationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateBotOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ResolutionTechniques) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateTrialComponentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c CourseCode) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "func (p *Parms) String() string {\n\tout, _ := json.MarshalIndent(p, \"\", \"\\t\")\n\treturn string(out)\n}", "func (p polynomial) String() (str string) {\n\tfor _, m := range p.monomials {\n\t\tstr = str + \" \" + m.String() + \" +\"\n\t}\n\tstr = strings.TrimRight(str, \"+\")\n\treturn \"f(x) = \" + strings.TrimSpace(str)\n}", "func (s CreateThingOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreatePatchBaselineOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r *RUT) String() string {\n\treturn r.Format(DefaultFormatter)\n}", "func (o *Crossplatformpolicycreate) String() string {\n \n \n \n \n \n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s BotVersionLocaleDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s LifeCycleLastTestInitiated) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DeleteMultiplexProgramOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s GetObjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s LifeCycleLastTestReverted) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateDocumentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateComponentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateIntegrationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Commonruleconditions) String() string {\n o.Clauses = []Commonruleconditions{{}} \n o.Predicates = []Commonrulepredicate{{}} \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (t Test1s) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "func (o *Directrouting) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "func (s CreateContactFlowOutput) String() string {\n\treturn awsutil.Prettify(s)\n}" ]
[ "0.72146875", "0.72146875", "0.7200535", "0.7199846", "0.7177446", "0.71668005", "0.7117925", "0.70871246", "0.70869714", "0.70795476", "0.7078246", "0.7067504", "0.70308644", "0.7027574", "0.7026196", "0.7024901", "0.70204926", "0.70168835", "0.7009952", "0.70094603", "0.7001816", "0.6996932", "0.6996419", "0.69918066", "0.6990033", "0.69900256", "0.698643", "0.6984376", "0.69747293", "0.6973591", "0.69637847", "0.69620943", "0.69607615", "0.69509125", "0.69469655", "0.6945404", "0.6945404", "0.69448304", "0.6940321", "0.69365126", "0.69326305", "0.69280046", "0.69259024", "0.6924626", "0.6921882", "0.69217396", "0.69179326", "0.6917183", "0.691136", "0.6910089", "0.6909178", "0.6908251", "0.6905034", "0.68989646", "0.689567", "0.68939006", "0.68939006", "0.68939006", "0.68918085", "0.68909156", "0.68905854", "0.68886465", "0.68883234", "0.68833447", "0.688259", "0.68797934", "0.68760914", "0.68760914", "0.6875131", "0.68750113", "0.68729824", "0.68727946", "0.68722576", "0.68713474", "0.6868439", "0.68683255", "0.68683255", "0.68683255", "0.68683255", "0.6868105", "0.68665683", "0.6861608", "0.6861178", "0.6859263", "0.68570536", "0.6853859", "0.6851655", "0.68515944", "0.68451566", "0.6844175", "0.68436414", "0.6843481", "0.684224", "0.68419397", "0.68406415", "0.68389916", "0.68358105", "0.6835294", "0.6832518", "0.683231", "0.68317014" ]
0.0
-1
Validate inspects the fields of the type to determine if they are valid.
func (s *DescribeCasesInput) Validate() error { invalidParams := aws.ErrInvalidParams{Context: "DescribeCasesInput"} if s.MaxResults != nil && *s.MaxResults < 10 { invalidParams.Add(aws.NewErrParamMinValue("MaxResults", 10)) } if invalidParams.Len() > 0 { return invalidParams } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *InfoField) Validate() error {\n\tif err := f.BWCls.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := f.RLC.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := f.Idx.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := f.PathType.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (f FieldSpec) Validate() error {\n\tif f.Name == \"\" {\n\t\treturn errors.New(\"Field name required\")\n\t}\n\n\tif f.Type == \"\" {\n\t\treturn errors.New(\"Field type required\")\n\t}\n\n\treturn nil\n}", "func (p *Pass) FieldsValid() bool {\n\tfmt.Printf(\"validating: \")\n\tvalid := true\n\tfor k, v := range *p {\n\t\tfmt.Printf(\"%v...\", k)\n\t\tv := isFieldValid(k, v)\n\t\tvalid = valid && v\n\t\tif v {\n\t\t\tfmt.Printf(\"VALID \")\n\t\t} else {\n\t\t\tfmt.Printf(\"INVALID \")\n\t\t}\n\t}\n\n\tfmt.Println(\"\")\n\treturn valid\n}", "func (m Type) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (m *TestFieldsEx2) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateFieldType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateProjectID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func Validate(instance interface{}) string {\n\tval := unwrap(reflect.ValueOf(instance))\n\ttyp := val.Type()\n\n\tif typ.Kind() != reflect.Struct {\n\t\tcore.DefaultLogger.Panic(\"The provided instance is not a struct\")\n\t}\n\n\tvar result []string\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tfield := typ.Field(i)\n\t\tfieldTag := field.Tag\n\t\tif len(fieldTag) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldVal := val.Field(i)\n\t\tfieldKind := fieldVal.Kind()\n\t\tif !fieldVal.CanInterface() || fieldKind == reflect.Invalid {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar toEval []evalContext\n\t\tvar requiredCtx *evalContext\n\n\t\tfor _, v := range validators {\n\t\t\tif param, found := fieldTag.Lookup(v.key); found {\n\t\t\t\tctx := evalContext{validator: v, param: param}\n\n\t\t\t\tif v.key == required.key {\n\t\t\t\t\trequiredCtx = &ctx\n\t\t\t\t} else {\n\t\t\t\t\ttoEval = append(toEval, ctx)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif len(toEval) == 0 && requiredCtx == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif requiredCtx == nil {\n\t\t\trequiredCtx = &evalContext{validator: required, param: \"true\"}\n\t\t}\n\n\t\tvar errors []string\n\t\teval := func(ctx evalContext) bool {\n\t\t\tif err := ctx.validator.fn(fieldVal, ctx.param); len(err) > 0 {\n\t\t\t\terrors = append(errors, err)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\tif eval(*requiredCtx) {\n\t\t\tfor _, ctx := range toEval {\n\t\t\t\teval(ctx)\n\t\t\t}\n\t\t}\n\n\t\tif len(errors) > 0 {\n\t\t\tresult = append(result, fmt.Sprintf(\"%s: %s\", field.Name, strings.Join(errors, \", \")))\n\t\t}\n\t}\n\n\treturn strings.Join(result, \"; \")\n}", "func (info *structInfo) fieldValid(i int, t reflect.Type) bool {\n\treturn info.field(i).isValid(i, t)\n}", "func (v *ClassValue) Valid() bool {\n\tfor _, f := range v.Fields {\n\t\tif !f.Valid() {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (self *StructFieldDef) Validate() error {\n\tif self.Name == \"\" {\n\t\treturn fmt.Errorf(\"StructFieldDef.name is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"Identifier\", self.Name)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"StructFieldDef.name does not contain a valid Identifier (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Type == \"\" {\n\t\treturn fmt.Errorf(\"StructFieldDef.type is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Type)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"StructFieldDef.type does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Comment != \"\" {\n\t\tval := Validate(RdlSchema(), \"String\", self.Comment)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"StructFieldDef.comment does not contain a valid String (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Items != \"\" {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Items)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"StructFieldDef.items does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Keys != \"\" {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Keys)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"StructFieldDef.keys does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\treturn nil\n}", "func (v *Validator) Validate(data interface{}) (bool, []string, error) {\n\t//validate and check for any errors, reading explicit validations errors and returning\n\t//a list of fields that failed or the error\n\terr := v.Validator.Struct(data)\n\tif err != nil {\n\t\tvalidationErrs, ok := err.(validator.ValidationErrors)\n\t\tif !ok {\n\t\t\treturn false, nil, errors.Wrap(err, \"validate\")\n\t\t}\n\t\tfields := make([]string, 0)\n\t\tfor _, validationErr := range validationErrs {\n\t\t\tfields = append(fields, validationErr.Field())\n\t\t}\n\t\treturn false, fields, nil\n\t}\n\treturn true, nil, nil\n}", "func validateFields(req *logical.Request, data *framework.FieldData) error {\n\tvar unknownFields []string\n\tfor k := range req.Data {\n\t\tif _, ok := data.Schema[k]; !ok {\n\t\t\tunknownFields = append(unknownFields, k)\n\t\t}\n\t}\n\n\tif len(unknownFields) > 0 {\n\t\t// Sort since this is a human error\n\t\tsort.Strings(unknownFields)\n\n\t\treturn fmt.Errorf(\"unknown fields: %q\", unknownFields)\n\t}\n\n\treturn nil\n}", "func validateFields(req *logical.Request, data *framework.FieldData) error {\n\tvar unknownFields []string\n\tfor k := range req.Data {\n\t\tif _, ok := data.Schema[k]; !ok {\n\t\t\tunknownFields = append(unknownFields, k)\n\t\t}\n\t}\n\n\tif len(unknownFields) > 0 {\n\t\t// Sort since this is a human error\n\t\tsort.Strings(unknownFields)\n\n\t\treturn fmt.Errorf(\"unknown fields: %q\", unknownFields)\n\t}\n\n\treturn nil\n}", "func (s *RecordSchema) Validate(v reflect.Value) bool {\n\tv = dereference(v)\n\tif v.Kind() != reflect.Struct || !v.CanAddr() || !v.CanInterface() {\n\t\treturn false\n\t}\n\trec, ok := v.Interface().(GenericRecord)\n\tif !ok {\n\t\t// This is not a generic record and is likely a specific record. Hence\n\t\t// use the basic check.\n\t\treturn v.Kind() == reflect.Struct\n\t}\n\n\tfieldCount := 0\n\tfor key, val := range rec.fields {\n\t\tfor idx := range s.Fields {\n\t\t\t// key.Name must have rs.Fields[idx].Name as a suffix\n\t\t\tif len(s.Fields[idx].Name) <= len(key) {\n\t\t\t\tlhs := key[len(key)-len(s.Fields[idx].Name):]\n\t\t\t\tif lhs == s.Fields[idx].Name {\n\t\t\t\t\tif !s.Fields[idx].Type.Validate(reflect.ValueOf(val)) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tfieldCount++\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// All of the fields set must be accounted for in the union.\n\tif fieldCount < len(rec.fields) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (s StructSpec) Validate() error {\n\tfor _, f := range s.Fields {\n\t\terr := f.Validate()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (cv *CustomValidator) Validate(i interface{}) error {\n\terrorRes, err := cv.Validator.Struct(i).(validator.ValidationErrors)\n\tif !err {\n\t\treturn nil\n\t}\n\terrorFields := []string{}\n\tfor _, k := range errorRes {\n\t\terrorFields = append(errorFields, k.StructField())\n\t}\n\tif len(errorFields) == 1 {\n\t\treturn errors.New(strings.Join(errorFields, \", \") + \" field is invalid or missing.\")\n\t}\n\treturn errors.New(strings.Join(errorFields, \", \") + \" fields are invalid or missing.\")\n}", "func Validate(v interface{}) error {\n\n\t// returns nil or ValidationErrors ( []FieldError )\n\terr := val.Struct(v)\n\tif err != nil {\n\n\t\t// this check is only needed when your code could produce\n\t\t// an invalid value for validation such as interface with nil\n\t\t// value most including myself do not usually have code like this.\n\t\tif _, ok := err.(*validator.InvalidValidationError); ok {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn err\n\t}\n\treturn nil\n}", "func ValidateFields(model interface{}) error {\n\terr := validator.Validate(model)\n\tif err != nil {\n\t\terrs, ok := err.(validator.ErrorMap)\n\t\tif ok {\n\t\t\tfor f, _ := range errs {\n\t\t\t\treturn errors.New(ecodes.ValidateField, constant.ValidateFieldErr+\"-\"+f)\n\t\t\t}\n\t\t} else {\n\t\t\treturn errors.New(ecodes.ValidationUnknown, constant.ValidationUnknownErr)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (v *Validator) ValidateFields(input map[string]string) {\n\tfor field, value := range input {\n\t\t_, found := find(requiredFields, field)\n\t\tif !found {\n\t\t\tv.errors[\"errors\"] = append(v.errors[field], fmt.Sprintf(\"%+v is not valid, check docs for valid fields\", field))\n\t\t}\n\t\t(v.model)[field] = value\n\t}\n}", "func (self *TypeDef) Validate() error {\n\tif self.Type == \"\" {\n\t\treturn fmt.Errorf(\"TypeDef.type is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Type)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"TypeDef.type does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Name == \"\" {\n\t\treturn fmt.Errorf(\"TypeDef.name is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeName\", self.Name)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"TypeDef.name does not contain a valid TypeName (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Comment != \"\" {\n\t\tval := Validate(RdlSchema(), \"String\", self.Comment)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"TypeDef.comment does not contain a valid String (%v)\", val.Error)\n\t\t}\n\t}\n\treturn nil\n}", "func (mt *EasypostFieldObject) Validate() (err error) {\n\tif mt.Key == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"key\"))\n\t}\n\tif mt.Value == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"value\"))\n\t}\n\tif mt.Visibility == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"visibility\"))\n\t}\n\tif mt.Label == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"label\"))\n\t}\n\n\treturn\n}", "func (ti TypeInfo) Validate() error {\n\tif len(ti.Type) == 0 {\n\t\treturn errors.Wrap(ErrValidatingData, \"TypeInfo requires a type\")\n\t}\n\treturn nil\n}", "func ValidateStructFields(in interface{}, requiredFieldIDs []string) (err error) {\n\tvar inAsMap map[string]interface{}\n\ttemp, err := json.Marshal(in)\n\tif err != nil {\n\t\treturn errors.New(\"error validating input struct\")\n\t}\n\terr = json.Unmarshal(temp, &inAsMap)\n\tif err != nil {\n\t\treturn errors.New(\"error validating input struct\")\n\t}\n\n\tfor _, requiredFieldID := range requiredFieldIDs {\n\t\t// Make sure the field is in the data.\n\t\tif val, ok := inAsMap[requiredFieldID]; !ok || len(fmt.Sprintf(\"%v\", val)) == 0 {\n\t\t\treturn errors.New(\"required input field \" + requiredFieldID + \" not specified\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func Validate(value interface{}) error {\n\tv := reflect.Indirect(reflect.ValueOf(value))\n\tt := v.Type()\n\n\t// Look for an IsValid method on value. To check that this IsValid method\n\t// exists, we need to retrieve it with MethodByName, which returns a\n\t// reflect.Value. This reflect.Value, m, has a method that is called\n\t// IsValid as well, which tells us whether v actually represents the\n\t// function we're looking for. But they're two completely different IsValid\n\t// methods. Yes, this is confusing.\n\tm := reflect.ValueOf(value).MethodByName(\"IsValid\")\n\tif m.IsValid() {\n\t\te := m.Call([]reflect.Value{})\n\t\terr, ok := e[0].Interface().(error)\n\t\tif ok && err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// For non-struct values, we cannot do much, as there's no associated tags\n\t// to lookup to decide how to validate, so we have to assume they're valid.\n\tif t.Kind() != reflect.Struct {\n\t\treturn nil\n\t}\n\n\t// For struct values, iterate through the fields and use the type of field\n\t// along with its validate tags to decide next steps\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tfield := v.Field(i)\n\n\t\tswitch field.Type().Kind() {\n\t\tcase reflect.Struct:\n\t\t\tdv := field.Interface()\n\t\t\tif err := Validate(dv); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase reflect.Slice:\n\t\t\tdv := reflect.ValueOf(field.Interface())\n\t\t\tif tag, ok := t.Field(i).Tag.Lookup(\"validate\"); ok {\n\t\t\t\tif err := validate(tag, t.Field(i).Name, v, v.Field(i)); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor j := 0; j < dv.Len(); j++ {\n\t\t\t\tif err := Validate(dv.Index(j).Interface()); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Map:\n\t\t\tif tag, ok := t.Field(i).Tag.Lookup(\"validate\"); ok {\n\t\t\t\tif err := validate(tag, t.Field(i).Name, v, v.Field(i)); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Bool, reflect.Int, reflect.Int64, reflect.Float64, reflect.String:\n\t\t\ttag, ok := t.Field(i).Tag.Lookup(\"validate\")\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := validate(tag, t.Field(i).Name, v, v.Field(i)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase reflect.Chan:\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unimplemented struct field type: %s\", t.Field(i).Name)\n\t\t}\n\t}\n\treturn nil\n}", "func (m *Type1) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (u *Usecase) validFields(d *Device) error {\n\tif d.Name == \"\" {\n\t\treturn &InvalidError{\"attribute `Name` must not be empty\"}\n\t}\n\n\tif d.User == 0 {\n\t\treturn &InvalidError{\"invalid user\"}\n\t}\n\n\treturn nil\n}", "func Validate(schema interface{}, errors []map[string]interface{}) {\n\t/**\n\t * create validator instance\n\t */\n\tvalidate := validator.New()\n\n\tif err := validate.Struct(schema); err != nil {\n\t\tif _, ok := err.(*validator.InvalidValidationError); ok {\n\t\t\terrors = append(errors, map[string]interface{}{\n\t\t\t\t\"message\": fmt.Sprint(err), \"flag\": \"INVALID_BODY\"},\n\t\t\t)\n\t\t}\n\n\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\terrors = append(errors, map[string]interface{}{\n\t\t\t\t\"message\": fmt.Sprint(err), \"flag\": \"INVALID_BODY\"},\n\t\t\t)\n\t\t}\n\t\texception.BadRequest(\"Validation error\", errors)\n\t}\n\tif errors != nil {\n\t\texception.BadRequest(\"Validation error\", errors)\n\t}\n}", "func (s *FieldStatsService) Validate() error {\n\tvar invalid []string\n\tif s.level != \"\" && (s.level != FieldStatsIndicesLevel && s.level != FieldStatsClusterLevel) {\n\t\tinvalid = append(invalid, \"Level\")\n\t}\n\tif len(invalid) != 0 {\n\t\treturn fmt.Errorf(\"missing or invalid required fields: %v\", invalid)\n\t}\n\treturn nil\n}", "func (t Type) Validate() error {\n\tswitch t {\n\tcase git:\n\t\treturn nil\n\tcase nop:\n\t\treturn nil\n\tdefault:\n\t\treturn ErrInvalidType\n\t}\n}", "func (time Time) Validate() bool {\n\tret := true\n\tif ret == true && time.hours != (Hours{}) {\n\t\tret = time.hours.Validate()\n\t}\n\n\tif ret == true && time.minutes != (Minutes{}) {\n\t\tret = time.minutes.Validate()\n\t}\n\n\tif ret == true && time.seconds != (Seconds{}) {\n\t\tret = time.seconds.Validate()\n\t}\n\n\tif ret == true && time.delay != (Delay{}) {\n\t\tret = time.delay.Validate()\n\t}\n\n\tif ret != true {\n\t\tlog.Println(\"Failed to validate time '\" + time.value + \"'\")\n\t}\n\treturn ret\n}", "func (p *Publication) IsValidFields() error {\n\tif p.Content != \"\" {\n\t\treturn nil\n\t}\n\treturn errorstatus.ErrorBadInfo\n\n}", "func (a Relayer) Validate() error {\n\treturn validation.ValidateStruct(&a,\n\t\tvalidation.Field(&a.Address, validation.Required),\n\t)\n}", "func (builder *Builder) ValidateFields() error {\n\tvmImageRefFields := []string{\"ImageSku\", \"ImageVersion\"}\n\tcustomVMIMageRefFields := []string{\"Image\", \"ImageResourceGroup\", \"ImageStorageAccount\", \"ImageContainer\"}\n\n\tif !builder.hasMarketplaceVMImageRef() && !builder.hasCustomVMIMageRef() {\n\t\treturn fmt.Errorf(\n\t\t\t\"missing fields: you must provide values for either %s fields or %s fields\",\n\t\t\tstrings.Join(vmImageRefFields, \", \"),\n\t\t\tstrings.Join(customVMIMageRefFields, \", \"),\n\t\t)\n\t}\n\n\tif builder.hasMarketplaceVMImageRef() && builder.hasCustomVMIMageRef() {\n\t\treturn fmt.Errorf(\n\t\t\t\"confilicting fields: you must provide values for either %s fields or %s fields\",\n\t\t\tstrings.Join(vmImageRefFields, \", \"),\n\t\t\tstrings.Join(customVMIMageRefFields, \", \"),\n\t\t)\n\t}\n\n\treturn nil\n}", "func (self *NumberTypeDef) Validate() error {\n\tif self.Type == \"\" {\n\t\treturn fmt.Errorf(\"NumberTypeDef.type is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Type)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"NumberTypeDef.type does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Name == \"\" {\n\t\treturn fmt.Errorf(\"NumberTypeDef.name is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeName\", self.Name)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"NumberTypeDef.name does not contain a valid TypeName (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Comment != \"\" {\n\t\tval := Validate(RdlSchema(), \"String\", self.Comment)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"NumberTypeDef.comment does not contain a valid String (%v)\", val.Error)\n\t\t}\n\t}\n\treturn nil\n}", "func (mt *EasypostCarrierTypes) Validate() (err error) {\n\tif mt.Type == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"type\"))\n\t}\n\tif mt.Object == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"object\"))\n\t}\n\tif mt.Fields == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"fields\"))\n\t}\n\n\tif ok := goa.ValidatePattern(`^CarrierType$`, mt.Object); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`response.object`, mt.Object, `^CarrierType$`))\n\t}\n\treturn\n}", "func (t *Transform) Validate() *field.Error {\n\tswitch t.Type {\n\tcase TransformTypeMath:\n\t\tif t.Math == nil {\n\t\t\treturn field.Required(field.NewPath(\"math\"), \"given transform type math requires configuration\")\n\t\t}\n\t\treturn verrors.WrapFieldError(t.Math.Validate(), field.NewPath(\"math\"))\n\tcase TransformTypeMap:\n\t\tif t.Map == nil {\n\t\t\treturn field.Required(field.NewPath(\"map\"), \"given transform type map requires configuration\")\n\t\t}\n\t\treturn verrors.WrapFieldError(t.Map.Validate(), field.NewPath(\"map\"))\n\tcase TransformTypeMatch:\n\t\tif t.Match == nil {\n\t\t\treturn field.Required(field.NewPath(\"match\"), \"given transform type match requires configuration\")\n\t\t}\n\t\treturn verrors.WrapFieldError(t.Match.Validate(), field.NewPath(\"match\"))\n\tcase TransformTypeString:\n\t\tif t.String == nil {\n\t\t\treturn field.Required(field.NewPath(\"string\"), \"given transform type string requires configuration\")\n\t\t}\n\t\treturn verrors.WrapFieldError(t.String.Validate(), field.NewPath(\"string\"))\n\tcase TransformTypeConvert:\n\t\tif t.Convert == nil {\n\t\t\treturn field.Required(field.NewPath(\"convert\"), \"given transform type convert requires configuration\")\n\t\t}\n\t\tif err := t.Convert.Validate(); err != nil {\n\t\t\treturn verrors.WrapFieldError(err, field.NewPath(\"convert\"))\n\t\t}\n\tdefault:\n\t\t// Should never happen\n\t\treturn field.Invalid(field.NewPath(\"type\"), t.Type, \"unknown transform type\")\n\t}\n\n\treturn nil\n}", "func (strategy UpdateScatterStrategy) FieldsValidation() error {\n\tif len(strategy) == 0 {\n\t\treturn nil\n\t}\n\n\tm := make(map[string]struct{}, len(strategy))\n\tfor _, term := range strategy {\n\t\tif term.Key == \"\" {\n\t\t\treturn fmt.Errorf(\"key should not be empty\")\n\t\t}\n\t\tid := term.Key + \":\" + term.Value\n\t\tif _, ok := m[id]; !ok {\n\t\t\tm[id] = struct{}{}\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"duplicated key=%v value=%v\", term.Key, term.Value)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (self *StructTypeDef) Validate() error {\n\tif self.Type == \"\" {\n\t\treturn fmt.Errorf(\"StructTypeDef.type is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Type)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"StructTypeDef.type does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Name == \"\" {\n\t\treturn fmt.Errorf(\"StructTypeDef.name is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeName\", self.Name)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"StructTypeDef.name does not contain a valid TypeName (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Comment != \"\" {\n\t\tval := Validate(RdlSchema(), \"String\", self.Comment)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"StructTypeDef.comment does not contain a valid String (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Fields == nil {\n\t\treturn fmt.Errorf(\"StructTypeDef: Missing required field: fields\")\n\t}\n\treturn nil\n}", "func (self *MapTypeDef) Validate() error {\n\tif self.Type == \"\" {\n\t\treturn fmt.Errorf(\"MapTypeDef.type is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Type)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"MapTypeDef.type does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Name == \"\" {\n\t\treturn fmt.Errorf(\"MapTypeDef.name is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeName\", self.Name)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"MapTypeDef.name does not contain a valid TypeName (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Comment != \"\" {\n\t\tval := Validate(RdlSchema(), \"String\", self.Comment)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"MapTypeDef.comment does not contain a valid String (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Keys == \"\" {\n\t\treturn fmt.Errorf(\"MapTypeDef.keys is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Keys)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"MapTypeDef.keys does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Items == \"\" {\n\t\treturn fmt.Errorf(\"MapTypeDef.items is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Items)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"MapTypeDef.items does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\treturn nil\n}", "func (s StructInCustom) Validate() []string {\n\tvar errs []string\n\tif s.Name == \"\" {\n\t\terrs = append(errs, \"name::is_required\")\n\t}\n\n\treturn errs\n}", "func (cv Validator) Validate(i interface{}) error {\n\treturn cv.Validator.Struct(i)\n}", "func Validate(v interface{}) (error, bool) {\n\tresult, err := govalidator.ValidateStruct(v)\n\tif err != nil {\n\t\tlog.Println(\"Invalid data\", err)\n\t}\n\treturn err, result\n}", "func validateFieldDurations(fl validator.FieldLevel) bool {\n\tv := fl.Field().Bool()\n\tif v {\n\t\t//read the parameter and extract the other fields that were specified\n\t\tparam := fl.Param()\n\t\tfields := strings.Fields(param)\n\t\tfor _, field := range fields {\n\t\t\t//check if the field is set\n\t\t\tstructField, _, _, ok := fl.GetStructFieldOKAdvanced2(fl.Parent(), field)\n\t\t\tif !ok || structField.IsZero() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "func (h *HazardType) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\terrors := validate.Validate(\n\t\t&validators.StringIsPresent{Name: \"Label\", Field: h.Label, Message: \"A label is required.\"},\n\t\t&validators.StringIsPresent{Name: \"Description\", Field: h.Description, Message: \"Please provide a brief description.\"},\n\t)\n\n\treturn errors, nil\n}", "func (tS *testAInfo) Validate(msg actor.Msg) bool {\n\tswitch m := msg[0].(type) {\n\tcase int:\n\t\tif m > 0 && m < 10 {\n\t\t\treturn true\n\t\t}\n\tdefault:\n\t\tfor _, datum := range tS.allowed {\n\t\t\tif reflect.TypeOf(msg[0]) ==\n\t\t\t\treflect.TypeOf(datum) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\t// Does not match a valid type\n\treturn false\n}", "func (ut *RegisterPayload) Validate() (err error) {\n\tif ut.Email == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"email\"))\n\t}\n\tif ut.Password == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"password\"))\n\t}\n\tif ut.FirstName == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"first_name\"))\n\t}\n\tif ut.LastName == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"last_name\"))\n\t}\n\tif err2 := goa.ValidateFormat(goa.FormatEmail, ut.Email); err2 != nil {\n\t\terr = goa.MergeErrors(err, goa.InvalidFormatError(`type.email`, ut.Email, goa.FormatEmail, err2))\n\t}\n\tif utf8.RuneCountInString(ut.Email) < 6 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.email`, ut.Email, utf8.RuneCountInString(ut.Email), 6, true))\n\t}\n\tif utf8.RuneCountInString(ut.Email) > 150 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.email`, ut.Email, utf8.RuneCountInString(ut.Email), 150, false))\n\t}\n\tif utf8.RuneCountInString(ut.FirstName) < 1 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.first_name`, ut.FirstName, utf8.RuneCountInString(ut.FirstName), 1, true))\n\t}\n\tif utf8.RuneCountInString(ut.FirstName) > 200 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.first_name`, ut.FirstName, utf8.RuneCountInString(ut.FirstName), 200, false))\n\t}\n\tif utf8.RuneCountInString(ut.LastName) < 1 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.last_name`, ut.LastName, utf8.RuneCountInString(ut.LastName), 1, true))\n\t}\n\tif utf8.RuneCountInString(ut.LastName) > 200 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.last_name`, ut.LastName, utf8.RuneCountInString(ut.LastName), 200, false))\n\t}\n\tif utf8.RuneCountInString(ut.Password) < 5 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.password`, ut.Password, utf8.RuneCountInString(ut.Password), 5, true))\n\t}\n\tif utf8.RuneCountInString(ut.Password) > 100 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.password`, ut.Password, utf8.RuneCountInString(ut.Password), 100, false))\n\t}\n\treturn\n}", "func (u Phone) Validate() error {\n\treturn nil\n\t// return validation.ValidateStruct(&u,\n\t// \tvalidation.Field(&u.Name, validation.Required),\n\t// \tvalidation.Field(&u.Created, validation.Required))\n}", "func (r *InfoReq) Validate() error {\n\treturn validate.Struct(r)\n}", "func (r *RouteSpecFields) Validate(ctx context.Context) (errs *apis.FieldError) {\n\n\tif r.Domain == \"\" {\n\t\terrs = errs.Also(apis.ErrMissingField(\"domain\"))\n\t}\n\n\tif r.Hostname == \"www\" {\n\t\terrs = errs.Also(apis.ErrInvalidValue(\"hostname\", r.Hostname))\n\t}\n\n\tif _, err := BuildPathRegexp(r.Path); err != nil {\n\t\terrs = errs.Also(apis.ErrInvalidValue(\"path\", r.Path))\n\t}\n\n\treturn errs\n}", "func (mt *EasypostScanform) Validate() (err error) {\n\tif mt.Address != nil {\n\t\tif err2 := mt.Address.Validate(); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tif mt.ID != nil {\n\t\tif ok := goa.ValidatePattern(`^sf_`, *mt.ID); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`response.id`, *mt.ID, `^sf_`))\n\t\t}\n\t}\n\tif ok := goa.ValidatePattern(`^ScanForm$`, mt.Object); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`response.object`, mt.Object, `^ScanForm$`))\n\t}\n\tif mt.Status != nil {\n\t\tif !(*mt.Status == \"creating\" || *mt.Status == \"created\" || *mt.Status == \"failed\") {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(`response.status`, *mt.Status, []interface{}{\"creating\", \"created\", \"failed\"}))\n\t\t}\n\t}\n\treturn\n}", "func Validate(schema interface{}) {\n\tvalidate := validator.New()\n\n\tif err := validate.Struct(schema); err != nil {\n\t\tif _, ok := err.(*validator.InvalidValidationError); ok {\n\t\t\texception.BadRequest(fmt.Sprint(err), \"INVALID_BODY\")\n\t\t}\n\n\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\texception.BadRequest(fmt.Sprint(err), \"INVALID_BODY\")\n\t\t}\n\t}\n}", "func (v *Validation) Validate(i interface{}) ValidationErrors {\n\terrs := v.validate.Struct(i)\n\tif errs == nil {\n\t\treturn nil\n\t}\n\n\tvar returnErrs ValidationErrors\n\tfor _, err := range errs.(validator.ValidationErrors) {\n\t\t// cast the FieldError into our ValidationError and append to the slice\n\t\tve := ValidationError{err.(validator.FieldError)}\n\t\treturnErrs = append(returnErrs, ve)\n\t}\n\treturn returnErrs\n}", "func (s *MemberDefinition) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"MemberDefinition\"}\n\tif s.CognitoMemberDefinition != nil {\n\t\tif err := s.CognitoMemberDefinition.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"CognitoMemberDefinition\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.OidcMemberDefinition != nil {\n\t\tif err := s.OidcMemberDefinition.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"OidcMemberDefinition\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (m *MeasurementType) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (s *UnionSchema) Validate(v reflect.Value) bool {\n\tv = dereference(v)\n\tfor i := range s.Types {\n\t\tif t := s.Types[i]; t.Validate(v) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (u *User) Validate() *errors.RestError {\n\tif err := validators.ValidateStruct(u); err != nil {\n\t\treturn err\n\t}\n\t// Sanitize Structure\n\tu.FirstName = strings.TrimSpace(u.FirstName)\n\tu.LastName = strings.TrimSpace(u.LastName)\n\tu.Email = strings.TrimSpace(u.Email)\n\tu.Username = strings.TrimSpace(u.Username)\n\tu.Password = strings.TrimSpace(u.Password)\n\t// Check password\n\tif err := u.validatePassword(); err != nil {\n\t\treturn err\n\t}\n\t// Check uniqueness\n\tif err := u.checkUniqueness(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (DirectorBindStrategy) Validate(ctx request.Context, obj runtime.Object) field.ErrorList {\n\to := obj.(*bind.DirectorBind)\n\tlog.Printf(\"Validating fields for DirectorBind %s\\n\", o.Name)\n\terrors := field.ErrorList{}\n\t// perform validation here and add to errors using field.Invalid\n\treturn errors\n}", "func (t *Test1) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.Validate(\n\t\t&validators.IntIsPresent{Field: t.Field1, Name: \"Field1\"},\n\t), nil\n}", "func (t ConvertTransform) Validate() *field.Error {\n\tif !t.GetFormat().IsValid() {\n\t\treturn field.Invalid(field.NewPath(\"format\"), t.Format, \"invalid format\")\n\t}\n\tif !t.ToType.IsValid() {\n\t\treturn field.Invalid(field.NewPath(\"toType\"), t.ToType, \"invalid type\")\n\t}\n\treturn nil\n}", "func (conf TypeConfig) Validate() error {\n\tfor _, rule := range conf.Rules {\n\t\td, ok := conf.Descriptors[rule.Descriptor]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"rule %s=%s uses descriptor %s that does not exist\", rule.Name, rule.Value, rule.Descriptor)\n\t\t}\n\t\tif !hasField(rule.Name, d) {\n\t\t\treturn fmt.Errorf(\"rule %s refers to field %s that is not present in descriptor\", rule.Descriptor, rule.Name)\n\t\t}\n\n\t}\n\tfor name, desc := range conf.Descriptors {\n\t\tfor i, d := range desc {\n\t\t\tcol, ok := d.(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"descriptor %s has invalid structure in element %d\", name, i)\n\t\t\t}\n\t\t\tif col[\"name\"] == \"ts\" && col[\"type\"] != \"time\" {\n\t\t\t\treturn fmt.Errorf(\"descriptor %s has field ts with wrong type %s\", name, col[\"type\"])\n\t\t\t}\n\t\t}\n\t\tcol := desc[0].(map[string]interface{})\n\t\tif col[\"name\"] != \"_path\" {\n\t\t\treturn fmt.Errorf(\"descriptor %s does not have _path as first column\", name)\n\t\t}\n\t}\n\treturn nil\n}", "func (m APIStepType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateAPIStepTypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (r *Version) Validate() error {\n\n\tR := *r\n\tif len(R) > 4 {\n\t\treturn errors.New(\"Version field may not contain more than 4 fields\")\n\t}\n\tif len(R) < 3 {\n\t\treturn errors.New(\"Version field must contain at least 3 fields\")\n\t}\n\tfor i, x := range R[:3] {\n\t\tn, ok := x.(int)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Version field %d is not an integer: %d\", i, n)\n\t\t}\n\t\tif n > 99 {\n\t\t\treturn fmt.Errorf(\"Version field %d value is over 99: %d\", i, n)\n\t\t}\n\t}\n\tif len(R) > 3 {\n\t\ts, ok := R[3].(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"optional field 4 of Version is not a string\")\n\t\t} else {\n\t\t\tfor i, x := range s {\n\t\t\t\tif !(unicode.IsLetter(x) || unicode.IsDigit(x)) {\n\t\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\t\"optional field 4 of Version contains other than letters and numbers at position %d: '%v,\", i, x)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (s *ListAggregatedUtterancesInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"ListAggregatedUtterancesInput\"}\n\tif s.AggregationDuration == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"AggregationDuration\"))\n\t}\n\tif s.BotAliasId != nil && len(*s.BotAliasId) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotAliasId\", 10))\n\t}\n\tif s.BotId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotId\"))\n\t}\n\tif s.BotId != nil && len(*s.BotId) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotId\", 10))\n\t}\n\tif s.BotVersion != nil && len(*s.BotVersion) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotVersion\", 1))\n\t}\n\tif s.Filters != nil && len(s.Filters) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"Filters\", 1))\n\t}\n\tif s.LocaleId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"LocaleId\"))\n\t}\n\tif s.MaxResults != nil && *s.MaxResults < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinValue(\"MaxResults\", 1))\n\t}\n\tif s.AggregationDuration != nil {\n\t\tif err := s.AggregationDuration.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"AggregationDuration\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.Filters != nil {\n\t\tfor i, v := range s.Filters {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"Filters\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.SortBy != nil {\n\t\tif err := s.SortBy.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"SortBy\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (s *CreateSlotTypeInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"CreateSlotTypeInput\"}\n\tif s.BotId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotId\"))\n\t}\n\tif s.BotId != nil && len(*s.BotId) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotId\", 10))\n\t}\n\tif s.BotVersion == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotVersion\"))\n\t}\n\tif s.BotVersion != nil && len(*s.BotVersion) < 5 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotVersion\", 5))\n\t}\n\tif s.LocaleId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"LocaleId\"))\n\t}\n\tif s.LocaleId != nil && len(*s.LocaleId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"LocaleId\", 1))\n\t}\n\tif s.SlotTypeName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"SlotTypeName\"))\n\t}\n\tif s.SlotTypeName != nil && len(*s.SlotTypeName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"SlotTypeName\", 1))\n\t}\n\tif s.SlotTypeValues != nil && len(s.SlotTypeValues) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"SlotTypeValues\", 1))\n\t}\n\tif s.CompositeSlotTypeSetting != nil {\n\t\tif err := s.CompositeSlotTypeSetting.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"CompositeSlotTypeSetting\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.ExternalSourceSetting != nil {\n\t\tif err := s.ExternalSourceSetting.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"ExternalSourceSetting\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.SlotTypeValues != nil {\n\t\tfor i, v := range s.SlotTypeValues {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"SlotTypeValues\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.ValueSelectionSetting != nil {\n\t\tif err := s.ValueSelectionSetting.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"ValueSelectionSetting\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (s *OrderBy) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"OrderBy\"}\n\tif s.PropertyName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"PropertyName\"))\n\t}\n\tif s.PropertyName != nil && len(*s.PropertyName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"PropertyName\", 1))\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (m *StripeRefundSpecificFields) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (m ModelErrorDatumType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateModelErrorDatumTypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (s *CreateBotAliasInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"CreateBotAliasInput\"}\n\tif s.BotAliasLocaleSettings != nil && len(s.BotAliasLocaleSettings) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotAliasLocaleSettings\", 1))\n\t}\n\tif s.BotAliasName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotAliasName\"))\n\t}\n\tif s.BotAliasName != nil && len(*s.BotAliasName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotAliasName\", 1))\n\t}\n\tif s.BotId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotId\"))\n\t}\n\tif s.BotId != nil && len(*s.BotId) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotId\", 10))\n\t}\n\tif s.BotVersion != nil && len(*s.BotVersion) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotVersion\", 1))\n\t}\n\tif s.BotAliasLocaleSettings != nil {\n\t\tfor i, v := range s.BotAliasLocaleSettings {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"BotAliasLocaleSettings\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.ConversationLogSettings != nil {\n\t\tif err := s.ConversationLogSettings.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"ConversationLogSettings\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.SentimentAnalysisSettings != nil {\n\t\tif err := s.SentimentAnalysisSettings.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"SentimentAnalysisSettings\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func Validate(ctx http.IContext, vld *validator.Validate, arg interface{}) bool {\n\n\tif err := ctx.GetRequest().GetBodyAs(arg); err != nil {\n\t\thttp.InternalServerException(ctx)\n\t\treturn false\n\t}\n\n\tswitch err := vld.Struct(arg); err.(type) {\n\tcase validator.ValidationErrors:\n\t\thttp.FailedValidationException(ctx, err.(validator.ValidationErrors))\n\t\treturn false\n\n\tcase nil:\n\t\tbreak\n\n\tdefault:\n\t\thttp.InternalServerException(ctx)\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (a *Account) Validate() error {\n\tvalidate := validator.New()\n\treturn validate.Struct(a)\n}", "func (s *CreateMemberInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"CreateMemberInput\"}\n\tif s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ClientRequestToken\", 1))\n\t}\n\tif s.InvitationId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"InvitationId\"))\n\t}\n\tif s.InvitationId != nil && len(*s.InvitationId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"InvitationId\", 1))\n\t}\n\tif s.MemberConfiguration == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"MemberConfiguration\"))\n\t}\n\tif s.NetworkId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"NetworkId\"))\n\t}\n\tif s.NetworkId != nil && len(*s.NetworkId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"NetworkId\", 1))\n\t}\n\tif s.MemberConfiguration != nil {\n\t\tif err := s.MemberConfiguration.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"MemberConfiguration\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (ut *UpdateUserPayload) Validate() (err error) {\n\tif ut.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"name\"))\n\t}\n\tif ut.Email == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"email\"))\n\t}\n\tif ut.Bio == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"bio\"))\n\t}\n\tif err2 := goa.ValidateFormat(goa.FormatEmail, ut.Email); err2 != nil {\n\t\terr = goa.MergeErrors(err, goa.InvalidFormatError(`type.email`, ut.Email, goa.FormatEmail, err2))\n\t}\n\tif ok := goa.ValidatePattern(`\\S`, ut.Name); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`type.name`, ut.Name, `\\S`))\n\t}\n\tif utf8.RuneCountInString(ut.Name) > 256 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.name`, ut.Name, utf8.RuneCountInString(ut.Name), 256, false))\n\t}\n\treturn\n}", "func (o *Virtualserver) validate(dbRecord *common.DbRecord) (ok bool, err error) {\n\t////////////////////////////////////////////////////////////////////////////\n\t// Marshal data interface.\n\t////////////////////////////////////////////////////////////////////////////\n\tvar data virtualserver.Data\n\terr = shared.MarshalInterface(dbRecord.Data, &data)\n\tif err != nil {\n\t\treturn\n\t}\n\t////////////////////////////////////////////////////////////////////////////\n\t// Test required fields.\n\t////////////////////////////////////////////////////////////////////////////\n\tok = true\n\trequired := make(map[string]bool)\n\trequired[\"ProductCode\"] = false\n\trequired[\"IP\"] = false\n\trequired[\"Port\"] = false\n\trequired[\"LoadBalancerIP\"] = false\n\trequired[\"Name\"] = false\n\t////////////////////////////////////////////////////////////////////////////\n\tif data.ProductCode != 0 {\n\t\trequired[\"ProductCode\"] = true\n\t}\n\tif len(dbRecord.LoadBalancerIP) > 0 {\n\t\trequired[\"LoadBalancerIP\"] = true\n\t}\n\tif len(data.Ports) != 0 {\n\t\trequired[\"Port\"] = true\n\t}\n\tif data.IP != \"\" {\n\t\trequired[\"IP\"] = true\n\t}\n\tif data.Name != \"\" {\n\t\trequired[\"Name\"] = true\n\t}\n\tfor _, val := range required {\n\t\tif val == false {\n\t\t\tok = false\n\t\t}\n\t}\n\tif !ok {\n\t\terr = fmt.Errorf(\"missing required fields - %+v\", required)\n\t}\n\treturn\n}", "func Validate(t interface{}) error {\n\treturn validator.Struct(t)\n}", "func (m *ColumnDetails) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateKeyType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSortOrder(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateValueType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (cv *CustomValidator) Validate(i interface{}) error {\n\treturn cv.Validator.Struct(i)\n}", "func (cv *CustomValidator) Validate(i interface{}) error {\n\treturn cv.Validator.Struct(i)\n}", "func (s *WriteRecordsInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"WriteRecordsInput\"}\n\tif s.DatabaseName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"DatabaseName\"))\n\t}\n\tif s.Records == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Records\"))\n\t}\n\tif s.Records != nil && len(s.Records) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"Records\", 1))\n\t}\n\tif s.TableName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"TableName\"))\n\t}\n\tif s.CommonAttributes != nil {\n\t\tif err := s.CommonAttributes.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"CommonAttributes\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.Records != nil {\n\t\tfor i, v := range s.Records {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"Records\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (m *HashType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateFunction(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMethod(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateModifier(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (s *CognitoMemberDefinition) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"CognitoMemberDefinition\"}\n\tif s.ClientId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"ClientId\"))\n\t}\n\tif s.ClientId != nil && len(*s.ClientId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ClientId\", 1))\n\t}\n\tif s.UserGroup == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"UserGroup\"))\n\t}\n\tif s.UserGroup != nil && len(*s.UserGroup) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"UserGroup\", 1))\n\t}\n\tif s.UserPool == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"UserPool\"))\n\t}\n\tif s.UserPool != nil && len(*s.UserPool) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"UserPool\", 1))\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (recipe *Recipe) Validate() error {\n\tvalidate := validator.New()\n\treturn validate.Struct(recipe)\n}", "func (s *CreateInferenceExperimentInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"CreateInferenceExperimentInput\"}\n\tif s.EndpointName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"EndpointName\"))\n\t}\n\tif s.ModelVariants == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"ModelVariants\"))\n\t}\n\tif s.ModelVariants != nil && len(s.ModelVariants) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ModelVariants\", 1))\n\t}\n\tif s.Name == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Name\"))\n\t}\n\tif s.Name != nil && len(*s.Name) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"Name\", 1))\n\t}\n\tif s.RoleArn == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"RoleArn\"))\n\t}\n\tif s.RoleArn != nil && len(*s.RoleArn) < 20 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"RoleArn\", 20))\n\t}\n\tif s.ShadowModeConfig == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"ShadowModeConfig\"))\n\t}\n\tif s.Type == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Type\"))\n\t}\n\tif s.DataStorageConfig != nil {\n\t\tif err := s.DataStorageConfig.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"DataStorageConfig\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.ModelVariants != nil {\n\t\tfor i, v := range s.ModelVariants {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"ModelVariants\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.ShadowModeConfig != nil {\n\t\tif err := s.ShadowModeConfig.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"ShadowModeConfig\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.Tags != nil {\n\t\tfor i, v := range s.Tags {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"Tags\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (s *UpdateSlotTypeInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"UpdateSlotTypeInput\"}\n\tif s.BotId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotId\"))\n\t}\n\tif s.BotId != nil && len(*s.BotId) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotId\", 10))\n\t}\n\tif s.BotVersion == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotVersion\"))\n\t}\n\tif s.BotVersion != nil && len(*s.BotVersion) < 5 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotVersion\", 5))\n\t}\n\tif s.LocaleId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"LocaleId\"))\n\t}\n\tif s.LocaleId != nil && len(*s.LocaleId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"LocaleId\", 1))\n\t}\n\tif s.SlotTypeId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"SlotTypeId\"))\n\t}\n\tif s.SlotTypeId != nil && len(*s.SlotTypeId) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"SlotTypeId\", 10))\n\t}\n\tif s.SlotTypeName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"SlotTypeName\"))\n\t}\n\tif s.SlotTypeName != nil && len(*s.SlotTypeName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"SlotTypeName\", 1))\n\t}\n\tif s.SlotTypeValues != nil && len(s.SlotTypeValues) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"SlotTypeValues\", 1))\n\t}\n\tif s.CompositeSlotTypeSetting != nil {\n\t\tif err := s.CompositeSlotTypeSetting.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"CompositeSlotTypeSetting\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.ExternalSourceSetting != nil {\n\t\tif err := s.ExternalSourceSetting.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"ExternalSourceSetting\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.SlotTypeValues != nil {\n\t\tfor i, v := range s.SlotTypeValues {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"SlotTypeValues\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.ValueSelectionSetting != nil {\n\t\tif err := s.ValueSelectionSetting.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"ValueSelectionSetting\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func Validate(obj interface{}) (map[string]interface{}, bool) {\n\n\trules := govalidator.MapData{\n\t\t\"name\": []string{\"required\", \"between:3,150\"},\n\t\t//\"email\": []string{\"required\", \"min:4\", \"max:20\", \"email\"},\n\t\t//\"web\": []string{\"url\"},\n\t\t//\"age\": []string{\"numeric_between:18,56\"},\n\t}\n\n\treturn validate.Validate(rules, obj)\n}", "func (u *User) Validate() ([]app.Invalid, error) {\n\tvar inv []app.Invalid\n\n\tif u.UserType == 0 {\n\t\tinv = append(inv, app.Invalid{Fld: \"UserType\", Err: \"The value of UserType cannot be 0.\"})\n\t}\n\n\tif u.FirstName == \"\" {\n\t\tinv = append(inv, app.Invalid{Fld: \"FirstName\", Err: \"A value of FirstName cannot be empty.\"})\n\t}\n\n\tif u.LastName == \"\" {\n\t\tinv = append(inv, app.Invalid{Fld: \"LastName\", Err: \"A value of LastName cannot be empty.\"})\n\t}\n\n\tif u.Email == \"\" {\n\t\tinv = append(inv, app.Invalid{Fld: \"Email\", Err: \"A value of Email cannot be empty.\"})\n\t}\n\n\tif u.Company == \"\" {\n\t\tinv = append(inv, app.Invalid{Fld: \"Company\", Err: \"A value of Company cannot be empty.\"})\n\t}\n\n\tif len(u.Addresses) == 0 {\n\t\tinv = append(inv, app.Invalid{Fld: \"Addresses\", Err: \"There must be at least one address.\"})\n\t} else {\n\t\tfor _, ua := range u.Addresses {\n\t\t\tif va, err := ua.Validate(); err != nil {\n\t\t\t\tinv = append(inv, va...)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(inv) > 0 {\n\t\treturn inv, errors.New(\"Validation failures identified\")\n\t}\n\n\treturn nil, nil\n}", "func (s *GetPropertyValueHistoryInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"GetPropertyValueHistoryInput\"}\n\tif s.ComponentName != nil && len(*s.ComponentName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ComponentName\", 1))\n\t}\n\tif s.ComponentTypeId != nil && len(*s.ComponentTypeId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ComponentTypeId\", 1))\n\t}\n\tif s.EndTime != nil && len(*s.EndTime) < 20 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"EndTime\", 20))\n\t}\n\tif s.EntityId != nil && len(*s.EntityId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"EntityId\", 1))\n\t}\n\tif s.PropertyFilters != nil && len(s.PropertyFilters) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"PropertyFilters\", 1))\n\t}\n\tif s.SelectedProperties == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"SelectedProperties\"))\n\t}\n\tif s.SelectedProperties != nil && len(s.SelectedProperties) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"SelectedProperties\", 1))\n\t}\n\tif s.StartTime != nil && len(*s.StartTime) < 20 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"StartTime\", 20))\n\t}\n\tif s.WorkspaceId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"WorkspaceId\"))\n\t}\n\tif s.WorkspaceId != nil && len(*s.WorkspaceId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"WorkspaceId\", 1))\n\t}\n\tif s.PropertyFilters != nil {\n\t\tfor i, v := range s.PropertyFilters {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"PropertyFilters\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (v *validator) Validate(val interface{}) (bool, *domain.NuxError) {\n\tif l, ok := val.(int); ok {\n\t\treturn v.validateInt(l)\n\t}\n\n\tif l, ok := val.(int64); ok {\n\t\treturn v.validateInt64(l)\n\t}\n\n\tif l, ok := val.(float64); ok {\n\t\treturn v.validateFloat64(l)\n\t}\n\n\tif l, ok := val.(float32); ok {\n\t\treturn v.validateFloat32(l)\n\t}\n\n\treturn true, nil\n}", "func (d *Definition) Validate() (bool, error) {\n\treturn govalidator.ValidateStruct(d)\n}", "func (s *ServiceCatalogProvisioningDetails) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"ServiceCatalogProvisioningDetails\"}\n\tif s.PathId != nil && len(*s.PathId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"PathId\", 1))\n\t}\n\tif s.ProductId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"ProductId\"))\n\t}\n\tif s.ProductId != nil && len(*s.ProductId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ProductId\", 1))\n\t}\n\tif s.ProvisioningArtifactId != nil && len(*s.ProvisioningArtifactId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"ProvisioningArtifactId\", 1))\n\t}\n\tif s.ProvisioningParameters != nil {\n\t\tfor i, v := range s.ProvisioningParameters {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"ProvisioningParameters\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (self *AliasTypeDef) Validate() error {\n\tif self.Type == \"\" {\n\t\treturn fmt.Errorf(\"AliasTypeDef.type is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Type)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"AliasTypeDef.type does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Name == \"\" {\n\t\treturn fmt.Errorf(\"AliasTypeDef.name is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeName\", self.Name)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"AliasTypeDef.name does not contain a valid TypeName (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Comment != \"\" {\n\t\tval := Validate(RdlSchema(), \"String\", self.Comment)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"AliasTypeDef.comment does not contain a valid String (%v)\", val.Error)\n\t\t}\n\t}\n\treturn nil\n}", "func (s *ListSlotTypesInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"ListSlotTypesInput\"}\n\tif s.BotId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotId\"))\n\t}\n\tif s.BotId != nil && len(*s.BotId) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotId\", 10))\n\t}\n\tif s.BotVersion == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotVersion\"))\n\t}\n\tif s.BotVersion != nil && len(*s.BotVersion) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotVersion\", 1))\n\t}\n\tif s.Filters != nil && len(s.Filters) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"Filters\", 1))\n\t}\n\tif s.LocaleId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"LocaleId\"))\n\t}\n\tif s.LocaleId != nil && len(*s.LocaleId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"LocaleId\", 1))\n\t}\n\tif s.MaxResults != nil && *s.MaxResults < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinValue(\"MaxResults\", 1))\n\t}\n\tif s.Filters != nil {\n\t\tfor i, v := range s.Filters {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"Filters\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.SortBy != nil {\n\t\tif err := s.SortBy.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"SortBy\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (s *UpdateBotAliasInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"UpdateBotAliasInput\"}\n\tif s.BotAliasId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotAliasId\"))\n\t}\n\tif s.BotAliasId != nil && len(*s.BotAliasId) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotAliasId\", 10))\n\t}\n\tif s.BotAliasLocaleSettings != nil && len(s.BotAliasLocaleSettings) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotAliasLocaleSettings\", 1))\n\t}\n\tif s.BotAliasName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotAliasName\"))\n\t}\n\tif s.BotAliasName != nil && len(*s.BotAliasName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotAliasName\", 1))\n\t}\n\tif s.BotId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BotId\"))\n\t}\n\tif s.BotId != nil && len(*s.BotId) < 10 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotId\", 10))\n\t}\n\tif s.BotVersion != nil && len(*s.BotVersion) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"BotVersion\", 1))\n\t}\n\tif s.BotAliasLocaleSettings != nil {\n\t\tfor i, v := range s.BotAliasLocaleSettings {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"BotAliasLocaleSettings\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\tif s.ConversationLogSettings != nil {\n\t\tif err := s.ConversationLogSettings.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"ConversationLogSettings\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.SentimentAnalysisSettings != nil {\n\t\tif err := s.SentimentAnalysisSettings.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"SentimentAnalysisSettings\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (v *Validator) Validate(i interface{}) error {\n\treturn v.validator.Struct(i)\n}", "func (s *CreateProfileInput) Validate() error {\n\tinvalidParams := aws.ErrInvalidParams{Context: \"CreateProfileInput\"}\n\n\tif s.Address == nil {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"Address\"))\n\t}\n\tif s.Address != nil && len(*s.Address) < 1 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"Address\", 1))\n\t}\n\tif s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 10 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"ClientRequestToken\", 10))\n\t}\n\tif len(s.DistanceUnit) == 0 {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"DistanceUnit\"))\n\t}\n\tif s.Locale != nil && len(*s.Locale) < 1 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"Locale\", 1))\n\t}\n\n\tif s.ProfileName == nil {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"ProfileName\"))\n\t}\n\tif s.ProfileName != nil && len(*s.ProfileName) < 1 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"ProfileName\", 1))\n\t}\n\tif len(s.TemperatureUnit) == 0 {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"TemperatureUnit\"))\n\t}\n\n\tif s.Timezone == nil {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"Timezone\"))\n\t}\n\tif s.Timezone != nil && len(*s.Timezone) < 1 {\n\t\tinvalidParams.Add(aws.NewErrParamMinLen(\"Timezone\", 1))\n\t}\n\tif len(s.WakeWord) == 0 {\n\t\tinvalidParams.Add(aws.NewErrParamRequired(\"WakeWord\"))\n\t}\n\tif s.MeetingRoomConfiguration != nil {\n\t\tif err := s.MeetingRoomConfiguration.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"MeetingRoomConfiguration\", err.(aws.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.Tags != nil {\n\t\tfor i, v := range s.Tags {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"Tags\", i), err.(aws.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (l *logger) Validate() error {\n\tif l == nil {\n\t\treturn nil\n\t}\n\tif err := l.Console.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"`Console` field: %s\", err.Error())\n\t}\n\tif err := l.File.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"`File` field: %s\", err.Error())\n\t}\n\treturn nil\n}", "func (self *ArrayTypeDef) Validate() error {\n\tif self.Type == \"\" {\n\t\treturn fmt.Errorf(\"ArrayTypeDef.type is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Type)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"ArrayTypeDef.type does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Name == \"\" {\n\t\treturn fmt.Errorf(\"ArrayTypeDef.name is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeName\", self.Name)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"ArrayTypeDef.name does not contain a valid TypeName (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Comment != \"\" {\n\t\tval := Validate(RdlSchema(), \"String\", self.Comment)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"ArrayTypeDef.comment does not contain a valid String (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.Items == \"\" {\n\t\treturn fmt.Errorf(\"ArrayTypeDef.items is missing but is a required field\")\n\t} else {\n\t\tval := Validate(RdlSchema(), \"TypeRef\", self.Items)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"ArrayTypeDef.items does not contain a valid TypeRef (%v)\", val.Error)\n\t\t}\n\t}\n\treturn nil\n}", "func (s *RegexMatchTuple) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"RegexMatchTuple\"}\n\tif s.FieldToMatch == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"FieldToMatch\"))\n\t}\n\tif s.RegexPatternSetId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"RegexPatternSetId\"))\n\t}\n\tif s.RegexPatternSetId != nil && len(*s.RegexPatternSetId) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"RegexPatternSetId\", 1))\n\t}\n\tif s.TextTransformation == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"TextTransformation\"))\n\t}\n\tif s.FieldToMatch != nil {\n\t\tif err := s.FieldToMatch.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"FieldToMatch\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (r *RecordValidator) Validate(i interface{}) error {\r\n\treturn r.validator.Struct(i)\r\n}", "func (s *Service) Validate() error {\n\tnonEmptyFields := map[string]checker{\n\t\t\"Name\": checker{s.Name, true},\n\t\t\"Type\": checker{s.Type.String(), false}, // Type is a enum, no need to check\n\t\t\"Owner\": checker{s.Owner, true},\n\t\t\"ClusterType\": checker{s.ClusterType, true},\n\t\t\"InstanceName\": checker{s.InstanceName.String(), true},\n\t}\n\n\tfor label, field := range nonEmptyFields {\n\t\tif field.val == \"\" {\n\t\t\treturn fmt.Errorf(errorTmpl, label+\" is empty\")\n\t\t} else if field.checkSeparator && strings.Contains(field.val, keyPartSeparator) {\n\t\t\treturn fmt.Errorf(errorTmpl, label+separatorErrorMsg)\n\t\t}\n\t}\n\n\tswitch {\n\tcase len([]rune(s.Name)) > maxServiceNameLen:\n\t\treturn fmt.Errorf(errorTmpl, fmt.Sprintf(\"Name %q is too long, max len is %d symbols\", s.Name, maxServiceNameLen))\n\tcase !reRolloutType.MatchString(s.RolloutType):\n\t\treturn fmt.Errorf(errorTmpl, \"RolloutType is invalid\")\n\t}\n\treturn nil\n}", "func (t *Visibility_Visibility) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Visibility_Visibility\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *UpdateWorkteamInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"UpdateWorkteamInput\"}\n\tif s.Description != nil && len(*s.Description) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"Description\", 1))\n\t}\n\tif s.MemberDefinitions != nil && len(s.MemberDefinitions) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"MemberDefinitions\", 1))\n\t}\n\tif s.WorkteamName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"WorkteamName\"))\n\t}\n\tif s.WorkteamName != nil && len(*s.WorkteamName) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"WorkteamName\", 1))\n\t}\n\tif s.MemberDefinitions != nil {\n\t\tfor i, v := range s.MemberDefinitions {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"MemberDefinitions\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}", "func (s *SlotTypeValue) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"SlotTypeValue\"}\n\tif s.Synonyms != nil && len(s.Synonyms) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"Synonyms\", 1))\n\t}\n\tif s.SampleValue != nil {\n\t\tif err := s.SampleValue.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"SampleValue\", err.(request.ErrInvalidParams))\n\t\t}\n\t}\n\tif s.Synonyms != nil {\n\t\tfor i, v := range s.Synonyms {\n\t\t\tif v == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\tinvalidParams.AddNested(fmt.Sprintf(\"%s[%v]\", \"Synonyms\", i), err.(request.ErrInvalidParams))\n\t\t\t}\n\t\t}\n\t}\n\n\tif invalidParams.Len() > 0 {\n\t\treturn invalidParams\n\t}\n\treturn nil\n}" ]
[ "0.6366166", "0.6255708", "0.62440985", "0.6219268", "0.6205969", "0.6186602", "0.61787015", "0.6151207", "0.6135345", "0.6129121", "0.61265224", "0.61265224", "0.60985357", "0.60598147", "0.60547787", "0.60132855", "0.5993056", "0.5990731", "0.59752667", "0.59422064", "0.59114707", "0.59090024", "0.5889592", "0.58741313", "0.5829609", "0.58170855", "0.58096683", "0.58095896", "0.58095545", "0.58024305", "0.5794755", "0.57862866", "0.57858443", "0.57791334", "0.5764243", "0.57606256", "0.57459706", "0.5732621", "0.5724816", "0.5721725", "0.5710794", "0.57104737", "0.5704633", "0.5703819", "0.5702953", "0.56983054", "0.56940216", "0.5690886", "0.5657812", "0.5649313", "0.56480217", "0.564582", "0.563624", "0.5627615", "0.5625255", "0.5619124", "0.5613144", "0.56088334", "0.5605432", "0.56024873", "0.55947214", "0.55911726", "0.5589795", "0.5585938", "0.55821085", "0.5582017", "0.5581614", "0.55808634", "0.5580246", "0.5574314", "0.5568627", "0.55618674", "0.5560738", "0.55515087", "0.5550786", "0.5550786", "0.5541505", "0.5539938", "0.55395836", "0.5536529", "0.5532453", "0.5530356", "0.55274034", "0.5516386", "0.55141157", "0.551397", "0.5513621", "0.5507534", "0.55044377", "0.5499806", "0.5497794", "0.5496284", "0.5494955", "0.5485755", "0.54851174", "0.5484035", "0.54840046", "0.5483409", "0.5483303", "0.5483193", "0.5481435" ]
0.0
-1
String returns the string representation
func (s DescribeCasesOutput) String() string { return awsutil.Prettify(s) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s CreateAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateCanaryOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s Library) String() string {\n\tres := make([]string, 5)\n\tres[0] = \"ID: \" + reform.Inspect(s.ID, true)\n\tres[1] = \"UserID: \" + reform.Inspect(s.UserID, true)\n\tres[2] = \"VolumeID: \" + reform.Inspect(s.VolumeID, true)\n\tres[3] = \"CreatedAt: \" + reform.Inspect(s.CreatedAt, true)\n\tres[4] = \"UpdatedAt: \" + reform.Inspect(s.UpdatedAt, true)\n\treturn strings.Join(res, \", \")\n}", "func (r Info) String() string {\n\tJSON, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn string(JSON)\n}", "func (s ReEncryptOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateFHIRDatastoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String() string {\n\toutput := output{\n\t\tRerun: Rerun,\n\t\tVariables: Variables,\n\t\tItems: Items,\n\t}\n\tvar err error\n\tvar b []byte\n\tif Indent == \"\" {\n\t\tb, err = json.Marshal(output)\n\t} else {\n\t\tb, err = json.MarshalIndent(output, \"\", Indent)\n\t}\n\tif err != nil {\n\t\tmessageErr := Errorf(\"Error in parser. Please report this output to https://github.com/drgrib/alfred/issues: %v\", err)\n\t\tpanic(messageErr)\n\t}\n\ts := string(b)\n\treturn s\n}", "func (s CreateQuickConnectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r *Registry) String() string {\n\tout := make([]string, 0, len(r.nameToObject))\n\tfor name, object := range r.nameToObject {\n\t\tout = append(out, fmt.Sprintf(\"* %s:\\n%s\", name, object.serialization))\n\t}\n\treturn strings.Join(out, \"\\n\\n\")\n}", "func (s CreateSceneOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateSafetyRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateLanguageModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o QtreeCreateResponse) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "func (r SendAll) String() string {\n\tJSON, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn string(JSON)\n}", "func (r ReceiveAll) String() string {\n\tJSON, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn string(JSON)\n}", "func (enc *simpleEncoding) String() string {\n\treturn \"simpleEncoding(\" + enc.baseName + \")\"\n}", "func (s CreateDatabaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (z Zamowienium) String() string {\n\tjz, _ := json.Marshal(z)\n\treturn string(jz)\n}", "func (s CreateHITTypeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProgramOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateEntityOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProjectVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Addshifttraderequest) String() string {\n \n \n \n \n o.AcceptableIntervals = []string{\"\"} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s CreateUseCaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r Rooms) String() string {\n\tjr, _ := json.Marshal(r)\n\treturn string(jr)\n}", "func (i Info) String() string {\n\ts, _ := i.toJSON()\n\treturn s\n}", "func (o *Botversionsummary) String() string {\n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (e ExternalCfps) String() string {\n\tje, _ := json.Marshal(e)\n\treturn string(je)\n}", "func (s CreateTrustStoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String() string {\n\treturn fmt.Sprintf(\n\t\t\"AppVersion = %s\\n\"+\n\t\t\t\"VCSRef = %s\\n\"+\n\t\t\t\"BuildVersion = %s\\n\"+\n\t\t\t\"BuildDate = %s\",\n\t\tAppVersion, VCSRef, BuildVersion, Date,\n\t)\n}", "func (s CreateDataLakeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateSolutionVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s GetSceneOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (i NotMachine) String() string { return toString(i) }", "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s StartPipelineReprocessingOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateDatastoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateSequenceStoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Adjustablelivespeakerdetection) String() string {\n \n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s CreateRateBasedRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r Resiliency) String() string {\n\tb, _ := json.Marshal(r)\n\treturn string(b)\n}", "func (s RestoreFromRecoveryPointOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateWaveOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o QtreeCreateResponseResult) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "func (s CreateRoomOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateBotLocaleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DeleteAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (z Zamowienia) String() string {\n\tjz, _ := json.Marshal(z)\n\treturn string(jz)\n}", "func (i *Info) String() string {\n\tb, _ := json.Marshal(i)\n\treturn string(b)\n}", "func (s ProcessingFeatureStoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ExportProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r RoomOccupancies) String() string {\n\tjr, _ := json.Marshal(r)\n\treturn string(jr)\n}", "func (r *InterRecord) String() string {\n\tbuf := r.Bytes()\n\tdefer ffjson.Pool(buf)\n\n\treturn string(buf)\n}", "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Coretype) String() string {\n \n \n \n \n \n o.ValidationFields = []string{\"\"} \n \n o.ItemValidationFields = []string{\"\"} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s CreateLayerOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateModelCardOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Limitchangerequestdetails) String() string {\n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s NetworkPathComponentDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (t Terms) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "func (g GetObjectOutput) String() string {\n\treturn helper.Prettify(g)\n}", "func (s StartContactEvaluationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Interactionstatsalert) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s CreateModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Digitalcondition) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "func (r RoomOccupancy) String() string {\n\tjr, _ := json.Marshal(r)\n\treturn string(jr)\n}", "func (d *Diagram) String() string { return toString(d) }", "func (o *Outboundroute) String() string {\n \n \n \n \n o.ClassificationTypes = []string{\"\"} \n \n \n o.ExternalTrunkBases = []Domainentityref{{}} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s CreateCodeRepositoryOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateActivationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateBotOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ResolutionTechniques) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateTrialComponentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c CourseCode) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "func (p *Parms) String() string {\n\tout, _ := json.MarshalIndent(p, \"\", \"\\t\")\n\treturn string(out)\n}", "func (p polynomial) String() (str string) {\n\tfor _, m := range p.monomials {\n\t\tstr = str + \" \" + m.String() + \" +\"\n\t}\n\tstr = strings.TrimRight(str, \"+\")\n\treturn \"f(x) = \" + strings.TrimSpace(str)\n}", "func (s CreateThingOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r *RUT) String() string {\n\treturn r.Format(DefaultFormatter)\n}", "func (s CreatePatchBaselineOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Crossplatformpolicycreate) String() string {\n \n \n \n \n \n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (s BotVersionLocaleDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s LifeCycleLastTestInitiated) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DeleteMultiplexProgramOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s GetObjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s LifeCycleLastTestReverted) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateDocumentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateComponentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateIntegrationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Commonruleconditions) String() string {\n o.Clauses = []Commonruleconditions{{}} \n o.Predicates = []Commonrulepredicate{{}} \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (t Test1s) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "func (o *Directrouting) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "func (s CreateContactFlowOutput) String() string {\n\treturn awsutil.Prettify(s)\n}" ]
[ "0.7215058", "0.7215058", "0.72000957", "0.7199919", "0.7177383", "0.7166947", "0.7118059", "0.7087492", "0.70870787", "0.7079275", "0.70782894", "0.7067719", "0.7031721", "0.70269966", "0.7026298", "0.70251423", "0.7021565", "0.70164025", "0.701059", "0.7010184", "0.70022964", "0.6997043", "0.6996532", "0.6992619", "0.69909185", "0.69900763", "0.69862556", "0.6985364", "0.6975378", "0.69738907", "0.69624275", "0.6961772", "0.69603413", "0.69507927", "0.6946753", "0.69460964", "0.69460964", "0.6944943", "0.694029", "0.69369334", "0.69332623", "0.69287163", "0.692656", "0.6924643", "0.69216746", "0.69213074", "0.69181406", "0.6917802", "0.6911058", "0.69104654", "0.6909528", "0.690845", "0.690454", "0.6899065", "0.6896141", "0.6894107", "0.6894107", "0.6894107", "0.68921995", "0.68920684", "0.689124", "0.68893504", "0.688871", "0.6884391", "0.6882336", "0.6880731", "0.68767136", "0.68766147", "0.68766147", "0.68751997", "0.68735147", "0.68734384", "0.68731403", "0.6871602", "0.6869421", "0.68684965", "0.68677104", "0.68677104", "0.68677104", "0.68677104", "0.68673396", "0.68622416", "0.6862084", "0.6859391", "0.6857645", "0.6853781", "0.68523467", "0.6851581", "0.6846037", "0.6844023", "0.6843859", "0.68434954", "0.68419206", "0.68416274", "0.684033", "0.6839815", "0.68363225", "0.6835165", "0.68334675", "0.68327725", "0.6832733" ]
0.0
-1
Send marshals and sends the DescribeCases API request.
func (r DescribeCasesRequest) Send(ctx context.Context) (*DescribeCasesResponse, error) { r.Request.SetContext(ctx) err := r.Request.Send() if err != nil { return nil, err } resp := &DescribeCasesResponse{ DescribeCasesOutput: r.Request.Data.(*DescribeCasesOutput), response: &aws.Response{Request: r.Request}, } return resp, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (mr *MockClientMockRecorder) DescribeCases(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeCases\", reflect.TypeOf((*MockClient)(nil).DescribeCases), arg0)\n}", "func (client *Client) ListCases(request *ListCasesRequest) (response *ListCasesResponse, err error) {\n\tresponse = CreateListCasesResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (m *MockClient) DescribeCases(arg0 *support.DescribeCasesInput) (*support.DescribeCasesOutput, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DescribeCases\", arg0)\n\tret0, _ := ret[0].(*support.DescribeCasesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (ec *executionContext) _Case(ctx context.Context, sel ast.SelectionSet, obj *models.Case) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, caseImplementors)\n\n\tvar wg sync.WaitGroup\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"Case\")\n\t\tcase \"Id\":\n\t\t\tout.Values[i] = ec._Case_Id(ctx, field, obj)\n\t\tcase \"Asset\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Asset(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"CaseNumber\":\n\t\t\tout.Values[i] = ec._Case_CaseNumber(ctx, field, obj)\n\t\tcase \"Origin\":\n\t\t\tout.Values[i] = ec._Case_Origin(ctx, field, obj)\n\t\tcase \"Owner\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Owner(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"Reason\":\n\t\t\tout.Values[i] = ec._Case_Reason(ctx, field, obj)\n\t\tcase \"IsClosed\":\n\t\t\tout.Values[i] = ec._Case_IsClosed(ctx, field, obj)\n\t\tcase \"Contact\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Contact(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"CreatedBy\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_CreatedBy(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"ClosedDate\":\n\t\t\tout.Values[i] = ec._Case_ClosedDate(ctx, field, obj)\n\t\tcase \"CreatedDate\":\n\t\t\tout.Values[i] = ec._Case_CreatedDate(ctx, field, obj)\n\t\tcase \"IsDeleted\":\n\t\t\tout.Values[i] = ec._Case_IsDeleted(ctx, field, obj)\n\t\tcase \"Description\":\n\t\t\tout.Values[i] = ec._Case_Description(ctx, field, obj)\n\t\tcase \"IsEscalated\":\n\t\t\tout.Values[i] = ec._Case_IsEscalated(ctx, field, obj)\n\t\tcase \"LastModifiedBy\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_LastModifiedBy(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"LastModifiedDate\":\n\t\t\tout.Values[i] = ec._Case_LastModifiedDate(ctx, field, obj)\n\t\tcase \"LastReferencedDate\":\n\t\t\tout.Values[i] = ec._Case_LastReferencedDate(ctx, field, obj)\n\t\tcase \"LastViewedDate\":\n\t\t\tout.Values[i] = ec._Case_LastViewedDate(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\twg.Wait()\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "func CreateListCasesRequest() (request *ListCasesRequest) {\n\trequest = &ListCasesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"CCC\", \"2020-07-01\", \"ListCases\", \"CCC\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (cc *Cerberus) Run(h *bridges.Helper) (interface{}, error) {\n\tr := make(map[string]interface{})\n\n\tid := h.Data.Get(\"id\").String()\n\trequestURL := fmt.Sprintf(\"https://cerberus.ledger-labs.com/adapter/transactions/%s/\", id)\n\n\terr := h.HTTPCall(\n\t\thttp.MethodGet,\n\t\trequestURL,\n\t\t&r,\n\t)\n\treturn r[\"confirmation\"], err\n}", "func (r DescribeActivationsRequest) Send() (*DescribeActivationsOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DescribeActivationsOutput), nil\n}", "func DeleteCase(w http.ResponseWriter, r *http.Request) {\r\n\tr.Header.Set(\"Content-Type\", \"application/json, charset=UTF-8\")\r\n\tvar dc DeleteConfig\r\n\r\n\tswitch r.Method {\r\n\tcase \"GET\":\r\n\t\tparams := mux.Vars(r)\r\n\t\tdc.Default()\r\n\t\tdc.CaseName = params[\"case_name\"]\r\n\tcase \"POST\":\r\n\t\tbody, err := ioutil.ReadAll(r.Body)\r\n\t\tif err != nil {\r\n\t\t\tapi.LogDebug(api.DEBUG, \"[+] POST /delete/endpoint, failed to read request\")\r\n\t\t\tfmt.Fprintln(w, api.HttpFailureMessage(\"Failed to read HTTP request\"))\r\n\t\t\treturn\r\n\t\t}\r\n\t\tdc.LoadParams(body)\r\n\t}\r\n\r\n\tif dc.CaseName == \"*\" || dc.CaseName == \"\" {\r\n\t\tapi.LogDebug(api.DEBUG, \"[+] POST /delete/case, valid casename required\")\r\n\t\tfmt.Fprintln(w, api.HttpFailureMessage(\"Valid casename is required. * or NULL can not be used\"))\r\n\t\treturn\r\n\t}\r\n\r\n\tvar query elastic.Query\r\n\tquery = elastic.NewBoolQuery().Must(elastic.NewTermQuery(\"CaseInfo.CaseName.keyword\", dc.CaseName))\r\n\tdeleteEndpointByQuery(w, r, query, \"DeleteCase\")\r\n}", "func (s DescribeCasesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DescribeCasesInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r DescribeCustomerGatewaysRequest) Send(ctx context.Context) (*DescribeCustomerGatewaysResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeCustomerGatewaysResponse{\n\t\tDescribeCustomerGatewaysOutput: r.Request.Data.(*DescribeCustomerGatewaysOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeEventCategoriesRequest) Send(ctx context.Context) (*DescribeEventCategoriesResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeEventCategoriesResponse{\n\t\tDescribeEventCategoriesOutput: r.Request.Data.(*DescribeEventCategoriesOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (m *SecurityRequestBuilder) Cases()(*CasesRequestBuilder) {\n return NewCasesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (r DescribeDetectorRequest) Send(ctx context.Context) (*DescribeDetectorResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeDetectorResponse{\n\t\tDescribeDetectorOutput: r.Request.Data.(*DescribeDetectorOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeEffectiveInstanceAssociationsRequest) Send() (*DescribeEffectiveInstanceAssociationsOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DescribeEffectiveInstanceAssociationsOutput), nil\n}", "func (r DescribeEventDetailsRequest) Send(ctx context.Context) (*DescribeEventDetailsResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeEventDetailsResponse{\n\t\tDescribeEventDetailsOutput: r.Request.Data.(*DescribeEventDetailsOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func CreateListCasesResponse() (response *ListCasesResponse) {\n\tresponse = &ListCasesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (r DescribeCertificateRequest) Send(ctx context.Context) (*DescribeCertificateResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeCertificateResponse{\n\t\tDescribeCertificateOutput: r.Request.Data.(*DescribeCertificateOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (c *SVCResponse) Describe(ch chan<- *prometheus.Desc) {\n\tfor _, metric := range c.metrics {\n\t\tch <- metric.Desc\n\t}\n\n\tch <- c.data.Desc\n\tch <- c.up.Desc()\n\tch <- c.totalScrapes.Desc()\n\tch <- c.jsonParseFailures.Desc()\n}", "func ChartCases(info *pb.HistoricalInfo, doConfirmed, doDeaths bool) (io.Reader, error) {\n\tcaseMap := make(map[int64]*pb.AreaInfo)\n\tvar orderedKeys []int64\n\n\t// Make a map of cases keyed by timestamp.\n\t// Also, collect the timestamps in a slice.(to later sort)\n\tfor _, i := range info.Info {\n\t\tcaseMap[i.UnixTimeOfRequest] = i\n\t\torderedKeys = append(orderedKeys, i.UnixTimeOfRequest)\n\t}\n\n\t// Sort that timestamp slice now.\n\tsort.Slice(orderedKeys, func(i, j int) bool {\n\t\treturn orderedKeys[i] < orderedKeys[j]\n\t})\n\t// Create a slice (ordered) of time.Time for x-axis use later.\n\tvar timeKeys []time.Time\n\tfor _, j := range orderedKeys {\n\t\ttimeKeys = append(timeKeys, time.Unix(j, 0))\n\t}\n\n\tvar caseStatsSorted []float64\n\tvar deathStatsSorted []float64\n\n\t// Extract from each case (in timestamp order) the opened/dead case numbers.\n\tfor _, i := range orderedKeys {\n\t\tif doConfirmed {\n\t\t\tcaseStatsSorted = append(caseStatsSorted, float64(caseMap[int64(i)].ConfirmedCases))\n\t\t}\n\t\tif doDeaths {\n\t\t\tdeathStatsSorted = append(deathStatsSorted, float64(caseMap[int64(i)].Deaths))\n\t\t}\n\t}\n\n\t// For safety sake later make sure there's at least one real number in the lists.\n\tif len(caseStatsSorted) == 0 {\n\t\tcaseStatsSorted = append(caseStatsSorted, 0)\n\t}\n\tif len(deathStatsSorted) == 0 {\n\t\tdeathStatsSorted = append(deathStatsSorted, 0)\n\t}\n\n\t// Construct the timeSeries data sets for cases/deaths.\n\tcSeries := chart.TimeSeries{\n\t\tName: \"Confirmed Cases\",\n\t\tXValues: timeKeys,\n\t\tYValues: caseStatsSorted,\n\t\tStyle: chart.Style{\n\t\t\tStrokeColor: drawing.ColorGreen, // will supercede defaults\n\t\t\tFillColor: drawing.ColorGreen.WithAlpha(64), // will supercede defaults\n\t\t},\n\t}\n\tdSeries := chart.TimeSeries{\n\t\tName: \"Deaths due to COVID-19\",\n\t\tXValues: timeKeys,\n\t\tYValues: deathStatsSorted,\n\t\tStyle: chart.Style{\n\t\t\tStrokeColor: drawing.ColorRed, // will supercede defaults\n\t\t\tFillColor: drawing.ColorRed.WithAlpha(64), // will supercede defaults\n\t\t},\n\t}\n\n\t// Create the graph/Chart with the new series attached.\n\tgraph := chart.Chart{\n\t\tYAxis: chart.YAxis{\n\t\t\tValueFormatter: func(v interface{}) string {\n\t\t\t\tif vf, isFloat := v.(float64); isFloat {\n\t\t\t\t\treturn fmt.Sprintf(\"%0.0f\", vf)\n\t\t\t\t}\n\t\t\t\treturn \"\"\n\t\t\t},\n\t\t\tStyle: chart.Style{\n\t\t\t\tFontSize: 14,\n\t\t\t\tFontColor: drawing.ColorWhite,\n\t\t\t},\n\t\t},\n\t\tXAxis: chart.XAxis{\n\t\t\tStyle: chart.Style{\n\t\t\t\tFontSize: 14,\n\t\t\t\tFontColor: drawing.ColorWhite,\n\t\t\t},\n\t\t},\n\t\tBackground: chart.Style{\n\t\t\tFillColor: drawing.ColorFromHex(\"808080\"),\n\t\t},\n\t\tCanvas: chart.Style{\n\t\t\tFillColor: drawing.ColorFromHex(\"d3d3d3\"),\n\t\t},\n\t\tSeries: []chart.Series{\n\t\t\tcSeries,\n\t\t\tdSeries,\n\t\t},\n\t\tLog: chart.NewLogger(),\n\t}\n\n\t// Note: we have to do this as a separate step because we need a reference to graph\n\tgraph.Elements = []chart.Renderable{\n\t\tchart.Legend(\n\t\t\t&graph,\n\t\t\tchart.Style{\n\t\t\t\tFontSize: 11,\n\t\t\t\tFontColor: drawing.ColorBlack,\n\t\t\t}),\n\t}\n\n\tvar f bytes.Buffer\n\terr := graph.Render(chart.PNG, &f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Traceln(\"wrote to file\")\n\n\treturn bufio.NewReader(&f), nil\n}", "func (c *XTestCase) RunCase(n int, interval int) {\n\t// Client Call\n\tvar call func() error\n\tswitch c.SubProtocol {\n\tcase bolt.ProtocolName, dubbo.ProtocolName, tars.ProtocolName:\n\t\tserver, ok := c.AppServer.(*util.RPCServer)\n\t\tif !ok {\n\t\t\tc.C <- fmt.Errorf(\"need a xprotocol rpc server\")\n\t\t\treturn\n\t\t}\n\t\tclient := server.Client\n\t\tif err := client.Connect(c.ClientMeshAddr); err != nil {\n\t\t\tc.C <- err\n\t\t\treturn\n\t\t}\n\t\tdefer client.Close()\n\t\tcall = func() error {\n\t\t\tclient.SendRequest()\n\t\t\tif !util.WaitMapEmpty(&client.Waits, 2*time.Second) {\n\t\t\t\treturn fmt.Errorf(\"request get no response\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\tdefault:\n\t\tc.C <- fmt.Errorf(\"unsupported protocol: %v\", c.AppProtocol)\n\t\treturn\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tif err := call(); err != nil {\n\t\t\tc.C <- err\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(time.Duration(interval) * time.Millisecond)\n\t}\n\tc.C <- nil\n}", "func runTestCases(ctx *gr.FCContext, evt map[string]string) ([]byte, error) {\n\tservingEndpoint := evt[\"servingEndpoint\"]\n\n\thttpClient := &http.Client{\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t\tTransport: &http.Transport{\n\t\t\tMaxIdleConnsPerHost: 100,\n\t\t\tIdleConnTimeout: 50 * time.Second,\n\t\t},\n\t}\n\n\tresp, err := httpClient.Get(servingEndpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\tif resp.StatusCode == 404 || resp.StatusCode == 200 {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbodyStr := strings.Replace(string(body), \"\\n\", \"\", -1)\n\t\treturn []byte(fmt.Sprintf(`{\"httpStatus\": %d, \"servingStatus\": \"succeeded\", \"body\": \"%s\"}`, resp.StatusCode, bodyStr)), nil\n\t}\n\treturn []byte(fmt.Sprintf(`{\"httpStatus\": %d, \"servingStatus\": \"succeeded\"}`, resp.StatusCode)), nil\n}", "func (r DescribeInstancesRequest) Send(ctx context.Context) (*DescribeInstancesResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeInstancesResponse{\n\t\tDescribeInstancesOutput: r.Request.Data.(*DescribeInstancesOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeDetectorModelRequest) Send(ctx context.Context) (*DescribeDetectorModelResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeDetectorModelResponse{\n\t\tDescribeDetectorModelOutput: r.Request.Data.(*DescribeDetectorModelOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (client *Client) ListCasesWithCallback(request *ListCasesRequest, callback func(response *ListCasesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListCasesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListCases(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (r DescribeInstanceInformationRequest) Send() (*DescribeInstanceInformationOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DescribeInstanceInformationOutput), nil\n}", "func (r DescribeInterconnectsRequest) Send(ctx context.Context) (*DescribeInterconnectsResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeInterconnectsResponse{\n\t\tDescribeInterconnectsOutput: r.Request.Data.(*DescribeInterconnectsOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeEventTypesRequest) Send(ctx context.Context) (*DescribeEventTypesResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeEventTypesResponse{\n\t\tDescribeEventTypesOutput: r.Request.Data.(*DescribeEventTypesOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (cf *CloudFormation) Describe(ch chan<- *prometheus.Desc) error {\n\tch <- cloudFormationStackDesc\n\treturn nil\n}", "func (r DescribeFleetRequest) Send(ctx context.Context) (*DescribeFleetResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeFleetResponse{\n\t\tDescribeFleetOutput: r.Request.Data.(*DescribeFleetOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeResourceRequest) Send(ctx context.Context) (*DescribeResourceResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeResourceResponse{\n\t\tDescribeResourceOutput: r.Request.Data.(*DescribeResourceOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (client *Client) ListCasesWithChan(request *ListCasesRequest) (<-chan *ListCasesResponse, <-chan error) {\n\tresponseChan := make(chan *ListCasesResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ListCases(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (m *ClientMetrics) Describe(ch chan<- *prom.Desc) {\n\tm.clientStartedCounter.Describe(ch)\n\tm.clientHandledCounter.Describe(ch)\n\tm.clientStreamMsgReceived.Describe(ch)\n\tm.clientStreamMsgSent.Describe(ch)\n\tif m.clientHandledHistogramEnabled {\n\t\tm.clientHandledHistogram.Describe(ch)\n\t}\n}", "func (r DescribeEntityRequest) Send(ctx context.Context) (*DescribeEntityResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeEntityResponse{\n\t\tDescribeEntityOutput: r.Request.Data.(*DescribeEntityOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeChangeSetRequest) Send(ctx context.Context) (*DescribeChangeSetResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeChangeSetResponse{\n\t\tDescribeChangeSetOutput: r.Request.Data.(*DescribeChangeSetOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (c *TestCase) RunCase(n int, interval int) {\n\t// Client Call\n\tvar call func() error\n\tswitch c.AppProtocol {\n\tcase protocol.HTTP1:\n\t\tcall = func() error {\n\t\t\tresp, err := http.Get(fmt.Sprintf(\"http://%s/%s\", c.ClientMeshAddr, HTTPTestPath))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer resp.Body.Close()\n\t\t\tif resp.StatusCode != http.StatusOK {\n\t\t\t\treturn fmt.Errorf(\"response status: %d\", resp.StatusCode)\n\t\t\t}\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tc.T.Logf(\"HTTP client receive data: %s\\n\", string(b))\n\t\t\treturn nil\n\t\t}\n\tcase protocol.HTTP2:\n\t\ttr := &http2.Transport{\n\t\t\tAllowHTTP: true,\n\t\t\tDialTLS: func(netw, addr string, cfg *tls.Config) (net.Conn, error) {\n\t\t\t\treturn net.Dial(netw, addr)\n\t\t\t},\n\t\t}\n\t\thttpClient := http.Client{Transport: tr}\n\t\tcall = func() error {\n\t\t\tresp, err := httpClient.Get(fmt.Sprintf(\"http://%s/%s\", c.ClientMeshAddr, HTTPTestPath))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer resp.Body.Close()\n\t\t\tif resp.StatusCode != http.StatusOK {\n\t\t\t\treturn fmt.Errorf(\"response status: %d\", resp.StatusCode)\n\n\t\t\t}\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tc.T.Logf(\"HTTP2 client receive data: %s\\n\", string(b))\n\t\t\treturn nil\n\t\t}\n\tdefault:\n\t\tc.C <- fmt.Errorf(\"unsupported protocol: %v\", c.AppProtocol)\n\t\treturn\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tif err := call(); err != nil {\n\t\t\tc.C <- err\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(time.Duration(interval) * time.Millisecond)\n\t}\n\tc.C <- nil\n}", "func ShowDevicesInFabric(w http.ResponseWriter, r *http.Request) {\n\tconstants.RestLock.Lock()\n\tdefer constants.RestLock.Unlock()\n\tsuccess := true\n\tstatusMsg := \"\"\n\talog := logging.AuditLog{Request: &logging.Request{Command: \"fabric show\"}}\n\talog.LogMessageInit()\n\tdefer alog.LogMessageEnd(&success, &statusMsg)\n\tvars := mux.Vars(r)\n\tFabricName := vars[\"name\"]\n\talog.Request.Params = map[string]interface{}{\n\t\t\"FabricName\": FabricName,\n\t}\n\talog.LogMessageReceived()\n\n\tif Fabric, err := infra.GetUseCaseInteractor().Db.GetFabric(FabricName); err == nil {\n\t\tresponse := Restmodel.SwitchesdataResponse{}\n\t\tif Devices, properr := infra.GetUseCaseInteractor().Db.GetDevicesInFabric(Fabric.ID); properr == nil {\n\t\t\tresponse.Items = make([]Restmodel.SwitchdataResponse, 0, len(Devices))\n\t\t\tfor _, device := range Devices {\n\t\t\t\track, rackerr := infra.GetUseCaseInteractor().Db.GetRackbyIP(FabricName, device.IPAddress)\n\t\t\t\trackName := \"\"\n\t\t\t\tif rackerr == nil {\n\t\t\t\t\trackName = rack.RackName\n\t\t\t\t}\n\n\t\t\t\tswitchData := Restmodel.SwitchdataResponse{IpAddress: device.IPAddress, Role: device.DeviceRole,\n\t\t\t\t\tFirmware: device.FirmwareVersion, Model: adapter.TranslateModelString(device.Model), Rack: rackName, Name: device.Name,\n\t\t\t\t\tFabric: &Restmodel.SwitchdataResponseFabric{FabricName: FabricName, FabricId: int32(Fabric.ID)}}\n\t\t\t\tresponse.Items = append(response.Items, switchData)\n\n\t\t\t}\n\n\t\t\tbytess, _ := json.Marshal(&response)\n\n\t\t\tsuccess = true\n\t\t\tw.Write(bytess)\n\n\t\t} else {\n\t\t\tstatusMsg = fmt.Sprintf(\"Unable to retrieve Devices for %s\\n\", FabricName)\n\t\t\thttp.Error(w, \"\",\n\t\t\t\thttp.StatusNotFound)\n\t\t\tOpenAPIError := swagger.ErrorModel{Message: statusMsg}\n\t\t\tbytess, _ := json.Marshal(&OpenAPIError)\n\t\t\tw.Write(bytess)\n\t\t}\n\t} else {\n\t\tstatusMsg = fmt.Sprintf(\"Unable to retrieve Fabric for %s\\n\", FabricName)\n\t\thttp.Error(w, \"\",\n\t\t\thttp.StatusNotFound)\n\t\tOpenAPIError := swagger.ErrorModel{Message: statusMsg}\n\t\tbytess, _ := json.Marshal(&OpenAPIError)\n\t\tw.Write(bytess)\n\t}\n}", "func (r DescribeRouteTablesRequest) Send(ctx context.Context) (*DescribeRouteTablesResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeRouteTablesResponse{\n\t\tDescribeRouteTablesOutput: r.Request.Data.(*DescribeRouteTablesOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (m *Client) Describe(ch chan<- *prometheus.Desc) {\n\tch <- m.storeValuesDesc\n\tch <- m.storeSizesDesc\n\tch <- m.memberlistMembersInfoDesc\n}", "func (r DescribeLoadBalancersRequest) Send(ctx context.Context) (*DescribeLoadBalancersResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeLoadBalancersResponse{\n\t\tDescribeLoadBalancersOutput: r.Request.Data.(*DescribeLoadBalancersOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func main() {\n\taddr := flag.String(\"addr\", \":8086\", \"address of destination service\")\n\tflag.Parse()\n\n\tclient, conn, err := newClient(*addr)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\tdefer conn.Close()\n\n\trsp, err := client.Endpoints(context.Background(), &discovery.EndpointsParams{})\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\n\tmarshaler := jsonpb.Marshaler{EmitDefaults: true, Indent: \" \"}\n\terr = marshaler.Marshal(os.Stdout, rsp)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n}", "func (i InputLayer1) CallUseCases() {\n\t// usually some logic would happen here to trigger a useCase or another\n\t// (ie : if it was an http router, it would be a different useCase for each route)\n\tlog.Print(\"from the inputLayer : I received a raw request and will format it in order to call UseCase 1\")\n\ti.UseCase1(\"address set in Input in Interfaces Layer\")\n\tlog.Print(\"from the inputLayer : I received the response from UC 1, I can format it to another format (think json for example)\")\n\tlog.Print(\"===\")\n\t//here, the custom type \"Age\" defined only at the interface level is passed to the useCase layer,\n\t//this layer will simply carry it without knowing what it is\n\tlog.Print(\"from the inputLayer : I received another raw request so I will format it in order to call UseCase 2\")\n\ti.UseCase2(Age(12))\n\tlog.Print(\"from the inputLayer : I received the response from UC 2, I can format it too\")\n}", "func describe(w io.Writer, service *servingv1.Service, revisions []*revisionDesc, printDetails bool) error {\n\tdw := printers.NewPrefixWriter(w)\n\n\t// Service info\n\twriteService(dw, service)\n\tdw.WriteLine()\n\tif err := dw.Flush(); err != nil {\n\t\treturn err\n\t}\n\n\t// Revisions summary info\n\twriteRevisions(dw, revisions, printDetails)\n\tdw.WriteLine()\n\tif err := dw.Flush(); err != nil {\n\t\treturn err\n\t}\n\n\t// Condition info\n\tcommands.WriteConditions(dw, service.Status.Conditions, printDetails)\n\tif err := dw.Flush(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Describe(param string) {\n\tfmt.Printf(\"Describing: %v...\\n\", param)\n\tpayload := domain.HttpRequestParam{\n\t\tMethod: \"GET\",\n\t\tURL: domain.BaseRoute + fmt.Sprintf(\"/REST/ndcproperties.json?id=%s\", param),\n\t\tHeaders: map[string]string{\n\t\t\t\"Authorization\": \"Bearer \",\n\t\t},\n\t}\n\n\tresp, err := MakeHttpRequest(payload)\n\tif err != nil {\n\t\tfmt.Printf(\"error: %v\\n\", err.Error())\n\t}\n\tdata := make(map[string]interface{})\n\n\terr = json.Unmarshal(resp, &data)\n\tif err != nil {\n\t\tfmt.Printf(\"error: %v\\n\", err.Error())\n\t}\n\n\t//pretty print data\n\tm, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\tfmt.Printf(\"error: %v\\n\", err.Error())\n\t}\n\tfmt.Printf(\"%v\\n\", string(m))\n}", "func (d *Dao) GrantCases(c context.Context) (mcases map[int64]*model.SimCase, err error) {\n\tconn := d.redis.Get(c)\n\tdefer conn.Close()\n\tvar ms map[string]string\n\tif ms, err = redis.StringMap(conn.Do(\"HGETALL\", _grantCaseKey)); err != nil {\n\t\tif err != redis.ErrNil {\n\t\t\treturn\n\t\t}\n\t\terr = nil\n\t}\n\tmcases = make(map[int64]*model.SimCase)\n\tfor m, s := range ms {\n\t\tif s == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tcid, err := strconv.ParseInt(m, 10, 64)\n\t\tif err != nil {\n\t\t\tlog.Error(\"strconv.ParseInt(%s) error(%v)\", m, err)\n\t\t\terr = nil\n\t\t\tcontinue\n\t\t}\n\t\tcc := &model.SimCase{}\n\t\tif err = json.Unmarshal([]byte(s), cc); err != nil {\n\t\t\tlog.Error(\"json.Unmarshal(%s) error(%v)\", s, err)\n\t\t\terr = nil\n\t\t\tcontinue\n\t\t}\n\t\tmcases[cid] = cc\n\t}\n\treturn\n}", "func (r DescribeNotificationsForBudgetRequest) Send(ctx context.Context) (*DescribeNotificationsForBudgetResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeNotificationsForBudgetResponse{\n\t\tDescribeNotificationsForBudgetOutput: r.Request.Data.(*DescribeNotificationsForBudgetOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeMaintenanceWindowExecutionsRequest) Send() (*DescribeMaintenanceWindowExecutionsOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DescribeMaintenanceWindowExecutionsOutput), nil\n}", "func (c *Client) Describe(ch chan<- *prometheus.Desc) {\n\tc.metrics.functionInvocation.Describe(ch)\n\tc.metrics.queueHistogram.Describe(ch)\n\tc.metrics.functionsHistogram.Describe(ch)\n\tc.metrics.serviceReplicasGauge.Describe(ch)\n\tc.metrics.functionInvocationStarted.Describe(ch)\n}", "func (incident *Incident) Send(cfg *CachetMonitor) error {\n\tswitch incident.Status {\n\t\tcase 1, 2, 3:\n\t\t\t// partial outage\n\t\t\tincident.ComponentStatus = 3\n\n\t\t\tcompInfo := cfg.API.GetComponentData(incident.ComponentID)\n\t\t\tif compInfo.Status == 3 {\n\t\t\t\t// major outage\n\t\t\t\tincident.ComponentStatus = 4\n\t\t\t}\n\t\tcase 4:\n\t\t\t// fixed\n\t\t\tincident.ComponentStatus = 1\n\t}\n\n\trequestType := \"POST\"\n\trequestURL := \"/incidents\"\n\tif incident.ID > 0 {\n\t\trequestType = \"PUT\"\n\t\trequestURL += \"/\" + strconv.Itoa(incident.ID)\n\t}\n\n\tjsonBytes, _ := json.Marshal(incident)\n\n\tresp, body, err := cfg.API.NewRequest(requestType, requestURL, jsonBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar data struct {\n\t\tID int `json:\"id\"`\n\t}\n\tif err := json.Unmarshal(body.Data, &data); err != nil {\n\t\treturn fmt.Errorf(\"Cannot parse incident body: %v, %v\", err, string(body.Data))\n\t}\n\n\tincident.ID = data.ID\n\tif resp.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"Could not create/update incident!\")\n\t}\n\n\treturn nil\n}", "func (r DescribeHostReservationOfferingsRequest) Send(ctx context.Context) (*DescribeHostReservationOfferingsResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeHostReservationOfferingsResponse{\n\t\tDescribeHostReservationOfferingsOutput: r.Request.Data.(*DescribeHostReservationOfferingsOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeAutomationExecutionsRequest) Send() (*DescribeAutomationExecutionsOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DescribeAutomationExecutionsOutput), nil\n}", "func CasesGetAllHCNCourse() mymodels.AllTest {\n\treturn mymodels.AllTest{\n\t\t{\n\t\t\tMethod: \"GET\",\n\t\t\tURL: \"/Courses/GetAllHCN\",\n\t\t\tFunction: courses.GetAllHCNCourse,\n\t\t\tBody: `{\"IDD\": 1}`,\n\t\t\tExpectedBody: `CourseID is empty or not valid`,\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t},\n\t\t{\n\t\t\tMethod: \"GET\",\n\t\t\tURL: \"/Courses/GetAllHCN\",\n\t\t\tFunction: courses.GetAllHCNCourse,\n\t\t\tBody: `{\"CourseID\":1}`,\n\t\t\tExpectedBody: `[{\"ID\":1,\"CourseID\":1,\"HCNID\":1,\"Displayable\":1},{\"ID\":2,\"CourseID\":1,\"HCNID\":2,\"Displayable\":0}]`,\n\t\t\tStatusCode: http.StatusOK,\n\t\t},\n\t\t{\n\t\t\tMethod: \"GET\",\n\t\t\tURL: \"/Courses/GetAllHCN\",\n\t\t\tFunction: courses.GetAllHCNCourse,\n\t\t\tBody: `{\"CourseID\": 2}`,\n\t\t\tExpectedBody: `[{\"ID\":3,\"CourseID\":2,\"HCNID\":1,\"Displayable\":1},{\"ID\":4,\"CourseID\":2,\"HCNID\":2,\"Displayable\":0}]`,\n\t\t\tStatusCode: http.StatusOK,\n\t\t},\n\t\t{\n\t\t\tMethod: \"GET\",\n\t\t\tURL: \"/Courses/GetAllHCN\",\n\t\t\tFunction: courses.GetAllHCNCourse,\n\t\t\tBody: ``,\n\t\t\tExpectedBody: `CourseID is empty or not valid`,\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t},\n\t}\n}", "func (r DescribeVpcsRequest) Send(ctx context.Context) (*DescribeVpcsResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeVpcsResponse{\n\t\tDescribeVpcsOutput: r.Request.Data.(*DescribeVpcsOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r OutputService11TestCaseOperation1Request) Send(ctx context.Context) (*OutputService11TestCaseOperation1Response, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &OutputService11TestCaseOperation1Response{\n\t\tOutputService11TestShapeOutputService11TestCaseOperation1Output: r.Request.Data.(*OutputService11TestShapeOutputService11TestCaseOperation1Output),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func Hello(w http.ResponseWriter, r *http.Request) {\n\ttmpl := template.Must(template.ParseFiles(\"html/get.html\"))\n\tif r.Method != http.MethodGet {\n\t\ttmpl.Execute(w, nil)\n\t\treturn\n\t}\n\n\tresp := utils.GetData()\n\tvar cases []models.Cases\n\terr := json.Unmarshal(resp, &cases)\n\tutils.CheckError(err)\n\t// fmt.Print(cases)\n\n\ttmpl.Execute(w, cases)\n}", "func (m *ClientMetrics) Describe(ch chan<- *prometheus.Desc) {\n\tm.clientHandledSummary.Describe(ch)\n}", "func CreateDescribeCertificatesRequest() (request *DescribeCertificatesRequest) {\n\trequest = &DescribeCertificatesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"waf-openapi\", \"2019-09-10\", \"DescribeCertificates\", \"waf\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (m *Mongo) FindConfirmedCases(ctx context.Context, outbreakID string, reportingDate time.Time, endDate *time.Time) ([]Case, error) {\n\tcollection := m.Client.Database(m.Database).Collection(m.personCollection())\n\tlastDate := endDate\n\tif lastDate == nil {\n\t\tl := reportingDate.Add(time.Hour * 24)\n\t\tlastDate = &l\n\t}\n\tfilter := bson.M{\n\t\t\"outbreakId\": outbreakID,\n\t\t\"classification\": \"LNG_REFERENCE_DATA_CATEGORY_CASE_CLASSIFICATION_CONFIRMED\",\n\t\t\"deleted\": false,\n\t\t\"$and\": bson.A{\n\t\t\tbson.M{\"dateOfReporting\": bson.M{\"$gte\": reportingDate}},\n\t\t\tbson.M{\"dateOfReporting\": bson.M{\"$lt\": lastDate}},\n\t\t},\n\t}\n\n\tvar cases []Case\n\tcursor, err := collection.Find(ctx, filter)\n\tif err != nil {\n\t\treturn cases, MongoQueryErr{\n\t\t\tReason: fmt.Sprintf(\"failed to retrieve cases for outbreak %s on reporting date %v\", outbreakID, reportingDate),\n\t\t\tInner: err,\n\t\t}\n\t}\n\tif err := cursor.All(ctx, &cases); err != nil {\n\t\treturn cases, MongoQueryErr{\n\t\t\tReason: fmt.Sprintf(\"error executing query for outbreak %s on reporting date %v\", outbreakID, reportingDate),\n\t\t\tInner: err,\n\t\t}\n\t}\n\n\treturn cases, nil\n}", "func (r DescribeKeyRequest) Send(ctx context.Context) (*DescribeKeyResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeKeyResponse{\n\t\tDescribeKeyOutput: r.Request.Data.(*DescribeKeyOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeMaintenanceWindowsRequest) Send() (*DescribeMaintenanceWindowsOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DescribeMaintenanceWindowsOutput), nil\n}", "func (r DescribeInstanceAssociationsStatusRequest) Send() (*DescribeInstanceAssociationsStatusOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DescribeInstanceAssociationsStatusOutput), nil\n}", "func (v *VirtualMachinesServerTransport) Do(req *http.Request) (*http.Response, error) {\n\trawMethod := req.Context().Value(runtime.CtxAPINameKey{})\n\tmethod, ok := rawMethod.(string)\n\tif !ok {\n\t\treturn nil, nonRetriableError{errors.New(\"unable to dispatch request, missing value for CtxAPINameKey\")}\n\t}\n\n\tvar resp *http.Response\n\tvar err error\n\n\tswitch method {\n\tcase \"VirtualMachinesClient.BeginAssessPatches\":\n\t\tresp, err = v.dispatchBeginAssessPatches(req)\n\tcase \"VirtualMachinesClient.BeginCapture\":\n\t\tresp, err = v.dispatchBeginCapture(req)\n\tcase \"VirtualMachinesClient.BeginConvertToManagedDisks\":\n\t\tresp, err = v.dispatchBeginConvertToManagedDisks(req)\n\tcase \"VirtualMachinesClient.BeginCreateOrUpdate\":\n\t\tresp, err = v.dispatchBeginCreateOrUpdate(req)\n\tcase \"VirtualMachinesClient.BeginDeallocate\":\n\t\tresp, err = v.dispatchBeginDeallocate(req)\n\tcase \"VirtualMachinesClient.BeginDelete\":\n\t\tresp, err = v.dispatchBeginDelete(req)\n\tcase \"VirtualMachinesClient.Generalize\":\n\t\tresp, err = v.dispatchGeneralize(req)\n\tcase \"VirtualMachinesClient.Get\":\n\t\tresp, err = v.dispatchGet(req)\n\tcase \"VirtualMachinesClient.BeginInstallPatches\":\n\t\tresp, err = v.dispatchBeginInstallPatches(req)\n\tcase \"VirtualMachinesClient.InstanceView\":\n\t\tresp, err = v.dispatchInstanceView(req)\n\tcase \"VirtualMachinesClient.NewListPager\":\n\t\tresp, err = v.dispatchNewListPager(req)\n\tcase \"VirtualMachinesClient.NewListAllPager\":\n\t\tresp, err = v.dispatchNewListAllPager(req)\n\tcase \"VirtualMachinesClient.NewListAvailableSizesPager\":\n\t\tresp, err = v.dispatchNewListAvailableSizesPager(req)\n\tcase \"VirtualMachinesClient.NewListByLocationPager\":\n\t\tresp, err = v.dispatchNewListByLocationPager(req)\n\tcase \"VirtualMachinesClient.BeginPerformMaintenance\":\n\t\tresp, err = v.dispatchBeginPerformMaintenance(req)\n\tcase \"VirtualMachinesClient.BeginPowerOff\":\n\t\tresp, err = v.dispatchBeginPowerOff(req)\n\tcase \"VirtualMachinesClient.BeginReapply\":\n\t\tresp, err = v.dispatchBeginReapply(req)\n\tcase \"VirtualMachinesClient.BeginRedeploy\":\n\t\tresp, err = v.dispatchBeginRedeploy(req)\n\tcase \"VirtualMachinesClient.BeginReimage\":\n\t\tresp, err = v.dispatchBeginReimage(req)\n\tcase \"VirtualMachinesClient.BeginRestart\":\n\t\tresp, err = v.dispatchBeginRestart(req)\n\tcase \"VirtualMachinesClient.RetrieveBootDiagnosticsData\":\n\t\tresp, err = v.dispatchRetrieveBootDiagnosticsData(req)\n\tcase \"VirtualMachinesClient.BeginRunCommand\":\n\t\tresp, err = v.dispatchBeginRunCommand(req)\n\tcase \"VirtualMachinesClient.SimulateEviction\":\n\t\tresp, err = v.dispatchSimulateEviction(req)\n\tcase \"VirtualMachinesClient.BeginStart\":\n\t\tresp, err = v.dispatchBeginStart(req)\n\tcase \"VirtualMachinesClient.BeginUpdate\":\n\t\tresp, err = v.dispatchBeginUpdate(req)\n\tdefault:\n\t\terr = fmt.Errorf(\"unhandled API %s\", method)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func CasesGetAllClinicalCasesCourse() mymodels.AllTest {\n\treturn mymodels.AllTest{\n\t\t{\n\t\t\tMethod: \"GET\",\n\t\t\tURL: \"/Courses/GetAllClinicalCases\",\n\t\t\tFunction: courses.GetAllClinicalCases,\n\t\t\tBody: `{\"CourseIDD\": 1}`,\n\t\t\tExpectedBody: `CourseID is empty or not valid`,\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t},\n\t\t{\n\t\t\tMethod: \"GET\",\n\t\t\tURL: \"/Courses/GetAllClinicalCases\",\n\t\t\tFunction: courses.GetAllClinicalCases,\n\t\t\tBody: `{\"CourseID\": 1}`,\n\t\t\tExpectedBody: `[{\"ID\":1,\"CourseID\":1,\"ClinicalCaseID\":1,\"Displayable\":1}]`,\n\t\t\tStatusCode: http.StatusOK,\n\t\t},\n\t\t{\n\t\t\tMethod: \"GET\",\n\t\t\tURL: \"/Courses/GetAllClinicalCases\",\n\t\t\tFunction: courses.GetAllClinicalCases,\n\t\t\tBody: `{\"CourseID\": 2}`,\n\t\t\tExpectedBody: `[{\"ID\":2,\"CourseID\":2,\"ClinicalCaseID\":2,\"Displayable\":1}]`,\n\t\t\tStatusCode: http.StatusOK,\n\t\t},\n\t\t{\n\t\t\tMethod: \"GET\",\n\t\t\tURL: \"/Courses/GetAllClinicalCases\",\n\t\t\tFunction: courses.GetAllClinicalCases,\n\t\t\tBody: ``,\n\t\t\tExpectedBody: `CourseID is empty or not valid`,\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t},\n\t}\n}", "func (r DescribeVoicesRequest) Send(ctx context.Context) (*DescribeVoicesResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeVoicesResponse{\n\t\tDescribeVoicesOutput: r.Request.Data.(*DescribeVoicesOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeFleetsRequest) Send(ctx context.Context) (*DescribeFleetsResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeFleetsResponse{\n\t\tDescribeFleetsOutput: r.Request.Data.(*DescribeFleetsOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (c *CephExporter) Describe(ch chan<- *prometheus.Desc) {\n\tfor _, cc := range c.collectors {\n\t\tcc.Describe(ch)\n\t}\n}", "func (r DescribeContainerInstancesRequest) Send(ctx context.Context) (*DescribeContainerInstancesResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeContainerInstancesResponse{\n\t\tDescribeContainerInstancesOutput: r.Request.Data.(*DescribeContainerInstancesOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (*accountingCollector) Describe(ch chan<- *prometheus.Desc) {\n\tch <- inlineActiveFlowsDesc\n\tch <- inlineIpv4ActiveFlowsDesc\n\tch <- inlineIpv6ActiveFlowsDesc\n\n\tch <- inlineFlowsDesc\n\tch <- inlineIpv4TotalFlowsDesc\n\tch <- inlineIpv6TotalFlowsDesc\n\n\tch <- inlineFlowCreationFailuresDesc\n\tch <- inlineIpv4FlowCreationFailuresDesc\n\tch <- inlineIpv6FlowCreationFailuresDesc\n}", "func (c *LoadBalancerCollector) Describe(ch chan<- *prometheus.Desc) {\n\tch <- c.Created\n\tch <- c.Services\n\tch <- c.MaxServices\n\tch <- c.Targets\n\tch <- c.MaxTargets\n\tch <- c.TargetsHealthy\n\tch <- c.TargetsUnhealthy\n\tch <- c.TargetsUnknown\n\tch <- c.AssignedCertificates\n\tch <- c.MaxAssignedCertificates\n\tch <- c.IngoingTraffic\n\tch <- c.OutgoingTraffic\n\tch <- c.IncludedTraffic\n\tch <- c.Connections\n\tch <- c.MaxConnections\n\tch <- c.ConnectionsPerSecond\n\tch <- c.RequestsPerSecond\n\tch <- c.IncomingBandwidth\n\tch <- c.OutgoingBandwidth\n}", "func (r OutputService10TestCaseOperation1Request) Send(ctx context.Context) (*OutputService10TestCaseOperation1Response, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &OutputService10TestCaseOperation1Response{\n\t\tOutputService10TestShapeOutputService10TestCaseOperation1Output: r.Request.Data.(*OutputService10TestShapeOutputService10TestCaseOperation1Output),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func TestShowCase(t *testing.T) {\n\tt.Log(\"Testing showcase fetching...\")\n\n\t// Send GET request to 'api/stories/showcase'.\n\tshowCaseUrl := \"http://localhost:8020/api/stories/showcase\"\n\tt.Logf(\"Sending GET request to\\n%v...\\n\", showCaseUrl)\n\n\tres, err := request(\"GET\", showCaseUrl, \"\")\n\tif err != nil {\n\t\tt.Errorf(\"%v\\n\", err)\n\t}\n\tdefer res.Body.Close()\n\n\t// Pull the JSON object out of the response body.\n\tstories := []Story{}\n\terr = json.NewDecoder(res.Body).Decode(&stories)\n\tif err != nil {\n\t\tt.Errorf(\"Invalid JSON object in response body \\n%v\\n\", err)\n\t}\n\n\t// The response body should contain 3 stories.\n\tif len(stories) < 3 {\n\t\tt.Errorf(\"Received only %d stories\\n\", len(stories))\n\t\treturn\n\t}\n\n\t// Make sure the received stories can be retrieved\n\t// from a GET request to 'api/stories/story/<story_id>'\n\tfor i, story := range stories {\n\n\t\t// Check whether 2 copies of the same story were received.\n\t\tfor otherI, otherStory := range stories {\n\t\t\tif i == otherI {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif story.Id == otherStory.Id {\n\t\t\t\tt.Errorf(\n\t\t\t\t\t\"Received duplicate stories:\\n%v\\n%v\\n\",\n\t\t\t\t\tstory.Title, otherStory.Title,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\t// Send a GET request to 'api/stories/story/<story_id>'.\n\t\turl := concat(\n\t\t\t\"http://localhost:8020/api/stories/story/\", story.Id.Hex(),\n\t\t)\n\n\t\texpectedStatus := http.StatusOK\n\t\tres, err := http.Get(url)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Failed to send request to %v\\n%v\\n\", url, err)\n\t\t} else if res.StatusCode != expectedStatus {\n\t\t\tt.Errorf(\n\t\t\t\t\"Expected status code %v, got %v\\n\",\n\t\t\t\texpectedStatus, res.StatusCode,\n\t\t\t)\n\t\t} else {\n\t\t\tt.Logf(\"Response received from \\n%v\\n\", url)\n\t\t}\n\n\t\t// Convert the JSON object in the response body to a story type.\n\t\tresStory := Story{}\n\t\terr = json.NewDecoder(res.Body).Decode(&resStory)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Invalid JSON object in response body \\n%v\\n\", err)\n\t\t}\n\t\tres.Body.Close()\n\n\t\t// Make sure the Title property in the 'api/stories/story' response\n\t\t// matches the one for the story in the\n\t\t// 'api/stories/showcase' response.\n\t\tif resStory.Title != story.Title {\n\t\t\tt.Errorf(\n\t\t\t\t\"Data received from %v differs from data received from %v\\n\",\n\t\t\t\tshowCaseUrl, url,\n\t\t\t)\n\t\t}\n\n\t}\n}", "func (r GetDiscoverySummaryRequest) Send(ctx context.Context) (*GetDiscoverySummaryResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &GetDiscoverySummaryResponse{\n\t\tGetDiscoverySummaryOutput: r.Request.Data.(*GetDiscoverySummaryOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (t *Test) Run(tc *TestSuite) error {\n\n\tmqutil.Logger.Print(\"\\n--- \" + t.Name)\n\tfmt.Printf(\"\\nRunning test case: %s\\n\", t.Name)\n\terr := t.ResolveParameters(tc)\n\tif err != nil {\n\t\tfmt.Printf(\"... Fail\\n... %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\treq := resty.R()\n\tif len(tc.ApiToken) > 0 {\n\t\treq.SetAuthToken(tc.ApiToken)\n\t} else if len(tc.Username) > 0 {\n\t\treq.SetBasicAuth(tc.Username, tc.Password)\n\t}\n\n\tpath := GetBaseURL(t.db.Swagger) + t.SetRequestParameters(req)\n\tvar resp *resty.Response\n\n\tt.startTime = time.Now()\n\tswitch t.Method {\n\tcase mqswag.MethodGet:\n\t\tresp, err = req.Get(path)\n\tcase mqswag.MethodPost:\n\t\tresp, err = req.Post(path)\n\tcase mqswag.MethodPut:\n\t\tresp, err = req.Put(path)\n\tcase mqswag.MethodDelete:\n\t\tresp, err = req.Delete(path)\n\tcase mqswag.MethodPatch:\n\t\tresp, err = req.Patch(path)\n\tcase mqswag.MethodHead:\n\t\tresp, err = req.Head(path)\n\tcase mqswag.MethodOptions:\n\t\tresp, err = req.Options(path)\n\tdefault:\n\t\treturn mqutil.NewError(mqutil.ErrInvalid, fmt.Sprintf(\"Unknown method in test %s: %v\", t.Name, t.Method))\n\t}\n\tt.stopTime = time.Now()\n\tfmt.Printf(\"... call completed: %f seconds\\n\", t.stopTime.Sub(t.startTime).Seconds())\n\n\tif err != nil {\n\t\tt.err = mqutil.NewError(mqutil.ErrHttp, err.Error())\n\t} else {\n\t\tmqutil.Logger.Print(resp.Status())\n\t\tmqutil.Logger.Println(string(resp.Body()))\n\t}\n\terr = t.ProcessResult(resp)\n\treturn err\n}", "func (r DescribeDatastoreRequest) Send() (*DescribeDatastoreOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DescribeDatastoreOutput), nil\n}", "func (r OutputService8TestCaseOperation1Request) Send(ctx context.Context) (*OutputService8TestCaseOperation1Response, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &OutputService8TestCaseOperation1Response{\n\t\tOutputService8TestShapeOutputService8TestCaseOperation1Output: r.Request.Data.(*OutputService8TestShapeOutputService8TestCaseOperation1Output),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (collector *Collector) Describe(ch chan<- *prometheus.Desc) {\n\tch <- collector.incidentsCreatedCount\n}", "func (r OutputService14TestCaseOperation1Request) Send(ctx context.Context) (*OutputService14TestCaseOperation1Response, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &OutputService14TestCaseOperation1Response{\n\t\tOutputService14TestShapeOutputService14TestCaseOperation1Output: r.Request.Data.(*OutputService14TestShapeOutputService14TestCaseOperation1Output),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func getBudgetCredits(e *httpexpect.Expect, t *testing.T) {\n\ttestCases := []testCase{\n\t\tnotLoggedTestCase, // 0 : missing token\n\t\t{\n\t\t\tToken: testCtx.User.Token,\n\t\t\tStatus: http.StatusOK,\n\t\t\tBodyContains: []string{\"BudgetCredits\", \"BudgetChapter\"},\n\t\t\tArraySize: 78,\n\t\t\tCountItemName: `\"id\"`,\n\t\t}, // 1 : ok\n\t}\n\n\tf := func(tc testCase) *httpexpect.Response {\n\t\treturn e.GET(\"/api/budget_credits\").\n\t\t\tWithHeader(\"Authorization\", \"Bearer \"+tc.Token).Expect()\n\t}\n\tfor _, r := range chkTestCases(testCases, f, \"GetBudgetCredits\") {\n\t\tt.Error(r)\n\t}\n}", "func (e *ebpfConntracker) Describe(ch chan<- *prometheus.Desc) {\n\tch <- conntrackerTelemetry.registersTotal\n}", "func (c *ComputeCollector) Describe(ch chan<- *prometheus.Desc) {\n\tch <- c.Instances\n\tch <- c.ForwardingRules\n}", "func MessageCases(fs Fighters) string {\n\n\tswitch length := len(fs.Fighters); {\n\tcase length == 1:\n\t\treturn evaluatePowerLvl(fs.Fighters[0])\n\n\tcase length == 2:\n\t\treturn compareTwoPowers(fs.Fighters[0], fs.Fighters[1])\n\n\tcase length > 2:\n\t\treturn compareOverTwoPowers(fs)\n\n\tdefault:\n\t\tinternal.Logger.Error().Msg(\"Improperly formated JSON message\")\n\t\treturn \"You did not format your JSON message properly, check the console log and the README.\"\n\t}\n}", "func (r DescribeAccessPointsRequest) Send(ctx context.Context) (*DescribeAccessPointsResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeAccessPointsResponse{\n\t\tDescribeAccessPointsOutput: r.Request.Data.(*DescribeAccessPointsOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (client *CapacitiesClient) listCreateRequest(ctx context.Context, options *CapacitiesClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/capacities\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-01-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (c *Controller) Send() (nbMetrics, nbValues int, err error) {\n\tif len(c.flows) == 0 && len(c.levels) == 0 {\n\t\treturn\n\t}\n\t// compute stats\n\tfor _, levelMetric := range c.levels {\n\t\tif len(levelMetric.Values) != 0 {\n\t\t\tnbMetrics++\n\t\t\tnbValues += len(levelMetric.Values)\n\t\t}\n\t}\n\tfor _, flowMetric := range c.flows {\n\t\tif len(flowMetric.Values) != 0 {\n\t\t\tnbMetrics++\n\t\t\tnbValues += len(flowMetric.Values)\n\t\t}\n\t}\n\t// marshall buffers into jsonl payload\n\tpayload, err := c.preparePayload()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"can't marshall internal buffers as JSON line payload: %w\", err)\n\t\treturn\n\t}\n\t// send payload\n\tif err = c.push(payload.String()); err != nil {\n\t\terr = fmt.Errorf(\"failed to push the metrics to the victoria metrics server: %w\", err)\n\t\treturn\n\t}\n\t// cleanup\n\tc.levels = make(map[string]JSONLineMetric, len(c.levels))\n\tc.flows = make(map[string]JSONLineMetric, len(c.flows))\n\treturn\n}", "func (r DescribeAssociationRequest) Send() (*DescribeAssociationOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DescribeAssociationOutput), nil\n}", "func (r DescribeWorkforceRequest) Send(ctx context.Context) (*DescribeWorkforceResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeWorkforceResponse{\n\t\tDescribeWorkforceOutput: r.Request.Data.(*DescribeWorkforceOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func getAllCust(w http.ResponseWriter, r *http.Request) {\n\t// Set dummy values\n\tcust := []Customer{\n\t\t{Name: \"Christian Hernandez\", City: \"Los Angeles, CA\", Zipcode: \"90293\"},\n\t\t{Name: \"Kacie\", City: \"Oneill\", Zipcode: \"12345\"},\n\t}\n\n\t//if someone requests XML, send it to them. If they request JSON, send that\n\tif r.Header.Get(\"Content-Type\") == \"application/xml\" {\n\n\t\t// set the right header for XML\n\t\tw.Header().Add(\"Content-Type\", \"application/xml\")\n\n\t\t// encode struct as XML and print it out\n\t\txml.NewEncoder(w).Encode(cust)\n\n\t} else {\n\t\t// set the right header for JSON\n\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\n\t\t// encode struct as JSON and print it out\n\t\tjson.NewEncoder(w).Encode(cust)\n\n\t}\n\n}", "func (r OutputService9TestCaseOperation1Request) Send(ctx context.Context) (*OutputService9TestCaseOperation1Response, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &OutputService9TestCaseOperation1Response{\n\t\tOutputService9TestShapeOutputService9TestCaseOperation1Output: r.Request.Data.(*OutputService9TestShapeOutputService9TestCaseOperation1Output),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (r DescribeChannelRequest) Send() (*DescribeChannelOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DescribeChannelOutput), nil\n}", "func main() {\n\tvar caseDir = flag.String(\"d\", \"\", \"input the case dir\")\n\tvar caseFile = flag.String(\"f\", \"\", \"input the file url, case.tar.gz\")\n\tvar caseName = flag.String(\"n\", \"\", \"input the 'case name' in the case dir, if there were multiply cases in the case dir. You can use this with -d and -f.\")\n\tvar caseID = flag.String(\"id\", \"\", \"input the 'case id' provided by 'Test Case server', please make sure the the tcserver is running.\")\n\tflag.Parse()\n\n\tvar warning_msg []liboct.ValidatorMessage\n\tvar err_msg []liboct.ValidatorMessage\n\tif len(*caseID) > 0 {\n\t} else if len(*caseFile) > 0 {\n\t\tliboct.ValidateByFile(*caseFile)\n\t} else if len(*caseDir) > 0 {\n\t\twarning_msg, err_msg = liboct.ValidateByDir(*caseDir, *caseName)\n\t} else {\n\t\tfmt.Println(\"Please input the test case\")\n\t\treturn\n\t}\n\tif len(err_msg) > 0 {\n\t\tfmt.Printf(\"The case is invalid, there are %d error(errors) and %d warning(warnings)\", len(err_msg), len(warning_msg))\n\t\tfmt.Println(\"Please see the details:\")\n\t\tfmt.Println(err_msg)\n\t\tfmt.Println(warning_msg)\n\t} else if len(warning_msg) > 0 {\n\t\tfmt.Printf(\"The case is OK, but there are %d warning(warnings)\", len(warning_msg))\n\t\tfmt.Println(\"Please see the details:\")\n\t\tfmt.Println(warning_msg)\n\t} else {\n\t\tfmt.Println(\"Good case.\")\n\t}\n}", "func (m *metricVec) Describe(ch chan<- *Desc) { m.metricMap.Describe(ch) }", "func (d *DiskEncryptionSetsServerTransport) Do(req *http.Request) (*http.Response, error) {\n\trawMethod := req.Context().Value(runtime.CtxAPINameKey{})\n\tmethod, ok := rawMethod.(string)\n\tif !ok {\n\t\treturn nil, nonRetriableError{errors.New(\"unable to dispatch request, missing value for CtxAPINameKey\")}\n\t}\n\n\tvar resp *http.Response\n\tvar err error\n\n\tswitch method {\n\tcase \"DiskEncryptionSetsClient.BeginCreateOrUpdate\":\n\t\tresp, err = d.dispatchBeginCreateOrUpdate(req)\n\tcase \"DiskEncryptionSetsClient.BeginDelete\":\n\t\tresp, err = d.dispatchBeginDelete(req)\n\tcase \"DiskEncryptionSetsClient.Get\":\n\t\tresp, err = d.dispatchGet(req)\n\tcase \"DiskEncryptionSetsClient.NewListPager\":\n\t\tresp, err = d.dispatchNewListPager(req)\n\tcase \"DiskEncryptionSetsClient.NewListAssociatedResourcesPager\":\n\t\tresp, err = d.dispatchNewListAssociatedResourcesPager(req)\n\tcase \"DiskEncryptionSetsClient.NewListByResourceGroupPager\":\n\t\tresp, err = d.dispatchNewListByResourceGroupPager(req)\n\tcase \"DiskEncryptionSetsClient.BeginUpdate\":\n\t\tresp, err = d.dispatchBeginUpdate(req)\n\tdefault:\n\t\terr = fmt.Errorf(\"unhandled API %s\", method)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func (client *CapacitiesClient) getDetailsCreateRequest(ctx context.Context, resourceGroupName string, dedicatedCapacityName string, options *CapacitiesClientGetDetailsOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif dedicatedCapacityName == \"\" {\n\t\treturn nil, errors.New(\"parameter dedicatedCapacityName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{dedicatedCapacityName}\", url.PathEscape(dedicatedCapacityName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-01-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (a *AssembliesApiService) GetFeatureSpecs(ctx _context.Context, did string, wvm string, wvmid string, eid string) (BtFeatureSpecsResponse664, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue BtFeatureSpecsResponse664\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/assemblies/d/{did}/{wvm}/{wvmid}/e/{eid}/featurespecs\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"did\"+\"}\", _neturl.QueryEscape(parameterToString(did, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"wvm\"+\"}\", _neturl.QueryEscape(parameterToString(wvm, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"wvmid\"+\"}\", _neturl.QueryEscape(parameterToString(wvmid, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"eid\"+\"}\", _neturl.QueryEscape(parameterToString(eid, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/vnd.onshape.v1+json;charset=UTF-8;qs=0.1\", \"application/json;charset=UTF-8; qs=0.09\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v BtFeatureSpecsResponse664\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (d *Dao) Case(c context.Context, arg *blocked.ArgCaseSearch) (ids []int64, pager *blocked.Pager, err error) {\n\treq := d.elastic.NewRequest(blocked.BusinessBlockedCase).Index(blocked.TableBlockedCase).Fields(\"id\")\n\tif arg.Keyword != blocked.SearchDefaultString {\n\t\treq.WhereLike([]string{\"origin_content\"}, []string{arg.Keyword}, true, elastic.LikeLevelHigh)\n\t}\n\tif arg.OriginType != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"origin_type\", arg.OriginType)\n\t}\n\tif arg.Status != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"status\", arg.Status)\n\t}\n\tif arg.CaseType != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"case_type\", arg.CaseType)\n\t}\n\tif arg.UID != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"mid\", arg.UID)\n\t}\n\tif arg.OPID != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"oper_id\", arg.OPID)\n\t}\n\treq.WhereRange(\"start_time\", arg.TimeFrom, arg.TimeTo, elastic.RangeScopeLcRc)\n\treq.Pn(arg.PN).Ps(arg.PS).Order(arg.Order, arg.Sort)\n\tvar res *search.ReSearchData\n\tif err = req.Scan(c, &res); err != nil {\n\t\terr = errors.Errorf(\"elastic search(%s) error(%v)\", req.Params(), err)\n\t\treturn\n\t}\n\tids, pager = pagerExtra(res)\n\treturn\n}", "func (a *aboutEndpoint) HandleGET(w http.ResponseWriter, r *http.Request, resources []string) {\n\n\tdata := map[string]interface{}{\n\t\t\"product\": \"RUFS\",\n\t\t\"version\": config.ProductVersion,\n\t}\n\n\t// Write data\n\n\tw.Header().Set(\"content-type\", \"application/json; charset=utf-8\")\n\n\tret := json.NewEncoder(w)\n\tret.Encode(data)\n}", "func (v *VirtualNetworkGatewayConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) {\n\trawMethod := req.Context().Value(runtime.CtxAPINameKey{})\n\tmethod, ok := rawMethod.(string)\n\tif !ok {\n\t\treturn nil, nonRetriableError{errors.New(\"unable to dispatch request, missing value for CtxAPINameKey\")}\n\t}\n\n\tvar resp *http.Response\n\tvar err error\n\n\tswitch method {\n\tcase \"VirtualNetworkGatewayConnectionsClient.BeginCreateOrUpdate\":\n\t\tresp, err = v.dispatchBeginCreateOrUpdate(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.BeginDelete\":\n\t\tresp, err = v.dispatchBeginDelete(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.Get\":\n\t\tresp, err = v.dispatchGet(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.BeginGetIkeSas\":\n\t\tresp, err = v.dispatchBeginGetIkeSas(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.GetSharedKey\":\n\t\tresp, err = v.dispatchGetSharedKey(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.NewListPager\":\n\t\tresp, err = v.dispatchNewListPager(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.BeginResetConnection\":\n\t\tresp, err = v.dispatchBeginResetConnection(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.BeginResetSharedKey\":\n\t\tresp, err = v.dispatchBeginResetSharedKey(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.BeginSetSharedKey\":\n\t\tresp, err = v.dispatchBeginSetSharedKey(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.BeginStartPacketCapture\":\n\t\tresp, err = v.dispatchBeginStartPacketCapture(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.BeginStopPacketCapture\":\n\t\tresp, err = v.dispatchBeginStopPacketCapture(req)\n\tcase \"VirtualNetworkGatewayConnectionsClient.BeginUpdateTags\":\n\t\tresp, err = v.dispatchBeginUpdateTags(req)\n\tdefault:\n\t\terr = fmt.Errorf(\"unhandled API %s\", method)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func (h *halCtlSuite) TestEnicsGet(c *C) {\n\tvar err error\n\tvar resp string\n\treq := &halproto.InterfaceGetRequest{\n\t\tKeyOrHandle: &halproto.InterfaceKeyHandle{\n\t\t\tKeyOrHandle: &halproto.InterfaceKeyHandle_InterfaceId{\n\t\t\t\tInterfaceId: uint64(1),\n\t\t\t},\n\t\t},\n\t}\n\tifGetReqMsg := &halproto.InterfaceGetRequestMsg{\n\t\tRequest: []*halproto.InterfaceGetRequest{req},\n\t}\n\n\tAssertEventually(c, func() (bool, interface{}) {\n\t\tresp, err = h.getEnics(ifGetReqMsg)\n\t\treturn err == nil, nil\n\t}, \"Failed to get Enics\")\n\tAssertEquals(c, true, strings.Contains(resp, \"enic-4\"), fmt.Sprintf(\"halctl returned: %v\", resp))\n}", "func (r DescribeIdentityPoolRequest) Send(ctx context.Context) (*DescribeIdentityPoolResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeIdentityPoolResponse{\n\t\tDescribeIdentityPoolOutput: r.Request.Data.(*DescribeIdentityPoolOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func (c *InterfacesCollector) Describe(ch chan<- *prometheus.Desc) {\n\tfor _, m := range c.collectors() {\n\t\tm.Describe(ch)\n\t}\n}" ]
[ "0.5720971", "0.5065622", "0.47158307", "0.46777928", "0.46056092", "0.4560555", "0.45494747", "0.4493546", "0.44670996", "0.43961352", "0.43052062", "0.4301415", "0.4285017", "0.42818654", "0.42645612", "0.42610997", "0.4260954", "0.42381668", "0.4226355", "0.41868818", "0.41830936", "0.41579446", "0.41150984", "0.41126555", "0.4109906", "0.4092033", "0.40732065", "0.40721208", "0.40627986", "0.40619475", "0.406187", "0.40469322", "0.4045776", "0.40452382", "0.4044053", "0.40418404", "0.40407738", "0.4026761", "0.4006982", "0.39954406", "0.3994673", "0.3992253", "0.39653635", "0.39619938", "0.3956526", "0.39529693", "0.393922", "0.39232874", "0.39179298", "0.390559", "0.38875544", "0.38792577", "0.38768354", "0.38733706", "0.3867585", "0.38663357", "0.38642943", "0.38528812", "0.38500637", "0.38499892", "0.38439167", "0.38416946", "0.38380632", "0.38379967", "0.38320008", "0.38253254", "0.3819746", "0.38171333", "0.38139728", "0.38137314", "0.38129395", "0.3811019", "0.3805348", "0.37993273", "0.37992784", "0.37984905", "0.37984368", "0.3793875", "0.37888816", "0.37819976", "0.37814713", "0.378043", "0.37801892", "0.37770337", "0.37703586", "0.37679675", "0.37617683", "0.3757135", "0.37559226", "0.3755582", "0.3751967", "0.3739838", "0.37395132", "0.37365344", "0.3736436", "0.37356326", "0.37327534", "0.37282825", "0.37281957", "0.37267637" ]
0.67444646
0
SDKResponseMetdata returns the response metadata for the DescribeCases request.
func (r *DescribeCasesResponse) SDKResponseMetdata() *aws.Response { return r.response }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *UpdateCostCategoryDefinitionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeEventCategoriesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService12TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService11TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService14TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService14TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeCertificateResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService8TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService4TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService4TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService10TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService4TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService15TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService11TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateClassifierResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService1TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService1TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService13TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService9TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService4TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService7TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService7TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService5TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService5TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService1TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService2TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService2TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService8TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService10TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService1TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService11TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService3TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService3TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService2TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService6TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *OutputService6TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService10TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService9TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeDimensionKeysResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService3TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService6TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService9TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeNotificationsForBudgetResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService7TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *GetCampaignVersionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *InputService5TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *ListCertificatesByCAResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeDetectorModelResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *GetCorsPolicyResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *GetCertificateResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *ListConstraintsForPortfolioResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateCanaryResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateHITTypeResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeEntityResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeKeyResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeChangeSetResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeDetectorResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeContainerInstancesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateSolutionVersionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *GetEC2RecommendationProjectedMetricsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *AuthorizeIpRulesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *GetCanaryResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *GetInstanceAccessDetailsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DeleteClientCertificateResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *StartAuditMitigationActionsTaskResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeDBClusterParameterGroupsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateClusterResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *GetDiscoverySummaryResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeTaskDefinitionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateVPCAssociationAuthorizationResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeCustomerGatewaysResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *AuthorizeDBSecurityGroupIngressResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeInstancesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeResourceResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateByteMatchSetResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *GetInstanceMetricDataResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeDRTAccessResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *GetCachePolicyResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *ListChangeSetsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeAccountAuditConfigurationResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateNetworkInterfaceResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DeleteHumanTaskUiResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CancelCommandResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateOpenIDConnectProviderResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *ListCandidatesForAutoMLJobResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *RespondToAuthChallengeResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateDBSecurityGroupResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateMatchmakingRuleSetResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeTargetGroupsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *ModifyTrafficMirrorFilterNetworkServicesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeAccessPointsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *ModifyReportDefinitionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *GetApiCacheResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeAssessmentTargetsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *UpdateKeyDescriptionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DeleteChannelResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *CreateDirectConnectGatewayAssociationResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *ExecuteProvisionedProductServiceActionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *DescribeVoicesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "func (r *AdminRespondToAuthChallengeResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}" ]
[ "0.6052566", "0.5981773", "0.5979193", "0.59784687", "0.5964548", "0.59451616", "0.59280354", "0.59241235", "0.5910149", "0.5910149", "0.59068704", "0.5896097", "0.5895423", "0.58784", "0.5873665", "0.5872515", "0.5872515", "0.5867986", "0.586602", "0.58512425", "0.5849684", "0.5849684", "0.5849562", "0.5849562", "0.58474904", "0.5845491", "0.5845491", "0.5844783", "0.5844373", "0.58440423", "0.5842824", "0.58394927", "0.58394927", "0.5830361", "0.58224016", "0.58224016", "0.58181196", "0.58058727", "0.58036536", "0.57920474", "0.5787927", "0.5785433", "0.57826954", "0.5777295", "0.5776542", "0.5771998", "0.5771258", "0.5764448", "0.57532585", "0.57350403", "0.57089233", "0.5701327", "0.56958425", "0.5691784", "0.568779", "0.5683191", "0.5681709", "0.56739694", "0.5672841", "0.56728315", "0.5669625", "0.56687754", "0.5659857", "0.5656836", "0.5654542", "0.56497854", "0.56430316", "0.56356025", "0.56303656", "0.5629107", "0.5626689", "0.56238496", "0.5618609", "0.56140697", "0.56140566", "0.56094855", "0.5603632", "0.55941814", "0.5592053", "0.558322", "0.55830115", "0.55828816", "0.5582428", "0.5578282", "0.55782354", "0.5577242", "0.5575951", "0.5575207", "0.5573865", "0.5569611", "0.556678", "0.55656636", "0.55650437", "0.55625665", "0.5560287", "0.55601066", "0.55592245", "0.55586904", "0.55554324", "0.55512124" ]
0.6943987
0
Custom marshaller for Message, converts unix seconds + offset to RFC3339 format
func (m *Message) MarshalJSON() ([]byte, error) { messageLocation := time.FixedZone("", m.TZ) utc := time.Unix(m.Time, 0) messageTime := utc.In(messageLocation).Format(time.RFC3339) return json.Marshal(&struct { ID string `json:"id"` Name string `json:"name"` Email string `json:"email"` Text string `json:"text"` Time string `json:"time"` }{ ID: m.ID, Name: m.Name, Email: m.Email, Text: m.Text, Time: messageTime, }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func MarshalTime(t time.Time) string {\n\treturn t.Format(time.RFC3339Nano)\n}", "func (m *Message) UnmarshalJSON(data []byte) error {\n\ttype MessageAlias Message\n\taux := &struct {\n\t\tTime string `json:\"time\"`\n\t\t*MessageAlias\n\t}{\n\t\tMessageAlias: (*MessageAlias)(m),\n\t}\n\tif err := json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\tmessageTime, _ := time.Parse(time.RFC3339, aux.Time)\n\t_, timeOffset := messageTime.Zone()\n\tm.Time = messageTime.Unix()\n\tm.TZ = timeOffset\n\treturn nil\n}", "func (t Time) MarshalBinary() ([]byte, error) {}", "func (t Time) MarshalJSON() ([]byte, error) {}", "func (t timeRFC3339) MarshalText() ([]byte, error) {\n\treturn []byte(t.Format(rfc3339Format)), nil\n}", "func (t Timespan) Marshal() string {\n\tconst (\n\t\tday = 24 * time.Hour\n\t)\n\n\tif !t.Valid {\n\t\treturn \"00:00:00\"\n\t}\n\n\t// val is used to track the duration value as we move our parts of our time into our string format.\n\t// For example, after we write to our string the number of days that value had, we remove those days\n\t// from the duration. We continue doing this until val only holds values < 10 millionth of a second (tick)\n\t// as that is the lowest precision in our string representation.\n\tval := t.Value\n\n\tsb := strings.Builder{}\n\n\t// Add a - sign if we have a negative value. Convert our value to positive for easier processing.\n\tif t.Value < 0 {\n\t\tsb.WriteString(\"-\")\n\t\tval = val * -1\n\t}\n\n\t// Only include the day if the duration is 1+ days.\n\tdays := val / day\n\tval = val - (days * day)\n\tif days > 0 {\n\t\tsb.WriteString(fmt.Sprintf(\"%d.\", int(days)))\n\t}\n\n\t// Add our hours:minutes:seconds section.\n\thours := val / time.Hour\n\tval = val - (hours * time.Hour)\n\tminutes := val / time.Minute\n\tval = val - (minutes * time.Minute)\n\tseconds := val / time.Second\n\tval = val - (seconds * time.Second)\n\tsb.WriteString(fmt.Sprintf(\"%02d:%02d:%02d\", int(hours), int(minutes), int(seconds)))\n\n\t// Add our sub-second string representation that is proceeded with a \".\".\n\tmilliseconds := val / time.Millisecond\n\tval = val - (milliseconds * time.Millisecond)\n\tticks := val / tick\n\tif milliseconds > 0 || ticks > 0 {\n\t\tsb.WriteString(fmt.Sprintf(\".%03d%d\", milliseconds, ticks))\n\t}\n\n\t// Remove any trailing 0's.\n\tstr := strings.TrimRight(sb.String(), \"0\")\n\tif strings.HasSuffix(str, \":\") {\n\t\tstr = str + \"00\"\n\t}\n\n\treturn str\n}", "func (t UnixTimestamp) MarshalJSON() ([]byte, error) {\n\treturn []byte(fmt.Sprintf(\"\\\"%d\\\"\", time.Time(t).Unix())), nil\n}", "func (t *timestamp) MarshalJSON() ([]byte, error) {\n\tts := time.Time(*t).Unix()\n\tstamp := fmt.Sprint(ts)\n\treturn []byte(stamp), nil\n}", "func (t *Timestamp) MarshalJSON() ([]byte, error) {\n\tts := time.Time(*t).Unix()\n\tstamp := fmt.Sprint(ts)\n\n\treturn []byte(stamp), nil\n}", "func (t *Timestamp) MarshalJSON() ([]byte, error) {\n\tts := time.Time(*t).Unix()\n\tstamp := fmt.Sprint(ts)\n\n\treturn []byte(stamp), nil\n}", "func toPayload(in interface{}, pretty bool) ([]byte, error) {\n\tvar b []byte\n\tvar err error\n\tif b, err = json.Marshal(in); err != nil {\n\t\treturn nil, err\n\t}\n\tvar m map[string]interface{}\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar marshaller func(m map[string]interface{})\n\tmarshaller = func(m map[string]interface{}) {\n\t\tfor k, v := range m {\n\t\t\tif child, ok := v.(map[string]interface{}); ok {\n\t\t\t\tmarshaller(child)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif s, ok := v.(string); ok {\n\t\t\t\tif t, e := time.Parse(time.RFC3339Nano, s); e == nil {\n\t\t\t\t\tif t.IsZero() {\n\t\t\t\t\t\tdelete(m, k)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tmarshaller(m)\n\tif pretty {\n\t\tjson.MarshalIndent(m, \"\", \" \")\n\t}\n\treturn json.Marshal(m)\n}", "func main() {\n\teur, err := time.LoadLocation(\"Europe/Vienna\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tt := time.Date(2017, 11, 20, 11, 20, 10, 0, eur)\n\n\t// json.Marshaler interface\n\tb, err := t.MarshalJSON()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Serialized as RFC 3339:\", string(b))\n\tt2 := time.Time{}\n\tt2.UnmarshalJSON(b)\n\tfmt.Println(\"Deserialized from RFC 3339:\", t2)\n\n\t// Serialize as epoch\n\tepoch := t.Unix()\n\tfmt.Println(\"Serialized as Epoch:\", epoch)\n\n\t// Deserialize epoch\n\tjsonStr := fmt.Sprintf(\"{\\\"created\\\":%d}\", epoch)\n\tdata := struct {\n\t\tCreated int64 `json:\"created\"`\n\t}{}\n\tjson.Unmarshal([]byte(jsonStr), &data)\n\tdeserialied := time.Unix(data.Created, 0)\n\tfmt.Println(\"Deserialized from Epoch:\", deserialied)\n}", "func (t JSONTime)MarshalJSON(b []byte) (err error) {\n s := string(b)\n logging.Trace(currentCtx,\"JSONTime(String)=%s\",s)\n if s == \"null\" || s == \"\" {\n t.Time = time.Time{}\n return\n }\n tt, err := time.Parse(jsonTimeLayout, s)\n t = JSONTime{tt}\n return\n}", "func TestSerializeTimestampRFC3339(t *testing.T) {\n\tt.Parallel()\n\n\tcreated := time.Now().UTC()\n\tmodified := created.Add(time.Hour)\n\n\tdeployment, err := makeUntypedDeploymentTimestamp(\"b\", \"123abc\",\n\t\t\"v1:C7H2a7/Ietk=:v1:yfAd1zOi6iY9DRIB:dumdsr+H89VpHIQWdB01XEFqYaYjAg==\", &created, &modified)\n\tassert.NoError(t, err)\n\n\tcreatedStr := created.Format(time.RFC3339Nano)\n\tmodifiedStr := modified.Format(time.RFC3339Nano)\n\tassert.Contains(t, string(deployment.Deployment), createdStr)\n\tassert.Contains(t, string(deployment.Deployment), modifiedStr)\n}", "func (blob *Blob) RFC822Z() string { return blob.Time.Format(time.RFC822Z) }", "func (blob *Blob) RFC822Z() string { return blob.Time.Format(time.RFC822Z) }", "func (t Unix) MarshalJSON() ([]byte, error) {\n\tsecs := time.Time(t).Unix()\n\treturn []byte(strconv.FormatInt(secs, 10)), nil\n}", "func packTime(msg *[]byte, the_time int64) {\n\tfor i := 0; i < 8; i++ {\n\t\t(*msg)[i+4] = byte(the_time >> uint(i*8))\n\t}\n}", "func (e EventRealTimeMetaChannelPrefix) Marshall(writer io.Writer) error {\n\tif err := marshallVarInt(writer, e.DeltaTime); err != nil {\n\t\treturn err\n\t}\n\n\t_, err := writer.Write([]byte{0xff, 0x20, 0x01, e.Prefix})\n\treturn err\n}", "func (ss StatsSummaryLastUpdated) MarshalJSON() ([]byte, error) {\n\tresp := struct {\n\t\tSummaryTime *string `json:\"summaryTime\"`\n\t}{}\n\tif ss.SummaryTime != nil {\n\t\tresp.SummaryTime = util.StrPtr(ss.SummaryTime.Format(TimeLayout))\n\t}\n\treturn json.Marshal(&resp)\n}", "func (t Time) MarshalText() ([]byte, error) {}", "func (t UnixTime) MarshalJSON() ([]byte, error) {\n\treturn []byte(fmt.Sprintf(\"%d\", time.Time(t).Unix())), nil\n}", "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\t// Per Node.js epochs, we need milliseconds\n\treturn []byte(strconv.FormatInt(t.JSEpoch(), 10)), nil\n}", "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\tts := t.Time().Unix()\n\tstamp := fmt.Sprint(ts)\n\n\treturn []byte(stamp), nil\n}", "func (n NullTimestamp) MarshalJSON() ([]byte, error) { return nulljson(n.Valid, n.Timestamp) }", "func (t StTimestamp) MarshalJSON() ([]byte, error) {\n\treturn []byte(fmt.Sprintf(`\"%s\"`, t.Format(\"2006-01-02 15:04:05\"))), nil\n}", "func marshalInfo(version string, t time.Time) string {\n\treturn fmt.Sprintf(\n\t\t`{\"Version\":%q,\"Time\":%q}`,\n\t\tversion,\n\t\tt.UTC().Format(time.RFC3339Nano),\n\t)\n}", "func (u UTCClipTime) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tobjectMap[\"@odata.type\"] = \"#Microsoft.Media.UtcClipTime\"\n\tpopulateTimeRFC3339(objectMap, \"time\", u.Time)\n\treturn json.Marshal(objectMap)\n}", "func (e EventRealTimeTimingClock) Marshall(writer io.Writer) error {\n\tif err := marshallVarInt(writer, e.DeltaTime); err != nil {\n\t\treturn err\n\t}\n\n\t_, err := writer.Write([]byte{0xf8})\n\treturn err\n}", "func MarshalTimestamp(t time.Time) graphql.Marshaler {\n\treturn graphql.WriterFunc(func(w io.Writer) {\n\t\tio.WriteString(w, strconv.FormatInt(t.Unix(), 10))\n\t})\n}", "func MarshalTimestamp(t time.Time) graphql.Marshaler {\n\treturn graphql.WriterFunc(func(w io.Writer) {\n\t\tio.WriteString(w, strconv.FormatInt(t.Unix(), 10))\n\t})\n}", "func (val Time) MarshalJSON() ([]byte, error) {\n\tsec := int64(val) / 1000000\n\tusec := int64(val) % 1000000\n\treturn []byte(fmt.Sprintf(\"%d.%06d\", sec, usec)), nil\n}", "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\t// write seconds.\n\ttt := time.Time(t)\n\tb := make([]byte, 0, 20)\n\tb = strconv.AppendInt(b, tt.Unix(), 10)\n\tb = append(b, '.')\n\n\t// write microsecond\n\tm := (time.Duration(tt.Nanosecond()) + 500*time.Nanosecond) / time.Microsecond\n\tswitch {\n\tcase m < 10:\n\t\tb = append(b, '0', '0', '0', '0', '0')\n\tcase m < 100:\n\t\tb = append(b, '0', '0', '0', '0')\n\tcase m < 1000:\n\t\tb = append(b, '0', '0', '0')\n\tcase m < 10000:\n\t\tb = append(b, '0', '0')\n\tcase m < 100000:\n\t\tb = append(b, '0')\n\t}\n\tb = strconv.AppendInt(b, int64(m), 10)\n\treturn b, nil\n}", "func parseUnixTimeString(ref *ShapeRef, memName, v string) string {\n\tref.API.AddSDKImport(\"private/protocol\")\n\treturn fmt.Sprintf(\"%s: %s,\\n\", memName, inlineParseModeledTime(protocol.UnixTimeFormatName, v))\n}", "func (v Timestamp) MarshalJSON() ([]byte, error) {\n\tif !v.Valid() {\n\t\treturn nullBytes, nil\n\t}\n\treturn []byte(strconv.FormatInt(v.time.Unix(), 10)), nil\n}", "func (t *TimeRFC1123) MarshalXML(e *xml.Encoder, start xml.StartElement) error {\n\treturn e.EncodeElement(time.Time(*t).Format(time.RFC1123), start)\n}", "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\t// Always send back in UTC with nanoseconds\n\ts := t.Time().UTC().Format(time.RFC3339Nano)\n\treturn []byte(`\"` + s + `\"`), nil\n}", "func (t *Time) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(t.Unix())\n}", "func (t *Timestamp) MarshalJSON() ([]byte, error) {\n\tif t != nil {\n\t\tts := time.Time(*t)\n\t\treturn []byte(fmt.Sprintf(`\"%d\"`, ts.UnixNano()/int64(time.Millisecond))), nil\n\t}\n\treturn nil, nil\n}", "func (t *JSONTime) MarshalJSON() ([]byte, error) {\n\t//do your serializing here\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", t.Time.Format(\"2006-01-02 15:04\"))\n\treturn []byte(stamp), nil\n}", "func (trz TimeRfc1123z) MarshalXML(e *xml.Encoder, start xml.StartElement) error {\n\treturn e.EncodeElement(time.Time(trz).Format(time.RFC1123Z), start)\n}", "func (t *Timestamp) UnmarshalJSON(data []byte) (err error) {\n\tt.Time, err = time.Parse(`\"`+time.RFC3339+`\"`, string(data))\n\treturn\n}", "func MarshalTimestamp(s *jsonplugin.MarshalState, v *timestamppb.Timestamp) {\n\tif v == nil {\n\t\ts.WriteNil()\n\t\treturn\n\t}\n\ts.WriteTime(v.AsTime())\n}", "func RFC3339(ts *tspb.Timestamp) string {\n\tt, err := ptypes.Timestamp(ts)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn t.Format(time.RFC3339)\n}", "func (xt XSDTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error {\n\tif !xt.innerTime.IsZero() {\n\t\tdateTimeLayout := time.RFC3339Nano\n\t\tif xt.innerTime.Nanosecond() == 0 {\n\t\t\tdateTimeLayout = time.RFC3339\n\t\t}\n\t\t// split off date portion\n\t\tdateAndTime := strings.SplitN(xt.innerTime.Format(dateTimeLayout), \"T\", 2)\n\t\ttimeString := dateAndTime[1]\n\t\tif !xt.hasTz {\n\t\t\ttoks := strings.SplitN(timeString, \"Z\", 2)\n\t\t\ttoks = strings.SplitN(toks[0], \"+\", 2)\n\t\t\ttoks = strings.SplitN(toks[0], \"-\", 2)\n\t\t\ttimeString = toks[0]\n\t\t}\n\t\te.EncodeElement(timeString, start)\n\t}\n\treturn nil\n}", "func (rd *requestDuration) MarshalJSON() ([]byte, error) {\n\tstamp := fmt.Sprint(rd)\n\treturn []byte(stamp), nil\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\n\t// CoinCap timestamp is unix milliseconds\n\tm, err := strconv.ParseInt(string(b), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Convert from milliseconds to nanoseconds\n\tt.Time = time.Unix(0, m*1e6)\n\treturn nil\n}", "func (t *LastAccessTime) Serialize() ([]byte, error) {\n\tb := make([]byte, 8)\n\tbinary.PutVarint(b, t.Time.Unix())\n\treturn b, nil\n}", "func (t unixMilli) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(t.UnixNano() / int64(time.Millisecond))\n}", "func (v TransactionsSinceIDRequest) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel(w, v)\n}", "func (e EventRealTimeMetaTempo) Marshall(writer io.Writer) error {\n\tif err := marshallVarInt(writer, e.DeltaTime); err != nil {\n\t\treturn err\n\t}\n\n\thh := uint8(e.MicroSecondPerQuarterNote >> 16)\n\tmm := uint8(e.MicroSecondPerQuarterNote >> 8)\n\tll := uint8(e.MicroSecondPerQuarterNote)\n\t_, err := writer.Write([]byte{0xff, 0x51, 0x03, hh, mm, ll})\n\treturn err\n}", "func (s AssetPropertyTimestamp) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.OffsetInNanos != nil {\n\t\tv := *s.OffsetInNanos\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"offsetInNanos\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TimeInSeconds != nil {\n\t\tv := *s.TimeInSeconds\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"timeInSeconds\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (t *Timestamp) MarshalJSON() ([]byte, error) {\n\treturn []byte(t.String()), nil\n}", "func buildMessageStruct(message string) interface{} {\n\tvar data map[string]interface{}\n\terr := json.Unmarshal([]byte(message), &data)\n\n\tif err == nil {\n\t\t// Save parsed json\n\t\tdata[\"datetime\"] = time.Now().UTC()\n\t\treturn data\n\t} else {\n\t\t// Could not parse json, save entire message.\n\t\treturn common.LogRecord{\n\t\t\tMessage: message,\n\t\t\tDatetime: time.Now().UTC(),\n\t\t}\n\t}\n}", "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn []byte(fmt.Sprintf(\"\\\"%s\\\"\", t.RFC3339Format())), nil\n}", "func iso8601(t time.Time) string {\n\ttstr := t.Format(\"2006-01-02T15:04:05\")\n\t_, zoneOffset := t.Zone()\n\tif zoneOffset == 0 {\n\t\treturn fmt.Sprintf(\"%sZ\", tstr)\n\t}\n\tif zoneOffset < 0 {\n\t\treturn fmt.Sprintf(\"%s-%02d%02d\", tstr, -zoneOffset/3600,\n\t\t\t(-zoneOffset%3600)/60)\n\t}\n\treturn fmt.Sprintf(\"%s+%02d%02d\", tstr, zoneOffset/3600,\n\t\t(zoneOffset%3600)/60)\n}", "func (v TimestampNano) MarshalJSON() ([]byte, error) {\n\tif !v.Valid() {\n\t\treturn nullBytes, nil\n\t}\n\treturn []byte(strconv.FormatInt(v.time.UnixNano(), 10)), nil\n}", "func (t Time) MarshalText() ([]byte, error) {\n\tif !t.Valid {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn []byte(strconv.FormatInt(t.toEpochMsec(), 10)), nil\n}", "func (v ServerTime) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson25363b2dEncodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi53(w, v)\n}", "func (t *Time) MarshalJSON() ([]byte, error) {\n\tstr := t.Format(fmt.Sprintf(`\"%s\"`, time.RFC1123Z))\n\treturn []byte(str), nil\n}", "func (ts *Timestamp) MarshalJSON() ([]byte, error) {\n\n\tif ts == nil || *ts == 0 {\n\t\treturn ekaenc.NULL_JSON_BYTES_SLICE, nil\n\t}\n\n\t// Date: 10 chars (YYYY-MM-DD)\n\t// Clock: 8 chars (hh:mm:ss)\n\t// Quotes: 2 chars (\"\")\n\t// Date clock separator: 1 char (T)\n\t// Summary: 21 char.\n\tb := make([]byte, 21)\n\n\t_ = ts.Date().AppendTo(b[1:1:20], '-')\n\t_ = ts.Time().AppendTo(b[12:12:20], ':')\n\n\tb[0] = '\"'\n\tb[11] = 'T'\n\tb[20] = '\"'\n\n\treturn b, nil\n}", "func (s OutputService13TestShapeTimeContainer) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Bar != nil {\n\t\tv := *s.Bar\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"bar\",\n\t\t\tprotocol.TimeValue{V: v, Format: \"unixTimestamp\", QuotedFormatTime: false}, metadata)\n\t}\n\tif s.Foo != nil {\n\t\tv := *s.Foo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"foo\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormatName, QuotedFormatTime: false}, metadata)\n\t}\n\treturn nil\n}", "func (t JSONTime) MarshalJSON() ([]byte, error) { \r\n\tformatted := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(YYYYMMDDHHMISS)) \r\n\treturn []byte(formatted), nil \r\n}", "func (e EncoderV2) encodeTime(t time.Time) error {\n\t_, err := e.Write([]byte{byte(encode_consts.TinyStructMarker | encode_consts.DateTimeStructSize)})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = e.Write([]byte{encode_consts.DateTimeWithZoneOffsetSignature})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, offset := t.Zone()\n\n\tt = t.Add(time.Duration(offset) * time.Second) // add offset before converting to unix local\n\tepochSeconds := t.Unix()\n\tnano := t.Nanosecond()\n\n\terr = e.encode(epochSeconds)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = e.encode(nano)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn e.encode(offset)\n}", "func (trz TimeRfc1123z) MarshalXMLAttr(name xml.Name) (attr xml.Attr, err error) {\n\tattr = xml.Attr{Name: name, Value: time.Time(trz).Format(time.RFC1123Z)}\n\treturn\n}", "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(timeFormat))\n\treturn []byte(stamp), nil\n}", "func convertTimestamps(rawDLR *rawDeliveryReceipt, w http.ResponseWriter) (*DeliveryReceipt, error) {\n\tdlr := &DeliveryReceipt{\n\t\tTo: rawDLR.To,\n\t\tNetworkCode: rawDLR.NetworkCode,\n\t\tMessageID: rawDLR.MessageID,\n\t\tMSISDN: rawDLR.MSISDN,\n\t\tStatus: rawDLR.Status,\n\t\tErrorCode: rawDLR.ErrorCode,\n\t\tPrice: rawDLR.Price,\n\t\tClientReference: rawDLR.ClientReference,\n\t}\n\n\tt, err := url.QueryUnescape(rawDLR.SCTS)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to unescape SCTS from %v with error %v\\n\", rawDLR, err)\n\t\thttp.Error(w, \"unable to return formvalue scts\", http.StatusInternalServerError)\n\t\treturn nil, err\n\t}\n\n\t// Convert the timestamp to a time.Time.\n\ttimestamp, err := time.Parse(\"0601021504\", t)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to time.Parse SCTS from %v with error %v\\n\", rawDLR, err)\n\t\thttp.Error(w, \"unable to parse time value from scts\", http.StatusInternalServerError)\n\t\treturn nil, err\n\t}\n\n\tdlr.SCTS = timestamp\n\n\tt, err = url.QueryUnescape(rawDLR.Timestamp)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to unescape message-timestamp from %v with error %v\\n\", rawDLR, err)\n\t\thttp.Error(w, \"unable to return formvalue message-timestamp\", http.StatusInternalServerError)\n\t\treturn nil, err\n\t}\n\n\t// Convert the timestamp to a time.Time.\n\ttimestamp, err = time.Parse(\"2006-01-02 15:04:05\", t)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to time.Parse message-timestamp from %v with error %v\\n\", rawDLR, err)\n\t\thttp.Error(w, \"unable to parse time value from message-timestamp\", http.StatusInternalServerError)\n\t\treturn nil, err\n\t}\n\n\tdlr.Timestamp = timestamp\n\n\treturn dlr, nil\n}", "func (t TimeUnixSeconds) MarshalYAML() (interface{}, error) {\n\tif !t.IsPresent() {\n\t\treturn nil, nil\n\t}\n\treturn t.value.Unix(), nil\n}", "func (t Time) RFC3339Format() string {\n\treturn t.Format(rfc3339MillisecondsFormat)\n}", "func (ct *CustomTime) MarshalJSON() ([]byte, error) {\n\tif ct.Time.UnixNano() == nilTime {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn []byte(fmt.Sprintf(\"\\\"%s\\\"\", ct.Time.Format(ctLayout))), nil\n}", "func (ct *Timestamp) UnmarshalJSON(data []byte) error {\n\ts := strings.Trim(string(data), \"\\\"\")\n\n\tt, err := time.Parse(time.RFC3339, s)\n\tif err == nil {\n\t\t(*ct).Time = t\n\t}\n\n\treturn err\n}", "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\tbuf := make([]byte, 0, 20)\n\tbuf = strconv.AppendInt(buf, int64(t), 10)\n\treturn buf, nil\n}", "func (t Timestamp) MarshalBSONValue() (_type bsontype.Type, b []byte, err error) {\n\t_type = bson.TypeDateTime\n\n\t//b = time.Time(t).AppendFormat(b, time.RFC3339)\n\tb = bsoncore.AppendTime(b, time.Time(t))\n\t//b, err = bson.Marshal(time.Time(t))\n\treturn _type, b, err\n}", "func (tso TimeWebsmsShortOne) MarshalXMLAttr(name xml.Name) (attr xml.Attr, err error) {\n\tattr = xml.Attr{Name: name, Value: time.Time(tso).Format(timeWebsmsShortOneFormat)}\n\treturn\n}", "func (m *Time) Marshal() (data []byte, err error) {\n\tif m == nil || m.Time.IsZero() {\n\t\treturn nil, nil\n\t}\n\treturn m.ProtoTime().Marshal()\n}", "func MarshalTimestamp(x interface{}) (Timestamp, error) {\n\tv := Timestamp{}\n\terr := v.Scan(x)\n\treturn v, err\n}", "func (a AbsoluteClipTime) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tobjectMap[\"@odata.type\"] = \"#Microsoft.Media.AbsoluteClipTime\"\n\tpopulate(objectMap, \"time\", a.Time)\n\treturn json.Marshal(objectMap)\n}", "func (t iso8601Datetime) MarshalJSON() ([]byte, error) {\n\ts := t.Time.Format(iso8601Layout)\n\treturn json.Marshal(s)\n}", "func (nt NullTime) MarshalJSON() ([]byte, error) {\n\tif !nt.Valid {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn json.Marshal(nt.Time)\n}", "func (e *Encoder) MarshalTime(v time.Time) (int, error) {\n\tn, err := e.Byte(TimestampColumn)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\ti, err := e.Time(v)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn n + i, nil\n}", "func (t Timestamp) MarshalXML(e *xml.Encoder, start xml.StartElement) error {\n\tts := t.Time().Unix()\n\tstamp := fmt.Sprint(ts)\n\n\treturn e.EncodeElement(stamp, start)\n}", "func (d *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.ParseInt(string(b), 10, 64)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.Time = time.Unix(ts/1000, (ts%1000)*1000000)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Cannot unmarshal Timestamp value: %v\", err)\n\t}\n\n\treturn nil\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tintSec, nanoSec := int64(0), int64(0)\n\tnanoSecPos := int64(1e9)\n\tseenDot := false\n\tseenNumber := false\n\tseenSign := false\n\tsign := int64(1)\n\tfor _, c := range b {\n\t\tswitch c {\n\t\tcase '.':\n\t\t\tseenDot = true\n\t\tcase '-':\n\t\t\tif seenDot || seenNumber || seenSign {\n\t\t\t\tgoto FALLBACK\n\t\t\t}\n\t\t\tsign = -1\n\t\t\tseenSign = true\n\t\tcase '+':\n\t\t\tif seenDot || seenNumber || seenSign {\n\t\t\t\tgoto FALLBACK\n\t\t\t}\n\t\t\tseenSign = true\n\t\tcase '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':\n\t\t\tseenNumber = true\n\t\t\tif seenDot {\n\t\t\t\tnanoSecPos /= 10\n\t\t\t\tnanoSec += nanoSecPos * int64(c-'0')\n\t\t\t} else {\n\t\t\t\tintSec = intSec*10 + int64(c-'0')\n\t\t\t}\n\t\tdefault:\n\t\t\tgoto FALLBACK\n\t\t}\n\t}\n\t*t = Timestamp(time.Unix(sign*intSec, nanoSec))\n\treturn nil\n\nFALLBACK:\n\ttimestamp, err := strconv.ParseFloat(string(b), 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfintSec, fracSec := math.Modf(timestamp)\n\t*t = Timestamp(time.Unix(int64(fintSec), int64(fracSec*1e9)))\n\treturn nil\n}", "func (i *Time) MarshalText() ([]byte, error) {\n\td := time.Duration(*i)\n\th := int(d / time.Hour)\n\tm := int((d % time.Hour) / time.Minute)\n\ts := int((d % time.Minute) / time.Second)\n\treturn []byte(fmt.Sprintf(\"%02d:%02d:%02d\", h, m, s)), nil\n}", "func AppendJSONTime(buf []byte, v time.Time) []byte {\n\tbuf = strconv.AppendInt(buf, v.Unix(), 10)\n\tusec := v.Nanosecond() / 1000\n\tif usec != 0 {\n\t\tbuf = append(buf, '.')\n\t\tn := len(buf)\n\t\tif cap(buf) < n+6 {\n\t\t\tnewBuf := make([]byte, n+6, cap(buf)*2)\n\t\t\tcopy(newBuf, buf)\n\t\t\tbuf = newBuf\n\t\t} else {\n\t\t\tbuf = buf[:n+6]\n\t\t}\n\t\tfor i := 0; i < 6; i++ {\n\t\t\tbuf[n+5-i] = byte('0' + usec%10)\n\t\t\tusec /= 10\n\t\t}\n\t}\n\treturn buf\n}", "func (tso TimeWebsmsShortOne) MarshalXML(e *xml.Encoder, start xml.StartElement) error {\n\treturn e.EncodeElement(time.Time(tso).Format(timeWebsmsShortOneFormat), start)\n}", "func (v TransactionsSinceIDRequest) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (time Time) MarshalXML(e *xml.Encoder, start xml.StartElement) error {\n\treturn e.EncodeElement(time.FormatCAP(), start)\n}", "func (ns *Namespace) Format(layout string, v interface{}) (string, error) {\n\tt, err := cast.ToTimeE(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn t.Format(layout), nil\n}", "func (v Messages) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson42239ddeEncodeGithubComKhliengDispatchServer17(w, v)\n}", "func FormatRFC3339(t time.Time) string {\n\treturn t.UTC().Format(time.RFC3339Nano)\n}", "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\tformatted := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(\"2006-01-02 15:04:05\"))\n\treturn []byte(formatted), nil\n}", "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\tformatted := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(\"2006-01-02 15:04:05\"))\n\treturn []byte(formatted), nil\n}", "func (t Time) MarshalJSON() ([]byte, error) {\n\tif t.IsZero() {\n\t\treturn []byte(`\"\"`), nil\n\t}\n\n\treturn []byte(`\"` + t.Format(time.RFC3339) + `\"`), nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {}", "func (t Time) MarshalBSONValue() (bsontype.Type, []byte, error) {\n\tvar dst []byte\n\tswitch UsedFormatType {\n\tcase TIMESTAMP:\n\t\tdst = bsoncore.AppendInt64(dst, t.Timestamp())\n\t\treturn bsontype.Int64, dst, nil\n\tcase TEXT:\n\t\tdst = bsoncore.AppendString(dst, string(t.formatText()))\n\t\treturn bsontype.String, dst, nil\n\tdefault:\n\t\treturn bsontype.Int64, nil, ErrUnKnownFormatType\n\t}\n}", "func TestFmtTimestampWithSpecialValueZero(t *testing.T) {\n\tformatted := (&NextChange{TimeStamp: \"0\"}).FmtTimestamp(time.Unix(0, 0))\n\tassert.Zero(t, formatted)\n}", "func (t NumericDate) MarshalJSON() ([]byte, error) {\n\treturn []byte(strconv.FormatInt(t.Unix(), 10)), nil\n}", "func (v PointInTime) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson390b7126EncodeGithubComChancedPicker51(w, v)\n}", "func (t *Timestamp) UnmarshalJSON(payload []byte) (err error) {\n\t// First get rid of the surrounding double quotes\n\tunquoted := strings.Replace(string(payload), `\"`, ``, -1)\n\tvalue, err := strconv.ParseInt(unquoted, 10, 64)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Per Node.js epochs, value will be in milliseconds\n\t*t = TimestampFromJSEpoch(value)\n\treturn\n}" ]
[ "0.5570334", "0.5424013", "0.53734726", "0.5352236", "0.5333705", "0.52996904", "0.5286782", "0.5276892", "0.5276661", "0.5276661", "0.52268916", "0.5222563", "0.5215754", "0.5206484", "0.5187875", "0.5187875", "0.51868486", "0.5179414", "0.5169098", "0.5166611", "0.5141693", "0.5112516", "0.51053435", "0.5074154", "0.50662035", "0.5064059", "0.50505775", "0.5041835", "0.50402725", "0.50387895", "0.50387895", "0.5038371", "0.5017508", "0.50087476", "0.4995706", "0.4964854", "0.49490866", "0.49487418", "0.49448663", "0.4910833", "0.49053383", "0.49050254", "0.4900573", "0.48937207", "0.48893675", "0.48806876", "0.48645607", "0.48505807", "0.48411673", "0.48407692", "0.4821919", "0.48204148", "0.48178", "0.48164815", "0.48121715", "0.48102292", "0.47937462", "0.47910905", "0.4789816", "0.47500026", "0.47490954", "0.4746252", "0.4737281", "0.47364867", "0.4705981", "0.4704958", "0.4688788", "0.46830308", "0.46819365", "0.4679008", "0.46762282", "0.4675072", "0.46711335", "0.46696913", "0.4651588", "0.46301436", "0.46168765", "0.4611707", "0.4598265", "0.4588199", "0.45797408", "0.45785442", "0.45723963", "0.45687422", "0.45556137", "0.45398623", "0.45396438", "0.4538549", "0.4528419", "0.4528336", "0.45245826", "0.4523842", "0.4523842", "0.45216894", "0.45174736", "0.45174122", "0.4512765", "0.4502419", "0.4502296", "0.4492912" ]
0.55164564
1
Custom unmarshaller for Message converts RFC3339 format to unix seconds + offset Aliases Message so that we can inherit fields without inheriting methods to avoid looping on UnmarshalJSON
func (m *Message) UnmarshalJSON(data []byte) error { type MessageAlias Message aux := &struct { Time string `json:"time"` *MessageAlias }{ MessageAlias: (*MessageAlias)(m), } if err := json.Unmarshal(data, &aux); err != nil { return err } messageTime, _ := time.Parse(time.RFC3339, aux.Time) _, timeOffset := messageTime.Zone() m.Time = messageTime.Unix() m.TZ = timeOffset return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Message) UnmarshalJSON(j []byte) error {\n\tvar rawStrings map[string]string\n\n\terr := json.Unmarshal(j, &rawStrings)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor k, v := range rawStrings {\n\t\tif strings.ToLower(k) == \"to\" {\n\t\t\tm.To = v\n\t\t}\n\t\tif strings.ToLower(k) == \"from\" {\n\t\t\tm.From = v\n\t\t}\n\t\tif strings.ToLower(k) == \"title\" {\n\t\t\tm.Title = v\n\t\t}\n\t\tif strings.ToLower(k) == \"content\" {\n\t\t\tm.Content = v\n\t\t}\n\t\t// properly parse Date field\n\t\tif strings.ToLower(k) == \"date\" {\n\t\t\tt, err := time.Parse(\"Jan 2, 2006 at 3:04pm (MST)\", v)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tm.Date = t\n\t\t}\n\t}\n\treturn nil\n}", "func (m *TestAllTypes_NestedMessage) Unmarshal(rawBytes []byte) (*TestAllTypes_NestedMessage, error) {\n\treader := jspb.NewReader(rawBytes)\n\n\tm = m.UnmarshalFromReader(reader)\n\n\tif err := reader.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "func (i *Event) UnmarshalJSON(b []byte) error {\n\ttype Mask Event\n\n\tp := struct {\n\t\t*Mask\n\t\tCreated *parseabletime.ParseableTime `json:\"created\"`\n\t\tTimeRemaining json.RawMessage `json:\"time_remaining\"`\n\t}{\n\t\tMask: (*Mask)(i),\n\t}\n\n\tif err := json.Unmarshal(b, &p); err != nil {\n\t\treturn err\n\t}\n\n\ti.Created = (*time.Time)(p.Created)\n\ti.TimeRemaining = duration.UnmarshalTimeRemaining(p.TimeRemaining)\n\n\treturn nil\n}", "func (j *Message) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (m *Message) UnmarshalJSON(data []byte) error {\n\ttype Alias Message\n\n\tvar v map[string]interface{}\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn err\n\t}\n\n\tva, ok := v[\"attachments\"]\n\tif !ok || va == float64(0) {\n\t\taux := &struct {\n\t\t\tAttachments interface{} `json:\"attachments\"`\n\t\t\t*Alias\n\t\t}{\n\t\t\tAlias: (*Alias)(m),\n\t\t}\n\n\t\tif err := json.Unmarshal(data, &aux); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}\n\n\taux := &struct {\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(m),\n\t}\n\n\tif err := json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (x *EMsg) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = EMsg(num)\n\treturn nil\n}", "func (x *P2P_Messages) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = P2P_Messages(num)\n\treturn nil\n}", "func (m *Message) UnmarshalJSON(input []byte) error {\n\ttype Message struct {\n\t\tSig *hexutil.Bytes `json:\"sig,omitempty\"`\n\t\tTTL *uint32 `json:\"ttl\"`\n\t\tTimestamp *uint32 `json:\"timestamp\"`\n\t\tTopic *TopicType `json:\"topic\"`\n\t\tPayload *hexutil.Bytes `json:\"payload\"`\n\t\tPadding *hexutil.Bytes `json:\"padding\"`\n\t\tPoW *float64 `json:\"pow\"`\n\t\tHash *hexutil.Bytes `json:\"hash\"`\n\t\tDst *hexutil.Bytes `json:\"recipientPublicKey,omitempty\"`\n\t}\n\tvar dec Message\n\tif err := json.Unmarshal(input, &dec); err != nil {\n\t\treturn err\n\t}\n\tif dec.Sig != nil {\n\t\tm.Sig = *dec.Sig\n\t}\n\tif dec.TTL != nil {\n\t\tm.TTL = *dec.TTL\n\t}\n\tif dec.Timestamp != nil {\n\t\tm.Timestamp = *dec.Timestamp\n\t}\n\tif dec.Topic != nil {\n\t\tm.Topic = *dec.Topic\n\t}\n\tif dec.Payload != nil {\n\t\tm.Payload = *dec.Payload\n\t}\n\tif dec.Padding != nil {\n\t\tm.Padding = *dec.Padding\n\t}\n\tif dec.PoW != nil {\n\t\tm.PoW = *dec.PoW\n\t}\n\tif dec.Hash != nil {\n\t\tm.Hash = *dec.Hash\n\t}\n\tif dec.Dst != nil {\n\t\tm.Dst = *dec.Dst\n\t}\n\treturn nil\n}", "func (m *Message) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {\n\n\tswitch k {\n\tcase \"Id\":\n\t\treturn dec.Int(&m.Id)\n\n\tcase \"Name\":\n\t\treturn dec.String(&m.Name)\n\n\tcase \"Price\":\n\t\treturn dec.Float64(&m.Price)\n\n\tcase \"Ints\":\n\t\tvar aSlice = Ints{}\n\t\terr := dec.Array(&aSlice)\n\t\tif err == nil && len(aSlice) > 0 {\n\t\t\tm.Ints = []int(aSlice)\n\t\t}\n\t\treturn err\n\n\tcase \"Floats\":\n\t\tvar aSlice = Float32s{}\n\t\terr := dec.Array(&aSlice)\n\t\tif err == nil && len(aSlice) > 0 {\n\t\t\tm.Floats = []float32(aSlice)\n\t\t}\n\t\treturn err\n\n\tcase \"SubMessageX\":\n\t\tvar value = &SubMessage{}\n\t\terr := dec.Object(value)\n\t\tif err == nil {\n\t\t\tm.SubMessageX = value\n\t\t}\n\n\t\treturn err\n\n\tcase \"MessagesX\":\n\t\tvar aSlice = SubMessagesPtr{}\n\t\terr := dec.Array(&aSlice)\n\t\tif err == nil && len(aSlice) > 0 {\n\t\t\tm.MessagesX = []*SubMessage(aSlice)\n\t\t}\n\t\treturn err\n\n\tcase \"SubMessageY\":\n\t\terr := dec.Object(&m.SubMessageY)\n\n\t\treturn err\n\n\tcase \"MessagesY\":\n\t\tvar aSlice = SubMessages{}\n\t\terr := dec.Array(&aSlice)\n\t\tif err == nil && len(aSlice) > 0 {\n\t\t\tm.MessagesY = []SubMessage(aSlice)\n\t\t}\n\t\treturn err\n\n\tcase \"IsTrue\":\n\t\tvar value bool\n\t\terr := dec.Bool(&value)\n\t\tif err == nil {\n\t\t\tm.IsTrue = &value\n\t\t}\n\t\treturn err\n\n\tcase \"Payload\":\n\t\tvar value = gojay.EmbeddedJSON{}\n\t\terr := dec.AddEmbeddedJSON(&value)\n\t\tif err == nil && len(value) > 0 {\n\t\t\tm.Payload = []byte(value)\n\t\t}\n\t\treturn err\n\n\tcase \"SQLNullString\":\n\t\tvar value = &sql.NullString{}\n\t\terr := dec.SQLNullString(value)\n\t\tif err == nil {\n\t\t\tm.SQLNullString = value\n\t\t}\n\t\treturn err\n\n\t}\n\treturn nil\n}", "func (m *SubMessage) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {\n\n\tswitch k {\n\tcase \"Id\":\n\t\treturn dec.Int(&m.Id)\n\n\tcase \"Description\":\n\t\treturn dec.String(&m.Description)\n\n\tcase \"StartTime\":\n\t\tvar format = time.RFC3339\n\t\tvar value = time.Time{}\n\t\terr := dec.Time(&value, format)\n\t\tif err == nil {\n\t\t\tm.StartTime = value\n\t\t}\n\t\treturn err\n\n\tcase \"EndTime\":\n\t\tvar format = time.RFC3339\n\t\tvar value = &time.Time{}\n\t\terr := dec.Time(value, format)\n\t\tif err == nil {\n\t\t\tm.EndTime = value\n\t\t}\n\t\treturn err\n\n\t}\n\treturn nil\n}", "func (v *Message) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6a975c40DecodeGithubComSerhio83DruidPkgStructs1(&r, v)\n\treturn r.Error()\n}", "func (x *CLC_Messages) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = CLC_Messages(num)\n\treturn nil\n}", "func (x *CLC_Messages) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = CLC_Messages(num)\n\treturn nil\n}", "func Unmarshal([]byte) (WireMessage, error) { return nil, nil }", "func (j *EventMsg) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (x *NET_Messages) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = NET_Messages(num)\n\treturn nil\n}", "func (x *NET_Messages) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = NET_Messages(num)\n\treturn nil\n}", "func (x *NET_Messages) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = NET_Messages(num)\n\treturn nil\n}", "func (x *EDotaBroadcastMessages) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = EDotaBroadcastMessages(num)\n\treturn nil\n}", "func (u *UTCClipTime) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"@odata.type\":\n\t\t\terr = unpopulate(val, \"ODataType\", &u.ODataType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"time\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Time\", &u.Time)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t\t}\n\t}\n\treturn nil\n}", "func UnmarshalMessage(s *jsonplugin.UnmarshalState, v proto.Message) {\n\t// If we read null, don't do anything.\n\tif s.ReadNil() {\n\t\treturn\n\t}\n\n\t// Read the raw object.\n\tdata := s.ReadRawMessage()\n\tif s.Err() != nil {\n\t\treturn\n\t}\n\n\t// Let protojson unmarshal v.\n\terr := protojson.UnmarshalOptions{\n\t\tDiscardUnknown: true,\n\t}.Unmarshal(data, v)\n\tif err != nil {\n\t\ts.SetErrorf(\"failed to unmarshal %s from JSON: %w\", proto.MessageName(v), err)\n\t}\n}", "func buildMessageStruct(message string) interface{} {\n\tvar data map[string]interface{}\n\terr := json.Unmarshal([]byte(message), &data)\n\n\tif err == nil {\n\t\t// Save parsed json\n\t\tdata[\"datetime\"] = time.Now().UTC()\n\t\treturn data\n\t} else {\n\t\t// Could not parse json, save entire message.\n\t\treturn common.LogRecord{\n\t\t\tMessage: message,\n\t\t\tDatetime: time.Now().UTC(),\n\t\t}\n\t}\n}", "func (v *Message) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson42239ddeDecodeGithubComKhliengDispatchServer18(&r, v)\n\treturn r.Error()\n}", "func (v *Message) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdproto1(&r, v)\n\treturn r.Error()\n}", "func (v *Msg) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeBackendInternalModels6(&r, v)\n\treturn r.Error()\n}", "func (v *Messages) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson42239ddeDecodeGithubComKhliengDispatchServer17(l, v)\n}", "func (pm *PingMessage) Unmarshal(bytes []byte) error {\n\tvar message PingMessage\n\tif err := json.Unmarshal(bytes, &message); err != nil {\n\t\treturn err\n\t}\n\tpm.Sender = message.Sender\n\tpm.Payload = message.Payload\n\n\treturn nil\n}", "func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson42239ddeDecodeGithubComKhliengDispatchServer18(l, v)\n}", "func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6a975c40DecodeGithubComSerhio83DruidPkgStructs1(l, v)\n}", "func (m *HookMessage) Unmarshal(b []byte) error {\n\terr := json.Unmarshal(b, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (a *AbsoluteClipTime) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"@odata.type\":\n\t\t\terr = unpopulate(val, \"ODataType\", &a.ODataType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"time\":\n\t\t\terr = unpopulate(val, \"Time\", &a.Time)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (x *SVC_Messages) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = SVC_Messages(num)\n\treturn nil\n}", "func (x *SVC_Messages) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = SVC_Messages(num)\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {}", "func (t *Timestamp) UnmarshalJSON(data []byte) (err error) {\n\tt.Time, err = time.Parse(`\"`+time.RFC3339+`\"`, string(data))\n\treturn\n}", "func (*nopSerializer) Unmarshal([]byte, Message) error { return nil }", "func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC5a4559bDecodeGithubComChromedpCdproto1(l, v)\n}", "func (m *Time) Unmarshal(data []byte) error {\n\tif len(data) == 0 {\n\t\tm.Time = time.Time{}\n\t\treturn nil\n\t}\n\tp := Timestamp{}\n\tif err := p.Unmarshal(data); err != nil {\n\t\treturn err\n\t}\n\t// leaving this here for the record. our JSON only handled seconds, so this results in writes by\n\t// protobuf clients storing values that aren't read by json clients, which results in unexpected\n\t// field mutation, which fails various validation and equality code.\n\t// m.Time = time.Unix(p.Seconds, int64(p.Nanos)).Local()\n\tm.Time = time.Unix(p.Seconds, int64(0)).Local()\n\treturn nil\n}", "func ParseMessage(msg string) Message {\n\tvar message Message\n\tmsgBytes := []byte(msg)\n\terr := json.Unmarshal(msgBytes, &message)\n\thandleErr(err)\n\tfmt.Println(\"Person\", message)\n\treturn message\n}", "func Unmarshal(bts []byte) *Message {\n\tmsg := new(Message)\n\tbuf := bytes.NewBuffer(bts)\n\tvar ipbts [4]byte\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.Version)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.Type)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.Pap)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.Rsv)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.SerialNo)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.ReqIdentifier)\n\tfor i := 0; i < 4; i++ {\n\t\tbinary.Read(buf, binary.BigEndian, &ipbts[i])\n\t}\n\tmsg.Head.UserIP = net.IPv4(ipbts[0], ipbts[1], ipbts[2], ipbts[3])\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.UserPort)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.ErrCode)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.AttrNum)\n\tvar auth [16]byte\n\tbinary.Read(buf, binary.BigEndian, &auth)\n\tmsg.Head.Authenticator = auth[:]\n\tmsg.Attrs = make([]Attr, msg.Head.AttrNum)\n\tfor i := byte(0); i < msg.Head.AttrNum; i++ {\n\t\tattr := &msg.Attrs[i]\n\t\tbinary.Read(buf, binary.BigEndian, &attr.Type)\n\t\tbinary.Read(buf, binary.BigEndian, &attr.Len)\n\t\tattr.Len -= 2\n\t\tattr.Str = make([]byte, attr.Len)\n\t\tbinary.Read(buf, binary.BigEndian, attr.Str)\n\t}\n\treturn msg\n}", "func (j *PublishMessagesRequest) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func UnmarshalMessage(msg *Message) (interface{}, error) {\n\treturn util.UnmarshalMessage(msg)\n}", "func (c *ClipTime) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"@odata.type\":\n\t\t\terr = unpopulate(val, \"ODataType\", &c.ODataType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\n\t// CoinCap timestamp is unix milliseconds\n\tm, err := strconv.ParseInt(string(b), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Convert from milliseconds to nanoseconds\n\tt.Time = time.Unix(0, m*1e6)\n\treturn nil\n}", "func (v *ChatMessage) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonD2b7633eDecode20191OPGPlus2InternalPkgModels20(l, v)\n}", "func (p *TickerDataMessage) UnmarshalJSON(b []byte) error {\n\tvar records []json.RawMessage\n\n\tif err := json.Unmarshal(b, &records); err != nil {\n\t\treturn err\n\t}\n\n\tif len(records) < 1 {\n\t\treturn errors.New(\"Empty message\")\n\t}\n\n\tswitch len(records) {\n\tcase 3:\n\t\tvar innerRecords []json.RawMessage\n\t\tif err := json.Unmarshal(records[2], &innerRecords); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(innerRecords[0], &p.Data.CurrencyPairID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(innerRecords[1], &p.Data.LastTradePrice); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(innerRecords[2], &p.Data.LowestAsk); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(innerRecords[3], &p.Data.HighestBid); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(innerRecords[4], &p.Data.PercentChangeInLast24Hours); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(innerRecords[5], &p.Data.BaseCurrencyVolumeInLast24Hours); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(innerRecords[6], &p.Data.QuoteCurrencyVolumeInLast24Hours); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(innerRecords[7], &p.Data.IsFrozen); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(innerRecords[8], &p.Data.HighestTradePriceInLast24Hours); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := json.Unmarshal(innerRecords[9], &p.Data.LowestTradePriceInLast24Hours); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfallthrough\n\tcase 2:\n\t\tif err := json.Unmarshal(records[1], &p.SubscriptonID); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfallthrough\n\tcase 1:\n\t\tif err := json.Unmarshal(records[0], &p.Channel); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "func (m *PresenceStatusMessage) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"expiryDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateDateTimeTimeZoneFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetExpiryDateTime(val.(DateTimeTimeZoneable))\n }\n return nil\n }\n res[\"message\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateItemBodyFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetMessage(val.(ItemBodyable))\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"publishedDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetPublishedDateTime(val)\n }\n return nil\n }\n return res\n}", "func (d *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.ParseInt(string(b), 10, 64)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.Time = time.Unix(ts/1000, (ts%1000)*1000000)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Cannot unmarshal Timestamp value: %v\", err)\n\t}\n\n\treturn nil\n}", "func (ct *Timestamp) UnmarshalJSON(data []byte) error {\n\ts := strings.Trim(string(data), \"\\\"\")\n\n\tt, err := time.Parse(time.RFC3339, s)\n\tif err == nil {\n\t\t(*ct).Time = t\n\t}\n\n\treturn err\n}", "func (o *OwnerWrapper) UnmarshalJSON(data []byte) error {\n\ttype Alias OwnerWrapper\n\taux := &struct {\n\t\tT string\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(o),\n\t}\n\tif err := json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\tif d, err := time.ParseDuration(aux.T); err != nil {\n\t\treturn err\n\t} else {\n\t\to.T = d\n\t}\n\treturn nil\n}", "func (m *IncomingMessage) UnmarshalJSON(data []byte) error {\n\tincomingMessageTypeOnly := struct {\n\t\tType string `json:\"type\"`\n\t}{}\n\tif err := json.Unmarshal(data, &incomingMessageTypeOnly); err != nil {\n\t\treturn err\n\t}\n\n\tswitch incomingMessageTypeOnly.Type {\n\tcase \"webhook_event\":\n\t\tvar evt WebhookEvent\n\t\tif err := json.Unmarshal(data, &evt); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tm.WebhookEvent = &evt\n\tcase \"request_log_event\":\n\t\tvar evt RequestLogEvent\n\t\tif err := json.Unmarshal(data, &evt); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tm.RequestLogEvent = &evt\n\tdefault:\n\t\treturn fmt.Errorf(\"Unexpected message type: %s\", incomingMessageTypeOnly.Type)\n\t}\n\n\treturn nil\n}", "func (ct *CustomTime) UnmarshalJSON(b []byte) (err error) {\n\ts := strings.Trim(string(b), \"\\\"\")\n\tif s == \"null\" {\n\t\tct.Time = time.Time{}\n\t\treturn\n\t}\n\tct.Time, err = time.Parse(ctLayout, s)\n\treturn\n}", "func Unmarshal(data []byte, v any) error {\n\tif pb, ok := v.(proto.Message); ok {\n\t\topts := protojson.UnmarshalOptions{DiscardUnknown: true}\n\t\treturn annotate(data, opts.Unmarshal(data, pb))\n\t}\n\treturn annotate(data, json.Unmarshal(data, v))\n}", "func (v *invocationMessage) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson2802b09fDecodeGithubComPhilippseithSignalr1(&r, v)\n\treturn r.Error()\n}", "func (v *DeviceShadowUpdateMsg) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonB7ed31d3DecodeMevericcoreMccommon6(&r, v)\n\treturn r.Error()\n}", "func (v *Msg) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonD2b7633eDecodeBackendInternalModels6(l, v)\n}", "func (t *Timestamp) UnmarshalJSON(payload []byte) (err error) {\n\t// First get rid of the surrounding double quotes\n\tunquoted := strings.Replace(string(payload), `\"`, ``, -1)\n\tvalue, err := strconv.ParseInt(unquoted, 10, 64)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Per Node.js epochs, value will be in milliseconds\n\t*t = TimestampFromJSEpoch(value)\n\treturn\n}", "func (a *JSONAttachment) UnmarshalJSON(data []byte) error {\n\ttype EmbeddedJSONAttachment JSONAttachment\n\tvar raw struct {\n\t\tDuration float64 `json:\"duration_in_seconds,omitempty\"`\n\t\t*EmbeddedJSONAttachment\n\t}\n\traw.EmbeddedJSONAttachment = (*EmbeddedJSONAttachment)(a)\n\n\terr := json.Unmarshal(data, &raw)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif raw.Duration > 0 {\n\t\tnsec := int64(raw.Duration * float64(time.Second))\n\t\traw.EmbeddedJSONAttachment.Duration = time.Duration(nsec)\n\t}\n\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(b []byte) error {\n\t// TODO Set Location dynamically (get it from HW?)\n\tloc, err := time.LoadLocation(\"Local\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Time, err = time.ParseInLocation(`\"2006-01-02 15:04\"`, string(b), loc)\n\treturn err\n}", "func (j *GetMessagesRequest) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (m *Message) Unmarshal(v interface{}) error {\n\tval := reflect.Indirect(reflect.ValueOf(v))\n\tif val.Kind() != reflect.Struct || !val.CanSet() {\n\t\treturn fmt.Errorf(\"%v is not a pointer to a struct\", reflect.TypeOf(v))\n\t}\n\tmaxAttrID, err := structMaxAttrID(val)\n\tif err != nil {\n\t\treturn err\n\t}\n\tattrs, err := parseMessage(m.nlm, maxAttrID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn unmarshal(val, \"\", nil, attrs)\n}", "func (v *ShadowUpdateRPCMsgSt) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson5bd79fa1DecodeMevericcoreMcplantainer(l, v)\n}", "func (m *Message) MarshalJSON() ([]byte, error) {\n\tmessageLocation := time.FixedZone(\"\", m.TZ)\n\tutc := time.Unix(m.Time, 0)\n\tmessageTime := utc.In(messageLocation).Format(time.RFC3339)\n\treturn json.Marshal(&struct {\n\t\tID string `json:\"id\"`\n\t\tName string `json:\"name\"`\n\t\tEmail string `json:\"email\"`\n\t\tText string `json:\"text\"`\n\t\tTime string `json:\"time\"`\n\t}{\n\t\tID: m.ID,\n\t\tName: m.Name,\n\t\tEmail: m.Email,\n\t\tText: m.Text,\n\t\tTime: messageTime,\n\t})\n}", "func (v *FetchMessages) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson42239ddeDecodeGithubComKhliengDispatchServer24(l, v)\n}", "func (v *invocationMessage) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson2802b09fDecodeGithubComPhilippseithSignalr1(l, v)\n}", "func (sp *SmartPosterPayload) Unmarshal(buf []byte) {\n\tmsg := &Message{}\n\tmsg.Unmarshal(buf)\n\tsp.Message = msg\n}", "func (v *Messages) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson42239ddeDecodeGithubComKhliengDispatchServer17(&r, v)\n\treturn r.Error()\n}", "func (lt *ISO8601LocalTime) UnmarshalJSON(b []byte) (err error) {\n\ts := string(b)\n\ts = s[1 : len(s)-1]\n\n\tt, err := time.Parse(time.RFC3339Nano, s)\n\tif err != nil {\n\n\t\tt, err = time.Parse(\"2006-01-02T15:04:05\", s)\n\t}\n\tlt.Time = t\n\treturn\n}", "func (v *ChatMessage) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecode20191OPGPlus2InternalPkgModels20(&r, v)\n\treturn r.Error()\n}", "func (m *ForeignMessage) Unmarshal(rawBytes []byte) (*ForeignMessage, error) {\n\treader := jspb.NewReader(rawBytes)\n\n\tm = m.UnmarshalFromReader(reader)\n\n\tif err := reader.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "func (v *ShadowUpdateMsgSt) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonB7ed31d3DecodeMevericcoreMccommon1(&r, v)\n\treturn r.Error()\n}", "func (ct *Time) UnmarshalJSON(b []byte) (err error) {\n\ts := strings.Trim(string(b), `\"`)\n\tnt, err := time.Parse(ctLayout, s)\n\t*ct = Time(nt)\n\treturn\n}", "func (e *ExportTimePeriod) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"from\":\n\t\t\terr = unpopulateTimeRFC3339(val, &e.From)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"to\":\n\t\t\terr = unpopulateTimeRFC3339(val, &e.To)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (t *NGETime) UnmarshalJSON(data []byte) error {\n\tif data == nil || bytes.Contains(data, nullBytes) {\n\t\t*t = NGETime(time.Unix(0, 0))\n\t\treturn nil\n\t}\n\n\tdataStr := string(data)\n\tdataStr = strings.Trim(dataStr, \"\\\" \")\n\n\tif dataStr == \"\" || dataStr == \"null\" {\n\t\t*t = NGETime(time.Unix(0, 0))\n\t\treturn nil\n\t}\n\n\tvar (\n\t\ttm time.Time\n\t\terr error\n\t)\n\n\tif timestampPattern.MatchString(dataStr) {\n\t\ttimestamp, err := strconv.ParseInt(dataStr, 10, 64)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tt.FromTimestamp(timestamp)\n\n\t\treturn nil\n\t}\n\n\tif marvelousTimePattern.MatchString(dataStr) {\n\t\tsecs := strings.Split(dataStr, \":\")\n\n\t\ttimeStr := strings.Join(secs[:3], \":\") + \".\" + secs[3]\n\n\t\ttm, err = time.ParseInLocation(\n\t\t\t\"2006-01-02 15:04:05.000Z\", timeStr, time.Local)\n\t} else {\n\t\ttm, err = time.ParseInLocation(\n\t\t\t\"2006-01-02T15:04:05.000Z\", dataStr, time.UTC)\n\t}\n\n\t*t = NGETime(tm)\n\n\treturn err\n}", "func (v *ShadowUpdateMsgSt) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonB7ed31d3DecodeMevericcoreMccommon1(l, v)\n}", "func (ss *StatsSummaryLastUpdated) UnmarshalJSON(data []byte) error {\n\tresp := struct {\n\t\tSummaryTime *string `json:\"summaryTime\"`\n\t}{}\n\terr := json.Unmarshal(data, &resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.SummaryTime != nil {\n\t\tvar summaryTime time.Time\n\t\tsummaryTime, err = time.Parse(time.RFC3339, *resp.SummaryTime)\n\t\tif err == nil {\n\t\t\tss.SummaryTime = &summaryTime\n\t\t\treturn nil\n\t\t}\n\t\tsummaryTime, err = time.Parse(TimeLayout, *resp.SummaryTime)\n\t\tss.SummaryTime = &summaryTime\n\t\treturn err\n\t}\n\treturn nil\n}", "func Unmarshal(message []byte) (*Message, error) {\n\tvar decoded Message\n\n\tif string(message[:3]) != \"EWP\" {\n\t\treturn nil, errors.New(\"protocol unsupported, expecting 'EWP'\")\n\t}\n\n\tdecoded.Version = binary.BigEndian.Uint32(message[3:7])\n\n\tdecoded.Protocol = Protocol(message[7])\n\n\tif decoded.Protocol > PING {\n\t\treturn nil, errors.New(\"message protocol unsupported, expecting GOSSIP, RPC or PING\")\n\t}\n\n\theaderLen := binary.BigEndian.Uint32(message[8:12])\n\tbodyLen := binary.BigEndian.Uint32(message[12:16])\n\n\tdecoded.Header = message[16:16+headerLen]\n\n\tdecoded.Body = message[16+headerLen:16+headerLen+bodyLen]\n\n\n\treturn &decoded, nil\n}", "func (v *ShadowUpdateRPCMsgSt) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson5bd79fa1DecodeMevericcoreMcplantainer(&r, v)\n\treturn r.Error()\n}", "func (message *UserStatusMessage) UnmarshalJSON(payload []byte) (err error) {\n\ttype surrogate UserStatusMessage\n\tvar inner struct {\n\t\tType string `json:\"__type\"`\n\t\tsurrogate\n\t}\n\tif err = json.Unmarshal(payload, &inner); err != nil {\n\t\treturn errors.JSONUnmarshalError.Wrap(err)\n\t}\n\tif inner.Type != (UserStatusMessage{}.GetType()) {\n\t\treturn errors.JSONUnmarshalError.Wrap(errors.ArgumentInvalid.With(\"__type\", inner.Type))\n\t}\n\t*message = UserStatusMessage(inner.surrogate)\n\treturn nil\n}", "func unmarshal(consumerMessage *sarama.ConsumerMessage) *Message {\n\tvar receivedMessage Message\n\terr := json.Unmarshal(consumerMessage.Value, &receivedMessage)\n\tif err != nil {\n\t\tlogrus.Error(\"unable to unmarshal message from consumer in kafka : \", err)\n\t\treturn &Message{}\n\t}\n\treturn &receivedMessage\n}", "func (q *QueryTimePeriod) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"from\":\n\t\t\terr = unpopulateTimeRFC3339(val, &q.From)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"to\":\n\t\t\terr = unpopulateTimeRFC3339(val, &q.To)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (t *ResponseTime) UnmarshalJSON(b []byte) error {\n\t//Assume number\n\tepoch, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\t// Fallback to Error time parsing if parse failure.\n\t\tvar errTime errorTime\n\t\tif err := json.Unmarshal(b, &errTime); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*t = ResponseTime(errTime)\n\t\treturn nil\n\t}\n\t*t = ResponseTime(time.Unix(int64(epoch), 0))\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(p []byte) (err error) {\n\tif bytes.Compare(p, null) == 0 {\n\t\tt.Time = time.Time{}\n\t\treturn nil\n\t}\n\tif err = t.Time.UnmarshalJSON(p); err == nil {\n\t\treturn nil\n\t}\n\tn, e := strconv.ParseInt(string(bytes.Trim(p, `\"`)), 10, 64)\n\tif e != nil {\n\t\treturn err\n\t}\n\tt.Time = time.Unix(n, 0)\n\treturn nil\n}", "func UnmarshalMessage(data string) *Message {\n\trv := &Message{}\n\n\tfor i, part := range strings.Split(data, \" \") {\n\t\t// Prefix\n\t\tif i == 0 && strings.Index(part, \":\") == 0 {\n\t\t\trv.Prefix = part[1:]\n\t\t\tcontinue\n\t\t}\n\t\t// Command\n\t\tif rv.Command == \"\" {\n\t\t\trv.Command = part\n\t\t\tcontinue\n\t\t}\n\t\t// Parameter\n\t\trv.Params = append(rv.Params, part)\n\t}\n\n\t// If a parameter starts with a colon is considered to be the last\n\t// parameter and may contain spaces\n\tfor i, param := range rv.Params {\n\t\tif strings.Index(param, \":\") == 0 {\n\t\t\t// Create a list with params before the one containing a colon\n\t\t\tparams := rv.Params[:i]\n\t\t\t// Join the remaining parameters, remove the first character\n\t\t\tparams = append(params, strings.Join(rv.Params[i:], \" \")[1:])\n\t\t\trv.Params = params\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn rv\n}", "func parseTime(msg []byte) *time.Time {\n\t// convert input to integer\n\ti := binary.BigEndian.Uint32(msg)\n\n\t// convert time from 1900 to Unix time\n\tt := int64(i) - timeGap1900\n\n\tres := time.Unix(t, 0)\n\treturn &res\n}", "func (j *AckMessagesRequest) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func TestUnmarshalBaseMessage(t *testing.T) {\n\tvar baseMessage BaseMessage\n\tbytesBaseMessage, _ := json.Marshal(baseMessage)\n\ttests := []struct {\n\t\tname string\n\t\tbaseMsg []byte\n\t\twant *BaseMessage\n\t\twantErr error\n\t}{\n\t\t{\n\t\t\tname: \"UnmarshalBaseMessageTest-WrongFormat\",\n\t\t\tbaseMsg: []byte(\"\"),\n\t\t\twant: nil,\n\t\t\twantErr: errors.New(\"unexpected end of JSON input\"),\n\t\t},\n\t\t{\n\t\t\tname: \"UnmarshalBaseMessageTest-RightFormat\",\n\t\t\tbaseMsg: bytesBaseMessage,\n\t\t\twant: &baseMessage,\n\t\t\twantErr: nil,\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tgot, err := UnmarshalBaseMessage(test.baseMsg)\n\t\t\tif err != nil {\n\t\t\t\tif !reflect.DeepEqual(err.Error(), test.wantErr.Error()) {\n\t\t\t\t\tt.Errorf(\"Error Got = %v,Want =%v\", err.Error(), test.wantErr.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif !reflect.DeepEqual(err, test.wantErr) {\n\t\t\t\t\tt.Errorf(\"Error Got = %v,Want =%v\", err, test.wantErr)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(got, test.want) {\n\t\t\t\tt.Errorf(\"UnmarshalBaseMessage() = %v, want %v\", got, test.want)\n\t\t\t}\n\t\t})\n\t}\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tot, err := time.Parse(fmt.Sprintf(`\"%s\"`, time.RFC1123Z), string(data))\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Time = ot\n\treturn nil\n}", "func (pm *PongMessage) Unmarshal(bytes []byte) error {\n\tvar message PongMessage\n\tif err := json.Unmarshal(bytes, &message); err != nil {\n\t\treturn err\n\t}\n\tpm.Sender = message.Sender\n\tpm.Payload = message.Payload\n\n\treturn nil\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tintSec, nanoSec := int64(0), int64(0)\n\tnanoSecPos := int64(1e9)\n\tseenDot := false\n\tseenNumber := false\n\tseenSign := false\n\tsign := int64(1)\n\tfor _, c := range b {\n\t\tswitch c {\n\t\tcase '.':\n\t\t\tseenDot = true\n\t\tcase '-':\n\t\t\tif seenDot || seenNumber || seenSign {\n\t\t\t\tgoto FALLBACK\n\t\t\t}\n\t\t\tsign = -1\n\t\t\tseenSign = true\n\t\tcase '+':\n\t\t\tif seenDot || seenNumber || seenSign {\n\t\t\t\tgoto FALLBACK\n\t\t\t}\n\t\t\tseenSign = true\n\t\tcase '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':\n\t\t\tseenNumber = true\n\t\t\tif seenDot {\n\t\t\t\tnanoSecPos /= 10\n\t\t\t\tnanoSec += nanoSecPos * int64(c-'0')\n\t\t\t} else {\n\t\t\t\tintSec = intSec*10 + int64(c-'0')\n\t\t\t}\n\t\tdefault:\n\t\t\tgoto FALLBACK\n\t\t}\n\t}\n\t*t = Timestamp(time.Unix(sign*intSec, nanoSec))\n\treturn nil\n\nFALLBACK:\n\ttimestamp, err := strconv.ParseFloat(string(b), 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfintSec, fracSec := math.Modf(timestamp)\n\t*t = Timestamp(time.Unix(int64(fintSec), int64(fracSec*1e9)))\n\treturn nil\n}", "func (v *streamItemMessage) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson2802b09fDecodeGithubComPhilippseithSignalr(&r, v)\n\treturn r.Error()\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\t// Fractional seconds are handled implicitly by Parse.\n\ttt, err := time.Parse(`\"`+time.RFC3339+`\"`, string(data))\n\tif _, ok := err.(*time.ParseError); ok {\n\t\ttt, err = time.Parse(`\"`+DeisDatetimeFormat+`\"`, string(data))\n\t\tif _, ok := err.(*time.ParseError); ok {\n\t\t\ttt, err = time.Parse(`\"`+PyOpenSSLTimeDateTimeFormat+`\"`, string(data))\n\t\t}\n\t}\n\t*t = Time{&tt}\n\treturn err\n}", "func (t *Time) UnmarshalText(data []byte) error {}", "func (v *ApiMessage) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi132(&r, v)\n\treturn r.Error()\n}", "func DecodeMessage(b []byte) (*Message, error) {\n\tvar msg Message\n\n\tif len(b) < 10+MsgIDLength {\n\t\treturn nil, errors.New(\"not enough data to decode valid message\")\n\t}\n\n\tmsg.Timestamp = int64(binary.BigEndian.Uint64(b[:8]))\n\tmsg.Attempts = binary.BigEndian.Uint16(b[8:10])\n\tcopy(msg.ID[:], b[10:10+MsgIDLength])\n\tmsg.Body = b[10+MsgIDLength:]\n\n\treturn &msg, nil\n}", "func (v *TransactionsSinceIDRequest) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel(l, v)\n}", "func (t *Time) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\n\t// Get rid of the quotes \"\" around the value.\n\t// A second option would be to include them\n\t// in the date format string instead, like so below:\n\t// time.Parse(`\"`+time.StampMicro+`\"`, s)\n\ts = s[1 : len(s)-1]\n\n\tts, err := time.Parse(time.StampMicro, s)\n\tif err != nil {\n\t\tts, err = time.Parse(\"2006-01-02T15:04:05.999999\", s)\n\t}\n\tt.Time = ts\n\treturn err\n}", "func (val *Time) UnmarshalJSON(data []byte) error {\n\tstr := string(data)\n\tidx := strings.IndexByte(str, '.')\n\tif idx == -1 {\n\t\tsec, err := strconv.ParseInt(str, 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*val = Time(sec * 1000000)\n\t\treturn nil\n\t}\n\tsec, err := strconv.ParseInt(str[:idx], 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tusec, err := strconv.ParseInt(str[idx+1:], 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*val = Time(sec*1000000 + usec)\n\treturn nil\n}", "func (t *LastAccessTime) Deserialize(b []byte) error {\n\ti, n := binary.Varint(b)\n\tif n <= 0 {\n\t\treturn fmt.Errorf(\"unmarshal last access time: %s\", b)\n\t}\n\tt.Time = time.Unix(int64(i), 0)\n\treturn nil\n}", "func (x *TextPBFieldFormat) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = TextPBFieldFormat(num)\n\treturn nil\n}" ]
[ "0.61280674", "0.6008713", "0.59525806", "0.594522", "0.5913755", "0.5891307", "0.5812734", "0.58116156", "0.5744641", "0.57408804", "0.5729062", "0.5692831", "0.5692831", "0.56830055", "0.56600046", "0.5649682", "0.5649682", "0.5649682", "0.56217265", "0.5620403", "0.56203574", "0.5617843", "0.5604424", "0.55980974", "0.5586425", "0.55786514", "0.5569453", "0.55629766", "0.55627626", "0.55626136", "0.55612177", "0.5545261", "0.5545261", "0.5520981", "0.5502079", "0.5495529", "0.5482106", "0.5473068", "0.547108", "0.5441963", "0.5435327", "0.5430267", "0.5419472", "0.54044145", "0.53966624", "0.5390213", "0.5386137", "0.538286", "0.5369145", "0.53572714", "0.53440714", "0.5319955", "0.5318496", "0.5315784", "0.5314064", "0.53117794", "0.5311582", "0.53115046", "0.5310457", "0.5303207", "0.5302665", "0.5298295", "0.52909094", "0.5286015", "0.52812636", "0.528055", "0.52785707", "0.5275153", "0.5269775", "0.52683073", "0.52576745", "0.5253895", "0.5250744", "0.52491385", "0.52460104", "0.52421707", "0.52414787", "0.5240143", "0.52229875", "0.5222735", "0.52221483", "0.5216383", "0.5207449", "0.5202099", "0.51981914", "0.51946616", "0.5185603", "0.5185132", "0.5179636", "0.5178665", "0.5169216", "0.5163936", "0.5162934", "0.5160286", "0.515784", "0.5151164", "0.51482576", "0.5147668", "0.5142028", "0.5141114" ]
0.7816977
0
Tag2Semver convert Tag to semver
func Tag2Semver(tag string) *Semver { semver := &Semver{} re, _ := regexp.Compile("(\\d+).(\\d+).(\\d+)") subs := re.FindStringSubmatch(tag) semver.Major, _ = strconv.Atoi(subs[1]) semver.Minor, _ = strconv.Atoi(subs[2]) semver.Patch, _ = strconv.Atoi(subs[3]) return semver }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GoTagToSemver(tag string) string {\n\tif tag == \"\" {\n\t\treturn \"\"\n\t}\n\n\ttag = strings.Fields(tag)[0]\n\t// Special cases for go1.\n\tif tag == \"go1\" {\n\t\treturn \"v1.0.0\"\n\t}\n\tif tag == \"go1.0\" {\n\t\treturn \"\"\n\t}\n\tm := tagRegexp.FindStringSubmatch(tag)\n\tif m == nil {\n\t\treturn \"\"\n\t}\n\tversion := \"v\" + m[1]\n\tif m[2] != \"\" {\n\t\tversion += m[2]\n\t} else {\n\t\tversion += \".0\"\n\t}\n\tif m[3] != \"\" {\n\t\tif !strings.HasPrefix(m[4], \"-\") {\n\t\t\tversion += \"-\"\n\t\t}\n\t\tversion += m[4] + \".\" + m[5]\n\t}\n\treturn version\n}", "func determineVersionFromTag(tag string) string {\n\tre := regexp.MustCompile(`^v?(\\d+\\.)?(\\d+\\.)?(\\*|\\d+.*)$`)\n\tmatches := re.FindStringSubmatch(tag)\n\tif len(matches) > 0 {\n\t\treturn strings.Join(matches[1:], \"\")\n\t}\n\treturn \"\"\n}", "func determineVersionFromTag(tag string) string {\n\tre := regexp.MustCompile(`^v?(\\d+\\.)?(\\d+\\.)?(\\*|\\d+.*)$`)\n\tmatches := re.FindStringSubmatch(tag)\n\tif len(matches) > 0 {\n\t\treturn strings.Join(matches[1:], \"\")\n\t}\n\treturn \"\"\n}", "func determineVersionFromTag(tag string) string {\n\tre := regexp.MustCompile(\"v?([^v].*)\")\n\tmatches := re.FindStringSubmatch(tag)\n\tif len(matches) > 0 {\n\t\treturn matches[1]\n\t} else {\n\t\treturn \"\"\n\t}\n}", "func SemanticVersion() string {\n\treturn gitTag\n}", "func (r Release) SemVer() (string, error) {\n\tif !semver.IsValid(r.Tag) && !semver.IsValid(fmt.Sprintf(\"v%s\", r.Tag)) {\n\t\treturn \"\", fmt.Errorf(\"%s is not valid semver\", r.Tag)\n\t}\n\treturn strings.TrimLeft(r.Tag, \"v\"), nil\n}", "func versionTag(v semver.Version) string {\n\tif isRelease(v) {\n\t\treturn \"latest\"\n\t}\n\treturn \"next\"\n}", "func determineVersionFromTagBollocks(tag string, source Source) string {\n\tvar re *regexp.Regexp\n\tif source.TagFilterRegex == \"\" {\n\t\tre = regexp.MustCompile(`^v?(?:\\d+\\.)?(?:\\d+\\.)?(?:\\*|\\d+.*)$`)\n\t\ttag = strings.TrimPrefix(tag, \"v\")\n\t} else {\n\t\tre = regexp.MustCompile(source.TagFilterRegex)\n\t}\n\n\tif re.MatchString(tag) {\n\t\treturn tag\n\t}\n\treturn \"\"\n}", "func semverify(version string) string {\n\tmatch := semverPattern.FindStringSubmatch(version)\n\tif match != nil && len(match) == 6 {\n\t\t// replace the last component of the semver (which is always 0 in our versioning scheme)\n\t\t// with the number of commits since the last tag\n\t\treturn fmt.Sprintf(\"%v.%v.%v+%v\", match[1], match[2], match[4], match[5])\n\t}\n\treturn version\n}", "func (i *IndexBuilder) semVer(metadata *helmchart.Metadata, branch, shortID string) string {\n\tif shortID == \"\" {\n\t\treturn fmt.Sprintf(\"%s-%s\", metadata.Version, branch)\n\t}\n\treturn fmt.Sprintf(\"%s-%s-%s\", metadata.Version, branch, shortID)\n}", "func GetNextVersion(tag string) (string, error) {\n\tif tag == \"\" {\n\t\treturn \"v1.0.0\", nil\n\t}\n\n\ttags := strings.Split(tag, \".\")\n\tlen := len(tags)\n\n\t// semantic version(e.g. v1.2.3)\n\tif len > 2 {\n\t\tpatch, err := strconv.Atoi(tags[len-1])\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\ttags[len-1] = strconv.Itoa(patch + 1)\n\t\treturn strings.Join(tags, \".\"), nil\n\t}\n\n\t// date version(e.g. 20180525.1 or release_20180525.1)\n\tconst layout = \"20060102\"\n\ttoday := time.Now().Format(layout)\n\n\tdateRe := regexp.MustCompile(`(.*)(\\d{8})\\.(.+)`)\n\tif m := dateRe.FindStringSubmatch(tag); m != nil {\n\t\tif m[2] == today {\n\t\t\tminor, err := strconv.Atoi(m[3])\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\n\t\t\tnext := strconv.Itoa(minor + 1)\n\t\t\treturn m[1] + today + \".\" + next, nil\n\t\t}\n\t\treturn m[1] + today + \".\" + \"1\", nil\n\t}\n\treturn today + \".1\", nil\n}", "func ToVersion(value string) (*semver.Version, error) {\n\tversion := value\n\tif version == \"\" {\n\t\tversion = \"0.0.0\"\n\t}\n\treturn semver.NewVersion(version)\n}", "func newestSemVer(v1 string, v2 string) (string, error) {\n\tv1Slice := strings.Split(v1, \".\")\n\tif len(v1Slice) != 3 {\n\t\treturn \"\", semverStringError(v1)\n\t}\n\tv2Slice := strings.Split(v2, \".\")\n\tif len(v2Slice) != 3 {\n\t\treturn \"\", semverStringError(v2)\n\t}\n\tfor i, subVer1 := range v1Slice {\n\t\tif v2Slice[i] > subVer1 {\n\t\t\treturn v2, nil\n\t\t} else if subVer1 > v2Slice[i] {\n\t\t\treturn v1, nil\n\t\t}\n\t}\n\treturn v1, nil\n}", "func NormalizeTag(v string) string {\n\treturn normalize(v, true)\n}", "func NewSemVer(t string) (*SemVer, error) {\n\tv, e := semver.NewVersion(t)\n\thasPrefix := false\n\n\tif strings.HasPrefix(t, \"v\") {\n\t\thasPrefix = true\n\t}\n\n\treturn &SemVer{v, hasPrefix, t}, e\n}", "func IsSemver(str string) bool {\n\treturn rxSemver.MatchString(str)\n}", "func ParseVersion(ver string) (ref string, err error) {\n\tif ver == \"\" {\n\t\terr = errors.Errorf(\"version must not be empty\")\n\t\treturn\n\t}\n\n\t_, err = version.NewVersion(ver)\n\tif err != nil {\n\t\terr = errors.Wrapf(err,\n\t\t\t\"failed to parse semver\")\n\t\treturn\n\t}\n\n\tref = strings.TrimSuffix(ver, \"+incompatible\")\n\n\tvar (\n\t\tok bool\n\t\tobtained string\n\t)\n\n\tif obtained, ok = tryVersionDateSha(ref); ok {\n\t\tref = obtained\n\t\treturn\n\t}\n\n\treturn\n}", "func Semver(str string) bool {\n\treturn rxSemver.MatchString(str)\n}", "func canonicalizeSemverPrefix(s string) string {\n\treturn addSemverPrefix(removeSemverPrefix(s))\n}", "func Tag(my, sv *Extent, force bool) error {\n\ttip, err := my.Repo.Head()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"# %s\", tip)\n\ttag, err := resolveTag(my, tip)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"# -> Force: %t\", force)\n\tif tag != nil && !force {\n\t\tlog.Printf(\"# %s\", tag)\n\t\treturn fmt.Errorf(\"%s is already tagged: %s\", tip.Hash().String()[:7], tag.Name().Short())\n\t}\n\tver, err := ReadVersion(my, sv)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttag, err = my.Repo.CreateTag(fmt.Sprintf(\"v%s\", ver), tip.Hash(), &git.CreateTagOptions{\n\t\tMessage: fmt.Sprintf(\"semver(tag): %s\", ver),\n\t\tTagger: &object.Signature{\n\t\t\tName: UserName,\n\t\t\tEmail: UserEmail,\n\t\t\tWhen: time.Now(),\n\t\t},\n\t})\n\tlog.Printf(\"# %s\", tag)\n\treturn err\n}", "func parseSemVer(s string) (uint32, uint32, uint32, string, string, error) {\n\t// Parse the various semver component from the version string via a regular\n\t// expression.\n\tm := semverRE.FindStringSubmatch(s)\n\tif m == nil {\n\t\terr := fmt.Errorf(\"malformed version string %q: does not conform to \"+\n\t\t\t\"semver specification\", s)\n\t\treturn 0, 0, 0, \"\", \"\", err\n\t}\n\n\tmajor, err := parseUint32(m[1], \"major\")\n\tif err != nil {\n\t\treturn 0, 0, 0, \"\", \"\", err\n\t}\n\n\tminor, err := parseUint32(m[2], \"minor\")\n\tif err != nil {\n\t\treturn 0, 0, 0, \"\", \"\", err\n\t}\n\n\tpatch, err := parseUint32(m[3], \"patch\")\n\tif err != nil {\n\t\treturn 0, 0, 0, \"\", \"\", err\n\t}\n\n\tpreRel := m[4]\n\terr = checkSemString(preRel, semanticAlphabet, \"pre-release\")\n\tif err != nil {\n\t\treturn 0, 0, 0, s, s, err\n\t}\n\n\tbuild := m[5]\n\terr = checkSemString(build, semanticAlphabet, \"buildmetadata\")\n\tif err != nil {\n\t\treturn 0, 0, 0, s, s, err\n\t}\n\n\treturn major, minor, patch, preRel, build, nil\n}", "func Version() string {\r\n\tonce.Do(func() {\r\n\t\tsemver := fmt.Sprintf(\"%d.%d.%d\", major, minor, patch)\r\n\t\tverBuilder := bytes.NewBufferString(semver)\r\n\t\tif tag != \"\" && tag != \"-\" {\r\n\t\t\tupdated := strings.TrimPrefix(tag, \"-\")\r\n\t\t\t_, err := verBuilder.WriteString(\"-\" + updated)\r\n\t\t\tif err == nil {\r\n\t\t\t\tverBuilder = bytes.NewBufferString(semver)\r\n\t\t\t}\r\n\t\t}\r\n\t\tversion = verBuilder.String()\r\n\t})\r\n\treturn version\r\n}", "func versionTag(version *version.Version) string {\n\tif version == nil {\n\t\treturn \"\"\n\t}\n\n\treturn fmt.Sprintf(\"v%s\", version.String())\n}", "func (b BuildInfo) Semver() (*semver.Version, error) {\r\n\tsv, err := semver.Make(b.Version)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn &sv, nil\r\n}", "func (r *Repository) FindSemverTag(c *semver.Constraints) (*plumbing.Reference, error) {\n\t// Check if Repository is nil to avoid a panic if this function is called\n\t// before repo has been cloned\n\tif r.Repository == nil {\n\t\treturn nil, errors.New(\"Repository is nil\")\n\t}\n\n\ttagsIter, err := r.Tags()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcoll := semverref.Collection{}\n\n\tif err := tagsIter.ForEach(func(t *plumbing.Reference) error {\n\t\tv, err := semver.NewVersion(t.Name().Short())\n\t\tif err != nil {\n\t\t\treturn nil // Ignore errors and thus tags that aren't parsable as a semver\n\t\t}\n\n\t\t// No way to a priori find the length of tagsIter so append to the collection.\n\t\tcoll = append(coll, semverref.SemverRef{Ver: v, Ref: t})\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn coll.HighestMatch(c)\n}", "func ParseTag(tagName string) (major, minor, patch int, ok bool) {\n\tconst prefix = \"go\"\n\tif !strings.HasPrefix(tagName, prefix) {\n\t\treturn 0, 0, 0, false\n\t}\n\tv := strings.SplitN(tagName[len(prefix):], \".\", 4)\n\tif len(v) > 3 {\n\t\treturn 0, 0, 0, false\n\t}\n\tmajor, ok = parse0To999(v[0])\n\tif !ok || major == 0 {\n\t\treturn 0, 0, 0, false\n\t}\n\tif len(v) == 2 || len(v) == 3 {\n\t\tminor, ok = parse0To999(v[1])\n\t\tif !ok {\n\t\t\treturn 0, 0, 0, false\n\t\t}\n\t}\n\tif len(v) == 3 {\n\t\tpatch, ok = parse0To999(v[2])\n\t\tif !ok {\n\t\t\treturn 0, 0, 0, false\n\t\t}\n\t}\n\treturn major, minor, patch, true\n}", "func isSemverFormat(fl FieldLevel) bool {\n\tsemverString := fl.Field().String()\n\n\treturn semverRegex.MatchString(semverString)\n}", "func tag() string {\n\ts, _ := sh.Output(\"bash\", \"-c\", \"git describe --abbrev=0 --tags 2> /dev/null\")\n\tif s == \"\" {\n\t\treturn \"0.0.0\"\n\t}\n\treturn s\n}", "func tag() string {\n\ts, _ := sh.Output(\"bash\", \"-c\", \"git describe --abbrev=0 --tags 2> /dev/null\")\n\tif s == \"\" {\n\t\treturn \"0.0.0\"\n\t}\n\treturn s\n}", "func TestVersionSemVer(t *testing.T) {\n\tt.Logf(\"Testing version semantic (%s)\", Version)\n\tdetails := strings.Split(Version, \".\")\n\tif len(details) != 3 {\n\t\tt.Errorf(\"Version should provide major, minor and path informations: %s\", Version)\n\t}\n\tif _, err := strconv.ParseInt(details[0], 2, 0); err != nil {\n\t\tt.Errorf(err.Error())\n\t}\n\tif _, err := strconv.ParseInt(details[1], 2, 0); err != nil {\n\t\tt.Errorf(err.Error())\n\t}\n\n\tpatch := strings.Split(details[2], \"-\")\n\tif _, err := strconv.ParseInt(patch[0], 2, 0); err != nil {\n\t\tt.Errorf(err.Error())\n\t}\n\tif len(patch) > 2 {\n\t\tt.Error(\"last version part only provides patch number and pre-release info\")\n\n\t}\n}", "func (sid SourceID) Tag() string {\n\treturn sid.Version.Format(semv.MajorMinorPatch)\n}", "func ValidateSemVer(attribute, data string) error {\n\n\tif data == \"\" {\n\t\treturn nil\n\t}\n\n\t_, err := semver.Parse(strings.TrimPrefix(data, \"v\"))\n\tif err != nil {\n\t\treturn makeValidationError(attribute, fmt.Sprintf(\"invalid semver %s: %s\", data, err))\n\t}\n\n\treturn nil\n}", "func addSemverPrefix(s string) string {\n\tif !strings.HasPrefix(s, \"v\") && !strings.HasPrefix(s, \"go\") {\n\t\treturn \"v\" + s\n\t}\n\treturn s\n}", "func parseVersion(v string) (semver.Version, error) {\n\tparts := strings.Split(v, \".\")\n\tvar err error\n\tfor i := len(parts); i > 0; i-- {\n\t\tvar ver semver.Version\n\t\tver, err = semver.ParseTolerant(strings.Join(parts[:i], \".\"))\n\t\tif err == nil {\n\t\t\treturn ver, nil\n\t\t}\n\t}\n\treturn semver.Version{}, err\n}", "func removeSemverPrefix(s string) string {\n\ts = strings.TrimPrefix(s, \"v\")\n\ts = strings.TrimPrefix(s, \"go\")\n\treturn s\n}", "func ParseStrictSV(semver string) (*SV, error) {\n\tsv := SV{}\n\tvar err error\n\n\tparts := strings.SplitN(semver, \"+\", 2)\n\tif len(parts) == 2 {\n\t\tsemver = parts[0]\n\t\tsv.buildIDs = strings.Split(parts[1], \".\")\n\t\tif err = CheckAllBuildIDs(sv.buildIDs); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"bad %s - %s\", Name, err)\n\t\t}\n\t}\n\n\tparts = strings.SplitN(semver, \"-\", 2)\n\tif len(parts) == 2 {\n\t\tsemver = parts[0]\n\t\tsv.preRelIDs = strings.Split(parts[1], \".\")\n\t\tif err = CheckAllPreRelIDs(sv.preRelIDs); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"bad %s - %s\", Name, err)\n\t\t}\n\t}\n\n\tparts = strings.SplitN(semver, \".\", 3)\n\tif len(parts) != 3 {\n\t\treturn nil,\n\t\t\tfmt.Errorf(\"bad %s\"+\n\t\t\t\t\" - it cannot be split into major/minor/patch parts\",\n\t\t\t\tName)\n\t}\n\n\tsv.major, err = strToVNum(parts[0], \"major\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"bad %s - %s\", Name, err)\n\t}\n\tsv.minor, err = strToVNum(parts[1], \"minor\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"bad %s - %s\", Name, err)\n\t}\n\tsv.patch, err = strToVNum(parts[2], \"patch\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"bad %s - %s\", Name, err)\n\t}\n\n\tsv.hasBeenSet = true\n\n\treturn &sv, nil\n}", "func ReleaseSemver() string {\n\ts := removeVAndHash(ReleaseVersion)\n\tv, err := semver.NewVersion(s)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn v.String()\n}", "func (sem *SemVer) String() (version string) {\n\tbase := fmt.Sprintf(\"v%d.%d.%d\", sem.Major, sem.Minor, sem.Patch)\n\tif len(sem.Pre) > 0 {\n\t\tvar build string\n\t\tfor _, val := range sem.Pre {\n\t\t\tbuild = build + \"-\" + val.String()\n\t\t}\n\t\treturn fmt.Sprintf(\"%s%s\", base, build)\n\t}\n\treturn base\n}", "func goTagForVersion(v string) string {\n\ttag, err := stdlib.TagForVersion(v)\n\tif err != nil {\n\t\tlog.Errorf(context.TODO(), \"goTagForVersion(%q): %v\", v, err)\n\t\treturn \"unknown\"\n\t}\n\treturn tag\n}", "func NewSemver(str string) (semver *Semver, err error) {\n\tmatches := semverRegexp.FindAllStringSubmatch(str, -1)\n\tif matches == nil {\n\t\treturn nil, fmt.Errorf(\"Failed to parse given version as semver: %s\", str)\n\t}\n\n\tsemver = &Semver{}\n\n\tif semver.Major, err = strconv.Atoi(matches[0][1]); err != nil {\n\t\treturn nil, err\n\t}\n\tif semver.Minor, err = strconv.Atoi(matches[0][2]); err != nil {\n\t\treturn nil, err\n\t}\n\tif semver.Patch, err = strconv.Atoi(matches[0][3]); err != nil {\n\t\treturn nil, err\n\t}\n\tsemver.Suffix = matches[0][4]\n\n\treturn semver, nil\n}", "func (ver *Version) SemVer() (SemVer, error) {\n\treturn NewSemVer(ver.Version)\n}", "func sortTags(tags []string) {\n\tsort.Slice(tags, func(i, j int) bool {\n\t\timatch := semverRegex.FindStringSubmatch(tags[i])\n\t\tjmatch := semverRegex.FindStringSubmatch(tags[j])\n\t\tif len(imatch) < 5 {\n\t\t\treturn false\n\t\t}\n\t\tif len(jmatch) < 5 {\n\t\t\treturn true\n\t\t}\n\n\t\t// Matches must be numbers due to regex they are parsed from.\n\t\tiM, _ := strconv.Atoi(imatch[1])\n\t\tjM, _ := strconv.Atoi(jmatch[1])\n\t\tim, _ := strconv.Atoi(imatch[2])\n\t\tjm, _ := strconv.Atoi(jmatch[2])\n\t\tip, _ := strconv.Atoi(imatch[3])\n\t\tjp, _ := strconv.Atoi(jmatch[3])\n\n\t\t// weight each level of semver for comparison\n\t\tiTotal := iM*marjorWeight + im*minorWeight + ip*patchWeight\n\t\tjTotal := jM*marjorWeight + jm*minorWeight + jp*patchWeight\n\n\t\t// de-rank all prereleases by a major version\n\t\tif imatch[4] != \"\" {\n\t\t\tiTotal -= marjorWeight\n\t\t}\n\t\tif jmatch[4] != \"\" {\n\t\t\tjTotal -= marjorWeight\n\t\t}\n\n\t\treturn iTotal > jTotal\n\t})\n}", "func Parsed() *semver.Version {\n\tversionToParse := String\n\tif String == \"dev\" {\n\t\tversionToParse = \"0.0.0+dev\"\n\t}\n\tparsedVersion, err := semver.NewVersion(versionToParse)\n\t// We have no semver version but a commitid\n\tif err != nil {\n\t\tparsedVersion, err = semver.NewVersion(\"0.0.0+\" + String)\n\t\t// this should never happen\n\t\tif err != nil {\n\t\t\treturn &semver.Version{}\n\t\t}\n\t}\n\treturn parsedVersion\n}", "func NewSemVer(major uint16, minor uint16, patch uint16) *SemVer {\n\treturn &SemVer{major, minor, patch}\n}", "func isSemVer(version string) bool {\n\t_, err := semver.Make(version)\n\treturn err == nil\n}", "func GetTagVersion() (string, int, error) {\n\t// Find all the version tags.\n\tcmd := exec.Command(\"git\", \"tag\", \"-l\", \"v[0-9]*\")\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\treturn \"\", 0, err\n\t}\n\ttags := strings.Split(string(out), \"\\n\")\n\n\t// Find the ancestor tags\n\tancestors := []string{}\n\tfor _, tag := range tags {\n\t\tcmd := exec.Command(\"git\", \"merge-base\", \"--is-ancestor\", tag, \"HEAD\")\n\t\t_, err := cmd.Output()\n\t\tif err == nil {\n\t\t\tancestors = append(ancestors, tag)\n\t\t}\n\t}\n\n\t// Find the most recent ancestor\n\tnumCommits := -1\n\tbestTag := \"\"\n\tfor _, tag := range ancestors {\n\t\tcmd := exec.Command(\"git\", \"log\", \"--oneline\", tag+\"..HEAD\")\n\t\tout, err := cmd.Output()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tn := len(strings.Split(string(out), \"\\n\")) - 1\n\t\tif numCommits < 0 || n < numCommits {\n\t\t\tnumCommits = n\n\t\t\tbestTag = tag\n\t\t}\n\t}\n\tif numCommits < 0 || bestTag == \"\" {\n\t\treturn \"\", 0, fmt.Errorf(\"No version tags\")\n\t}\n\treturn bestTag, numCommits, nil\n}", "func NewSemver(ver string) (*Semver, error) {\n\tv := &Semver{}\n\terr := v.set(ver)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "func ParseVersion(raw string) (*Version, error) {\n\tconst standardError = \"invalid version string\"\n\n\trawSegments := strings.Split(raw, \".\")\n\tif !(len(rawSegments) == 3 || (len(rawSegments) == 4 && strings.Contains(rawSegments[2], \"-\"))) {\n\t\treturn nil, errors.New(standardError)\n\t}\n\n\tv := &Version{segments: make([]int64, 4), original: raw}\n\tfor i, str := range rawSegments {\n\t\t//For any case such as SemVer-preview.1, SemVer-beta.1, SemVer-alpha.1 this would be true, and we assume the version to be a preview version.\n\t\tif strings.Contains(str, \"-\") {\n\t\t\tif i != 2 {\n\t\t\t\treturn nil, errors.New(standardError)\n\t\t\t}\n\t\t\tv.preview = true\n\t\t\t//Splitting the string into two pieces and extracting SemVer which is always at 0th index\n\t\t\tstr = strings.Split(str, \"-\")[0]\n\t\t}\n\n\t\tval, err := strconv.ParseInt(str, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(standardError)\n\t\t}\n\t\tv.segments[i] = val\n\t}\n\n\treturn v, nil\n}", "func getUpdatedRefFromTag(owner string, repo string, path string, tagName string, commitSHA string, allTags []string) (string, error) {\n\tif recommendationActionRefs == nil {\n\t\tif err := loadRecommendationsFromWeb(); err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"failed to load recommendations from web\")\n\t\t}\n\t}\n\n\t// if the action is in the recommendations\n\tk := fmt.Sprintf(\"%s/%s\", owner, repo)\n\tif path != \"\" {\n\t\tk = fmt.Sprintf(\"%s/%s\", k, path)\n\t}\n\trecommend, ok := recommendationActionRefs[k]\n\tif ok {\n\t\t// the repo (owner/repo/path) was found in the recommends list\n\t\tif recommend.RecommendedRefType == \"tag\" {\n\t\t\t// the owner recommends tags\n\t\t\tfor _, recommendedTag := range recommend.RecommendedRefs {\n\t\t\t\tif recommendedTag == tagName {\n\t\t\t\t\t// exact match, return it\n\t\t\t\t\treturn ref.CreateRefString(owner, repo, path, tagName), nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// the exact tag was not found in the recommendations\n\t\t\t// so let's sort by semver and return the highest\n\t\t\tparsedVersions := []*semver.Version{}\n\t\t\tfor _, allTag := range allTags {\n\t\t\t\tv, err := semver.NewVersion(allTag)\n\t\t\t\tif err == nil {\n\t\t\t\t\tparsedVersions = append(parsedVersions, v)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(parsedVersions) > 0 {\n\t\t\t\t// there are some semvers so we can pick the highest\n\t\t\t\tsort.Sort(semver.Collection(parsedVersions))\n\t\t\t\thighestVersion := parsedVersions[len(parsedVersions)-1]\n\t\t\t\treturn ref.CreateRefString(owner, repo, path, highestVersion.Original()), nil\n\t\t\t}\n\n\t\t\t// ok so here, we recommend tags, tags aren't semver and we don't have a match\n\t\t\t// this is sorted, so we will recommend the top tag in the list\n\t\t\tif len(allTags) > 0 {\n\t\t\t\treturn ref.CreateRefString(owner, repo, path, allTags[0]), nil\n\t\t\t}\n\t\t}\n\t}\n\n\t// if the version parses as semver\n\tv, err := semver.NewVersion(tagName)\n\tif err == nil {\n\t\tparsedVersions := []*semver.Version{}\n\t\tfor _, allTag := range allTags {\n\t\t\tv, err := semver.NewVersion(allTag)\n\t\t\tif err == nil {\n\t\t\t\tparsedVersions = append(parsedVersions, v)\n\t\t\t}\n\t\t}\n\t\tif len(parsedVersions) > 0 {\n\t\t\t// there are some semvers so we can pick the highest\n\t\t\tsort.Sort(semver.Collection(parsedVersions))\n\n\t\t\t// Find the most specific version of the tag\n\t\t\tmostSpecificVersion := v\n\t\t\tfor _, parsedVersion := range parsedVersions {\n\t\t\t\tif parsedVersion.GreaterThan(v) {\n\t\t\t\t\tif parsedVersion.Major() == v.Major() {\n\t\t\t\t\t\tif parsedVersion.GreaterThan(mostSpecificVersion) {\n\t\t\t\t\t\t\tmostSpecificVersion = parsedVersion\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn ref.CreateRefString(owner, repo, path, mostSpecificVersion.Original()), nil\n\t\t}\n\n\t}\n\n\t// when all else fails, return the commit sha\n\treturn ref.CreateRefString(owner, repo, path, commitSHA), nil\n}", "func StripVersionFromDependency(content string) (res string, err error) {\n\tfields := strings.Split(content, \"/\")\n\tlastField := fields[len(fields)-1]\n\n\t_, err = version.NewVersion(lastField)\n\tif err != nil {\n\t\terr = errors.Wrapf(err,\n\t\t\t\"failed to parse semver\")\n\t\treturn\n\t}\n\n\tres = strings.Join(fields[0:len(fields)-1], \"/\")\n\treturn\n}", "func (s *Semver) set(ver string) error {\n\tsv, err := semverlib.NewVersion(ver)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.Version = sv\n\treturn nil\n}", "func (mi *modInfo) Tag() string {\n\tif mi.tagPrefix == \"\" {\n\t\treturn mi.futureTagVersion\n\t}\n\treturn fmt.Sprintf(\"%s/%s\", mi.tagPrefix, mi.futureTagVersion)\n}", "func NormalizeTag(tag string) string {\n\ttag = strings.ToLower(tag)\n\treturn strings.Replace(tag, \"_\", \"-\", -1)\n}", "func NewSemver(major, minor, patch uint32) Semver {\n\treturn Semver{major, minor, patch}\n}", "func selectTag(goVersion string, tags []string) (match string) {\n\tconst rPrefix = \"release.r\"\n\tif strings.HasPrefix(goVersion, rPrefix) {\n\t\tp := \"go.r\"\n\t\tv, err := strconv.ParseFloat(goVersion[len(rPrefix):], 64)\n\t\tif err != nil {\n\t\t\treturn \"\"\n\t\t}\n\t\tvar matchf float64\n\t\tfor _, t := range tags {\n\t\t\tif !strings.HasPrefix(t, p) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttf, err := strconv.ParseFloat(t[len(p):], 64)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif matchf < tf && tf <= v {\n\t\t\t\tmatch, matchf = t, tf\n\t\t\t}\n\t\t}\n\t}\n\tconst wPrefix = \"weekly.\"\n\tif strings.HasPrefix(goVersion, wPrefix) {\n\t\tp := \"go.weekly.\"\n\t\tv := goVersion[len(wPrefix):]\n\t\tfor _, t := range tags {\n\t\t\tif !strings.HasPrefix(t, p) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif match < t && t[len(p):] <= v {\n\t\t\t\tmatch = t\n\t\t\t}\n\t\t}\n\t}\n\treturn match\n}", "func CalculateFeatureCompatibilityVersion(versionStr string) string {\n\tv1, err := semver.Make(versionStr)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\tif v1.GTE(semver.MustParse(\"3.4.0\")) {\n\t\treturn fmt.Sprintf(\"%d.%d\", v1.Major, v1.Minor)\n\t}\n\n\treturn \"\"\n}", "func NewSemVer(v string) (SemVer, error) {\n\tver, err := semver.ParseTolerant(v)\n\tif err != nil {\n\t\treturn SemVer{}, VerError.Wrap(err)\n\t}\n\n\treturn SemVer{\n\t\tVersion: ver,\n\t}, nil\n}", "func ExtractVersion(r io.Reader) (*semver.Version, error) {\n\tbuffer := make([]byte, 8)\n\tif _, err := io.ReadFull(r, buffer); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := bytes.NewBuffer(buffer)\n\n\treserved := uint16(0)\n\tif err := encoding.ReadUint16LE(buf, &reserved); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmajor := uint16(0)\n\tif err := encoding.ReadUint16LE(buf, &major); err != nil {\n\t\treturn nil, err\n\t}\n\n\tminor := uint16(0)\n\tif err := encoding.ReadUint16LE(buf, &minor); err != nil {\n\t\treturn nil, err\n\t}\n\n\tpatch := uint16(0)\n\tif err := encoding.ReadUint16LE(buf, &patch); err != nil {\n\t\treturn nil, err\n\t}\n\n\tversion, err := semver.NewVersion(fmt.Sprintf(\"%d.%d.%d\", major, minor, patch))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn version, nil\n}", "func (s *Semver) Semver() *semverlib.Version {\n\treturn s.Version\n}", "func (v *Version) SemanticVersion() (major, minor, patch uint) {\n\tmajor = uint(v.Version>>16) & 0xFFFF\n\tminor = uint(v.Version>>8) & 0xFF\n\tpatch = uint(v.Version) & 0xFF\n\treturn\n}", "func NewSemVerFromString(versionString string) (*SemVer, error) {\n\tversionString = strings.TrimPrefix(versionString, \"v\")\n\tsplits := strings.Split(versionString, \".\")\n\tif len(splits) != 3 {\n\t\treturn nil, errp.New(\"The version format has to be 'major.minor.patch'.\")\n\t}\n\n\tmajor, err := strconv.Atoi(splits[0])\n\tif err != nil {\n\t\treturn nil, errp.Wrap(err, \"The major version is not a number.\")\n\t}\n\n\tminor, err := strconv.Atoi(splits[1])\n\tif err != nil {\n\t\treturn nil, errp.Wrap(err, \"The minor version is not a number.\")\n\t}\n\n\tpatch, err := strconv.Atoi(splits[2])\n\tif err != nil {\n\t\treturn nil, errp.Wrap(err, \"The patch version is not a number.\")\n\t}\n\n\treturn &SemVer{major: uint16(major), minor: uint16(minor), patch: uint16(patch)}, nil\n}", "func GetTagVersionForDownloadScript(version string) string {\n\tif !IsReleasedTagVersion(version) {\n\t\treturn \"master\"\n\t}\n\n\treturn version\n}", "func PHPSetSemver(oldVersion string, newVersion *semver.Version) error {\n\t// open version file\n\trawdata, err := GetFileContents(config.FilePath)\n\tif err != nil {\n\t\treturn errors.New(\"Error opening version file\")\n\t}\n\n\t// extract the version\n\tcontents := string(rawdata)\n\tre := regexp.MustCompile(config.VersionKey + \".*'(.*)'\")\n\tparts := re.FindStringSubmatch(contents)\n\tfind := parts[0]\n\treplace := strings.Replace(find, oldVersion, newVersion.String(), 1)\n\tnewContents := strings.Replace(contents, find, replace, 1)\n\n\terr = PutFileContents(config.FilePath, newContents)\n\tif err != nil {\n\t\treturn errors.New(\"Error writing version file\")\n\t}\n\n\treturn nil\n}", "func NewOldSemVer(v string) (OldSemVer, error) {\n\tver, err := NewSemVer(v)\n\tif err != nil {\n\t\treturn OldSemVer{}, err\n\t}\n\n\treturn OldSemVer{\n\t\tMajor: int64(ver.Major),\n\t\tMinor: int64(ver.Minor),\n\t\tPatch: int64(ver.Patch),\n\t}, nil\n}", "func Parse(version string) (*Version, error) {\n\tv, err := semver.NewVersion(version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Version{\n\t\tMajor: v.Major(),\n\t\tMinor: v.Minor(),\n\t\tPatch: v.Patch(),\n\t}, nil\n}", "func tryVersionDateSha(ver string) (ref string, ok bool) {\n\tcomponents := strings.Split(ver, \"-\")\n\n\tif len(components) != 3 {\n\t\treturn\n\t}\n\n\tok = true\n\tref = components[2]\n\n\treturn\n}", "func CanonicalVersion(in string) string {\n\tmatches := regexCanonical.FindStringSubmatch(in)\n\tversion := regexGroup(regexCanonical, \"version\", matches)\n\treturn semver.Canonical(version)\n}", "func formTag(u *bsonTag) *model.Tag {\n\treturn &model.Tag{\n\t\tID: u.ID.Hex(),\n\t\tTag: u.Tag,\n\t\tUserID: u.UserID,\n\t\tExpireAt: u.ExpireAt,\n\t\tCreatedAt: u.CreatedAt,\n\t\tUpdatedAt: u.UpdatedAt,\n\t}\n}", "func ParseTagging(src string) *Tagging {\n\tvar res Tagging\n\tseps := strings.SplitN(src, \":\", 2)\n\tres.Name = seps[0]\n\tif len(seps) == 2 {\n\t\tres.Versions = strings.Split(seps[1], \",\")\n\t}\n\treturn &res\n}", "func ParseVersion(v string) (*semver.Version, error) {\n\t// for compatibility with old version which not support `version` mechanism.\n\tif v == \"\" {\n\t\treturn semver.New(featuresDict[Base]), nil\n\t}\n\tif v[0] == 'v' {\n\t\tv = v[1:]\n\t}\n\tver, err := semver.NewVersion(v)\n\tif err != nil {\n\t\treturn nil, errs.ErrSemverNewVersion.Wrap(err).GenWithStackByCause()\n\t}\n\treturn ver, nil\n}", "func (r *Repo) Next(ref string) (*semver.Version, error) {\n\tbase := filepath.Base(ref)\n\tversion := base\n\tif strings.HasPrefix(version, \"release-\") {\n\t\tversion = version[len(\"release-\"):]\n\t}\n\tv, err := semver.ParseTolerant(version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tv.Patch = 0\n\tv.Pre = nil\n\tv.Build = nil\n\n\tfam := semver.Versions{}\n\taVersion, _ := regexp.Compile(\"^v\\\\d+.\\\\d+.\\\\d+$\")\n\tfor _, tag := range r.Tags {\n\t\tif !aVersion.MatchString(tag) {\n\t\t\tcontinue\n\t\t}\n\t\ttv, err := semver.ParseTolerant(tag[1:])\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr,\"failed to parse verison in branch: %s, %v\", tag, err)\n\t\t}\n\t\tif tv.Major == v.Major && tv.Minor == v.Minor {\n\t\t\tfam = append(fam, tv)\n\t\t}\n\t}\n\n\tsemver.Sort(fam)\n\n\tif len(fam) > 0 {\n\t\tnext := fam[len(fam)-1]\n\t\tif err := next.IncrementPatch(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &next, nil\n\t} else {\n\t\treturn &v, nil\n\t}\n}", "func (b *Builder) VersionTag(v sous.SourceID, kind string) string {\n\treturn versionTag(b.DockerRegistryHost, v, kind, b.log)\n}", "func TagNameLTE(v string) predicate.GithubRelease {\n\treturn predicate.GithubRelease(sql.FieldLTE(FieldTagName, v))\n}", "func getLatestVersion(r *git.Repository) (tag string, err error) {\n\titer, err := r.Tags()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlatestTag := semver.MustParse(\"0.0.0\")\n\terr = iter.ForEach(func(ref *plumbing.Reference) error {\n\t\tv, err := semver.NewVersion(ref.Name().Short())\n\t\tif err != nil {\n\t\t\txlog.Debugf(\"Ignoring tag %s as it is not a valid semver\", ref.Name().Short())\n\t\t\treturn nil\n\t\t}\n\n\t\tif v.GreaterThan(latestTag) {\n\t\t\tlatestTag = v\n\t\t\treturn nil\n\t\t}\n\n\t\t// version was older than current version\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif latestTag.String() == \"0.0.0\" {\n\t\treturn \"\", errors.New(\"Unable to find latest version\")\n\t}\n\n\treturn latestTag.String(), nil\n}", "func canonicalizeToken(tok string, pkg schema.PackageReference) string {\n\t_, _, member, _ := DecomposeToken(tok, hcl.Range{})\n\treturn fmt.Sprintf(\"%s:%s:%s\", pkg.Name(), pkg.TokenToModule(tok), member)\n}", "func SortTags(tags []string, sortTag SortTag) []string {\n\tswitch sortTag {\n\tcase SortTagReverse:\n\t\tfor i := len(tags)/2 - 1; i >= 0; i-- {\n\t\t\topp := len(tags) - 1 - i\n\t\t\ttags[i], tags[opp] = tags[opp], tags[i]\n\t\t}\n\t\treturn tags\n\tcase SortTagLexicographical:\n\t\tsort.Strings(tags)\n\t\treturn tags\n\tcase SortTagSemver:\n\t\tsemverIsh := func(s string) string {\n\t\t\ts = strings.TrimLeftFunc(s, func(r rune) bool {\n\t\t\t\treturn !unicode.IsNumber(r)\n\t\t\t})\n\t\t\tif vt := fmt.Sprintf(\"v%s\", s); semver.IsValid(vt) {\n\t\t\t\treturn vt\n\t\t\t}\n\t\t\treturn \"\"\n\t\t}\n\t\tsort.Slice(tags, func(i, j int) bool {\n\t\t\tif c := semver.Compare(semverIsh(tags[i]), semverIsh(tags[j])); c > 0 {\n\t\t\t\treturn true\n\t\t\t} else if c < 0 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif c := strings.Count(tags[i], \".\") - strings.Count(tags[j], \".\"); c > 0 {\n\t\t\t\treturn true\n\t\t\t} else if c < 0 {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\treturn strings.Compare(tags[i], tags[j]) < 0\n\t\t})\n\t\treturn tags\n\tdefault:\n\t\treturn tags\n\t}\n}", "func Parse(ref string) (string, string, error) {\n\tdistributionRef, err := distreference.ParseNamed(ref)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\ttag := GetTagFromNamedRef(distributionRef)\n\treturn distributionRef.Name(), tag, nil\n}", "func formatSigTag(imageDesc v1.Descriptor) string {\n\tdigest := imageDesc.Digest\n\treturn fmt.Sprint(digest.Algorithm(), \"-\", digest.Encoded(), \".\", signatureTagSuffix)\n}", "func TagName(v string) predicate.GithubRelease {\n\treturn predicate.GithubRelease(sql.FieldEQ(FieldTagName, v))\n}", "func GetVersions() semver.Collection {\n\tresult := Execute(false, \"git\", \"tag\")\n\tresult.Verify(\"git\", \"Cannot list GIT tags\")\n\n\tvar versions semver.Collection\n\tfor _, tag := range strings.Split(strings.TrimSpace(result.Stdout), \"\\n\") {\n\t\tif !versionMatcher.MatchString(tag) {\n\t\t\tcontinue\n\t\t}\n\n\t\tversion, err := semver.NewVersion(versionMatcher.ReplaceAllString(tag, \"\"))\n\n\t\tif err != nil {\n\t\t\tFail(\"Cannot parse GIT tag {errorPrimary}%s{-} as a version, will skip it: {errorPrimary}%s{-}\", tag, err.Error())\n\t\t\tcontinue\n\t\t}\n\n\t\tversions = append(versions, version)\n\t}\n\n\t// Sort versions\n\tsort.Sort(versions)\n\n\treturn versions\n}", "func FindTagForVersion(dir string, version string, gitter Gitter) (string, error) {\n\terr := gitter.FetchTags(dir)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"fetching tags for %s\", dir)\n\t}\n\tanswer := \"\"\n\ttags, err := gitter.FilterTags(dir, version)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"listing tags for %s\", version)\n\t}\n\tif len(tags) == 1 {\n\t\tanswer = tags[0]\n\t} else if len(tags) == 0 {\n\t\t// try with v\n\t\tfilter := fmt.Sprintf(\"v%s\", version)\n\t\ttags, err := gitter.FilterTags(dir, filter)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrapf(err, \"listing tags for %s\", filter)\n\t\t}\n\t\tif len(tags) == 1 {\n\t\t\tanswer = tags[0]\n\t\t} else {\n\t\t\treturn \"\", errors.Errorf(\"cannot resolve %s to a single git object (searching for tag %s and tag %s), found %+v\", version, version, filter, tags)\n\t\t}\n\t} else {\n\t\treturn \"\", errors.Errorf(\"cannot resolve %s to a single git object, found %+v\", version, tags)\n\t}\n\treturn answer, nil\n}", "func EncodingFromVersionStr(v string) ([]byte, error) {\n\tnewV, err := roachpb.ParseVersion(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnewCV := ClusterVersion{Version: newV}\n\treturn protoutil.Marshal(&newCV)\n}", "func PHPGetSemver() (*semver.Version, error) {\n\t// open version file\n\trawdata, err := GetFileContents(config.FilePath)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Error opening version file\")\n\t}\n\n\t// extract the version\n\tcontents := string(rawdata)\n\tre := regexp.MustCompile(config.VersionKey + \".*'(.*)'\")\n\tparts := re.FindStringSubmatch(contents)\n\n\tif len(parts) < 2 {\n\t\treturn nil, errors.New(\"Error extracting version from version file\")\n\t}\n\n\tversion := parts[1]\n\treturn semver.New(version), nil\n}", "func TagNameLT(v string) predicate.GithubRelease {\n\treturn predicate.GithubRelease(sql.FieldLT(FieldTagName, v))\n}", "func (b *BumpFile) parseVersion() error {\n\tcnt := 0\n\tmatches := regex.FindAllString(string(b.contents), -1)\n\tverstrs, uniform := uniformVersions(matches)\n\tcnt = len(verstrs)\n\tswitch {\n\tcase cnt > 1:\n\t\tif !uniform {\n\t\t\treturn fmt.Errorf(`Expected one version found multiple in %s: %v`, b.path, verstrs)\n\t\t}\n\tcase cnt == 0:\n\t\tfmt.Printf(\"No version found in %s\", b.path)\n\t\treturn nil\n\t}\n\n\tverAtoms := strings.Split(verstrs[0], \".\")\n\tverObj := NewVersion(verAtoms[0], verAtoms[1], verAtoms[2], nil)\n\tb.curver = &verObj\n\n\treturn nil\n}", "func MakeTag(desc string) string {\n\ts := strings.ToLower(desc)\n\ts = strings.Replace(s, \"go \", \"go\", -1)\n\ts = strings.Replace(s, \"java \", \"java\", -1)\n\ts = strings.Replace(s, \"(\", \"\", -1)\n\ts = strings.Replace(s, \")\", \"\", -1)\n\treturn strings.Replace(s, \" \", \"-\", -1)\n}", "func latestVer(names []string) *semver.Version {\n\t//convert names to semver\n\t//get latest version\n\tvar latest *semver.Version\n\n\tfor _, name := range names {\n\t\tverStr := strings.Split(name, \" \")[0]\n\t\tver, err := semver.NewVersion(verStr)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif latest == nil || latest.LessThan(ver) {\n\t\t\tlatest = ver\n\t\t}\n\t}\n\treturn latest\n}", "func ParseSV(semver string) (*SV, error) {\n\ts := strings.TrimPrefix(semver, \"v\")\n\tif s == semver {\n\t\treturn nil,\n\t\t\tfmt.Errorf(\"bad %s - it does not start with a 'v'\", Name)\n\t}\n\n\treturn ParseStrictSV(s)\n}", "func parse(x string) version {\n\tvar v version\n\n\t// Parse major version.\n\tvar ok bool\n\tv.major, x, ok = cutInt(x)\n\tif !ok {\n\t\treturn version{}\n\t}\n\tif x == \"\" {\n\t\t// Interpret \"1\" as \"1.0.0\".\n\t\tv.minor = \"0\"\n\t\tv.patch = \"0\"\n\t\treturn v\n\t}\n\n\t// Parse . before minor version.\n\tif x[0] != '.' {\n\t\treturn version{}\n\t}\n\n\t// Parse minor version.\n\tv.minor, x, ok = cutInt(x[1:])\n\tif !ok {\n\t\treturn version{}\n\t}\n\tif x == \"\" {\n\t\t// Patch missing is same as \"0\" for older versions.\n\t\t// Starting in Go 1.21, patch missing is different from explicit .0.\n\t\tif cmpInt(v.minor, \"21\") < 0 {\n\t\t\tv.patch = \"0\"\n\t\t}\n\t\treturn v\n\t}\n\n\t// Parse patch if present.\n\tif x[0] == '.' {\n\t\tv.patch, x, ok = cutInt(x[1:])\n\t\tif !ok || x != \"\" {\n\t\t\t// Note that we are disallowing prereleases (alpha, beta, rc) for patch releases here (x != \"\").\n\t\t\t// Allowing them would be a bit confusing because we already have:\n\t\t\t//\t1.21 < 1.21rc1\n\t\t\t// But a prerelease of a patch would have the opposite effect:\n\t\t\t//\t1.21.3rc1 < 1.21.3\n\t\t\t// We've never needed them before, so let's not start now.\n\t\t\treturn version{}\n\t\t}\n\t\treturn v\n\t}\n\n\t// Parse prerelease.\n\ti := 0\n\tfor i < len(x) && (x[i] < '0' || '9' < x[i]) {\n\t\tif x[i] < 'a' || 'z' < x[i] {\n\t\t\treturn version{}\n\t\t}\n\t\ti++\n\t}\n\tif i == 0 {\n\t\treturn version{}\n\t}\n\tv.kind, x = x[:i], x[i:]\n\tif x == \"\" {\n\t\treturn v\n\t}\n\tv.pre, x, ok = cutInt(x)\n\tif !ok || x != \"\" {\n\t\treturn version{}\n\t}\n\n\treturn v\n}", "func checkVersion(ver string) error {\n\tif ver[0] == 'v' {\n\t\tver = ver[1:]\n\t}\n\tv, err := semver.NewVersion(ver)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc, err := semver.NewConstraint(\">= 1.2\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !c.Check(v) {\n\t\treturn ErrIncompatibleVersion\n\t}\n\treturn nil\n}", "func (sv *SemVer) BumpMajor() string {\n\tv := sv.Version.IncMajor()\n\treturn v.String()\n}", "func tag() string {\n\tbuf := &bytes.Buffer{}\n\t_, _ = sh.Exec(nil, buf, nil, \"git\", \"describe\", \"--tags\")\n\treturn buf.String()\n}", "func parseVersion(v string) string {\n\treturn strings.Replace(v, \"+\", \"-\", -1)\n}", "func SortSemanticVersion(items []string) ([]string, []string) {\n\tversionMap := make(map[*semver.Version]string, len(items))\n\tversions := make(semver.Versions, 0, len(items))\n\tvar malformed []string\n\tfor _, item := range items {\n\t\ts := item\n\t\tif strings.HasPrefix(s, \"v\") {\n\t\t\ts = item[1:]\n\t\t}\n\t\tversion, err := semver.NewVersion(s)\n\t\tif err != nil {\n\t\t\tmalformed = append(malformed, item)\n\t\t\tcontinue\n\t\t}\n\t\tversionMap[version] = item\n\t\tversions = append(versions, version)\n\t}\n\tsort.Sort(versions)\n\tvar data []string\n\tfor _, version := range versions {\n\t\tdata = append(data, versionMap[version])\n\t}\n\tsort.Strings(malformed)\n\treturn malformed, data\n}", "func SplitVersionFromStack(stackWithVersion string) (string, string, error) {\n\tvar requestVersion string\n\tvar stack string\n\n\tif valid, err := ValidateStackVersionTag(stackWithVersion); !valid {\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t\treturn \"\", \"\", fmt.Errorf(\"stack/version tag '%s' is malformed, use form '<stack>:<version>' or '<stack>'\",\n\t\t\tstackWithVersion)\n\t} else if strings.Contains(stackWithVersion, \":\") {\n\t\tpair := strings.Split(stackWithVersion, \":\")\n\t\tif len(pair) != 2 {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"problem splitting stack/version pair from tag '%s', instead of a pair got a length of %d\",\n\t\t\t\tstackWithVersion, len(pair))\n\t\t}\n\n\t\tstack = pair[0]\n\t\trequestVersion = pair[1]\n\t} else {\n\t\tstack = stackWithVersion\n\t\trequestVersion = \"\"\n\t}\n\n\treturn stack, requestVersion, nil\n}", "func isAboveV1(content string) bool {\n\tver, err := version.NewVersion(content)\n\tif err != nil {\n\t\tpanic(errors.Wrapf(err, \"must've provided a valid semver\"))\n\t}\n\n\tsegments := ver.Segments()\n\treturn segments[0] > 1\n}", "func parseVersionRelease(nvr string) (version, release string) {\n\treleaseIndex := strings.LastIndex(nvr, \"-\")\n\trelease = nvr[releaseIndex+1:]\n\n\tversionIndex := strings.LastIndex(nvr[:releaseIndex], \"-\")\n\tversion = nvr[versionIndex+1 : releaseIndex]\n\treturn\n}", "func Parse(vsnstr string) (Version, error) {\n\t// Split version, pre-release, and metadata.\n\tnpmstrs, err := splitVersionString(vsnstr)\n\tif err != nil {\n\t\treturn New(0, 0, 0), err\n\t}\n\t// Parse these parts.\n\tnums, err := parseNumberString(npmstrs[0])\n\tif err != nil {\n\t\treturn New(0, 0, 0), err\n\t}\n\tprmds := []string{}\n\tif npmstrs[1] != \"\" {\n\t\tprmds = strings.Split(npmstrs[1], \".\")\n\t}\n\tif npmstrs[2] != \"\" {\n\t\tprmds = append(prmds, Metadata)\n\t\tprmds = append(prmds, strings.Split(npmstrs[2], \".\")...)\n\t}\n\t// Done.\n\treturn New(nums[0], nums[1], nums[2], prmds...), nil\n}", "func (g *GitUtil) GetLastVersion() (*semver.Version, string, error) {\n\n\tvar tags []*semver.Version\n\n\tgitTags, err := g.Repository.Tags()\n\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\terr = gitTags.ForEach(func(p *plumbing.Reference) error {\n\t\tv, err := semver.NewVersion(p.Name().Short())\n\t\tlog.Tracef(\"Tag %+v with hash: %s\", p.Name().Short(), p.Hash())\n\n\t\tif err == nil {\n\t\t\ttags = append(tags, v)\n\t\t} else {\n\t\t\tlog.Debugf(\"Tag %s is not a valid version, skip\", p.Name().Short())\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tsort.Sort(sort.Reverse(semver.Collection(tags)))\n\n\tif len(tags) == 0 {\n\t\tlog.Debugf(\"Found no tags\")\n\t\treturn nil, \"\", nil\n\t}\n\n\tlog.Debugf(\"Found old version %s\", tags[0].String())\n\n\ttag, err := g.Repository.Tag(tags[0].Original())\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tlog.Debugf(\"Found old hash %s\", tag.Hash().String())\n\treturn tags[0], tag.Hash().String(), nil\n}", "func ToPackageVersion(pf *packages.Files, digest string, url string) *PackageVersion {\n\to := pf.Operator\n\tif url == \"\" {\n\t\turl = defaultURL\n\t}\n\tif url[len(url)-1:] != \"/\" {\n\t\turl = url + \"/\"\n\t}\n\turl = fmt.Sprintf(\"%s%s-%v.tgz\", url, o.Name, o.Version)\n\tpv := PackageVersion{\n\t\tMetadata: &Metadata{\n\t\t\tName: o.Name,\n\t\t\tVersion: o.Version,\n\t\t\tDescription: o.Description,\n\t\t\tMaintainers: o.Maintainers,\n\t\t\tAppVersion: o.AppVersion,\n\t\t},\n\t\tURLs: []string{url},\n\t\tDigest: digest,\n\t}\n\treturn &pv\n}" ]
[ "0.8033717", "0.64685607", "0.64685607", "0.6248479", "0.6246429", "0.61023104", "0.6089825", "0.6022404", "0.5941345", "0.58103824", "0.57868564", "0.5746408", "0.56511533", "0.56365997", "0.56305784", "0.5590219", "0.5577145", "0.55253094", "0.547381", "0.54599845", "0.54329455", "0.54167295", "0.54016536", "0.5349894", "0.53452694", "0.534192", "0.53414994", "0.53401357", "0.53401357", "0.5321922", "0.5293414", "0.5275683", "0.5271888", "0.52662295", "0.52587914", "0.52419275", "0.5241498", "0.5234488", "0.5231417", "0.52219856", "0.52191037", "0.51999706", "0.5185642", "0.5184801", "0.5170412", "0.5120165", "0.51152754", "0.5102466", "0.51013124", "0.50835675", "0.50327593", "0.50195616", "0.50055414", "0.49750462", "0.49279472", "0.49169585", "0.49167567", "0.49069467", "0.4904491", "0.49044538", "0.48893422", "0.4871533", "0.48692453", "0.4859147", "0.48460087", "0.48445198", "0.48416218", "0.47755867", "0.47733307", "0.4772678", "0.47624514", "0.47329056", "0.4731029", "0.4722074", "0.4721772", "0.4712394", "0.47117567", "0.46792674", "0.46760407", "0.46753374", "0.46518987", "0.46491396", "0.4642544", "0.46282867", "0.46259448", "0.46248493", "0.46170196", "0.46161914", "0.46107724", "0.4610095", "0.4607206", "0.46039557", "0.46027443", "0.45983976", "0.45810536", "0.4580529", "0.45761368", "0.45672777", "0.4564631", "0.45510477" ]
0.8342163
0
LiftUp semver based on changelog
func (s *Semver) Upgrade(cl *Changelog) { switch { case len(cl.Removed)+len(cl.Changed) > 0: s.Major++ s.Minor = 0 s.Patch = 0 case len(cl.Deprecated)+len(cl.Added)+len(cl.MissingDefination) > 0: s.Minor++ s.Patch = 0 case len(cl.Fixed)+len(cl.Security) > 0: s.Patch++ } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newVer(major, minor, patch uint8) Version {/* Release 1.0.1, update Readme, create changelog. */\n\treturn Version(uint32(major)<<16 | uint32(minor)<<8 | uint32(patch))\n}", "func main() {\n\tgitRepo := git.NewDefaultVersionGitRepo()\n\tbumper := version.NewConventionalCommitBumpStrategy(gitRepo)\n\tversion, err := bumper.Bump()\n\n\tif err != nil {\n\t\tlog.Error(\"Cannot bump version caused by: %v\", err)\n\t\tos.Exit(1)\n\t}\n\tfmt.Println(version)\n}", "func semverify(version string) string {\n\tmatch := semverPattern.FindStringSubmatch(version)\n\tif match != nil && len(match) == 6 {\n\t\t// replace the last component of the semver (which is always 0 in our versioning scheme)\n\t\t// with the number of commits since the last tag\n\t\treturn fmt.Sprintf(\"%v.%v.%v+%v\", match[1], match[2], match[4], match[5])\n\t}\n\treturn version\n}", "func (s *Semver) set(ver string) error {\n\tsv, err := semverlib.NewVersion(ver)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.Version = sv\n\treturn nil\n}", "func Version(remote, detail bool) {\n\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tmsg := fmt.Sprintf(\"'%v' an error has occurred. please check. \\nError: \", \"gnvm version -r\")\n\t\t\tError(ERROR, msg, err)\n\t\t\tos.Exit(0)\n\t\t}\n\t}()\n\n\tlocalVersion, arch := config.VERSION, \"32 bit\"\n\tif runtime.GOARCH == \"amd64\" {\n\t\tarch = \"64 bit\"\n\t}\n\n\tcp := CP{Red, true, None, true, \"Kenshin Wang\"}\n\tcp1 := CP{Red, true, None, true, \"fallenwood\"}\n\tP(DEFAULT, \"Current version %v %v.\", localVersion, arch, \"\\n\")\n\tP(DEFAULT, \"Copyright (C) 2014-2016 %v <[email protected]>\", cp, \"\\n\")\n\tP(DEFAULT, \"Copyright (C) 2022 %v <[email protected]>\", cp1, \"\\n\")\n\tcp.FgColor, cp.Value = Blue, \"https://github.com/fallenwood/gnvm\"\n\tP(DEFAULT, \"See %v for more information.\", cp, \"\\n\")\n\n\tif !remote {\n\t\treturn\n\t}\n\n\tcode, res, err := curl.Get(\"http://ksria.com/gnvm/CHANGELOG.md\")\n\tif code != 0 {\n\t\tpanic(err)\n\t}\n\tdefer res.Body.Close()\n\n\tversionFunc := func(content string, line int) bool {\n\t\tif content != \"\" && line == 1 {\n\t\t\tarr := strings.Fields(content)\n\t\t\tif len(arr) == 2 {\n\n\t\t\t\tcp := CP{Red, true, None, true, arr[0][1:]}\n\t\t\t\tP(DEFAULT, \"Latest version %v, publish data %v\", cp, arr[1], \"\\n\")\n\n\t\t\t\tlatestVersion, msg := arr[0][1:], \"\"\n\t\t\t\tlocalArr, latestArr := strings.Split(localVersion, \".\"), strings.Split(latestVersion, \".\")\n\n\t\t\t\tswitch {\n\t\t\t\tcase latestArr[0] > localArr[0]:\n\t\t\t\t\tmsg = \"must be upgraded.\"\n\t\t\t\tcase latestArr[1] > localArr[1]:\n\t\t\t\t\tmsg = \"suggest to upgrade.\"\n\t\t\t\tcase latestArr[2] > localArr[2]:\n\t\t\t\t\tmsg = \"optional upgrade.\"\n\t\t\t\t}\n\n\t\t\t\tif msg != \"\" {\n\t\t\t\t\tP(NOTICE, msg+\" Please download latest %v from %v\", \"gnvm.exe\", \"https://github.com/kenshin/gnvm\", \"\\n\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tif line > 2 && detail {\n\t\t\tP(DEFAULT, content)\n\t\t}\n\n\t\treturn false\n\t}\n\n\tif err := curl.ReadLine(res.Body, versionFunc); err != nil && err != io.EOF {\n\t\tpanic(err)\n\t}\n}", "func (p *plugin) cmdVersion(w irc.ResponseWriter, r *irc.Request, params cmd.ParamList) {\n\trev, _ := strconv.ParseInt(app.VersionRevision, 10, 64)\n\tstamp := time.Unix(rev, 0)\n\tutime := math.Abs(time.Since(lastRestart).Hours())\n\n\tvar upSince string\n\tif utime < 1 {\n\t\tupSince = util.Bold(\"<1\")\n\t} else {\n\t\tupSince = util.Bold(\"%.0f\", utime)\n\t}\n\n\tproto.PrivMsg(\n\t\tw, r.Target,\n\t\tTextVersionDisplay,\n\t\tr.SenderName,\n\t\tutil.Bold(app.Name),\n\t\tutil.Bold(\"%d.%d\", app.VersionMajor, app.VersionMinor),\n\t\tstamp.Format(TextDateFormat),\n\t\tstamp.Format(TextTimeFormat),\n\t\tupSince,\n\t)\n}", "func setupVersion() (*semver.Version, error) {\n\tvar selectedVersion *semver.Version\n\n\tcfg := config.Instance\n\tstate := state.Instance\n\n\tversionType := \"user supplied version\"\n\n\tif len(state.Cluster.Version) == 0 {\n\t\tvar err error\n\n\t\tversionList, err := provider.Versions()\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting versions: %v\", err)\n\t\t}\n\n\t\tavailableVersions := versionList.AvailableVersions()\n\n\t\tif cfg.Cluster.UseLatestVersionForInstall {\n\t\t\tselectedVersion = availableVersions[len(availableVersions)-1].Version()\n\t\t\tversionType = \"latest version\"\n\t\t} else if cfg.Cluster.UseMiddleClusterImageSetForInstall {\n\t\t\tversionsWithoutDefault := removeDefaultVersion(availableVersions)\n\t\t\tnumVersions := len(versionsWithoutDefault)\n\t\t\tif numVersions < 2 {\n\t\t\t\tstate.Cluster.EnoughVersionsForOldestOrMiddleTest = false\n\t\t\t} else {\n\t\t\t\tselectedVersion = versionsWithoutDefault[numVersions/2].Version()\n\t\t\t}\n\t\t\tversionType = \"middle version\"\n\t\t} else if cfg.Cluster.UseOldestClusterImageSetForInstall {\n\t\t\tversionsWithoutDefault := removeDefaultVersion(availableVersions)\n\t\t\tnumVersions := len(versionsWithoutDefault)\n\t\t\tif numVersions < 2 {\n\t\t\t\tstate.Cluster.EnoughVersionsForOldestOrMiddleTest = false\n\t\t\t} else {\n\t\t\t\tselectedVersion = versionsWithoutDefault[0].Version()\n\t\t\t}\n\t\t\tversionType = \"oldest version\"\n\t\t} else if cfg.Cluster.PreviousReleaseFromDefault > 0 {\n\t\t\tdefaultIndex := findDefaultVersionIndex(availableVersions)\n\n\t\t\tif defaultIndex < 0 {\n\t\t\t\tlog.Printf(\"unable to find default version in avaialable version list\")\n\t\t\t\tstate.Cluster.PreviousVersionFromDefaultFound = false\n\t\t\t} else {\n\n\t\t\t\ttargetIndex := defaultIndex - cfg.Cluster.PreviousReleaseFromDefault\n\n\t\t\t\tif targetIndex < 0 {\n\t\t\t\t\tlog.Printf(\"not enough enabled versions to go back %d releases\", cfg.Cluster.PreviousReleaseFromDefault)\n\t\t\t\t\tstate.Cluster.PreviousVersionFromDefaultFound = false\n\t\t\t\t} else {\n\t\t\t\t\tselectedVersion = availableVersions[targetIndex].Version()\n\t\t\t\t\tversionType = fmt.Sprintf(\"version %d releases prior to the default\", cfg.Cluster.PreviousReleaseFromDefault)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if cfg.Cluster.NextReleaseAfterProdDefault > -1 {\n\t\t\tdefaultVersion := versionList.Default()\n\t\t\tselectedVersion, err = nextReleaseAfterGivenVersionFromVersionList(defaultVersion, availableVersions, cfg.Cluster.NextReleaseAfterProdDefault)\n\t\t\tversionType = fmt.Sprintf(\"%d release(s) from the default version in prod\", cfg.Cluster.NextReleaseAfterProdDefault)\n\t\t} else {\n\t\t\tselectedVersion = versionList.Default()\n\t\t\tversionType = \"current default\"\n\t\t}\n\n\t\tif err == nil {\n\t\t\tif state.Cluster.EnoughVersionsForOldestOrMiddleTest && state.Cluster.PreviousVersionFromDefaultFound {\n\t\t\t\tstate.Cluster.Version = util.SemverToOpenshiftVersion(selectedVersion)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Unable to get the %s.\", versionType)\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"error finding default cluster version: %v\", err)\n\t\t}\n\t} else {\n\t\tvar err error\n\t\t// Make sure the cluster version is valid\n\t\tselectedVersion, err = util.OpenshiftVersionToSemver(state.Cluster.Version)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"supplied version %s is invalid: %v\", state.Cluster.Version, err)\n\t\t}\n\t}\n\n\tlog.Printf(\"Using the %s '%s'\", versionType, state.Cluster.Version)\n\n\treturn selectedVersion, nil\n}", "func (i *IndexBuilder) semVer(metadata *helmchart.Metadata, branch, shortID string) string {\n\tif shortID == \"\" {\n\t\treturn fmt.Sprintf(\"%s-%s\", metadata.Version, branch)\n\t}\n\treturn fmt.Sprintf(\"%s-%s-%s\", metadata.Version, branch, shortID)\n}", "func addSemverPrefix(s string) string {\n\tif !strings.HasPrefix(s, \"v\") && !strings.HasPrefix(s, \"go\") {\n\t\treturn \"v\" + s\n\t}\n\treturn s\n}", "func version() {\n fmt.Printf(\"v%s\\ncommit=%s\\n\", versionNumber, commitId)\n}", "func setupVersion(cfg *config.Config, osd *osd.OSD) (err error) {\n\tsuffix := \"\"\n\n\tif len(cfg.Cluster.Version) > 0 {\n\t\treturn\n\t}\n\tif cfg.Upgrade.MajorTarget != 0 || cfg.Upgrade.MinorTarget != 0 {\n\t\t// don't require major to be set\n\t\tif cfg.Upgrade.MajorTarget == 0 {\n\t\t\tcfg.Upgrade.MajorTarget = -1\n\t\t}\n\n\t\tif config.Cfg.OCM.Env == \"int\" && config.Cfg.Upgrade.ReleaseStream == \"\" {\n\t\t\tsuffix = \"nightly\"\n\t\t}\n\n\t\t// look for the latest release and install it for this OSD cluster.\n\t\tif cfg.Cluster.Version, err = osd.LatestVersion(cfg.Upgrade.MajorTarget, cfg.Upgrade.MinorTarget, suffix); err == nil {\n\t\t\tlog.Printf(\"CLUSTER_VERSION not set but a TARGET is, running '%s'\", cfg.Cluster.Version)\n\t\t}\n\t}\n\n\tif len(cfg.Cluster.Version) == 0 {\n\t\tif cfg.Cluster.Version, err = osd.DefaultVersion(); err == nil {\n\t\t\tlog.Printf(\"CLUSTER_VERSION not set, using the current default '%s'\", cfg.Cluster.Version)\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"Error finding default cluster version: %v\", err)\n\t\t}\n\t}\n\n\treturn\n}", "func ToVersion(value string) (*semver.Version, error) {\n\tversion := value\n\tif version == \"\" {\n\t\tversion = \"0.0.0\"\n\t}\n\treturn semver.NewVersion(version)\n}", "func versionTag(v semver.Version) string {\n\tif isRelease(v) {\n\t\treturn \"latest\"\n\t}\n\treturn \"next\"\n}", "func Release(path string, change parser.SemVerChange, ch chan Result, options ReleaseOptions) {\n\tdefer close(ch)\n\n\t// Get Git User\n\tuser, err := git.GetUser(path)\n\tif err != nil {\n\t\tch <- Result{\n\t\t\tError: fmt.Errorf(\"[Git] get user: %v\", err),\n\t\t}\n\t\treturn\n\t}\n\tch <- Result{\n\t\tPhase: PhaseGetGitUser,\n\t\tMessage: user.String(),\n\t}\n\n\t// Parse Commits\n\tcommits, err := parser.ParseCommits(path)\n\tif err != nil {\n\t\tch <- Result{\n\t\t\tError: fmt.Errorf(\"[Release] parse commits: %v\", err),\n\t\t}\n\t\treturn\n\t}\n\tch <- Result{\n\t\tPhase: PhaseParseCommits,\n\t\tMessage: strconv.Itoa(len(commits)),\n\t}\n\n\t// Read version from last bump commit if exist\n\tvar version string\n\tif len(commits) > 0 {\n\t\tlastCommit := commits[len(commits)-1]\n\t\tif lastCommit.SemVer != \"\" {\n\t\t\tversion = lastCommit.SemVer\n\t\t\tch <- Result{\n\t\t\t\tPhase: PhaseLastVersionFromCommit,\n\t\t\t\tMessage: version,\n\t\t\t}\n\t\t}\n\t}\n\n\t// Read version from npm (package.json) if exist\n\tvar npmVersion string\n\tisNpm := npm.HasPackage(path)\n\tif isNpm {\n\t\tpkg, err := npm.ParsePackage(path)\n\t\tif err != nil {\n\t\t\tch <- Result{\n\t\t\t\tError: fmt.Errorf(\n\t\t\t\t\t\"[Release] parse npm package: %v\",\n\t\t\t\t\terr,\n\t\t\t\t),\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tnpmVersion = pkg.Version\n\t\tch <- Result{\n\t\t\tPhase: PhaseLastVersionFromPackage,\n\t\t\tMessage: npmVersion,\n\t\t}\n\t}\n\n\t// Inconsistency between commit history and package.json version\n\tif npmVersion != \"\" && npmVersion != version {\n\t\tch <- Result{\n\t\t\tPhase: PhaseLastVersionInconsistency,\n\t\t\tMessage: fmt.Sprintf(\n\t\t\t\t\"package.json: %s, git: %s\",\n\t\t\t\tnpmVersion,\n\t\t\t\tversion,\n\t\t\t),\n\t\t}\n\t\tversion = npmVersion\n\t}\n\n\t// Find Change\n\tif change == \"\" {\n\t\tchange = semver.GetChange(commits)\n\t\tch <- Result{\n\t\t\tPhase: PhaseChangeFound,\n\t\t\tMessage: string(change),\n\t\t}\n\t}\n\n\t// Calculate new version\n\tnewVersion, err := semver.GetVersion(version, change)\n\tif err != nil {\n\t\tch <- Result{\n\t\t\tError: fmt.Errorf(\n\t\t\t\t\"[Release] get semver version: %v\",\n\t\t\t\terr,\n\t\t\t),\n\t\t}\n\t\treturn\n\t}\n\tch <- Result{\n\t\tPhase: PhaseNextVersion,\n\t\tMessage: newVersion,\n\t}\n\n\t// Generate changelog\n\tcf, _, err := changelog.Save(path, newVersion, version, change, commits, user)\n\tif err != nil {\n\t\tch <- Result{\n\t\t\tError: fmt.Errorf(\"[Release] save changelog: %v\", err),\n\t\t}\n\t\treturn\n\t}\n\tch <- Result{\n\t\tPhase: PhaseChangelogUpdated,\n\t\tMessage: cf,\n\t}\n\n\t// Version: npm\n\tif isNpm {\n\t\t_, err = npm.Version(path, newVersion, string(change))\n\t\tif err != nil {\n\t\t\tch <- Result{\n\t\t\t\tError: fmt.Errorf(\"[npm] version: %v\", err),\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tch <- Result{\n\t\t\tPhase: PhasePackageVersion,\n\t\t}\n\t}\n\n\t// Release: Git\n\terr = git.Release(path, newVersion, user, options.SuppressPush)\n\tif err != nil {\n\t\tch <- Result{\n\t\t\tError: fmt.Errorf(\"[Release] git: %v\", err),\n\t\t}\n\t\treturn\n\t}\n\tch <- Result{\n\t\tPhase: PhaseGitRelease,\n\t\tMessage: newVersion,\n\t}\n\n\t// Publish: npm\n\tif isNpm {\n\t\t_, err = npm.Publish(path)\n\t\tif err != nil {\n\t\t\tch <- Result{\n\t\t\t\tError: fmt.Errorf(\"[npm] publish: %v\", err),\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tch <- Result{\n\t\t\tPhase: PhasePackagePublish,\n\t\t}\n\t}\n}", "func TestVersionSemVer(t *testing.T) {\n\tt.Logf(\"Testing version semantic (%s)\", Version)\n\tdetails := strings.Split(Version, \".\")\n\tif len(details) != 3 {\n\t\tt.Errorf(\"Version should provide major, minor and path informations: %s\", Version)\n\t}\n\tif _, err := strconv.ParseInt(details[0], 2, 0); err != nil {\n\t\tt.Errorf(err.Error())\n\t}\n\tif _, err := strconv.ParseInt(details[1], 2, 0); err != nil {\n\t\tt.Errorf(err.Error())\n\t}\n\n\tpatch := strings.Split(details[2], \"-\")\n\tif _, err := strconv.ParseInt(patch[0], 2, 0); err != nil {\n\t\tt.Errorf(err.Error())\n\t}\n\tif len(patch) > 2 {\n\t\tt.Error(\"last version part only provides patch number and pre-release info\")\n\n\t}\n}", "func menuVersion() {\n\tfmt.Println(appName + \" - v\" + semverInfo())\n}", "func TestAPIVersionsSimple(t *testing.T) {\n\tv201, err := semver.Make(\"2.0.1\")\n\tassert.Nil(t, err)\n\tv300, err := semver.Make(\"3.0.0\")\n\tassert.Nil(t, err)\n\tv312, err := semver.Make(\"3.1.2\")\n\tassert.Nil(t, err)\n\tv314, err := semver.Make(\"3.1.4\")\n\tassert.Nil(t, err)\n\tv317, err := semver.Make(\"3.1.7\")\n\tassert.Nil(t, err)\n\tv400, err := semver.Make(\"4.0.0\")\n\tassert.Nil(t, err)\n\n\tassert.True(t, v312.LT(v314))\n\tassert.True(t, v312.LT(v317))\n\n\tsingleRange, err := semver.ParseRange(\"3.1.4\")\n\tassert.True(t, singleRange(v314))\n\n\tmultiRange, err := semver.ParseRange(\">=3.1.4 <=3.1.8\")\n\tassert.True(t, multiRange(v317))\n\tassert.False(t, multiRange(v312))\n\tassert.False(t, multiRange(v400))\n\n\tanotherRange, err := semver.ParseRange(\">=3.1.0\")\n\tassert.True(t, anotherRange(v400))\n\tassert.False(t, anotherRange(v300))\n\tassert.False(t, anotherRange(v201))\n\n}", "func isBeforeV1(version string) bool {\r\n\treturn semver.IsValid(version) && semver.Compare(version, \"v1.0.0\") < 0\r\n}", "func Tag2Semver(tag string) *Semver {\n\n\tsemver := &Semver{}\n\n\tre, _ := regexp.Compile(\"(\\\\d+).(\\\\d+).(\\\\d+)\")\n\tsubs := re.FindStringSubmatch(tag)\n\n\tsemver.Major, _ = strconv.Atoi(subs[1])\n\tsemver.Minor, _ = strconv.Atoi(subs[2])\n\tsemver.Patch, _ = strconv.Atoi(subs[3])\n\n\treturn semver\n}", "func repoNewVersionHandler(c web.C, w http.ResponseWriter, r *http.Request) {\n\tuuid := c.Env[\"uuid\"].(dvid.UUID)\n\tjsonData := struct {\n\t\tNote string `json:\"note\"`\n\t\tUUID string `json:\"uuid\"`\n\t}{}\n\n\tif r.Body != nil {\n\t\tdata, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tBadRequest(w, r, err)\n\t\t\treturn\n\t\t}\n\n\t\tif len(data) > 0 {\n\t\t\tif err := json.Unmarshal(data, &jsonData); err != nil {\n\t\t\t\tBadRequest(w, r, fmt.Sprintf(\"Malformed JSON request in body: %v\", err))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tvar uuidPtr *dvid.UUID\n\tif len(jsonData.UUID) > 0 {\n\t\tuuid, err := dvid.StringToUUID(jsonData.UUID)\n\t\tif err != nil {\n\t\t\tBadRequest(w, r, fmt.Sprintf(\"Bad UUID provided: %v\", err))\n\t\t\treturn\n\t\t}\n\t\tuuidPtr = &uuid\n\t}\n\n\t// create new version with empty branch specification\n\tnewuuid, err := datastore.NewVersion(uuid, jsonData.Note, \"\", uuidPtr)\n\tif err != nil {\n\t\tBadRequest(w, r, err)\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tfmt.Fprintf(w, \"{%q: %q}\", \"child\", newuuid)\n\t}\n\n\t// send newversion op to kafka\n\tmsginfo := map[string]interface{}{\n\t\t\"Action\": \"newversion\",\n\t\t\"Parent\": string(uuid),\n\t\t\"Child\": newuuid,\n\t\t\"Note\": jsonData.Note,\n\t}\n\tjsonmsg, _ := json.Marshal(msginfo)\n\tif err := datastore.LogRepoOpToKafka(uuid, jsonmsg); err != nil {\n\t\tBadRequest(w, r, fmt.Sprintf(\"Error on sending newversion op to kafka: %v\\n\", err))\n\t\treturn\n\t}\n}", "func GoTagToSemver(tag string) string {\n\tif tag == \"\" {\n\t\treturn \"\"\n\t}\n\n\ttag = strings.Fields(tag)[0]\n\t// Special cases for go1.\n\tif tag == \"go1\" {\n\t\treturn \"v1.0.0\"\n\t}\n\tif tag == \"go1.0\" {\n\t\treturn \"\"\n\t}\n\tm := tagRegexp.FindStringSubmatch(tag)\n\tif m == nil {\n\t\treturn \"\"\n\t}\n\tversion := \"v\" + m[1]\n\tif m[2] != \"\" {\n\t\tversion += m[2]\n\t} else {\n\t\tversion += \".0\"\n\t}\n\tif m[3] != \"\" {\n\t\tif !strings.HasPrefix(m[4], \"-\") {\n\t\t\tversion += \"-\"\n\t\t}\n\t\tversion += m[4] + \".\" + m[5]\n\t}\n\treturn version\n}", "func checkVersion(ver string) error {\n\tif ver[0] == 'v' {\n\t\tver = ver[1:]\n\t}\n\tv, err := semver.NewVersion(ver)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc, err := semver.NewConstraint(\">= 1.2\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !c.Check(v) {\n\t\treturn ErrIncompatibleVersion\n\t}\n\treturn nil\n}", "func (b BuildInfo) Semver() (*semver.Version, error) {\r\n\tsv, err := semver.Make(b.Version)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn &sv, nil\r\n}", "func SemanticVersion() string {\n\treturn gitTag\n}", "func (r Release) SemVer() (string, error) {\n\tif !semver.IsValid(r.Tag) && !semver.IsValid(fmt.Sprintf(\"v%s\", r.Tag)) {\n\t\treturn \"\", fmt.Errorf(\"%s is not valid semver\", r.Tag)\n\t}\n\treturn strings.TrimLeft(r.Tag, \"v\"), nil\n}", "func PHPSetSemver(oldVersion string, newVersion *semver.Version) error {\n\t// open version file\n\trawdata, err := GetFileContents(config.FilePath)\n\tif err != nil {\n\t\treturn errors.New(\"Error opening version file\")\n\t}\n\n\t// extract the version\n\tcontents := string(rawdata)\n\tre := regexp.MustCompile(config.VersionKey + \".*'(.*)'\")\n\tparts := re.FindStringSubmatch(contents)\n\tfind := parts[0]\n\treplace := strings.Replace(find, oldVersion, newVersion.String(), 1)\n\tnewContents := strings.Replace(contents, find, replace, 1)\n\n\terr = PutFileContents(config.FilePath, newContents)\n\tif err != nil {\n\t\treturn errors.New(\"Error writing version file\")\n\t}\n\n\treturn nil\n}", "func minorRelease(f *os.File, release, draftURL, changelogURL string) {\n\t// Check for draft and use it if available\n\tlog.Printf(\"Checking if draft release notes exist for %s...\", release)\n\n\tresp, err := http.Get(draftURL)\n\tif err == nil {\n\t\tdefer resp.Body.Close()\n\t}\n\n\tif err == nil && resp.StatusCode == 200 {\n\t\tlog.Print(\"Draft found - using for release notes...\")\n\t\t_, err = io.Copy(f, resp.Body)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error during copy to file: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tf.WriteString(\"\\n\")\n\t} else {\n\t\tlog.Print(\"Failed to find draft - creating generic template... (error message/status code printed below)\")\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error message: %v\", err)\n\t\t} else {\n\t\t\tlog.Printf(\"Response status code: %d\", resp.StatusCode)\n\t\t}\n\t\tf.WriteString(\"## Major Themes\\n\\n* TBD\\n\\n## Other notable improvements\\n\\n* TBD\\n\\n## Known Issues\\n\\n* TBD\\n\\n## Provider-specific Notes\\n\\n* TBD\\n\\n\")\n\t}\n\n\t// Aggregate all previous release in series\n\tf.WriteString(fmt.Sprintf(\"### Previous Release Included in %s\\n\\n\", release))\n\n\t// Regexp Example:\n\t// Assume the release tag is v1.7.0, this regexp matches \"- [v1.7.0-\" in\n\t// \"- [v1.7.0-rc.1](#v170-rc1)\"\n\t// \"- [v1.7.0-beta.2](#v170-beta2)\"\n\t// \"- [v1.7.0-alpha.3](#v170-alpha3)\"\n\treAnchor, _ := regexp.Compile(fmt.Sprintf(\"- \\\\[%s-\", release))\n\n\tresp, err = http.Get(changelogURL)\n\tif err == nil {\n\t\tdefer resp.Body.Close()\n\t}\n\n\tif err == nil && resp.StatusCode == 200 {\n\t\tbuf := new(bytes.Buffer)\n\t\tbuf.ReadFrom(resp.Body)\n\t\tfor _, line := range strings.Split(buf.String(), \"\\n\") {\n\t\t\tif anchor := reAnchor.FindStringSubmatch(line); anchor != nil {\n\t\t\t\tf.WriteString(line + \"\\n\")\n\t\t\t}\n\t\t}\n\t\tf.WriteString(\"\\n\")\n\t} else {\n\t\tlog.Print(\"Failed to fetch past changelog for minor release - continuing... (error message/status code printed below)\")\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error message: %v\", err)\n\t\t} else {\n\t\t\tlog.Printf(\"Response status code: %d\", resp.StatusCode)\n\t\t}\n\t}\n}", "func newVersionAvailable(currentVersion string) (bool, *string, error) {\n\tgardenctlLatestURL := \"https://api.github.com/repos/gardener/gardenctl/releases/latest\"\n\tresp, err := http.Get(gardenctlLatestURL)\n\tif err != nil {\n\t\treturn false, nil, err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn false, nil, err\n\t}\n\n\tdata := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(body), &data); err != nil {\n\t\treturn false, nil, err\n\t}\n\tvar latestVersion string\n\tif data[\"tag_name\"] != nil {\n\t\tlatestVersion = data[\"tag_name\"].(string)\n\t}\n\n\tc, err := semver.NewConstraint(\"> \" + currentVersion)\n\tif err != nil {\n\t\treturn false, nil, err\n\t}\n\n\tlatest, err := semver.NewVersion(latestVersion)\n\tif err != nil {\n\t\treturn false, nil, err\n\t}\n\n\treturn c.Check(latest), &latestVersion, nil\n}", "func Version() string {\r\n\tonce.Do(func() {\r\n\t\tsemver := fmt.Sprintf(\"%d.%d.%d\", major, minor, patch)\r\n\t\tverBuilder := bytes.NewBufferString(semver)\r\n\t\tif tag != \"\" && tag != \"-\" {\r\n\t\t\tupdated := strings.TrimPrefix(tag, \"-\")\r\n\t\t\t_, err := verBuilder.WriteString(\"-\" + updated)\r\n\t\t\tif err == nil {\r\n\t\t\t\tverBuilder = bytes.NewBufferString(semver)\r\n\t\t\t}\r\n\t\t}\r\n\t\tversion = verBuilder.String()\r\n\t})\r\n\treturn version\r\n}", "func SetVersion(version string, commit string) {\n\tif version == \"\" {\n\t\tmainSemver = \"0.0.0\"\n\t} else {\n\t\tmainSemver = version\n\t}\n\tif commit == \"\" {\n\t\tmainCommit = \"0000\"\n\t} else {\n\t\tmainCommit = commit\n\t}\n}", "func main() {\n\tvar bumpMajor, bumpMinor, bumpPatch bool\n\tvar newAPI string\n\n\tcmd := &cobra.Command{\n\t\tShort: \"Utility script to bump the API and realease versions in all relevant files.\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tif newAPI == \"\" && !bumpMajor && !bumpMinor && !bumpPatch {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif bumpMajor || bumpMinor || bumpPatch {\n\t\t\t\tif !oneof(bumpMajor, bumpMinor, bumpPatch) {\n\t\t\t\t\tlog.Fatalf(\"Expected only one of --major, --minor, and --patch.\")\n\t\t\t\t}\n\t\t\t\tversions := strings.Split(currentReleaseVersion, \".\")\n\n\t\t\t\tatoi := func(s string) int {\n\t\t\t\t\ti, err := strconv.Atoi(s)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t\treturn i\n\t\t\t\t}\n\n\t\t\t\tmajor := atoi(versions[0])\n\t\t\t\tminor := atoi(versions[1])\n\t\t\t\tpatch := atoi(versions[2])\n\n\t\t\t\tif bumpMajor {\n\t\t\t\t\tmajor++\n\t\t\t\t\tminor = 0\n\t\t\t\t\tpatch = 0\n\t\t\t\t}\n\t\t\t\tif bumpMinor {\n\t\t\t\t\tminor++\n\t\t\t\t\tpatch = 0\n\t\t\t\t}\n\t\t\t\tif bumpPatch {\n\t\t\t\t\tpatch++\n\t\t\t\t}\n\t\t\t\treplace(currentReleaseVersion, fmt.Sprintf(\"%d.%d.%d\", major, minor, patch))\n\t\t\t}\n\n\t\t\tif newAPI != \"\" && currentAPIVersion != newAPI {\n\t\t\t\tversionRegexStr := \"^([v]\\\\d+)([p_]\\\\d+)?((alpha|beta)\\\\d*)?\"\n\t\t\t\tversionRegex, err := regexp.Compile(versionRegexStr)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatalf(\"Unexpected Error compiling version regex: %+v\", err)\n\t\t\t\t}\n\t\t\t\tif !versionRegex.Match([]byte(newAPI)) {\n\t\t\t\t\tlog.Fatalf(\"The API version must conform to the regex: %s\", versionRegexStr)\n\t\t\t\t}\n\n\t\t\t\tschemaDir := filepath.Join(\"schema\", \"google\", \"showcase\")\n\t\t\t\terr = os.Rename(filepath.Join(schemaDir, currentAPIVersion), filepath.Join(schemaDir, newAPI))\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatalf(\"Failed to change proto directory: %+v\", err)\n\t\t\t\t}\n\n\t\t\t\treplace(currentAPIVersion, newAPI)\n\t\t\t\tutil.CompileProtos(newAPI)\n\t\t\t}\n\t\t},\n\t}\n\n\tcmd.Flags().BoolVarP(\n\t\t&bumpMajor,\n\t\t\"major\",\n\t\t\"\",\n\t\tfalse,\n\t\t\"Pass this flag to bump the major version\")\n\tcmd.Flags().BoolVarP(\n\t\t&bumpMinor,\n\t\t\"minor\",\n\t\t\"\",\n\t\tfalse,\n\t\t\"Pass this flag to bump the minor version\")\n\tcmd.Flags().BoolVarP(\n\t\t&bumpPatch,\n\t\t\"patch\",\n\t\t\"\",\n\t\tfalse,\n\t\t\"Pass this flag to bump the patch version\")\n\tcmd.Flags().StringVarP(\n\t\t&newAPI,\n\t\t\"api\",\n\t\t\"a\",\n\t\t\"\",\n\t\t\"The new API version to set.\")\n\n\tif err := cmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "func latestVer(names []string) *semver.Version {\n\t//convert names to semver\n\t//get latest version\n\tvar latest *semver.Version\n\n\tfor _, name := range names {\n\t\tverStr := strings.Split(name, \" \")[0]\n\t\tver, err := semver.NewVersion(verStr)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif latest == nil || latest.LessThan(ver) {\n\t\t\tlatest = ver\n\t\t}\n\t}\n\treturn latest\n}", "func ReleaseSemver() string {\n\ts := removeVAndHash(ReleaseVersion)\n\tv, err := semver.NewVersion(s)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn v.String()\n}", "func isSemverFormat(fl FieldLevel) bool {\n\tsemverString := fl.Field().String()\n\n\treturn semverRegex.MatchString(semverString)\n}", "func newestSemVer(v1 string, v2 string) (string, error) {\n\tv1Slice := strings.Split(v1, \".\")\n\tif len(v1Slice) != 3 {\n\t\treturn \"\", semverStringError(v1)\n\t}\n\tv2Slice := strings.Split(v2, \".\")\n\tif len(v2Slice) != 3 {\n\t\treturn \"\", semverStringError(v2)\n\t}\n\tfor i, subVer1 := range v1Slice {\n\t\tif v2Slice[i] > subVer1 {\n\t\t\treturn v2, nil\n\t\t} else if subVer1 > v2Slice[i] {\n\t\t\treturn v1, nil\n\t\t}\n\t}\n\treturn v1, nil\n}", "func setupUpgradeVersion(cfg *config.Config, osd *osd.OSD) (err error) {\n\t// Decide the version to install\n\terr = setupVersion(cfg, osd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclusterVersion, err := osd.OpenshiftVersionToSemver(cfg.Cluster.Version)\n\tif err != nil {\n\t\tlog.Printf(\"error while parsing cluster version %s: %v\", cfg.Cluster.Version, err)\n\t\treturn err\n\t}\n\n\tif cfg.Upgrade.UpgradeToCISIfPossible {\n\t\tsuffix := \"\"\n\t\tif config.Cfg.OCM.Env == \"int\" {\n\t\t\tsuffix = \"nightly\"\n\t\t}\n\t\tcisUpgradeVersionString, err := osd.LatestVersion(-1, -1, suffix)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"unable to get the most recent version of openshift from OSD: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tcisUpgradeVersion, err := osd.OpenshiftVersionToSemver(cisUpgradeVersionString)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"unable to parse most recent version of openshift from OSD: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t// If the available cluster image set makes sense, then we'll just use that\n\t\tif cisUpgradeVersion.GreaterThan(clusterVersion) {\n\t\t\tlog.Printf(\"Using cluster image set.\")\n\t\t\tcfg.Upgrade.ReleaseName = cisUpgradeVersionString\n\t\t\tmetadata.Instance.UpgradeVersionSource = \"cluster image set\"\n\t\t\tlog.Printf(\"Selecting version '%s' to be able to upgrade to '%s'\", cfg.Cluster.Version, cfg.Upgrade.ReleaseName)\n\t\t\treturn nil\n\t\t}\n\n\t\tlog.Printf(\"The most recent cluster image set is equal to the default. Falling back to upgrading with Cincinnati.\")\n\t}\n\n\tcfg.Upgrade.ReleaseName, cfg.Upgrade.Image, err = upgrade.LatestRelease(cfg, cfg.Upgrade.ReleaseStream, true)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't get latest release from release-controller: %v\", err)\n\t}\n\n\tupgradeVersion, err := osd.OpenshiftVersionToSemver(cfg.Upgrade.ReleaseName)\n\tif err != nil {\n\t\tlog.Printf(\"error while parsing upgrade version %s: %v\", cfg.Upgrade.ReleaseName, err)\n\t\treturn err\n\t}\n\n\tif !clusterVersion.LessThan(upgradeVersion) {\n\t\tlog.Printf(\"Cluster version is equal to or newer than the upgrade version. Looking up previous version...\")\n\t\tif cfg.Cluster.Version, err = osd.PreviousVersion(cfg.Upgrade.ReleaseName); err != nil {\n\t\t\treturn fmt.Errorf(\"failed retrieving previous version to '%s': %v\", cfg.Upgrade.ReleaseName, err)\n\t\t}\n\t}\n\n\t// set upgrade image\n\tlog.Printf(\"Selecting version '%s' to be able to upgrade to '%s' on release stream '%s'\",\n\t\tcfg.Cluster.Version, cfg.Upgrade.ReleaseName, cfg.Upgrade.ReleaseStream)\n\treturn\n}", "func (sem *SemVer) String() (version string) {\n\tbase := fmt.Sprintf(\"v%d.%d.%d\", sem.Major, sem.Minor, sem.Patch)\n\tif len(sem.Pre) > 0 {\n\t\tvar build string\n\t\tfor _, val := range sem.Pre {\n\t\t\tbuild = build + \"-\" + val.String()\n\t\t}\n\t\treturn fmt.Sprintf(\"%s%s\", base, build)\n\t}\n\treturn base\n}", "func Semver(str string) bool {\n\treturn rxSemver.MatchString(str)\n}", "func tryVersionDateSha(ver string) (ref string, ok bool) {\n\tcomponents := strings.Split(ver, \"-\")\n\n\tif len(components) != 3 {\n\t\treturn\n\t}\n\n\tok = true\n\tref = components[2]\n\n\treturn\n}", "func GetNextVersion(tag string) (string, error) {\n\tif tag == \"\" {\n\t\treturn \"v1.0.0\", nil\n\t}\n\n\ttags := strings.Split(tag, \".\")\n\tlen := len(tags)\n\n\t// semantic version(e.g. v1.2.3)\n\tif len > 2 {\n\t\tpatch, err := strconv.Atoi(tags[len-1])\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\ttags[len-1] = strconv.Itoa(patch + 1)\n\t\treturn strings.Join(tags, \".\"), nil\n\t}\n\n\t// date version(e.g. 20180525.1 or release_20180525.1)\n\tconst layout = \"20060102\"\n\ttoday := time.Now().Format(layout)\n\n\tdateRe := regexp.MustCompile(`(.*)(\\d{8})\\.(.+)`)\n\tif m := dateRe.FindStringSubmatch(tag); m != nil {\n\t\tif m[2] == today {\n\t\t\tminor, err := strconv.Atoi(m[3])\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\n\t\t\tnext := strconv.Itoa(minor + 1)\n\t\t\treturn m[1] + today + \".\" + next, nil\n\t\t}\n\t\treturn m[1] + today + \".\" + \"1\", nil\n\t}\n\treturn today + \".1\", nil\n}", "func (h Client) Version() (*semver.Version, error) {\n\tout, _, err := h.Exec(\"version\", \"--template={{.Version}}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tversion, err := semver.NewVersion(out)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn version, nil\n}", "func isSemVer(version string) bool {\n\t_, err := semver.Make(version)\n\treturn err == nil\n}", "func isAboveV1(content string) bool {\n\tver, err := version.NewVersion(content)\n\tif err != nil {\n\t\tpanic(errors.Wrapf(err, \"must've provided a valid semver\"))\n\t}\n\n\tsegments := ver.Segments()\n\treturn segments[0] > 1\n}", "func GitVersion() string { return gitVersion }", "func (c *HBComp) logVersion() {\n\tnow := time.Now()\n\tif now.Sub(c.lastVersionLogTime) >= c.app.VersionLogPeriod {\n\t\tc.Log.Info(c.app.InvocationArgs)\n\t\tc.lastVersionLogTime = now\n\t}\n}", "func Version(frame wdte.Frame, args ...wdte.Func) wdte.Func {\n\tframe = frame.Sub(\"version\")\n\n\tinfo, ok := debug.ReadBuildInfo()\n\tif !ok {\n\t\treturn wdte.Error{\n\t\t\tErr: ErrNoBuildInfo,\n\t\t\tFrame: frame,\n\t\t}\n\t}\n\n\tfor _, dep := range info.Deps {\n\t\tif dep.Path != \"github.com/DeedleFake/wdte\" {\n\t\t\tcontinue\n\t\t}\n\n\t\treturn wdte.String(dep.Version)\n\t}\n\n\treturn wdte.Error{\n\t\tErr: ErrDepNotFound,\n\t\tFrame: frame,\n\t}\n}", "func TestMakeUpVersion(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tmajor uint8\n\t\tminor uint8\n\t\tfix uint8\n\t\twant uint32\n\t}{\n\t\t{\n\t\t\tname: \"MakeUpversionTest\",\n\t\t\tmajor: FixVersion,\n\t\t\tminor: MinorVersion,\n\t\t\tfix: FixVersion,\n\t\t\twant: 16843008,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tif got := makeUpVersion(tt.major, tt.minor, tt.fix); got != tt.want {\n\t\t\t\tt.Errorf(\"makeUpVersion() = %v, majorVersion %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "func changeVersion(current_version, options string) string {\n\tif !isValidVersion(current_version) {\n\t\tcurrent_version = \"0.0.0\"\n\t}\n\t\n\tv := models.Version{}\n\t\n\tparts := strings.Split(current_version, \".\")\n\tfor i := 0; i < 3; i++ {\n\t\tn, _ := strconv.Atoi(parts[i])\n\t\tswitch i {\n\t\tcase 0:\n\t\t\tv.Major = n\n\t\tcase 1:\n\t\t\tv.Minor = n\n\t\tcase 2:\n\t\t\tv.Patch = n\n\t\t}\n\t}\n\t\n\t// Change version according to '-v' argument\n\toptions_list := strings.Split(options, \"\")\n\tfor _, c := range options_list {\n\t\tswitch c {\n\t\tcase \"M\":\n\t\t\tv.IncMajor()\n\t\tcase \"m\":\n\t\t\tv.IncMinor()\n\t\tcase \"p\":\n\t\t\tv.IncPatch()\n\t\t}\n\t}\n\t\n\treturn v.Stringify()\n}", "func TestGetSemverVersisonWithNonStandardVersion(t *testing.T) {\n\tversion.Map[\"version\"] = \"1.3.153-dev+7a8285f4\"\n\tresult, err := version.GetSemverVersion()\n\n\tprVersions := []semver.PRVersion{{VersionStr: \"dev\"}}\n\tbuilds := []string{\"7a8285f4\"}\n\texpectedResult := semver.Version{Major: 1, Minor: 3, Patch: 153, Pre: prVersions, Build: builds}\n\tassert.NoError(t, err, \"GetSemverVersion should exit without failure\")\n\tassert.Exactly(t, expectedResult, result)\n}", "func (ver *Version) SemVer() (SemVer, error) {\n\treturn NewSemVer(ver.Version)\n}", "func GetCurrentVersion() *semver.Version {\n\t// Get the current version\n\tversions := GetVersions()\n\n\tif len(versions) == 0 {\n\t\tversion, _ := semver.NewVersion(\"0.0.0\")\n\t\treturn version\n\t}\n\n\treturn versions[len(versions)-1]\n}", "func ParseVersion(ver string) (ref string, err error) {\n\tif ver == \"\" {\n\t\terr = errors.Errorf(\"version must not be empty\")\n\t\treturn\n\t}\n\n\t_, err = version.NewVersion(ver)\n\tif err != nil {\n\t\terr = errors.Wrapf(err,\n\t\t\t\"failed to parse semver\")\n\t\treturn\n\t}\n\n\tref = strings.TrimSuffix(ver, \"+incompatible\")\n\n\tvar (\n\t\tok bool\n\t\tobtained string\n\t)\n\n\tif obtained, ok = tryVersionDateSha(ref); ok {\n\t\tref = obtained\n\t\treturn\n\t}\n\n\treturn\n}", "func removeSemverPrefix(s string) string {\n\ts = strings.TrimPrefix(s, \"v\")\n\ts = strings.TrimPrefix(s, \"go\")\n\treturn s\n}", "func (f *Features) getVersion(ctx context.Context, adminDB *mongo.Database) {\n\tcmd := bson.D{\n\t\t{\n\t\t\tKey: \"buildInfo\",\n\t\t\tValue: 1,\n\t\t},\n\t}\n\tvar result buildInfo\n\terr := adminDB.RunCommand(ctx, cmd).Decode(&result)\n\tif err != nil {\n\t\tf.MongoVersion = &semver.Version{}\n\t\treturn\n\t}\n\n\tf.MongoVersion = semver.MustParse(result.Version)\n}", "func Test_LatestVersion(t *testing.T) {\n\tmockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(\"0.6.1\\n\"))\n\t}))\n\tdefer mockServer.Close()\n\n\tversion, err := latestVersion(mockServer.URL)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\ttestVersion := semver.New(\"0.6.1\")\n\tif !version.Equal(*testVersion) {\n\t\tt.Error(\"Version equality check failed.\")\n\t}\n}", "func HandleVersion(w http.ResponseWriter, r *http.Request) {\n\tv := struct {\n\t\tSource string `json:\"source,omitempty\"`\n\t\tVersion string `json:\"version,omitempty\"`\n\t\tCommit string `json:\"commit,omitempty\"`\n\t}{\n\t\tSource: version.GitRepository,\n\t\tCommit: version.GitCommit,\n\t\tVersion: version.Version.String(),\n\t}\n\twriteJSON(w, &v, 200)\n}", "func TestVersion(t *testing.T) {\n\tassert := audit.NewTestingAssertion(t, true)\n\t// Setup the test server.\n\tmux := newMultiplexer(assert)\n\tts := restaudit.StartServer(mux, assert)\n\tdefer ts.Close()\n\terr := mux.Register(\"test\", \"json\", NewTestHandler(\"json\", assert))\n\tassert.Nil(err)\n\t// Perform test requests.\n\treq := restaudit.NewRequest(\"GET\", \"/base/test/json/4711?foo=0815\")\n\treq.AddHeader(restaudit.HeaderAccept, restaudit.ApplicationJSON)\n\tresp := ts.DoRequest(req)\n\tresp.AssertStatusEquals(200)\n\tresp.AssertHeaderEquals(\"Version\", \"1.0.0\")\n\n\treq = restaudit.NewRequest(\"GET\", \"/base/test/json/4711?foo=0815\")\n\treq.AddHeader(restaudit.HeaderAccept, restaudit.ApplicationJSON)\n\treq.AddHeader(\"Version\", \"2\")\n\tresp = ts.DoRequest(req)\n\tresp.AssertStatusEquals(200)\n\tresp.AssertHeaderEquals(\"Version\", \"2.0.0\")\n\n\treq = restaudit.NewRequest(\"GET\", \"/base/test/json/4711?foo=0815\")\n\treq.AddHeader(restaudit.HeaderAccept, restaudit.ApplicationJSON)\n\treq.AddHeader(\"Version\", \"3.0\")\n\tresp = ts.DoRequest(req)\n\tresp.AssertStatusEquals(200)\n\tresp.AssertHeaderEquals(\"Version\", \"4.0.0-alpha\")\n}", "func runWhenKong(t *testing.T, semverRange string) {\n\tif currentVersion.Major == 0 {\n\t\tclient, err := NewTestClient(nil, nil)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tres, err := client.Root(defaultCtx)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tv := res[\"version\"].(string)\n\n\t\tcurrentVersion, err = semver.Parse(cleanVersionString(v))\n\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n\n\tr, err := semver.ParseRange(semverRange)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif !r(currentVersion) {\n\t\tt.Skip()\n\t}\n\n}", "func Process(v, pattern, prerelease, metadata, prefix string, ignore bool) (string, error) {\n\tlastTag := getLatestGitTag(getCommitSHA())\n\tif ignore && v == \"\" {\n\t\treturn \"\", fmt.Errorf(\"ignore previous is true but no base version provided, please check input\")\n\t} else if !ignore {\n\t\tv = lastTag\n\t}\n\n\tif prerelease == \"\" {\n\t\tprerelease = timeSinceLastTag(lastTag)\n\t}\n\n\tsemVer, err := semver.NewVersion(v)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"version parse failed, [%v]. %s is not a valid SemVer tag\", err, v)\n\t}\n\n\toutVersion := incVersion(*semVer, pattern)\n\n\tt, err := outVersion.SetPrerelease(prerelease)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error appending pre-release data: %v\", err)\n\t}\n\toutVersion = t\n\n\tif metadata != \"\" {\n\t\tt, err := outVersion.SetMetadata(metadata)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"error appending metadata: %v\", err)\n\t\t}\n\t\toutVersion = t\n\t}\n\n\toutString := outVersion.String()\n\n\tif prefix != \"\" {\n\t\toutString = fmt.Sprintf(\"%s%s\", prefix, outString)\n\t}\n\n\treturn outString, nil\n}", "func Parsed() *semver.Version {\n\tversionToParse := String\n\tif String == \"dev\" {\n\t\tversionToParse = \"0.0.0+dev\"\n\t}\n\tparsedVersion, err := semver.NewVersion(versionToParse)\n\t// We have no semver version but a commitid\n\tif err != nil {\n\t\tparsedVersion, err = semver.NewVersion(\"0.0.0+\" + String)\n\t\t// this should never happen\n\t\tif err != nil {\n\t\t\treturn &semver.Version{}\n\t\t}\n\t}\n\treturn parsedVersion\n}", "func checkVersion(cReg registry.ClusterRegistry) (string, bool) {\n\tfv := version.SemVersion\n\tlv, err := cReg.LatestDaemonVersion()\n\tif err != nil {\n\t\tlog.Errorf(\"error attempting to check latest fleet version in Registry: %v\", err)\n\t} else if lv != nil && fv.LessThan(*lv) {\n\t\treturn fmt.Sprintf(oldVersionWarning, fv.String(), lv.String()), false\n\t}\n\treturn \"\", true\n}", "func CheckForUpdate(out io.Writer) error {\n\tversion := CurrVersion\n\n\tif !isValidVersion(version) {\n\t\tfmt.Fprintf(out, messages.CLI_UNTAGGED_PROMPT)\n\t\tfmt.Fprintf(out, messages.CLI_INSTALL_CMD)\n\t\treturn nil\n\t}\n\n\t// fetch latest cli version\n\tlatestTagResp, err := api.RepoLatestRequest(\"astronomer\", \"astro-cli\")\n\tif err != nil {\n\t\tfmt.Fprintln(out, err)\n\t\tlatestTagResp.TagName = messages.NA\n\t}\n\n\t// fetch meta data around current cli version\n\tcurrentTagResp, err := api.RepoTagRequest(\"astronomer\", \"astro-cli\", string(\"v\")+version)\n\tif err != nil {\n\t\tfmt.Fprintln(out, \"Release info not found, please upgrade.\")\n\t\tfmt.Fprintln(out, messages.CLI_INSTALL_CMD)\n\t\treturn nil\n\t}\n\n\tcurrentPub := currentTagResp.PublishedAt.Format(\"2006.01.02\")\n\tcurrentTag := currentTagResp.TagName\n\tlatestPub := latestTagResp.PublishedAt.Format(\"2006.01.02\")\n\tlatestTag := latestTagResp.TagName\n\n\tfmt.Fprintf(out, messages.CLI_CURR_VERSION_DATE+\"\\n\", currentTag, currentPub)\n\tfmt.Fprintf(out, messages.CLI_LATEST_VERSION_DATE+\"\\n\", latestTag, latestPub)\n\n\tif latestTag > currentTag {\n\t\tfmt.Fprintln(out, messages.CLI_UPGRADE_PROMPT)\n\t\tfmt.Fprintln(out, messages.CLI_INSTALL_CMD)\n\t} else {\n\t\tfmt.Fprintln(out, messages.CLI_RUNNING_LATEST)\n\t}\n\n\treturn nil\n}", "func nextReleaseAfterGivenVersionFromVersionList(givenVersion *semver.Version, versionList []*spi.Version, releasesFromGivenVersion int) (*semver.Version, error) {\n\tversionBuckets := map[string]*semver.Version{}\n\n\t// Assemble a map that lists a release (x.y.0) to its latest version, with nightlies taking precedence over all else\n\tfor _, version := range versionList {\n\t\tversionSemver := version.Version()\n\t\tmajorMinor := createMajorMinorStringFromSemver(versionSemver)\n\n\t\tif _, ok := versionBuckets[majorMinor]; !ok {\n\t\t\tversionBuckets[majorMinor] = versionSemver\n\t\t} else {\n\t\t\tcurrentGreatestVersion := versionBuckets[majorMinor]\n\t\t\tversionIsNightly := strings.Contains(versionSemver.Prerelease(), \"nightly\")\n\t\t\tcurrentIsNightly := strings.Contains(currentGreatestVersion.Prerelease(), \"nightly\")\n\n\t\t\t// Make sure nightlies take precedence over other versions\n\t\t\tif versionIsNightly && !currentIsNightly {\n\t\t\t\tversionBuckets[majorMinor] = versionSemver\n\t\t\t} else if currentIsNightly && !versionIsNightly {\n\t\t\t\tcontinue\n\t\t\t} else if currentGreatestVersion.LessThan(versionSemver) {\n\t\t\t\tversionBuckets[majorMinor] = versionSemver\n\t\t\t}\n\t\t}\n\t}\n\n\t// Parse all major minor versions (x.y.0) into semver versions and place them in an array.\n\t// This is done explicitly so that we can utilize the semver library's sorting capability.\n\tmajorMinorList := []*semver.Version{}\n\tfor k := range versionBuckets {\n\t\tparsedMajorMinor, err := semver.NewVersion(k)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmajorMinorList = append(majorMinorList, parsedMajorMinor)\n\t}\n\n\tsort.Sort(semver.Collection(majorMinorList))\n\n\t// Now that the list is sorted, we want to locate the major minor of the given version in the list.\n\tgivenMajorMinor, err := semver.NewVersion(createMajorMinorStringFromSemver(givenVersion))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tindexOfGivenMajorMinor := -1\n\tfor i, majorMinor := range majorMinorList {\n\t\tif majorMinor.Equal(givenMajorMinor) {\n\t\t\tindexOfGivenMajorMinor = i\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif indexOfGivenMajorMinor == -1 {\n\t\treturn nil, fmt.Errorf(\"unable to find given version from list of available versions\")\n\t}\n\n\t// Next, we'll go the given version distance ahead of the given version. We want to do it this way instead of guessing\n\t// the next minor release so that we can handle major releases in the future, In other words, if the Openshift\n\t// 4.y line stops at 4.13, we'll still be able to pick 5.0 if it's the next release after 4.13.\n\tnextMajorMinorIndex := indexOfGivenMajorMinor + releasesFromGivenVersion\n\n\tif len(majorMinorList) <= nextMajorMinorIndex {\n\t\treturn nil, fmt.Errorf(\"there is no eligible next release from the list of available versions\")\n\t}\n\tnextMajorMinor := createMajorMinorStringFromSemver(majorMinorList[nextMajorMinorIndex])\n\n\tif _, ok := versionBuckets[nextMajorMinor]; !ok {\n\t\treturn nil, fmt.Errorf(\"no major/minor version found for %s\", nextMajorMinor)\n\t}\n\n\treturn versionBuckets[nextMajorMinor], nil\n}", "func canonicalizeSemverPrefix(s string) string {\n\treturn addSemverPrefix(removeSemverPrefix(s))\n}", "func TestGetSemverVersisonWithStandardVersion(t *testing.T) {\n\tversion.Map[\"version\"] = \"1.2.1\"\n\tresult, err := version.GetSemverVersion()\n\texpectedResult := semver.Version{Major: 1, Minor: 2, Patch: 1}\n\tassert.NoError(t, err, \"GetSemverVersion should exit without failure\")\n\tassert.Exactly(t, expectedResult, result)\n}", "func (r *Repo) Next(ref string) (*semver.Version, error) {\n\tbase := filepath.Base(ref)\n\tversion := base\n\tif strings.HasPrefix(version, \"release-\") {\n\t\tversion = version[len(\"release-\"):]\n\t}\n\tv, err := semver.ParseTolerant(version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tv.Patch = 0\n\tv.Pre = nil\n\tv.Build = nil\n\n\tfam := semver.Versions{}\n\taVersion, _ := regexp.Compile(\"^v\\\\d+.\\\\d+.\\\\d+$\")\n\tfor _, tag := range r.Tags {\n\t\tif !aVersion.MatchString(tag) {\n\t\t\tcontinue\n\t\t}\n\t\ttv, err := semver.ParseTolerant(tag[1:])\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr,\"failed to parse verison in branch: %s, %v\", tag, err)\n\t\t}\n\t\tif tv.Major == v.Major && tv.Minor == v.Minor {\n\t\t\tfam = append(fam, tv)\n\t\t}\n\t}\n\n\tsemver.Sort(fam)\n\n\tif len(fam) > 0 {\n\t\tnext := fam[len(fam)-1]\n\t\tif err := next.IncrementPatch(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &next, nil\n\t} else {\n\t\treturn &v, nil\n\t}\n}", "func buildVersionDetails(ctx context.Context, currentModulePath, packagePath string,\n\tmodInfos []*internal.ModuleInfo,\n\tsh *internal.SymbolHistory,\n\tlinkify func(v *internal.ModuleInfo) string,\n\tvc *vuln.Client,\n) (*VersionsDetails, error) {\n\t// lists organizes versions by VersionListKey.\n\tlists := make(map[VersionListKey]*VersionList)\n\t// seenLists tracks the order in which we encounter entries of each version\n\t// list. We want to preserve this order.\n\tvar seenLists []VersionListKey\n\tfor _, mi := range modInfos {\n\t\t// Try to resolve the most appropriate major version for this version. If\n\t\t// we detect a +incompatible version (when the path version does not match\n\t\t// the sematic version), we prefer the path version.\n\t\tmajor := semver.Major(mi.Version)\n\t\tif mi.ModulePath == stdlib.ModulePath {\n\t\t\tvar err error\n\t\t\tmajor, err = stdlib.MajorVersionForVersion(mi.Version)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\t// We prefer the path major version except for v1 import paths where the\n\t\t// semver major version is v0. In this case, we prefer the more specific\n\t\t// semver version.\n\t\tpathMajor := internal.MajorVersionForModule(mi.ModulePath)\n\t\tif pathMajor != \"\" {\n\t\t\tmajor = pathMajor\n\t\t} else if version.IsIncompatible(mi.Version) {\n\t\t\tmajor = semver.Major(mi.Version)\n\t\t} else if major != \"v0\" && !strings.HasPrefix(major, \"go\") {\n\t\t\tmajor = \"v1\"\n\t\t}\n\t\tkey := VersionListKey{\n\t\t\tModulePath: mi.ModulePath,\n\t\t\tMajor: major,\n\t\t\tIncompatible: version.IsIncompatible(mi.Version),\n\t\t}\n\t\tcommitTime := \"date unknown\"\n\t\tif !mi.CommitTime.IsZero() {\n\t\t\tcommitTime = absoluteTime(mi.CommitTime)\n\t\t}\n\t\tvs := &VersionSummary{\n\t\t\tLink: linkify(mi),\n\t\t\tCommitTime: commitTime,\n\t\t\tVersion: LinkVersion(mi.ModulePath, mi.Version, mi.Version),\n\t\t\tIsMinor: isMinor(mi.Version),\n\t\t\tRetracted: mi.Retracted,\n\t\t\tRetractionRationale: shortRationale(mi.RetractionRationale),\n\t\t}\n\t\tif sv := sh.SymbolsAtVersion(mi.Version); sv != nil {\n\t\t\tvs.Symbols = symbolsForVersion(linkify(mi), sv)\n\t\t}\n\t\t// Show only package level vulnerability warnings on stdlib version pages.\n\t\tpkg := \"\"\n\t\tif mi.ModulePath == stdlib.ModulePath {\n\t\t\tpkg = packagePath\n\t\t}\n\t\tvs.Vulns = vuln.VulnsForPackage(ctx, mi.ModulePath, mi.Version, pkg, vc)\n\t\tvl := lists[key]\n\t\tif vl == nil {\n\t\t\tseenLists = append(seenLists, key)\n\t\t\tvl = &VersionList{\n\t\t\t\tVersionListKey: key,\n\t\t\t\tDeprecated: mi.Deprecated,\n\t\t\t\tDeprecationComment: shortRationale(mi.DeprecationComment),\n\t\t\t}\n\t\t\tlists[key] = vl\n\t\t}\n\t\tvl.Versions = append(vl.Versions, vs)\n\t}\n\n\tvar details VersionsDetails\n\tother := map[string]bool{}\n\tfor _, key := range seenLists {\n\t\tvl := lists[key]\n\t\tif key.ModulePath == currentModulePath {\n\t\t\tif key.Incompatible {\n\t\t\t\tdetails.IncompatibleModules = append(details.IncompatibleModules, vl)\n\t\t\t} else {\n\t\t\t\tdetails.ThisModule = append(details.ThisModule, vl)\n\t\t\t}\n\t\t} else {\n\t\t\tother[key.ModulePath] = true\n\t\t}\n\t}\n\tfor m := range other {\n\t\tdetails.OtherModules = append(details.OtherModules, m)\n\t}\n\t// Sort for testing.\n\tsort.Strings(details.OtherModules)\n\n\t// Pkgsite will not display psuedoversions for the standard library. If the\n\t// version details contain master then this package exists only at master.\n\t// Show only the first entry. The additional entries will all be duplicate\n\t// links to package@master.\n\tif len(details.ThisModule) > 0 &&\n\t\tlen(details.ThisModule[0].Versions) > 0 &&\n\t\tcurrentModulePath == stdlib.ModulePath &&\n\t\tdetails.ThisModule[0].Versions[0].Version == \"master\" {\n\t\tdetails.ThisModule[0].Versions = details.ThisModule[0].Versions[:1]\n\t}\n\treturn &details, nil\n}", "func pseudoVersionRev(v string) string {\n\tv = strings.TrimSuffix(v, \"+incompatible\")\n\tj := strings.LastIndex(v, \"-\")\n\treturn v[j+1:]\n}", "func TestFormats25to26Minversion(t *testing.T) {\n\tts := newTestSwupd(t, \"format25to26minversion\")\n\tdefer ts.cleanup()\n\n\tts.Bundles = []string{\"test-bundle\"}\n\n\t// format25 MoM should NOT have minversion in header, which is introduced\n\t// in format26. (It should also not have it because minversion is set to 0)\n\tts.Format = 25\n\tts.addFile(10, \"test-bundle\", \"/foo\", \"content\")\n\tts.createManifests(10)\n\n\texpSubs := []string{\n\t\t\"MANIFEST\\t25\",\n\t\t\"version:\\t10\",\n\t\t\"previous:\\t0\",\n\t\t\"filecount:\\t2\",\n\t\t\"timestamp:\\t\",\n\t\t\"contentsize:\\t\",\n\t\t\"includes:\\tos-core\",\n\t\t\"10\\t/foo\",\n\t\t\"10\\t/usr/share\",\n\t}\n\tcheckManifestContains(t, ts.Dir, \"10\", \"test-bundle\", expSubs...)\n\n\tnExpSubs := []string{\n\t\t\"\\t0\\t/foo\",\n\t\t\".d..\\t\",\n\t\t\"minversion:\\t\",\n\t}\n\tcheckManifestNotContains(t, ts.Dir, \"10\", \"test-bundle\", nExpSubs...)\n\n\t// minversion now set to 20, but the MoM should still NOT have minversion\n\t// in header due to format25 being used\n\tts.MinVersion = 20\n\tts.addFile(20, \"test-bundle\", \"/foo\", \"new content\")\n\tts.createManifests(20)\n\n\texpSubs = []string{\n\t\t\"MANIFEST\\t25\",\n\t\t\"version:\\t20\",\n\t\t\"previous:\\t10\",\n\t\t\"filecount:\\t2\",\n\t\t\"includes:\\tos-core\",\n\t\t\"20\\t/foo\",\n\t}\n\tcheckManifestContains(t, ts.Dir, \"20\", \"test-bundle\", expSubs...)\n\tcheckManifestNotContains(t, ts.Dir, \"20\", \"MoM\", \"minversion:\\t\")\n\n\t// updated to format26, minversion still set to 20, so we should see\n\t// minversion header in the MoM\n\tts.Format = 26\n\tts.addFile(30, \"test-bundle\", \"/foo\", \"even newer content\")\n\tts.createManifests(30)\n\texpSubs = []string{\n\t\t\"MANIFEST\\t26\",\n\t\t\"version:\\t30\",\n\t\t\"previous:\\t20\",\n\t\t\"filecount:\\t2\",\n\t\t\"includes:\\tos-core\",\n\t}\n\tcheckManifestContains(t, ts.Dir, \"30\", \"test-bundle\", expSubs...)\n\tcheckManifestContains(t, ts.Dir, \"30\", \"MoM\", \"minversion:\\t20\")\n}", "func Version(am string) (string, error) {\n\ts, err := getStatus(am)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tinfo := s.VersionInfo\n\treturn fmt.Sprintf(\"%s (branch: %s, rev: %s)\", *info.Version, *info.Branch, *info.Revision), nil\n}", "func parseSemVer(s string) (uint32, uint32, uint32, string, string, error) {\n\t// Parse the various semver component from the version string via a regular\n\t// expression.\n\tm := semverRE.FindStringSubmatch(s)\n\tif m == nil {\n\t\terr := fmt.Errorf(\"malformed version string %q: does not conform to \"+\n\t\t\t\"semver specification\", s)\n\t\treturn 0, 0, 0, \"\", \"\", err\n\t}\n\n\tmajor, err := parseUint32(m[1], \"major\")\n\tif err != nil {\n\t\treturn 0, 0, 0, \"\", \"\", err\n\t}\n\n\tminor, err := parseUint32(m[2], \"minor\")\n\tif err != nil {\n\t\treturn 0, 0, 0, \"\", \"\", err\n\t}\n\n\tpatch, err := parseUint32(m[3], \"patch\")\n\tif err != nil {\n\t\treturn 0, 0, 0, \"\", \"\", err\n\t}\n\n\tpreRel := m[4]\n\terr = checkSemString(preRel, semanticAlphabet, \"pre-release\")\n\tif err != nil {\n\t\treturn 0, 0, 0, s, s, err\n\t}\n\n\tbuild := m[5]\n\terr = checkSemString(build, semanticAlphabet, \"buildmetadata\")\n\tif err != nil {\n\t\treturn 0, 0, 0, s, s, err\n\t}\n\n\treturn major, minor, patch, preRel, build, nil\n}", "func determineVersionFromTagBollocks(tag string, source Source) string {\n\tvar re *regexp.Regexp\n\tif source.TagFilterRegex == \"\" {\n\t\tre = regexp.MustCompile(`^v?(?:\\d+\\.)?(?:\\d+\\.)?(?:\\*|\\d+.*)$`)\n\t\ttag = strings.TrimPrefix(tag, \"v\")\n\t} else {\n\t\tre = regexp.MustCompile(source.TagFilterRegex)\n\t}\n\n\tif re.MatchString(tag) {\n\t\treturn tag\n\t}\n\treturn \"\"\n}", "func version(w io.Writer, set *flag.FlagSet) error {\n\tfmt.Fprintf(w, \"GlobalSign EST Client %s\\n\", versionString)\n\treturn nil\n}", "func (s *Action) Version(ctx context.Context, c *cli.Context) error {\n\tversion := make(chan string, 1)\n\tgo func(u chan string) {\n\t\tif disabled := os.Getenv(\"CHECKPOINT_DISABLE\"); disabled != \"\" {\n\t\t\tu <- \"\"\n\t\t\treturn\n\t\t}\n\n\t\tif s.version.String() == \"0.0.0+HEAD\" {\n\t\t\t// chan not check version against HEAD\n\t\t\tu <- \"\"\n\t\t\treturn\n\t\t}\n\n\t\tr, err := ghrel.FetchLatestStableRelease(gitHubOrg, gitHubRepo)\n\t\tif err != nil {\n\t\t\tu <- color.RedString(\"\\nError checking latest version: %s\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif s.version.LT(r.Version()) {\n\t\t\tu <- color.YellowString(\"\\nYour version (%s) of gopass is out of date!\\nThe latest version is %s.\\nYou can update by downloading from www.justwatch.com/gopass or via your package manager\", s.version, r.Version().String())\n\t\t}\n\t\tu <- \"\"\n\t}(version)\n\n\tcli.VersionPrinter(c)\n\n\tfmt.Printf(\" GPG: %s\\n\", s.Store.GPGVersion(ctx).String())\n\tfmt.Printf(\" Git: %s\\n\", s.Store.GitVersion(ctx).String())\n\n\tselect {\n\tcase vi := <-version:\n\t\tif vi != \"\" {\n\t\t\tfmt.Println(vi)\n\t\t}\n\tcase <-time.After(2 * time.Second):\n\t\tfmt.Println(color.RedString(\"Version check timed out\"))\n\t}\n\n\treturn nil\n}", "func (cmfInstance *cmf) GetVersion() {\n\tfmt.Println(\"Git - Commit Message Formatter v\", version)\n}", "func IsSemver(str string) bool {\n\treturn rxSemver.MatchString(str)\n}", "func NewSemVer(t string) (*SemVer, error) {\n\tv, e := semver.NewVersion(t)\n\thasPrefix := false\n\n\tif strings.HasPrefix(t, \"v\") {\n\t\thasPrefix = true\n\t}\n\n\treturn &SemVer{v, hasPrefix, t}, e\n}", "func createVersionPostHook(event *api.Event) {\n\tlogdog.Infof(\"create version post hook\")\n\tif event.Status == api.EventStatusSuccess {\n\t\tevent.Version.Status = api.VersionHealthy\n\t} else if event.Status == api.EventStatusCancel {\n\t\tevent.Version.Status = api.VersionCancel\n\t} else {\n\t\tevent.Version.Status = api.VersionFailed\n\t\tevent.Version.ErrorMessage = event.ErrorMessage\n\t}\n\n\toperation := string(event.Version.Operation)\n\t// Record that whether this event is a deploy for project. According this flag, we will make some special operations.\n\tDeployInProject := false\n\tif (operation == string(api.DeployOperation)) && (event.Version.ProjectVersionID != \"\") {\n\t\tDeployInProject = true\n\t}\n\n\tds := store.NewStore()\n\tdefer ds.Close()\n\n\tif err := ds.UpdateVersionDocument(event.Version.VersionID, event.Version); err != nil {\n\t\tlogdog.Errorf(\"Unable to update version status post hook for %+v: %v\", event.Version, err)\n\t}\n\n\tif remote, err := remoteManager.FindRemote(event.Service.Repository.Webhook); err == nil {\n\t\tif err := remote.PostCommitStatus(&event.Service, &event.Version); err != nil {\n\t\t\tlogdog.Errorf(\"Unable to post commit status to %s: %v\", event.Service.Repository.Webhook, err)\n\t\t}\n\t}\n\n\tif DeployInProject == false {\n\t\tif event.Version.Status == api.VersionHealthy {\n\t\t\tif err := ds.AddNewVersion(event.Version.ServiceID, event.Version.VersionID); err != nil {\n\t\t\t\tlogdog.Errorf(\"Unable to add new version in post hook for %+v: %v\", event.Version, err)\n\t\t\t}\n\t\t} else {\n\t\t\tif err := ds.AddNewFailVersion(event.Version.ServiceID, event.Version.VersionID); err != nil {\n\t\t\t\tlogdog.Errorf(\"Unable to add new version in post hook for %+v: %v\", event.Version, err)\n\t\t\t}\n\t\t}\n\n\t}\n\tif err := ds.UpdateServiceLastInfo(event.Version.ServiceID, event.Version.CreateTime, event.Version.Name); err != nil {\n\t\tlogdog.Errorf(\"Unable to update new version info in service %+v: %v\", event.Version, err)\n\t}\n\n\t// Use for checking project's version deploy status.\n\tif DeployInProject == true {\n\t\tevent.Version.FinalStatus = \"finished\"\n\t}\n\n\t// TODO: poll version log, not query once.\n\tversionLog, err := ds.FindVersionLogByVersionID(event.Version.VersionID)\n\tif err != nil {\n\t\tlogdog.Warnf(\"Notify error, getting version failed: %v\", err)\n\t} else {\n\t\tnotify.Notify(&event.Service, &event.Version, versionLog.Logs)\n\t}\n\n\t// trigger after create end\n\ttriggerHooks(event, PreStopPhase)\n}", "func main() {\n\terr := cmd.Execute(version)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "func createVersionHandler(event *api.Event) error {\n\tlogdog.Infof(\"create version handler\")\n\n\topts := workerOptions.DeepCopy()\n\topts.Quota = Resource2Quota(event.Version.BuildResource, opts.Quota)\n\tworker, err := CloudController.Provision(string(event.EventID), opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = worker.Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// trigger after get an valid worker\n\ttriggerHooks(event, PostStartPhase)\n\n\t// set worker info to event\n\tevent.Worker = worker.GetWorkerInfo()\n\tSaveEventToEtcd(event)\n\tgo CheckWorkerTimeout(event)\n\n\twebhook := event.Service.Repository.Webhook\n\tif remote, err := remoteManager.FindRemote(webhook); webhook == api.GITHUB && err == nil {\n\t\tif err = remote.PostCommitStatus(&event.Service, &event.Version); err != nil {\n\t\t\tlogdog.Errorf(\"Unable to post commit status to github: %v\", err)\n\t\t}\n\t}\n\treturn nil\n}", "func (r *Repository) VersionOnCommit(n int) {\n\tr.createVersion = n\n}", "func generateVersionFromPushData(payload api.WebhookGithub) (name string, description string,\n\tcommitID string) {\n\tcommit := payload[api.GithubWebhookFlagCommit].(map[string]interface{})\n\tref := payload[api.GithubWebhookFlagRef].(string)\n\n\t// generate name\n\tvar namePrefix string\n\tvar tagName string\n\tif isReleaseTag(api.GithubWebhookPush, payload) {\n\t\tnamePrefix = \"tag_\"\n\t\t// e.g. refs/tags/v0.12\n\t\ttagName = strings.SplitN(ref, \"/\", -1)[2]\n\t} else {\n\t\tnamePrefix = \"ci_\"\n\t}\n\n\tif nil != commit[\"id\"] {\n\t\tif \"\" != tagName && canBeUsedInImageTag(tagName) {\n\t\t\tname = namePrefix + tagName\n\t\t} else {\n\t\t\tname = namePrefix + commit[\"id\"].(string)\n\t\t}\n\t} else {\n\t\tname = namePrefix + uuid.NewV4().String()\n\t}\n\n\t// generate description\n\tif nil != commit[\"message\"] {\n\t\tdescription = commit[\"message\"].(string)\n\t} else {\n\t\tdescription = \"\"\n\t}\n\tif nil != commit[\"id\"] {\n\t\tcommitID = commit[\"id\"].(string)\n\t\tdescription = description + \"\\r\\n\" + commit[\"id\"].(string)\n\t}\n\n\tlog.Infof(\"webhook push event: name[%s] description[%s] commit[%s]\", name, description, commitID)\n\treturn name, description, commitID\n}", "func notes(version string) string {\n\tprevious := executeWithOutput(\n\t\t\"git\",\n\t\t\"describe\",\n\t\t\"--abbrev=0\",\n\t\t\"--tags\",\n\t\tversion+\"^\",\n\t)\n\tprevious = strings.TrimSpace(previous)\n\n\toutput := executeWithOutput(\n\t\t\"git\",\n\t\t\"log\",\n\t\tprevious+\"..HEAD\",\n\t\t\"--oneline\",\n\t\t\"--pretty=format:%s\",\n\t)\n\tcommits := strings.Split(output, \"\\n\")\n\n\treturn format(commits)\n}", "func setVersion() {\n\tgitTag = GitCommit\n\n\t// A development build is one that's not at a tag or has uncommitted changes\n\tdevBuild = gitTag == \"\" || gitShortStat != \"\"\n\n\t// Only set the appVersion if -ldflags was used\n\tif gitNearestTag != \"\" || gitTag != \"\" {\n\t\tif devBuild && gitNearestTag != \"\" {\n\t\t\tappVersion = fmt.Sprintf(\"%s (+%s %s)\", strings.TrimPrefix(gitNearestTag, \"v\"), GitCommit, buildDate)\n\t\t} else if gitTag != \"\" {\n\t\t\tappVersion = strings.TrimPrefix(gitTag, \"v\")\n\t\t}\n\t}\n}", "func compareVersions(dV semver.Version, cV semver.Version, logger logr.Logger) (VersionComparison, error) {\n\tresult := dV.Compare(cV)\n\tswitch result {\n\tcase -1:\n\t\tlogger.Info(fmt.Sprintf(\"%s is less than %s\", dV, cV))\n\t\treturn VersionDowngrade, nil\n\tcase 0:\n\t\tlogger.Info(fmt.Sprintf(\"%s is equal to %s\", dV, cV))\n\t\treturn VersionEqual, nil\n\tcase 1:\n\t\tlogger.Info(fmt.Sprintf(\"%s is greater than %s\", dV, cV))\n\t\treturn VersionUpgrade, nil\n\tdefault:\n\t\treturn VersionUnknown, fmt.Errorf(\"semver comparison failed for unknown reason. Versions %s & %s\", dV, cV)\n\t}\n\n}", "func (s *Semver) Semver() *semverlib.Version {\n\treturn s.Version\n}", "func (t *targetrunner) checkCloudVersion(ctx context.Context, lom *cluster.LOM) (vchanged bool, err error, errCode int) {\n\tvar objMeta cmn.SimpleKVs\n\tobjMeta, err, errCode = t.cloud.headObj(ctx, lom)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"%s: failed to head metadata, err: %v\", lom, err)\n\t\treturn\n\t}\n\tif cloudVersion, ok := objMeta[cmn.HeaderObjVersion]; ok {\n\t\tif lom.Version() != cloudVersion {\n\t\t\tglog.Infof(\"%s: version changed from %s to %s\", lom, lom.Version(), cloudVersion)\n\t\t\tvchanged = true\n\t\t}\n\t}\n\treturn\n}", "func (b *BumpFile) parseVersion() error {\n\tcnt := 0\n\tmatches := regex.FindAllString(string(b.contents), -1)\n\tverstrs, uniform := uniformVersions(matches)\n\tcnt = len(verstrs)\n\tswitch {\n\tcase cnt > 1:\n\t\tif !uniform {\n\t\t\treturn fmt.Errorf(`Expected one version found multiple in %s: %v`, b.path, verstrs)\n\t\t}\n\tcase cnt == 0:\n\t\tfmt.Printf(\"No version found in %s\", b.path)\n\t\treturn nil\n\t}\n\n\tverAtoms := strings.Split(verstrs[0], \".\")\n\tverObj := NewVersion(verAtoms[0], verAtoms[1], verAtoms[2], nil)\n\tb.curver = &verObj\n\n\treturn nil\n}", "func set(c *cli.Context) error {\n\tif !c.Args().Present() {\n\t\treturn cli.NewExitError(\"Missing paramter: `version`\", 1)\n\t}\n\tnewVersion := c.Args().Get(0)\n\tif len(newVersion) <= 0 {\n\t\treturn cli.NewExitError(\"Empty parameter: `version`\", 2)\n\t}\n\tisValid := isVersion(newVersion)\n\tif !isValid {\n\t\treturn cli.NewExitError(fmt.Sprintf(\"Version '%v' is not valid\", newVersion), 3)\n\t}\n\n\tallFiles, err := findManifests(getGivenPathOrWorkingDir(c), handlers)\n\n\t// validations\n\tif err != nil {\n\t\treturn cli.NewExitError(err, 4)\n\t}\n\n\tif len(allFiles) == 0 {\n\t\treturn cli.NewExitError(\"No application has been found\", 5)\n\t}\n\n\tfor _, file := range allFiles {\n\t\tif file.HasError {\n\t\t\treturn cli.NewExitError(fmt.Sprintf(\"Invalid file content: %v\", file.Path), 6)\n\t\t}\n\t}\n\n\t// execute version update\n\tfor _, file := range allFiles {\n\t\tsetVersion(file, newVersion)\n\t\tupdatedManifest, err := findManifests(file.Path, handlers)\n\n\t\tif err != nil {\n\t\t\treturn cli.NewExitError(err, 7)\n\t\t}\n\n\t\tfmt.Println(fmt.Sprintf(\"%v: New version: %v (%v)\", file.Version, updatedManifest[0].Version, file.Path))\n\t}\n\treturn nil\n}", "func CalculateFeatureCompatibilityVersion(versionStr string) string {\n\tv1, err := semver.Make(versionStr)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\tif v1.GTE(semver.MustParse(\"3.4.0\")) {\n\t\treturn fmt.Sprintf(\"%d.%d\", v1.Major, v1.Minor)\n\t}\n\n\treturn \"\"\n}", "func version(w http.ResponseWriter, r *http.Request) {\n\t_, _ = fmt.Fprintf(w, ver)\n}", "func getVersion() string {\n\tif metadata == \"\" {\n\t\treturn version\n\t}\n\treturn version + \"-\" + metadata\n}", "func (u utilityEndpoints) versionCheck(c echo.Context) error {\n\tvf, err := u.version.VersionFormatter(version.FullVersion)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"format version\")\n\t\treturn c.JSON(http.StatusInternalServerError, NewErrorResponse(err))\n\t}\n\n\tmsg, update, err := u.version.UpdateWarningVersion(vf)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"update warning version\")\n\t\treturn c.JSON(http.StatusInternalServerError, NewErrorResponse(err))\n\t}\n\n\tresponse := VersionResponse{\n\t\tVersion: u.version.GetHumanVersion(),\n\t\tMsg: msg,\n\t\tUpdate: update,\n\t}\n\n\treturn c.JSON(http.StatusOK, response)\n}", "func APIVersion() string { return version }", "func Bump(my, sv *Extent, axis, pre string) error {\n\tver, err := ReadVersion(my, sv)\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch axis {\n\tcase \"major\":\n\t\tver, err = makeVersion(ver, BumpMajor(), WithPre(pre))\n\tcase \"minor\":\n\t\tver, err = makeVersion(ver, BumpMinor(), WithPre(pre))\n\tcase \"patch\":\n\t\tver, err = makeVersion(ver, BumpPatch(), WithPre(pre))\n\tcase \"final\":\n\t\tver, err = makeVersion(ver, BumpFinal())\n\tcase \"pre\":\n\t\tif len(ver.Pre) == 0 {\n\t\t\tver, err = makeVersion(ver, BumpPatch())\n\t\t} else if pre == \"\" {\n\t\t\tpre = ver.Pre[0].String()\n\t\t}\n\t\tif pre == \"\" {\n\t\t\tpre = PrePrefix\n\t\t}\n\t\tver, err = makeVersion(ver, BumpPre(pre))\n\tdefault:\n\t\terr = fmt.Errorf(\"bump axis not supported: %s\", axis)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn WriteVersion(my, sv, ver)\n}", "func isV1(version string) bool {\r\n\tif !semver.IsValid(version) || isBeforeV1(version) {\r\n\t\treturn false\r\n\t}\r\n\treturn semver.Major(version) == \"v1\"\r\n}", "func Version() string {\n\tvar hashStr string\n\tif CommitHash != \"\" {\n\t\thashStr = \"+\" + CommitHash\n\t}\n\n\tif currentVersion.label == \"\" {\n\t\treturn fmt.Sprintf(\"%d.%d.%d%s\", currentVersion.major, currentVersion.minor, currentVersion.patch, hashStr)\n\t}\n\n\treturn fmt.Sprintf(\"%d.%d.%d-%s%s\", currentVersion.major, currentVersion.minor, currentVersion.patch, currentVersion.label, hashStr)\n}", "func (s *BasesiciListener) EnterVersion(ctx *VersionContext) {}", "func versionRun(cmd *cobra.Command, args []string) {\n\tprintKeyValue(\"Version: \", version)\n\tprintKeyValue(\"Commit: \", commit)\n\tprintKeyValue(\"Date: \", date)\n\tprintKeyValue(\"Author: \", author)\n\tprintKeyValue(\"Website: \", website)\n}", "func NewSemVer(major uint16, minor uint16, patch uint16) *SemVer {\n\treturn &SemVer{major, minor, patch}\n}" ]
[ "0.6343716", "0.62656754", "0.61034876", "0.6014288", "0.5980086", "0.5917084", "0.58818126", "0.5873797", "0.58636415", "0.58607054", "0.5804735", "0.57341987", "0.5712932", "0.569971", "0.56932336", "0.5670829", "0.5653534", "0.56260407", "0.56222355", "0.56178916", "0.5589658", "0.5585575", "0.5565846", "0.55393267", "0.5487225", "0.54144853", "0.5402878", "0.5394833", "0.5365674", "0.5335784", "0.5310598", "0.5293213", "0.52928305", "0.52850175", "0.5277144", "0.5264746", "0.5240203", "0.5238538", "0.5237338", "0.523667", "0.52325946", "0.52237266", "0.5222239", "0.52150846", "0.52149725", "0.5214939", "0.520649", "0.5195576", "0.5182213", "0.5173069", "0.5173011", "0.51698375", "0.5158393", "0.51502174", "0.5143489", "0.5136198", "0.51205045", "0.5115802", "0.5111524", "0.51039183", "0.5098846", "0.5098104", "0.50941384", "0.5090347", "0.5079863", "0.5078619", "0.5063529", "0.50533694", "0.5052086", "0.5047296", "0.50393105", "0.50217915", "0.50216043", "0.50117195", "0.5003287", "0.49911028", "0.49905992", "0.49750122", "0.49691457", "0.49684104", "0.49657434", "0.49614948", "0.49608684", "0.49581265", "0.49553755", "0.4954763", "0.4950707", "0.49447584", "0.49404445", "0.49250552", "0.49226093", "0.49162972", "0.49157915", "0.49108255", "0.48995447", "0.48974618", "0.48971328", "0.4893272", "0.48804793", "0.48767236" ]
0.6264196
2
Get an authentication token to communicate with an EKS cluster. Uses IAM credentials from the AWS provider to generate a temporary token that is compatible with [AWS IAM Authenticator]( authentication. This can be used to authenticate to an EKS cluster or to a cluster that has the AWS IAM Authenticator server configured.
func GetClusterAuth(ctx *pulumi.Context, args *GetClusterAuthArgs, opts ...pulumi.InvokeOption) (*GetClusterAuthResult, error) { var rv GetClusterAuthResult err := ctx.Invoke("aws:eks/getClusterAuth:getClusterAuth", args, &rv, opts...) if err != nil { return nil, err } return &rv, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func AWSGetToken(accessKeyId, secretAccessKey, region, clusterID string) (string, error) {\n\tcred := credentials.NewStaticCredentials(accessKeyId, secretAccessKey, \"\")\n\n\tsess, err := session.NewSession(&aws.Config{Region: aws.String(region), Credentials: cred})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tstsClient := sts.New(sess)\n\n\trequest, _ := stsClient.GetCallerIdentityRequest(&sts.GetCallerIdentityInput{})\n\trequest.HTTPRequest.Header.Add(\"x-k8s-aws-id\", clusterID)\n\tpresignedURLString, err := request.Presign(60)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fmt.Sprintf(`{\"token\": \"k8s-aws-v1.%s\"}`, base64.RawURLEncoding.EncodeToString([]byte(presignedURLString))), nil\n}", "func GetEKSToken(clusterName, region string) (string, error) {\n\tgen, err := token.NewGenerator(false, false)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttok, err := gen.GetWithOptions(&token.GetTokenOptions{\n\t\tClusterID: clusterName,\n\t\tRegion: region,\n\t\tAssumeRoleARN: \"\",\n\t\tAssumeRoleExternalID: \"\",\n\t\tSessionName: \"\",\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn gen.FormatJSON(tok), nil\n}", "func Get(app, provider, pArn string, duration int64) (*aws.Credentials, error) {\n\t// Get provider config\n\tp, err := config.GetOktaProvider(provider)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading provider config: %v\", err)\n\t}\n\n\t// Get app config\n\ta, err := config.GetOktaApp(app)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading config for app %s: %v\", app, err)\n\t}\n\n\t// Initialize Okta client\n\tc, err := NewClient(p.BaseURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"initializing Okta client: %v\", err)\n\t}\n\n\t// Get user credentials\n\tuser := p.Username\n\tif user == \"\" {\n\t\t// Get credentials from the user\n\t\tfmt.Print(\"Okta username: \")\n\t\tfmt.Scanln(&user)\n\t}\n\n\tpass, err := keyChain.Get(provider)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting key chain: %v\", err)\n\t}\n\n\t// Initialize spinner\n\tvar s = spinner.New()\n\n\t// Get session token\n\ts.Start()\n\tresp, err := c.GetSessionToken(&GetSessionTokenParams{\n\t\tUsername: user,\n\t\tPassword: string(pass),\n\t})\n\ts.Stop()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting session token: %v\", err)\n\t}\n\n\tvar st string\n\n\t// TODO Handle multiple MFA devices (allow user to choose)\n\tswitch resp.Status {\n\tcase StatusSuccess:\n\t\tst = resp.SessionToken\n\tcase StatusMFARequired:\n\t\tfactor := resp.Embedded.Factors[0]\n\t\tstateToken := resp.StateToken\n\n\t\tvar vfResp *VerifyFactorResponse\n\n\t\tswitch factor.FactorType {\n\t\tcase MFATypePush:\n\t\t\t// Okta Verify push notification:\n\t\t\t// https://developer.okta.com/docs/api/resources/authn/#verify-push-factor\n\t\t\t// Keep polling authentication transactions with WAITING result until the challenge\n\t\t\t// completes or expires.\n\t\t\tfmt.Println(\"Please approve request on Okta Verify app\")\n\t\t\ts.Start()\n\t\t\tvfResp, err = c.VerifyFactor(&VerifyFactorParams{\n\t\t\t\tFactorID: factor.ID,\n\t\t\t\tStateToken: stateToken,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"verifying MFA: %v\", err)\n\t\t\t}\n\n\t\t\tfor vfResp.FactorResult == VerifyFactorStatusWaiting {\n\t\t\t\tvfResp, err = c.VerifyFactor(&VerifyFactorParams{\n\t\t\t\t\tFactorID: factor.ID,\n\t\t\t\t\tStateToken: stateToken,\n\t\t\t\t})\n\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t}\n\t\t\ts.Stop()\n\t\tcase MFATypeTOTP:\n\t\t\tfmt.Print(\"Please enter the OTP from your MFA device: \")\n\t\t\tvar otp string\n\t\t\tfmt.Scanln(&otp)\n\n\t\t\ts.Start()\n\t\t\tvfResp, err = c.VerifyFactor(&VerifyFactorParams{\n\t\t\t\tFactorID: factor.ID,\n\t\t\t\tPassCode: otp,\n\t\t\t\tStateToken: stateToken,\n\t\t\t})\n\t\t\ts.Stop()\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unsupported MFA type '%s'\", factor.FactorType)\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"verifying MFA: %v\", err)\n\t\t}\n\n\t\t// Handle failed MFA verification (verification rejected or timed out)\n\t\tif vfResp.Status != VerifyFactorStatusSuccess {\n\t\t\treturn nil, fmt.Errorf(\"MFA verification failed\")\n\t\t}\n\n\t\tst = vfResp.SessionToken\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Invalid status %s\", resp.Status)\n\t}\n\n\t// Launch Okta app with session token\n\ts.Start()\n\tsamlAssertion, err := c.LaunchApp(&LaunchAppParams{SessionToken: st, URL: a.URL})\n\ts.Stop()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error launching app: %v\", err)\n\t}\n\n\tarn, err := saml.Get(*samlAssertion, pArn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.Start()\n\tcreds, err := aws.AssumeSAMLRole(arn.Provider, arn.Role, *samlAssertion, duration)\n\ts.Stop()\n\n\tif err != nil {\n\t\tif err.Error() == aws.ErrDurationExceeded {\n\t\t\tlog.Println(color.YellowString(aws.DurationExceededMessage))\n\t\t\ts.Start()\n\t\t\tcreds, err = aws.AssumeSAMLRole(arn.Provider, arn.Role, *samlAssertion, 3600)\n\t\t\ts.Stop()\n\t\t}\n\t}\n\n\treturn creds, err\n}", "func (i *awsIamKubeAuthPlugin) getToken(ctx context.Context) (bearerToken string, err error) {\n\t// If the token is expired, refresh the token\n\tif i.t.Token == \"\" || i.t.Expiration.Before(time.Now()) {\n\t\tif i.t, err = i.g.GetWithOptions(ctx, &i.o); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tpersistErr := i.persistConfig()\n\tif persistErr != nil {\n\t\tklog.Errorf(\"failed to update aws-iam cache: %v\", err)\n\t}\n\n\tbearerToken = i.t.Token\n\n\treturn\n}", "func GetToken(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"aws:token\")\n}", "func GetBearerToken(in *restclient.Config, explicitKubeConfigPath string) (string, error) {\n\n\tif len(in.BearerToken) > 0 {\n\t\treturn in.BearerToken, nil\n\t}\n\n\tif in == nil {\n\t\treturn \"\", errors.Errorf(\"RestClient can't be nil\")\n\t}\n\tif in.ExecProvider != nil {\n\t\ttc, err := in.TransportConfig()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tauth, err := exec.GetAuthenticator(in.ExecProvider)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t//This function will return error because of TLS Cert missing,\n\t\t// This code is not making actual request. We can ignore it.\n\t\t_ = auth.UpdateTransportConfig(tc)\n\n\t\trt, err := transport.New(tc)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treq := http.Request{Header: map[string][]string{}}\n\n\t\t_, _ = rt.RoundTrip(&req)\n\n\t\ttoken := req.Header.Get(\"Authorization\")\n\t\treturn strings.TrimPrefix(token, \"Bearer \"), nil\n\t}\n\tif in.AuthProvider != nil {\n\t\tif in.AuthProvider.Name == \"gcp\" {\n\t\t\ttoken := in.AuthProvider.Config[\"access-token\"]\n\t\t\ttoken, err := RefreshTokenIfExpired(in, explicitKubeConfigPath, token)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\treturn strings.TrimPrefix(token, \"Bearer \"), nil\n\t\t}\n\t}\n\treturn \"\", errors.Errorf(\"could not find a token\")\n}", "func (a *Auth) GetToken(tokenSecretContext *api.TokenSecretContext) (string, error) {\n\tvar inputSecretKey string\n\tvar outputSecretKey string\n\tsecretName := tokenSecretContext.SecretName\n\n\t// Handle edge cases for different providers.\n\tswitch a.ProviderType {\n\tcase TypeDCOS:\n\t\tinputSecretKey = tokenSecretContext.SecretName\n\t\tnamespace := tokenSecretContext.SecretNamespace\n\t\tif namespace != \"\" {\n\t\t\tinputSecretKey = namespace + \"/\" + secretName\n\t\t}\n\t\toutputSecretKey = inputSecretKey\n\n\tcase TypeK8s:\n\t\tinputSecretKey = tokenSecretContext.SecretName\n\t\toutputSecretKey = SecretTokenKey\n\n\tdefault:\n\t\tinputSecretKey = tokenSecretContext.SecretName\n\t\toutputSecretKey = SecretNameKey\n\t}\n\n\t// Get secret value with standardized interface\n\tsecretValue, err := a.ProviderClient.GetSecret(inputSecretKey, a.requestToContext(tokenSecretContext))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Retrieve auth token\n\tauthToken, exists := secretValue[outputSecretKey]\n\tif !exists {\n\t\treturn \"\", ErrAuthTokenNotFound\n\t}\n\treturn authToken.(string), nil\n\n}", "func Get(app, provider string) (*awsprovider.Credentials, error) {\n\t// Get provider config\n\tp, err := config.GetOktaProvider(provider)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading provider config: %v\", err)\n\t}\n\n\t// Get app config\n\ta, err := config.GetOktaApp(app)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading config for app %s: %v\", app, err)\n\t}\n\n\t// Initialize Okta client\n\tc, err := NewClient(p.BaseURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"initializing Okta client: %v\", err)\n\t}\n\n\t// Get user credentials\n\tuser := p.Username\n\tif user == \"\" {\n\t\t// Get credentials from the user\n\t\tfmt.Print(\"Okta username: \")\n\t\tfmt.Scanln(&user)\n\t}\n\n\tfmt.Print(\"Okta password: \")\n\tpass, err := gopass.GetPasswd()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Couldn't read password from terminal\")\n\t}\n\n\t// Initialize spinner\n\tvar s SpinnerWrapper\n\tif runtime.GOOS == \"windows\" {\n\t\ts = &noopSpinner{}\n\t} else {\n\t\ts = spinner.New(spinner.CharSets[14], 50*time.Millisecond)\n\t}\n\n\t// Get session token\n\ts.Start()\n\tresp, err := c.GetSessionToken(&GetSessionTokenParams{\n\t\tUsername: user,\n\t\tPassword: string(pass),\n\t})\n\ts.Stop()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting session token: %v\", err)\n\t}\n\n\tvar st string\n\n\t// TODO Handle multiple MFA devices (allow user to choose)\n\t// TODO Verify MFA type?\n\tswitch resp.Status {\n\tcase StatusSuccess:\n\t\tst = resp.SessionToken\n\tcase StatusMFARequired:\n\t\tfmt.Print(\"Please enter the OTP from your MFA device: \")\n\t\tvar otp string\n\t\tfmt.Scanln(&otp)\n\n\t\ts.Start()\n\t\tvfResp, err := c.VerifyFactor(&VerifyFactorParams{\n\t\t\tFactorID: resp.Embedded.Factors[0].ID,\n\t\t\tPassCode: otp,\n\t\t\tStateToken: resp.StateToken,\n\t\t})\n\t\ts.Stop()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"verifying MFA: %v\", err)\n\t\t}\n\n\t\tst = vfResp.SessionToken\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Invalid status %s\", resp.Status)\n\t}\n\n\t// Launch Okta app with session token\n\ts.Start()\n\tsamlAssertion, err := c.LaunchApp(&LaunchAppParams{SessionToken: st, URL: a.URL})\n\ts.Stop()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error launching app: %v\", err)\n\t}\n\n\t// Assume role\n\tinput := sts.AssumeRoleWithSAMLInput{\n\t\tPrincipalArn: aws.String(a.PrincipalARN),\n\t\tRoleArn: aws.String(a.RoleARN),\n\t\tSAMLAssertion: aws.String(*samlAssertion),\n\t}\n\n\tsess := session.Must(session.NewSession())\n\tsvc := sts.New(sess)\n\n\ts.Start()\n\taResp, err := svc.AssumeRoleWithSAML(&input)\n\ts.Stop()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"assuming role: %v\", err)\n\t}\n\n\tkeyID := *aResp.Credentials.AccessKeyId\n\tsecretKey := *aResp.Credentials.SecretAccessKey\n\tsessionToken := *aResp.Credentials.SessionToken\n\texpiration := *aResp.Credentials.Expiration\n\n\tcreds := awsprovider.Credentials{\n\t\tAccessKeyID: keyID,\n\t\tSecretAccessKey: secretKey,\n\t\tSessionToken: sessionToken,\n\t\tExpiration: expiration,\n\t}\n\n\treturn &creds, nil\n}", "func (ic *iamClient) GetToken() (string, error) {\n\tif ic == nil {\n\t\treturn \"\", ErrServerNotInit\n\t}\n\n\treturn ic.cli.GetToken()\n}", "func (c TwoLeggedClient) GetToken(scope string) (*Token, error) {\n\t// Read the private key in service account secret.\n\tpemBytes := []byte(toString(c.secret[\"private_key\"]))\n\tblock, _ := pem.Decode(pemBytes)\n\tif block == nil {\n\t\treturn nil, fmt.Errorf(\"Failed to read private key pem block.\")\n\t}\n\n\t// Ignore error, handle the error case below.\n\tpkcs8key, err := x509.ParsePKCS8PrivateKey(block.Bytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create a pkeyInterface object containing the private key. The\n\t// pkeyInterface object has a sign function to sign a hash.\n\tpkey, ok := pkcs8key.(pkeyInterface)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Failed to parse private key.\")\n\t}\n\n\t// Get the JWT token\n\tjwt, err := createJWT(c.secret, scope, pkey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Construct the POST request to fetch the OAuth token.\n\tparams := url.Values{\n\t\t\"assertion\": []string{jwt},\n\t\t\"grant_type\": []string{jwtBearerUrn},\n\t}\n\n\t// Send the POST request and return token.\n\treturn retrieveAccessToken(toString(c.secret[\"token_uri\"]), params)\n}", "func (c *ClientSecretCredential) GetToken(ctx context.Context, opts azcore.TokenRequestOptions) (*azcore.AccessToken, error) {\n\ttk, err := c.client.authenticate(ctx, c.tenantID, c.clientID, c.clientSecret, opts.Scopes)\n\tif err != nil {\n\t\taddGetTokenFailureLogs(\"Client Secret Credential\", err, true)\n\t\treturn nil, err\n\t}\n\tlogGetTokenSuccess(c, opts)\n\treturn tk, nil\n}", "func (c *EpinioClient) generateToken(ctx context.Context, oidcProvider *dex.OIDCProvider, prompt bool) (*oauth2.Token, error) {\n\tvar authCode, codeVerifier string\n\tvar err error\n\n\tif prompt {\n\t\tauthCode, codeVerifier, err = c.getAuthCodeAndVerifierFromUser(oidcProvider)\n\t} else {\n\t\tauthCode, codeVerifier, err = c.getAuthCodeAndVerifierWithServer(ctx, oidcProvider)\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error getting the auth code\")\n\t}\n\n\ttoken, err := oidcProvider.ExchangeWithPKCE(ctx, authCode, codeVerifier)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"exchanging with PKCE\")\n\t}\n\treturn token, nil\n}", "func (client *K8SClient) GetToken() string {\n\treturn client.token\n}", "func (c *FakeCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) {\n\treturn azcore.AccessToken{Token: \"Sanitized\", ExpiresOn: time.Now().Add(time.Hour * 24).UTC()}, nil\n}", "func (c *ClientSecretCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (*azcore.AccessToken, error) {\n\tar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes)\n\tif err == nil {\n\t\tlogGetTokenSuccess(c, opts)\n\t\treturn &azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err\n\t}\n\n\tar, err = c.client.AcquireTokenByCredential(ctx, opts.Scopes)\n\tif err != nil {\n\t\taddGetTokenFailureLogs(credNameSecret, err, true)\n\t\treturn nil, newAuthenticationFailedErrorFromMSALError(credNameSecret, err)\n\t}\n\tlogGetTokenSuccess(c, opts)\n\treturn &azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err\n}", "func (tm *IAMTokenManager) requestToken() (*IAMTokenInfo, error) {\n\tbuilder := NewRequestBuilder(POST).\n\t\tConstructHTTPURL(tm.iamURL, nil, nil)\n\n\tbuilder.AddHeader(CONTENT_TYPE, DEFAULT_CONTENT_TYPE).\n\t\tAddHeader(Accept, APPLICATION_JSON)\n\n\tbuilder.AddFormData(\"grant_type\", \"\", \"\", REQUEST_TOKEN_GRANT_TYPE).\n\t\tAddFormData(\"apikey\", \"\", \"\", tm.iamAPIkey).\n\t\tAddFormData(\"response_type\", \"\", \"\", REQUEST_TOKEN_RESPONSE_TYPE)\n\n\treq, err := builder.Build()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.SetBasicAuth(tm.iamClientId, tm.iamClientSecret)\n\n\tresp, err := tm.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\tif resp != nil {\n\t\t\tbuff := new(bytes.Buffer)\n\t\t\tbuff.ReadFrom(resp.Body)\n\t\t\treturn nil, fmt.Errorf(buff.String())\n\t\t}\n\t}\n\n\ttokenInfo := IAMTokenInfo{}\n\tjson.NewDecoder(resp.Body).Decode(&tokenInfo)\n\tdefer resp.Body.Close()\n\treturn &tokenInfo, nil\n}", "func getOauthToken() (*gceCredential, error) {\n\t_, err := user.Current()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconfPath := path.Join(*credentialsDir, \".config/gcloud/credentials\")\n\tf, err := os.Open(confPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to load gcloud credentials: %q\", confPath)\n\t}\n\tdefer f.Close()\n\tcache := &gcloudCredentialsCache{}\n\tif err := json.NewDecoder(f).Decode(cache); err != nil {\n\t\treturn nil, err\n\t}\n\tif len(cache.Data) == 0 {\n\t\treturn nil, fmt.Errorf(\"no gcloud credentials cached in: %q\", confPath)\n\t}\n\treturn &cache.Data[0].Credential, nil\n}", "func (c *resourcePrincipalFederationClient) getSecurityToken() (securityToken, error) {\n\tvar err error\n\tipFederationClient := c.instancePrincipalKeyProvider.FederationClient\n\n\tcommon.Debugf(\"Refreshing instance principal token\")\n\t//Refresh instance principal token\n\tif refreshable, ok := ipFederationClient.(*x509FederationClient); ok {\n\t\terr = refreshable.renewSecurityTokenIfNotValid()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t//Acquire resource principal token from target service\n\tcommon.Debugf(\"Acquiring resource principal token from target service\")\n\ttokenResponse, err := c.acquireResourcePrincipalToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//Read the public key from the session supplier.\n\tpem := c.sessionKeySupplier.PublicKeyPemRaw()\n\tpemSanitized := sanitizeCertificateString(string(pem))\n\n\t//Exchange resource principal token for session token from identity\n\tcommon.Debugf(\"Exchanging resource principal token for resource principal session token\")\n\tsessionToken, err := c.exchangeToken(pemSanitized, tokenResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newPrincipalToken(sessionToken) // should be a resource principal token\n}", "func GetCredentialsForCluster(cloud kubermaticv1.CloudSpec, secretKeySelector provider.SecretKeySelectorValueFunc) (accessKeyID, secretAccessKey string, err error) {\n\taccessKeyID = cloud.AWS.AccessKeyID\n\tsecretAccessKey = cloud.AWS.SecretAccessKey\n\n\tif accessKeyID == \"\" {\n\t\tif cloud.AWS.CredentialsReference == nil {\n\t\t\treturn \"\", \"\", errors.New(\"no credentials provided\")\n\t\t}\n\t\taccessKeyID, err = secretKeySelector(cloud.AWS.CredentialsReference, resources.AWSAccessKeyID)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\tif secretAccessKey == \"\" {\n\t\tif cloud.AWS.CredentialsReference == nil {\n\t\t\treturn \"\", \"\", errors.New(\"no credentials provided\")\n\t\t}\n\t\tsecretAccessKey, err = secretKeySelector(cloud.AWS.CredentialsReference, resources.AWSSecretAccessKey)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\treturn accessKeyID, secretAccessKey, nil\n}", "func (c Client) GetToken(username string, password string) (string, error) {\n\t// The SchedulesDirect token url\n\turl := fmt.Sprint(DefaultBaseURL, APIVersion, \"/token\")\n\n\t// encrypt the password\n\tsha1hexPW := encryptPassword(password)\n\n\t// TODO: Evaluate performance of this string concatenation, not that this\n\t// should run often.\n\tvar jsonStr = []byte(\n\t\t`{\"username\":\"` + username +\n\t\t\t`\", \"password\":\"` + sha1hexPW + `\"}`)\n\n\t// setup the request\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(jsonStr))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// perform the POST\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close() //resp.Body.Close() will run when we're finished.\n\n\t// create a TokenResponse struct, return if err\n\tr := new(TokenResponse)\n\n\t// decode the response body into the new TokenResponse struct\n\terr = json.NewDecoder(resp.Body).Decode(r)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Print some debugging output\n\t//fmt.Println(\"response Status:\", resp.Status)\n\t//fmt.Println(\"response Headers:\", resp.Header)\n\t//body, _ := ioutil.ReadAll(resp.Body)\n\t//fmt.Println(\"response Body:\", string(body))\n\n\t// return the token string\n\treturn r.Token, nil\n}", "func (c *ClientSecretCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) {\n\treturn c.client.GetToken(ctx, opts)\n}", "func (ap *oauth2ClientCredentialsAuthPlugin) requestToken() (*oauth2Token, error) {\n\tbody := url.Values{\"grant_type\": []string{\"client_credentials\"}}\n\tif len(*ap.Scopes) > 0 {\n\t\tbody[\"scope\"] = []string{strings.Join(*ap.Scopes, \" \")}\n\t}\n\n\tr, err := http.NewRequest(\"POST\", ap.TokenURL, strings.NewReader(body.Encode()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tr.SetBasicAuth(ap.ClientID, ap.ClientSecret)\n\n\tclient := defaultRoundTripperClient(&tls.Config{InsecureSkipVerify: ap.tlsSkipVerify}, 10)\n\tresponse, err := client.Do(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbodyRaw, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif response.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"error in response from OAuth2 token endpoint: %v\", string(bodyRaw))\n\t}\n\n\tvar tokenResponse tokenEndpointResponse\n\terr = json.Unmarshal(bodyRaw, &tokenResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif strings.ToLower(tokenResponse.TokenType) != \"bearer\" {\n\t\treturn nil, errors.New(\"unknown token type returned from token endpoint\")\n\t}\n\n\treturn &oauth2Token{\n\t\tToken: strings.TrimSpace(tokenResponse.AccessToken),\n\t\tExpiresAt: time.Now().Add(time.Duration(tokenResponse.ExpiresIn) * time.Second),\n\t}, nil\n}", "func (c *AzureCLICredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) {\n\tif len(opts.Scopes) != 1 {\n\t\treturn azcore.AccessToken{}, errors.New(credNameAzureCLI + \": GetToken() requires exactly one scope\")\n\t}\n\t// CLI expects an AAD v1 resource, not a v2 scope\n\topts.Scopes = []string{strings.TrimSuffix(opts.Scopes[0], defaultSuffix)}\n\treturn c.s.GetToken(ctx, opts)\n}", "func (c *MockClient) AuthenticateToken(ctx context.Context, customToken string) (string, error) {\n\treturn \"ehrid\", nil\n}", "func NewTempCredentialsProvider(k keyring.Keyring, config Config) (credentials.Provider, error) {\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmasterCreds := NewMasterCredentials(k, config.CredentialsName)\n\n\tif config.RoleARN != \"\" && config.MfaSerial == \"\" {\n\t\tlog.Println(\"Using AssumeRole for credentials\")\n\t\treturn NewAssumeRoleProvider(masterCreds, config)\n\t}\n\n\tsessionTokenCredsProvider, err := NewCachedSessionTokenProvider(masterCreds, k, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif config.RoleARN == \"\" {\n\t\tlog.Println(\"Using GetSessionToken for credentials\")\n\t\treturn sessionTokenCredsProvider, nil\n\t}\n\n\t// If assuming a role using a SessionToken, MFA has already been used in the SessionToken\n\t// and is not required for the AssumeRole call\n\tconfig.MfaSerial = \"\"\n\n\tlog.Println(\"Using GetSessionToken + AssumeRole for credentials\")\n\treturn NewAssumeRoleProvider(credentials.NewCredentials(sessionTokenCredsProvider), config)\n}", "func (a Auth0Tokener) GetToken(ctx context.Context) (string, error) {\n\treq, _ := http.NewRequest(\"POST\", a.url, strings.NewReader(a.payload))\n\treq.Header.Add(\"content-type\", \"application/json\")\n\n\tresp, err := a.doer.Do(req)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed obtaining new access token: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"failed obtaining new access token: status code %v\", resp.StatusCode)\n\t}\n\n\tvar tr tokenResponse\n\terr = json.NewDecoder(resp.Body).Decode(&tr)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed decoding new access token: %w\", err)\n\t}\n\n\treturn tr.AT, nil\n}", "func GetECRAuthorizationToken(AccountID string, Region string) (string, error) {\n\tmySession := session.Must(session.NewSession())\n\tsvc := ecr.New(mySession, aws.NewConfig().WithRegion(Region))\n\tvar input ecr.GetAuthorizationTokenInput\n\tinput.SetRegistryIds([]*string{&AccountID})\n\tauthOutput, err := svc.GetAuthorizationToken(&input)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn decodeB64(*authOutput.AuthorizationData[0].AuthorizationToken), nil\n}", "func NewToken(uid int32) (string, string, error) {\n\ttoken := jwtgo.New(jwtgo.SigningMethodES256)\n\n\tclaims := token.Claims.(jwtgo.MapClaims)\n\tclaims[claimUID] = uid\n\tclaims[claimExpire] = time.Now().Add(time.Hour * tokenExpireInHour).Unix()\n\n\tt, err := token.SignedString([]byte(TokenHMACKey))\n\treturn respTokenKey, t, err\n}", "func (s *MTLSAuthService) Get(ctx context.Context,\n\tconsumerUsernameOrID, keyOrID *string) (*MTLSAuth, error) {\n\n\tcred, err := s.client.credentials.Get(ctx, \"mtls-auth\",\n\t\tconsumerUsernameOrID, keyOrID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar mtlsAuth MTLSAuth\n\terr = json.Unmarshal(cred, &mtlsAuth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &mtlsAuth, nil\n}", "func (i *Impersonator) GetToken(sa *corev1.ServiceAccount) (string, error) {\n\tsecret, err := serviceaccounttoken.EnsureSecretForServiceAccount(context.Background(), i.clusterContext.Core.Secrets(\"\").Controller().Lister().Get, i.clusterContext.K8sClient, sa)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error getting secret: %w\", err)\n\t}\n\ttoken, ok := secret.Data[\"token\"]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"error getting token: invalid secret object\")\n\t}\n\treturn string(token), nil\n}", "func getAKSClient(orgId uint, secretId string) (*azureClient.AKSClient, error) {\n\tc := AKSCluster{\n\t\tmodelCluster: &model.ClusterModel{\n\t\t\tOrganizationId: orgId,\n\t\t\tSecretId: secretId,\n\t\t},\n\t}\n\n\treturn c.GetAKSClient()\n}", "func (K *KWAPI) newToken(username, password string) (auth *KWAuth, err error) {\n\n\tpath := fmt.Sprintf(\"https://%s/oauth/token\", K.Server)\n\n\treq, err := http.NewRequest(http.MethodPost, path, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thttp_header := make(http.Header)\n\thttp_header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\thttp_header.Set(\"User-Agent\", K.AgentString)\n\n\treq.Header = http_header\n\n\tclient_id := K.ApplicationID\n\n\tpostform := &url.Values{\n\t\t\"client_id\": {client_id},\n\t\t\"client_secret\": {K.secrets.decrypt(K.secrets.client_secret_key)},\n\t\t\"redirect_uri\": {K.RedirectURI},\n\t}\n\n\tif password != NONE {\n\t\tpostform.Add(\"grant_type\", \"password\")\n\t\tpostform.Add(\"username\", username)\n\t\tpostform.Add(\"password\", password)\n\t} else {\n\t\tsignature := K.secrets.decrypt(K.secrets.signature_key)\n\t\trandomizer := rand.New(rand.NewSource(int64(time.Now().Unix())))\n\t\tnonce := randomizer.Int() % 999999\n\t\ttimestamp := int64(time.Now().Unix())\n\n\t\tbase_string := fmt.Sprintf(\"%s|@@|%s|@@|%d|@@|%d\", client_id, username, timestamp, nonce)\n\n\t\tmac := hmac.New(sha1.New, []byte(signature))\n\t\tmac.Write([]byte(base_string))\n\t\tsignature = hex.EncodeToString(mac.Sum(nil))\n\n\t\tauth_code := fmt.Sprintf(\"%s|@@|%s|@@|%d|@@|%d|@@|%s\",\n\t\t\tbase64.StdEncoding.EncodeToString([]byte(client_id)),\n\t\t\tbase64.StdEncoding.EncodeToString([]byte(username)),\n\t\t\ttimestamp, nonce, signature)\n\n\t\tpostform.Add(\"grant_type\", \"authorization_code\")\n\t\tpostform.Add(\"code\", auth_code)\n\n\t}\n\n\tif K.Snoop {\n\t\tStdout(\"\\n[kiteworks]: %s\\n--> ACTION: \\\"POST\\\" PATH: \\\"%s\\\"\", username, path)\n\t\tfor k, v := range *postform {\n\t\t\tif k == \"grant_type\" || k == \"redirect_uri\" || k == \"scope\" {\n\t\t\t\tStdout(\"\\\\-> POST PARAM: %s VALUE: %s\", k, v)\n\t\t\t} else {\n\t\t\t\tStdout(\"\\\\-> POST PARAM: %s VALUE: [HIDDEN]\", k)\n\t\t\t}\n\t\t}\n\t}\n\n\treq.Body = ioutil.NopCloser(bytes.NewReader([]byte(postform.Encode())))\n\n\tclient := K.Session(username).NewClient()\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := K.decodeJSON(resp, &auth); err != nil {\n\t\treturn nil, err\n\t}\n\n\tauth.Expires = auth.Expires + time.Now().Unix()\n\treturn\n}", "func (c *ChainedTokenCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (*azcore.AccessToken, error) {\n\tif c.successfulCredential != nil && !c.retrySources {\n\t\treturn c.successfulCredential.GetToken(ctx, opts)\n\t}\n\n\tvar errs []error\n\tfor _, cred := range c.sources {\n\t\ttoken, err := cred.GetToken(ctx, opts)\n\t\tif err == nil {\n\t\t\tlog.Writef(EventAuthentication, \"Azure Identity => %s authenticated with %s\", c.name, extractCredentialName(cred))\n\t\t\tc.successfulCredential = cred\n\t\t\treturn token, nil\n\t\t}\n\t\terrs = append(errs, err)\n\t\tif _, ok := err.(credentialUnavailableError); !ok {\n\t\t\tres := getResponseFromError(err)\n\t\t\tmsg := createChainedErrorMessage(errs)\n\t\t\treturn nil, newAuthenticationFailedError(c.name, msg, res)\n\t\t}\n\t}\n\t// if we get here, all credentials returned credentialUnavailableError\n\tmsg := createChainedErrorMessage(errs)\n\terr := newCredentialUnavailableError(c.name, msg)\n\tlog.Write(EventAuthentication, \"Azure Identity => ERROR: \"+err.Error())\n\treturn nil, err\n}", "func (RequestAuthenticationToken *TRequestAuthenticationToken) GetCredential() string {\n\treturn \"\"\n}", "func (c *StaticCredential) GetToken(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error) {\n\treturn c.token, nil\n}", "func (a *ClientCredentials) Token() (*oauth2.Token, error) {\n\tvar err error\n\ta.c, err = configClientCredentials(a.B)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn a.c.Token(context.TODO())\n}", "func (s *ClientLookupTokenRetriever) GetToken(namespace, name string) (string, error) {\n\tfor i := 0; i < 30; i++ {\n\t\t// Wait on subsequent retries\n\t\tif i != 0 {\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\n\t\t// Get the service account\n\t\tserviceAccount, err := s.Client.ServiceAccounts(namespace).Get(name)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Get the secrets\n\t\t// TODO: JTL: create one directly once we have that ability\n\t\tfor _, secretRef := range serviceAccount.Secrets {\n\t\t\tsecret, err2 := s.Client.Secrets(namespace).Get(secretRef.Name)\n\t\t\tif err2 != nil {\n\t\t\t\t// Tolerate fetch errors on a particular secret\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif IsValidServiceAccountToken(serviceAccount, secret) {\n\t\t\t\t// Return a valid token\n\t\t\t\treturn string(secret.Data[kapi.ServiceAccountTokenKey]), nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"Could not get token for %s/%s\", namespace, name)\n}", "func GetServicePrincipalToken(config *config.AzureConfig, aadEndpoint, resource string, proxyMode bool) (adal.OAuthTokenProvider, error) {\n\toauthConfig, err := adal.NewOAuthConfig(aadEndpoint, config.TenantID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create OAuth config, error: %v\", err)\n\t}\n\n\tif config.UseManagedIdentityExtension {\n\t\tmlog.Info(\"using managed identity extension to retrieve access token\")\n\t\tmsiEndpoint, err := adal.GetMSIVMEndpoint()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get managed service identity endpoint, error: %v\", err)\n\t\t}\n\t\t// using user-assigned managed identity to access keyvault\n\t\tif len(config.UserAssignedIdentityID) > 0 {\n\t\t\tmlog.Info(\"using User-assigned managed identity to retrieve access token\", \"clientID\", redactClientCredentials(config.UserAssignedIdentityID))\n\t\t\treturn adal.NewServicePrincipalTokenFromMSIWithUserAssignedID(msiEndpoint,\n\t\t\t\tresource,\n\t\t\t\tconfig.UserAssignedIdentityID)\n\t\t}\n\t\tmlog.Info(\"using system-assigned managed identity to retrieve access token\")\n\t\t// using system-assigned managed identity to access keyvault\n\t\treturn adal.NewServicePrincipalTokenFromMSI(\n\t\t\tmsiEndpoint,\n\t\t\tresource)\n\t}\n\n\tif len(config.ClientSecret) > 0 && len(config.ClientID) > 0 {\n\t\tmlog.Info(\"azure: using client_id+client_secret to retrieve access token\",\n\t\t\t\"clientID\", redactClientCredentials(config.ClientID), \"clientSecret\", redactClientCredentials(config.ClientSecret))\n\n\t\tspt, err := adal.NewServicePrincipalToken(\n\t\t\t*oauthConfig,\n\t\t\tconfig.ClientID,\n\t\t\tconfig.ClientSecret,\n\t\t\tresource)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif proxyMode {\n\t\t\treturn addTargetTypeHeader(spt), nil\n\t\t}\n\t\treturn spt, nil\n\t}\n\n\tif len(config.AADClientCertPath) > 0 && len(config.AADClientCertPassword) > 0 {\n\t\tmlog.Info(\"using jwt client_assertion (client_cert+client_private_key) to retrieve access token\")\n\t\tcertData, err := os.ReadFile(config.AADClientCertPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read client certificate from file %s, error: %v\", config.AADClientCertPath, err)\n\t\t}\n\t\tcertificate, privateKey, err := decodePkcs12(certData, config.AADClientCertPassword)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to decode the client certificate, error: %v\", err)\n\t\t}\n\t\tspt, err := adal.NewServicePrincipalTokenFromCertificate(\n\t\t\t*oauthConfig,\n\t\t\tconfig.ClientID,\n\t\t\tcertificate,\n\t\t\tprivateKey,\n\t\t\tresource)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif proxyMode {\n\t\t\treturn addTargetTypeHeader(spt), nil\n\t\t}\n\t\treturn spt, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"no credentials provided for accessing keyvault\")\n}", "func getBearerToken(t *testing.T) string {\n\ttokenProvider, err := framework.GetConfig()\n\tif err != nil {\n\t\tt.Fatalf(\"error, can't get config: %s\", err)\n\t}\n\n\t// use this for\n\t// tokenProvider.TLSClientConfig\n\n\t// build the request header with a token from the kubeconfig\n\treturn fmt.Sprintf(\"Bearer %s\", tokenProvider.BearerToken)\n}", "func GenECRToken(aFlags AWSFlags) *ecr.GetAuthorizationTokenOutput {\n\tclient.AddConfig(awsgo.SvcTypeECR, aFlags)\n\toutput, err := client.ECR().GetAuthorizationToken(nil)\n\tif err != nil {\n\t\tFailf(\"error generating token: %v\", err)\n\t}\n\treturn output\n}", "func GetECRAuthToken(awsRegion string) (authToken string, getAuthTokenErr error) {\n\tecrClient, ecrClientInitErr := config.ECRClientInit(awsRegion)\n\tif ecrClientInitErr != nil {\n\t\treturn \"\", ecrClientInitErr\n\t}\n\n\tinput := &ecr.GetAuthorizationTokenInput{}\n\n\tresult, getAuthTokenErr := ecrClient.GetAuthorizationToken(input)\n\tif getAuthTokenErr != nil {\n\t\tif aerr, ok := getAuthTokenErr.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase ecr.ErrCodeServerException:\n\t\t\t\tfmt.Println(ecr.ErrCodeServerException, aerr.Error())\n\t\t\tcase ecr.ErrCodeInvalidParameterException:\n\t\t\t\tfmt.Println(ecr.ErrCodeInvalidParameterException, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(getAuthTokenErr.Error())\n\t\t}\n\t\treturn \"\", getAuthTokenErr\n\t}\n\tauthTokenValue := result.AuthorizationData[0].AuthorizationToken\n\treturn *authTokenValue, nil\n}", "func (m *GoogleComputeAuthMethod) Authenticate(ctx context.Context, r auth.RequestMetadata) (*auth.User, auth.Session, error) {\n\ttoken := strings.TrimSpace(strings.TrimPrefix(r.Header(m.Header), \"Bearer \"))\n\tif token == \"\" {\n\t\treturn nil, nil, nil // skip this auth method\n\t}\n\n\t// Grab root Google OAuth2 keys to verify JWT signature. They are most likely\n\t// already cached in the process memory.\n\tcerts := m.certs\n\tif certs == nil {\n\t\tvar err error\n\t\tif certs, err = signing.FetchGoogleOAuth2Certificates(ctx); err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t}\n\n\t// Verify and deserialize the token. GCE VM tokens are always issued by\n\t// accounts.google.com.\n\tverifiedToken, err := VerifyIDToken(ctx, token, certs, \"https://accounts.google.com\")\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Tokens can either be in \"full\" or \"standard\" format. We want \"full\", since\n\t// \"standard\" doesn't have details about the VM.\n\tif verifiedToken.Google.ComputeEngine.ProjectID == \"\" {\n\t\treturn nil, nil, errors.Reason(\"no google.compute_engine in the GCE VM token, use 'full' format\").Err()\n\t}\n\n\t// Convert \"<realm>:<project>\" to \"<project>.<realm>\" for \"bot:...\" string.\n\tdomain := verifiedToken.Google.ComputeEngine.ProjectID\n\tif chunks := strings.SplitN(domain, \":\", 2); len(chunks) == 2 {\n\t\tdomain = fmt.Sprintf(\"%s.%s\", chunks[1], chunks[0])\n\t}\n\n\t// Generate some \"bot\" identity just to have something representative in the\n\t// context for e.g. logs. This also verifies there are no funky characters\n\t// in the instance and project names. Full information about the token will be\n\t// exposed via GoogleComputeTokenInfo in auth.User.Extra.\n\tident, err := identity.MakeIdentity(fmt.Sprintf(\"bot:%s@gce.%s\",\n\t\tverifiedToken.Google.ComputeEngine.InstanceName, domain))\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Check the audience in the token.\n\tif m.AudienceCheck == nil {\n\t\treturn nil, nil, errors.Reason(\"GoogleComputeAuthMethod has no AudienceCheck\").Err()\n\t}\n\tswitch valid, err := m.AudienceCheck(ctx, r, verifiedToken.Aud); {\n\tcase err != nil:\n\t\treturn nil, nil, err\n\tcase !valid:\n\t\tlogging.Errorf(ctx, \"openid: GCE VM token from %s has unrecognized audience %q\", ident, verifiedToken.Aud)\n\t\treturn nil, nil, auth.ErrBadAudience\n\t}\n\n\t// Success.\n\treturn &auth.User{\n\t\tIdentity: ident,\n\t\tExtra: &GoogleComputeTokenInfo{\n\t\t\tAudience: verifiedToken.Aud,\n\t\t\tServiceAccount: verifiedToken.Email,\n\t\t\tInstance: verifiedToken.Google.ComputeEngine.InstanceName,\n\t\t\tZone: verifiedToken.Google.ComputeEngine.Zone,\n\t\t\tProject: verifiedToken.Google.ComputeEngine.ProjectID,\n\t\t},\n\t}, nil, nil\n}", "func (c *Client) GetToken() (string, error) {\n\t// Check if it has a refresh token.\n\tif c.RefreshToken == \"\" {\n\t\treturn \"\", microerror.Maskf(invalidConfigError, \"No refresh token saved in config file, unable to acquire new access token. Please login again.\")\n\t}\n\n\tif isTokenExpired(c.AccessToken) {\n\t\t// Get a new token.\n\t\trefreshTokenResponse, err := oidc.RefreshToken(c.RefreshToken)\n\t\tif err != nil {\n\t\t\treturn \"\", microerror.Mask(err)\n\t\t}\n\n\t\t// Parse the ID Token for the email address.\n\t\tidToken, err := oidc.ParseIDToken(refreshTokenResponse.IDToken)\n\t\tif err != nil {\n\t\t\treturn \"\", microerror.Mask(err)\n\t\t}\n\n\t\t// Update the config file with the new access token.\n\t\tc.IDToken = idToken\n\t\tc.AccessToken = refreshTokenResponse.AccessToken\n\n\t\tfmt.Println(\"DEBUG: Access token has just been refreshed.\")\n\t}\n\n\treturn c.AccessToken, nil\n}", "func (p *AssumeRoleProvider) Retrieve(ctx context.Context) (aws.Credentials, error) {\n\t// Apply defaults where parameters are not set.\n\tif len(p.options.RoleSessionName) == 0 {\n\t\t// Try to work out a role name that will hopefully end up unique.\n\t\tp.options.RoleSessionName = fmt.Sprintf(\"aws-go-sdk-%d\", time.Now().UTC().UnixNano())\n\t}\n\tif p.options.Duration == 0 {\n\t\t// Expire as often as AWS permits.\n\t\tp.options.Duration = DefaultDuration\n\t}\n\tinput := &sts.AssumeRoleInput{\n\t\tDurationSeconds: aws.Int32(int32(p.options.Duration / time.Second)),\n\t\tPolicyArns: p.options.PolicyARNs,\n\t\tRoleArn: aws.String(p.options.RoleARN),\n\t\tRoleSessionName: aws.String(p.options.RoleSessionName),\n\t\tExternalId: p.options.ExternalID,\n\t\tSourceIdentity: p.options.SourceIdentity,\n\t\tTags: p.options.Tags,\n\t\tTransitiveTagKeys: p.options.TransitiveTagKeys,\n\t}\n\tif p.options.Policy != nil {\n\t\tinput.Policy = p.options.Policy\n\t}\n\tif p.options.SerialNumber != nil {\n\t\tif p.options.TokenProvider != nil {\n\t\t\tinput.SerialNumber = p.options.SerialNumber\n\t\t\tcode, err := p.options.TokenProvider()\n\t\t\tif err != nil {\n\t\t\t\treturn aws.Credentials{}, err\n\t\t\t}\n\t\t\tinput.TokenCode = aws.String(code)\n\t\t} else {\n\t\t\treturn aws.Credentials{}, fmt.Errorf(\"assume role with MFA enabled, but TokenProvider is not set\")\n\t\t}\n\t}\n\n\tresp, err := p.options.Client.AssumeRole(ctx, input)\n\tif err != nil {\n\t\treturn aws.Credentials{Source: ProviderName}, err\n\t}\n\n\treturn aws.Credentials{\n\t\tAccessKeyID: *resp.Credentials.AccessKeyId,\n\t\tSecretAccessKey: *resp.Credentials.SecretAccessKey,\n\t\tSessionToken: *resp.Credentials.SessionToken,\n\t\tSource: ProviderName,\n\n\t\tCanExpire: true,\n\t\tExpires: *resp.Credentials.Expiration,\n\t}, nil\n}", "func (i *IAM) GetAccessToken(pn string, useDefaultNS bool) (*string, error) {\n\tns := i.getNamespace(useDefaultNS)\n\n\t//curl for the auth token ... need to supply appropiate ns\n\tres, err := i.ExecuteVerificationCmd(pn, CurlAuthToken, ns)\n\tlog.Printf(\"[NOTICE] curl result: %v\", res)\n\n\tif err != nil {\n\t\t//this is an error from trying to execute the command as opposed to\n\t\t//the command itself returning an error\n\t\treturn nil, fmt.Errorf(\"error raised trying to execute auth token command - %v\", err)\n\t}\n\n\t//try and extract token\n\tvar a struct {\n\t\tAccessToken string `json:\"access_token,omitempty\"`\n\t}\n\tjson.Unmarshal([]byte(res.Stdout), &a)\n\n\tlog.Printf(\"[DEBUG] Access Token JSON result: %+v\", a)\n\n\treturn &a.AccessToken, nil\n}", "func (p Plugin) ExchangeToken(ctx context.Context, trustDomain, k8sSAjwt string) (\n\tstring /*access token*/, time.Time /*expireTime*/, int /*httpRespCode*/, error) {\n\taud := constructAudience(trustDomain)\n\tvar jsonStr = constructFederatedTokenRequest(aud, k8sSAjwt)\n\treq, _ := http.NewRequest(\"POST\", SecureTokenEndpoint, bytes.NewBuffer(jsonStr))\n\treq.Header.Set(\"Content-Type\", contentType)\n\n\tresp, err := p.hTTPClient.Do(req)\n\terrMsg := \"failed to call token exchange service. \"\n\tif err != nil || resp == nil {\n\t\tstatusCode := http.StatusServiceUnavailable\n\t\t// If resp is not null, return the actually status code returned from the token service.\n\t\t// If resp is null, return a service unavailable status and try again.\n\t\tif resp != nil {\n\t\t\tstatusCode = resp.StatusCode\n\t\t\terrMsg += fmt.Sprintf(\"HTTP status: %s. Error: %v\", resp.Status, err)\n\t\t} else {\n\t\t\terrMsg += fmt.Sprintf(\"HTTP response empty. Error: %v\", err)\n\t\t}\n\t\treturn \"\", time.Now(), statusCode, errors.New(errMsg)\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\trespData := &federatedTokenResponse{}\n\tif err := json.Unmarshal(body, respData); err != nil {\n\t\treturn \"\", time.Now(), resp.StatusCode, fmt.Errorf(\n\t\t\t\"failed to unmarshal response data. HTTP status: %s. Error: %v. Body size: %d\", resp.Status, err, len(body))\n\t}\n\n\tif respData.AccessToken == \"\" {\n\t\treturn \"\", time.Now(), resp.StatusCode, fmt.Errorf(\n\t\t\t\"exchanged empty token. HTTP status: %s. Response: %v\", resp.Status, string(body))\n\t}\n\n\treturn respData.AccessToken, time.Now().Add(time.Second * time.Duration(respData.ExpiresIn)), resp.StatusCode, nil\n}", "func (c *SecurityClient) GetToken() auth.Token {\n\treturn c.token\n}", "func GetAccessToken() (string, error) {\n\tc := cache.GetCache()\n\tif token, exists := c.Get(CacheKeyBCSCCAccessToken); exists {\n\t\treturn token.(string), nil\n\t}\n\tbcsCCConf := config.GlobalConf.BCSCC\n\treqURL := fmt.Sprintf(\"%s%s\", bcsCCConf.SSMHost, getAccessTokenPath)\n\theader := http.Header{}\n\theader.Add(\"X-BK-APP-CODE\", config.GlobalConf.App.Code)\n\theader.Add(\"X-BK-APP-SECRET\", config.GlobalConf.App.Secret)\n\tdata := map[string]interface{}{}\n\tdata[\"grant_type\"] = \"client_credentials\"\n\tdata[\"id_provider\"] = \"client\"\n\treq := gorequest.SuperAgent{\n\t\tUrl: reqURL,\n\t\tMethod: \"POST\",\n\t\tHeader: header,\n\t\tData: data,\n\t}\n\tbody, err := component.Request(req, timeout, \"\", nil)\n\tif err != nil {\n\t\tlogging.Error(\"request bk-ssm error, data: %v, err: %v\", req.Data, err)\n\t\treturn \"\", errorx.NewRequestBKSSMErr(err.Error())\n\t}\n\t// 解析返回\n\tvar resp getAccessTokenResp\n\tif err := json.Unmarshal([]byte(body), &resp); err != nil {\n\t\tlogging.Error(\"parse resp error, body: %v\", body)\n\t\treturn \"\", err\n\t}\n\n\tif resp.Code != 0 {\n\t\tlogging.Error(\"request bk-ssm api error, code: %d, message: %s\", resp.Code, resp.Message)\n\t\treturn \"\", errorx.NewRequestBKSSMErr(resp.Message)\n\t}\n\tif resp.Data.ExpiresIn > 10 {\n\t\tc.Add(CacheKeyBCSCCAccessToken, resp.Data.AccessToken, time.Duration(resp.Data.ExpiresIn-5)*time.Second)\n\t}\n\treturn resp.Data.AccessToken, nil\n}", "func GetAuthToken(profile string) string {\n\t// get secret by profile name\n\tsecret, err := keyring.Get(ServiceName, profile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn generateToptToken(secret)\n}", "func (a *Authenticator) requestNewToken() (jwt.Token, error) {\n\trestRequest, err := a.getAuthRequest()\n\tif err != nil {\n\t\treturn jwt.Token{}, fmt.Errorf(\"error during auth request creation: %w\", err)\n\t}\n\n\tgetMethod := rest.PostMethod\n\n\thttpRequest, err := restRequest.GetHTTPRequest(a.BasePath, getMethod.Method)\n\tif err != nil {\n\t\treturn jwt.Token{}, fmt.Errorf(\"error constructing token http request: %w\", err)\n\t}\n\tbodyToSign, err := restRequest.GetJSONBody()\n\tif err != nil {\n\t\treturn jwt.Token{}, fmt.Errorf(\"error marshalling token request: %w\", err)\n\t}\n\tsignature, err := signWithKey(bodyToSign, a.PrivateKeyBody)\n\tif err != nil {\n\t\treturn jwt.Token{}, err\n\t}\n\thttpRequest.Header.Add(signatureHeader, signature)\n\n\thttpResponse, err := a.HTTPClient.Do(httpRequest)\n\tif err != nil {\n\t\treturn jwt.Token{}, fmt.Errorf(\"error requesting token: %w\", err)\n\t}\n\n\tdefer httpResponse.Body.Close()\n\n\t// read entire response body\n\tb, err := ioutil.ReadAll(httpResponse.Body)\n\tif err != nil {\n\t\treturn jwt.Token{}, fmt.Errorf(\"error requesting token: %w\", err)\n\t}\n\n\trestResponse := rest.Response{\n\t\tBody: b,\n\t\tStatusCode: httpResponse.StatusCode,\n\t\tMethod: getMethod,\n\t}\n\n\tvar tokenToReturn tokenResponse\n\terr = restResponse.ParseResponse(&tokenToReturn)\n\tif err != nil {\n\t\treturn jwt.Token{}, fmt.Errorf(\"error requesting token: %w\", err)\n\t}\n\n\treturn jwt.New(tokenToReturn.Token)\n}", "func GetLoginToken(rancherURI string) (client.Token, error) {\n\ttoken := client.Token{}\n\t// Generate a private key, to encrypt/decrypt the authKey token\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn token, err\n\t}\n\tpublicKey := privateKey.PublicKey\n\tmarshalKey, err := json.Marshal(publicKey)\n\tif err != nil {\n\t\treturn token, err\n\t}\n\tencodedKey := base64.StdEncoding.EncodeToString(marshalKey)\n\tid, err := generateKey()\n\tif err != nil {\n\t\treturn token, err\n\t}\n\t// Set response type to json\n\tresponseType := \"json\"\n\ttokenURL := fmt.Sprintf(authTokenURL, rancherURI, id)\n\treq, err := http.NewRequest(http.MethodGet, tokenURL, bytes.NewBuffer(nil))\n\tif err != nil {\n\t\treturn token, err\n\t}\n\treq.Header.Set(\"content-type\", \"application/json\")\n\treq.Header.Set(\"accept\", \"application/json\")\n\n\t// Don´t verify certificates\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{\n\t\t\tInsecureSkipVerify: true,\n\t\t},\n\t}\n\n\tclient := &http.Client{Transport: tr, Timeout: 300 * time.Second}\n\n\tloginRequest := fmt.Sprintf(\"%s/login?requestId=%s&publicKey=%s&responseType=%s\",\n\t\trancherURI, id, encodedKey, responseType)\n\n\tfmt.Printf(\"\\nOpening browser for login to: %s \\n\", rancherURI)\n\topenbrowser(loginRequest)\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt)\n\n\t// Timeout for user to login and get token\n\ttimeout := time.NewTicker(15 * time.Minute)\n\tdefer timeout.Stop()\n\n\tpoll := time.NewTicker(10 * time.Second)\n\tdefer poll.Stop()\n\n\t// Loop until we get the token\n\tfor {\n\t\tselect {\n\t\tcase <-poll.C:\n\t\t\tres, err := client.Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn token, err\n\t\t\t}\n\t\t\tcontent, err := ioutil.ReadAll(res.Body)\n\t\t\tif err != nil {\n\t\t\t\tres.Body.Close()\n\t\t\t\treturn token, err\n\t\t\t}\n\t\t\tres.Body.Close()\n\t\t\terr = json.Unmarshal(content, &token)\n\t\t\tif err != nil {\n\t\t\t\treturn token, err\n\t\t\t}\n\t\t\tif token.Token == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdecoded, err := base64.StdEncoding.DecodeString(token.Token)\n\t\t\tif err != nil {\n\t\t\t\treturn token, err\n\t\t\t}\n\t\t\tdecryptedBytes, err := privateKey.Decrypt(nil, decoded, &rsa.OAEPOptions{Hash: crypto.SHA256})\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\ttoken.Token = string(decryptedBytes)\n\t\t\t// delete token\n\t\t\treq, err = http.NewRequest(http.MethodDelete, tokenURL, bytes.NewBuffer(nil))\n\t\t\tif err != nil {\n\t\t\t\treturn token, err\n\t\t\t}\n\t\t\treq.Header.Set(\"content-type\", \"application/json\")\n\t\t\treq.Header.Set(\"accept\", \"application/json\")\n\t\t\ttr := &http.Transport{\n\t\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\t\tInsecureSkipVerify: true,\n\t\t\t\t},\n\t\t\t}\n\t\t\tclient = &http.Client{Transport: tr, Timeout: 150 * time.Second}\n\t\t\tres, err = client.Do(req)\n\t\t\tif err != nil {\n\t\t\t\t// log error and use the token if login succeeds\n\t\t\t\tfmt.Printf(\"DeleteToken: %v\", err)\n\t\t\t}\n\t\t\treturn token, nil\n\n\t\tcase <-timeout.C:\n\t\t\tbreak\n\n\t\tcase <-interrupt:\n\t\t\tfmt.Printf(\"received interrupt\\n\")\n\t\t\tbreak\n\t\t}\n\n\t\treturn token, nil\n\t}\n}", "func GenerateToken(key []byte, userID int64, credential string) (string, error) {\n\n\t//new token\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\n\t// Claims\n\tclaims := make(jwt.MapClaims)\n\tclaims[\"user_id\"] = userID\n\tclaims[\"credential\"] = credential\n\tclaims[\"exp\"] = time.Now().Add(time.Hour*720).UnixNano() / int64(time.Millisecond)\n\ttoken.Claims = claims\n\n\t// Sign and get as a string\n\ttokenString, err := token.SignedString(key)\n\treturn tokenString, err\n}", "func (c *Client) GetToken(username, password string) (*AccessToken, error) {\n form := map[string]string{\n \"username\": username,\n \"password\": password,\n }\n\n req, err := c.NewRequest(\"POST\", \"/authorization/signin\", form)\n if err != nil {\n return nil, err\n }\n\n resp, err := c.client.Do(req)\n if err != nil {\n return nil, err\n }\n\n if resp.StatusCode < 200 || resp.StatusCode > 299 {\n return nil, ErrBadStatusCode\n }\n\n var authResp AuthResponse\n err = json.NewDecoder(resp.Body).Decode(&authResp)\n if err != nil {\n return nil, err\n }\n\n if (authResp.AccessToken.Token == \"\") {\n return nil, ErrBadCredentials\n }\n \n return &authResp.AccessToken, nil\n}", "func GetAuthToken(registry DockerRegistry) (*string, *string) {\n\n\n\turl := registry.url\n\tregistryUrlSplit := strings.Split(url, \".\")\n\tregistryId := registryUrlSplit[0]\n\n\tlog.WithField(\"RegistryID\", registryId).Info(\"Registry ID:\")\n\n\t// split the docker url.\n\tauthTokenInput := ecr.GetAuthorizationTokenInput{\n\t\tRegistryIds: []*string{aws.String(registryId)},\n\t}\n\n\tawsConfig := aws.Config{\n\t\tRegion: aws.String(registryUrlSplit[3]),\n\t}\n\n\tmySession, err := session.NewSession(&awsConfig)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tsvc := ecr.New(mySession)\n\n\tauthTokenOutput, err := svc.GetAuthorizationToken(&authTokenInput)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tauthToken := authTokenOutput.AuthorizationData[0].AuthorizationToken\n\texpiresAt := authTokenOutput.AuthorizationData[0].ExpiresAt\n\tproxyEndpoint := authTokenOutput.AuthorizationData[0].ProxyEndpoint\n\n\tb64DecodedTokenBytes, err := base64.StdEncoding.DecodeString(*authToken)\n\t// todo: handle error\n\n\tbase64DecodedToken := string(b64DecodedTokenBytes)\n\tcreds := strings.Split(base64DecodedToken, \":\")\n\tusername := creds[0]\n\tpassword := creds[1]\n\n\tlog.WithField(\"username\", username).WithField(\"password\", password).Info(\"Extracted from ECR\")\n\tlog.WithField(\"Expiry\", expiresAt).Info(\"Expiration\")\n\tlog.WithField(\"Proxy Endpoint\", *proxyEndpoint).Info(\"Proxy Endpoint\")\n\n\treturn &username, &password\n}", "func (c ThreeLeggedClient) GetToken(scope string) (*Token, error) {\n\t// In the authorize flow, user will paste a verification code back to console.\n\tcode, err := authorizeFlow(c.secret, scope, c.authorizeHandler)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The verify flow takes in the verification code from authorize flow, sends a\n\t// POST request containing the code to fetch oauth token.\n\treturn verifyFlow(c.secret, scope, code)\n}", "func (c *Client) GetToken(username, siteID, clientIP string) (string, error) {\n\tform := url.Values{}\n\tform.Add(\"username\", username)\n\tif siteID != \"\" {\n\t\tform.Add(\"target_site\", siteID)\n\t}\n\tif clientIP != \"\" {\n\t\tform.Add(\"client_ip\", clientIP)\n\t}\n\tresp, err := c.HTTPClient.PostForm(c.BaseURL+\"/trusted\", form)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tticket, err := ioutil.ReadAll(resp.Body)\n\tresp.Body.Close()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(ticket), nil\n}", "func GetToken(client TokenAuthHandler) (err error) {\n\tvar token string\n\n\tif tokenFile := os.Getenv(\"VAULT_TOKEN_FILE\"); tokenFile != \"\" {\n\t\ttoken, err = GetTokenFromFile(tokenFile)\n\t}\n\n\tif err == nil && token != \"\" {\n\t\t// Reach out to the API to make sure it's good\n\t\tt, err := client.Validate(token)\n\n\t\tif err == nil && t != nil {\n\t\t\tclient.SetToken(token)\n\t\t\treturn nil\n\t\t}\n\n\t\tlog.Warn(\"Retrieved token is not valid, falling back\")\n\t}\n\n\tif err != nil {\n\t\tlog.Warn(err.Error())\n\t}\n\n\t// Fall back to logging in with user/pass creds\n\ttoken, err = GetTokenWithLogin(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient.SetToken(token)\n\treturn nil\n}", "func (cfg *ClientConf) getAuthToken() (string, error) {\n return cfg.basicToken(cfg.Username, cfg.Password), nil\n}", "func GetAuthToken(address string, pkey string, API string) (string, error) {\n var data = new(StringRes)\n // 1: Get the auth data to sign\n // ----------------------------\n res_data, err := http.Get(API+\"/AuthDatum\")\n // Data will need to be hashed\n if err != nil { return \"\", fmt.Errorf(\"Could not get authentication data: (%s)\", err) }\n body, err1 := ioutil.ReadAll(res_data.Body)\n if err != nil { return \"\", fmt.Errorf(\"Could not parse authentication data: (%s)\", err1) }\n err2 := json.Unmarshal(body, &data)\n if err2 != nil { return \"\", fmt.Errorf(\"Could not unmarshal authentication data: (%s)\", err2) }\n\n // Hash the data. Keep the byte array\n data_hash := sig.Keccak256Hash([]byte(data.Result))\n // Sign the data with the private key\n privkey, err3 := crypto.HexToECDSA(pkey)\n if err3 != nil { return \"\", fmt.Errorf(\"Could not parse private key: (%s)\", err3) }\n // Sign the auth data\n _sig, err4 := sig.Ecsign(data_hash, privkey)\n if err4 != nil { return \"\", fmt.Errorf(\"Could not sign with private key: (%s)\", err4) }\n\n // 2: Send sigature, get token\n // ---------------------\n var authdata = new(StringRes)\n var jsonStr = []byte(`{\"owner\":\"`+address+`\",\"sig\":\"0x`+_sig+`\"}`)\n res, err5 := http.Post(API+\"/Authenticate\", \"application/json\", bytes.NewBuffer(jsonStr))\n if err5 != nil { return \"\", fmt.Errorf(\"Could not hit POST /Authenticate: (%s)\", err5) }\n if res.StatusCode != 200 { return \"\", fmt.Errorf(\"(%s): Error in POST /Authenticate\", res.StatusCode)}\n body, err6 := ioutil.ReadAll(res.Body)\n if err6 != nil { return \"\" , fmt.Errorf(\"Could not read /Authenticate body: (%s)\", err6)}\n err7 := json.Unmarshal(body, &authdata)\n if err7 != nil { return \"\", fmt.Errorf(\"Could not unmarshal /Authenticate body: (%s)\", err7) }\n\n // Return the JSON web token\n return string(authdata.Result), nil\n}", "func requestToken(client *http.Client, username, password string) ([]byte, error) {\n\treq, err := http.NewRequest(\"GET\", cfg.tokenRequestEndpoint, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.SetBasicAuth(username, password)\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\treturn ioutil.ReadAll(resp.Body)\n}", "func GenerateServiceAccountToken(clientset kubernetes.Interface) (string, error) {\n\t_, err := clientset.CoreV1().Namespaces().Create(context.TODO(), &v1.Namespace{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cattleNamespace,\n\t\t},\n\t}, metav1.CreateOptions{})\n\tif err != nil && !errors.IsAlreadyExists(err) {\n\t\treturn \"\", err\n\t}\n\n\tserviceAccount := &v1.ServiceAccount{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: kontainerEngine,\n\t\t},\n\t}\n\n\t_, err = clientset.CoreV1().ServiceAccounts(cattleNamespace).Create(context.TODO(), serviceAccount, metav1.CreateOptions{})\n\tif err != nil && !errors.IsAlreadyExists(err) {\n\t\treturn \"\", fmt.Errorf(\"error creating service account: %v\", err)\n\t}\n\n\tadminRole := &v1beta1.ClusterRole{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: clusterAdmin,\n\t\t},\n\t\tRules: []v1beta1.PolicyRule{\n\t\t\t{\n\t\t\t\tAPIGroups: []string{\"*\"},\n\t\t\t\tResources: []string{\"*\"},\n\t\t\t\tVerbs: []string{\"*\"},\n\t\t\t},\n\t\t\t{\n\t\t\t\tNonResourceURLs: []string{\"*\"},\n\t\t\t\tVerbs: []string{\"*\"},\n\t\t\t},\n\t\t},\n\t}\n\tclusterAdminRole, err := clientset.RbacV1beta1().ClusterRoles().Get(context.TODO(), clusterAdmin, metav1.GetOptions{})\n\tif err != nil {\n\t\tclusterAdminRole, err = clientset.RbacV1beta1().ClusterRoles().Create(context.TODO(), adminRole, metav1.CreateOptions{})\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"error creating admin role: %v\", err)\n\t\t}\n\t}\n\n\tclusterRoleBinding := &v1beta1.ClusterRoleBinding{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: newClusterRoleBindingName,\n\t\t},\n\t\tSubjects: []v1beta1.Subject{\n\t\t\t{\n\t\t\t\tKind: \"ServiceAccount\",\n\t\t\t\tName: serviceAccount.Name,\n\t\t\t\tNamespace: cattleNamespace,\n\t\t\t\tAPIGroup: v1.GroupName,\n\t\t\t},\n\t\t},\n\t\tRoleRef: v1beta1.RoleRef{\n\t\t\tKind: \"ClusterRole\",\n\t\t\tName: clusterAdminRole.Name,\n\t\t\tAPIGroup: v1beta1.GroupName,\n\t\t},\n\t}\n\tif _, err = clientset.RbacV1beta1().ClusterRoleBindings().Create(context.TODO(), clusterRoleBinding, metav1.CreateOptions{}); err != nil && !errors.IsAlreadyExists(err) {\n\t\treturn \"\", fmt.Errorf(\"error creating role bindings: %v\", err)\n\t}\n\n\tstart := time.Millisecond * 250\n\tfor i := 0; i < 5; i++ {\n\t\ttime.Sleep(start)\n\t\tif serviceAccount, err = clientset.CoreV1().ServiceAccounts(cattleNamespace).Get(context.TODO(), serviceAccount.Name, metav1.GetOptions{}); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"error getting service account: %v\", err)\n\t\t}\n\n\t\tif len(serviceAccount.Secrets) > 0 {\n\t\t\tsecret := serviceAccount.Secrets[0]\n\t\t\tsecretObj, err := clientset.CoreV1().Secrets(cattleNamespace).Get(context.TODO(), secret.Name, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"error getting secret: %v\", err)\n\t\t\t}\n\t\t\tif token, ok := secretObj.Data[\"token\"]; ok {\n\t\t\t\treturn string(token), nil\n\t\t\t}\n\t\t}\n\t\tstart = start * 2\n\t}\n\n\treturn \"\", errs.New(\"failed to fetch serviceAccountToken\")\n}", "func (ts tokenSource) Token() (*oauth2.Token, error) {\n\tconf := ts.conf\n\n\tcredSource, err := conf.parse(ts.ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsubjectToken, err := credSource.subjectToken()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstsRequest := stsTokenExchangeRequest{\n\t\tGrantType: \"urn:ietf:params:oauth:grant-type:token-exchange\",\n\t\tAudience: conf.Audience,\n\t\tScope: conf.Scopes,\n\t\tRequestedTokenType: \"urn:ietf:params:oauth:token-type:access_token\",\n\t\tSubjectToken: subjectToken,\n\t\tSubjectTokenType: conf.SubjectTokenType,\n\t}\n\theader := make(http.Header)\n\theader.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tclientAuth := clientAuthentication{\n\t\tAuthStyle: oauth2.AuthStyleInHeader,\n\t\tClientID: conf.ClientID,\n\t\tClientSecret: conf.ClientSecret,\n\t}\n\tvar options map[string]interface{}\n\t// Do not pass workforce_pool_user_project when client authentication is used.\n\t// The client ID is sufficient for determining the user project.\n\tif conf.WorkforcePoolUserProject != \"\" && conf.ClientID == \"\" {\n\t\toptions = map[string]interface{}{\n\t\t\t\"userProject\": conf.WorkforcePoolUserProject,\n\t\t}\n\t}\n\tstsResp, err := exchangeToken(ts.ctx, conf.TokenURL, &stsRequest, clientAuth, header, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taccessToken := &oauth2.Token{\n\t\tAccessToken: stsResp.AccessToken,\n\t\tTokenType: stsResp.TokenType,\n\t}\n\tif stsResp.ExpiresIn < 0 {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: got invalid expiry from security token service\")\n\t} else if stsResp.ExpiresIn >= 0 {\n\t\taccessToken.Expiry = now().Add(time.Duration(stsResp.ExpiresIn) * time.Second)\n\t}\n\n\tif stsResp.RefreshToken != \"\" {\n\t\taccessToken.RefreshToken = stsResp.RefreshToken\n\t}\n\treturn accessToken, nil\n}", "func GetAuthenticator() (core.Authenticator, error) {\n\tkey, err := GetAPIkeyValue()\n\tif err != nil {\n\t\treturn nil, errors.New(\"could not get the value of API key\")\n\t}\n\tauth := &core.IamAuthenticator{\n\t\tApiKey: key,\n\t}\n\treturn auth, nil\n}", "func GetKeyvaultToken(grantType OAuthGrantType) (authorizer autorest.Authorizer, err error) {\n\tconfig, err := adal.NewOAuthConfig(azure.PublicCloud.ActiveDirectoryEndpoint, tenantID)\n\tupdatedAuthorizeEndpoint, err := url.Parse(\"https://login.windows.net/\" + tenantID + \"/oauth2/token\")\n\tconfig.AuthorizeEndpoint = *updatedAuthorizeEndpoint\n\tif err != nil {\n\t\treturn\n\t}\n\n\tswitch grantType {\n\tcase OAuthGrantTypeServicePrincipal:\n\t\tspt, err := adal.NewServicePrincipalToken(\n\t\t\t*config,\n\t\t\tclientID,\n\t\t\tclientSecret,\n\t\t\t\"https://vault.azure.net\")\n\n\t\tif err != nil {\n\t\t\treturn authorizer, err\n\t\t}\n\t\tauthorizer = autorest.NewBearerAuthorizer(spt)\n\tcase OAuthGrantTypeDeviceFlow:\n\t\tsender := &http.Client{}\n\n\t\tcode, err := adal.InitiateDeviceAuth(\n\t\t\tsender,\n\t\t\t*config,\n\t\t\tsamplesAppID, // clientID\n\t\t\t\"https://vault.azure.net\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"%s: %v\\n\", \"failed to initiate device auth\", err)\n\t\t}\n\n\t\tlog.Println(*code.Message)\n\t\tspt, err := adal.WaitForUserCompletion(sender, code)\n\t\tif err != nil {\n\t\t\treturn authorizer, err\n\t\t}\n\t\tauthorizer = autorest.NewBearerAuthorizer(spt)\n\tdefault:\n\t\tlog.Fatalln(\"invalid token type specified\")\n\t}\n\n\treturn\n}", "func GetKubeConfig(clusterName string, region string) (*rest.Config, error) {\n\tif clusterName == \"\" {\n\t\terr := errors.New(\"Cluster name is required\")\n\t\tlog.Error().Err(err).Msg(\"Failed to create kube client\")\n\t\treturn nil, err\n\t}\n\n\tif region == \"\" {\n\t\terr := errors.New(\"Region is required\")\n\t\tlog.Error().Err(err).Msg(\"Failed to create kube client\")\n\t\treturn nil, err\n\t}\n\n\ts, err := session.NewSession(&aws.Config{Region: aws.String(region)})\n\tsvc := eks.New(s)\n\tinput := &eks.DescribeClusterInput{\n\t\tName: aws.String(clusterName),\n\t}\n\n\tclusterInfo, err := svc.DescribeCluster(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tlog.Error().Err(aerr).Str(\"code\", aerr.Code()).Msg(\"Failed to describe cluster\")\n\t\t} else {\n\t\t\tlog.Error().Err(err).Msg(\"Failed to describe cluster\")\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tca, err := base64.StdEncoding.DecodeString(*clusterInfo.Cluster.CertificateAuthority.Data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgen, err := token.NewGenerator(false, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttkn, err := gen.Get(*clusterInfo.Cluster.Name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &rest.Config{\n\t\tHost: *clusterInfo.Cluster.Endpoint,\n\t\tBearerToken: tkn.Token,\n\t\tTLSClientConfig: rest.TLSClientConfig{\n\t\t\tCAData: ca,\n\t\t},\n\t}, nil\n}", "func New(name string, configPath string, userName string) (tokenauth.Source, error) {\n\tif configPath == \"\" {\n\t\tconfigPath = k8s.DefaultKubeConfigPath\n\t}\n\tk8sConfig, err := cfg.LoadFromFile(configPath)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Failed to load k8s config from file %v. Make sure it is there or change\"+\n\t\t\t\" permissions.\", configPath)\n\t}\n\n\tinfo, ok := k8sConfig.AuthInfos[userName]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"Failed to find user %s inside k8s config AuthInfo from file %v\", userName, configPath)\n\t}\n\n\t// Currently supported:\n\t// - token\n\t// - OIDC\n\t// - Google compute platform via Oauth2\n\tif info.AuthProvider != nil {\n\t\tswitch info.AuthProvider.Name {\n\t\tcase \"oidc\":\n\t\t\tcache, err := k8s.NewCacheFromUser(configPath, userName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"Failed to get OIDC configuration from user. \")\n\t\t\t}\n\t\t\ts, _, err := oidcauth.NewWithCache(name, cache, nil)\n\t\t\treturn s, err\n\t\tcase \"gcp\":\n\t\t\tc, err := oauth2auth.NewConfigFromMap(info.AuthProvider.Config)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"Failed to create OAuth2 config from map.\")\n\t\t\t}\n\t\t\treturn oauth2auth.NewGCP(name, userName, configPath, c)\n\t\tdefault:\n\t\t\t// TODO(bplotka): Add support for more of them if needed.\n\t\t\treturn nil, errors.Errorf(\"Not supported k8s Auth provider %v\", info.AuthProvider.Name)\n\t\t}\n\t}\n\n\tif info.Token != \"\" {\n\t\treturn directauth.New(name, info.Token), nil\n\t}\n\n\treturn nil, errors.Errorf(\"Not found supported auth source from k8s config %+v\", info)\n}", "func GetTokenString(deviceId string) string {\n\ttokenObj := jwt.NewWithClaims(jwt.SigningMethodHS256, &jwt.StandardClaims{\n\t\tExpiresAt: LocalConfig.tokenLifetime,\n\t\tSubject: deviceId,\n\t})\n\ttokenStr, _ := tokenObj.SignedString([]byte(LocalConfig.tokenKey))\n\n\treturn tokenStr\n}", "func (c *DeviceCodeCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (*azcore.AccessToken, error) {\n\t// ensure we request offline_access\n\tscopes := make([]string, len(opts.Scopes))\n\tcopy(scopes, opts.Scopes)\n\tfor i, scope := range scopes {\n\t\tif scope == \"offline_access\" {\n\t\t\tbreak\n\t\t} else if i == len(scopes)-1 {\n\t\t\tscopes = append(scopes, \"offline_access\")\n\t\t}\n\t}\n\tif len(c.refreshToken) != 0 {\n\t\ttk, err := c.client.refreshAccessToken(ctx, c.tenantID, c.clientID, \"\", c.refreshToken, scopes)\n\t\tif err != nil {\n\t\t\taddGetTokenFailureLogs(\"Device Code Credential\", err, true)\n\t\t\treturn nil, err\n\t\t}\n\t\tc.refreshToken = tk.refreshToken\n\t\tlogGetTokenSuccess(c, opts)\n\t\treturn tk.token, nil\n\t}\n\tdc, err := c.client.requestNewDeviceCode(ctx, c.tenantID, c.clientID, scopes)\n\tif err != nil {\n\t\tauthErr := newAuthenticationFailedError(err, nil)\n\t\taddGetTokenFailureLogs(\"Device Code Credential\", authErr, true)\n\t\treturn nil, authErr\n\t}\n\t// send authentication flow instructions back to the user to log in and authorize the device\n\terr = c.userPrompt(ctx, DeviceCodeMessage{\n\t\tUserCode: dc.UserCode,\n\t\tVerificationURL: dc.VerificationURL,\n\t\tMessage: dc.Message,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// poll the token endpoint until a valid access token is received or until authentication fails\n\tfor {\n\t\ttk, err := c.client.authenticateDeviceCode(ctx, c.tenantID, c.clientID, dc.DeviceCode, scopes)\n\t\t// if there is no error, save the refresh token and return the token credential\n\t\tif err == nil {\n\t\t\tc.refreshToken = tk.refreshToken\n\t\t\tlogGetTokenSuccess(c, opts)\n\t\t\treturn tk.token, err\n\t\t}\n\t\t// if there is an error, check for an AADAuthenticationFailedError in order to check the status for token retrieval\n\t\t// if the error is not an AADAuthenticationFailedError, then fail here since something unexpected occurred\n\t\tvar authFailed AuthenticationFailedError\n\t\tif errors.As(err, &authFailed) && strings.Contains(authFailed.Error(), \"authorization_pending\") {\n\t\t\t// wait for the interval specified from the initial device code endpoint and then poll for the token again\n\t\t\ttime.Sleep(time.Duration(dc.Interval) * time.Second)\n\t\t} else {\n\t\t\taddGetTokenFailureLogs(\"Device Code Credential\", err, true)\n\t\t\treturn nil, err\n\t\t}\n\t}\n}", "func (c *Config) Client() (*alks.Client, error) {\n\tlog.Println(\"[DEBUG] Validating STS credentials\")\n\n\t// lookup credentials\n\tcreds := getCredentials(c)\n\tcp, cpErr := creds.Get()\n\n\tif cpErr == nil {\n\t\tlog.Printf(\"[DEBUG] Got credentials from provider: %s\\n\", cp.ProviderName)\n\t}\n\n\t// validate we have credentials\n\tif cpErr != nil {\n\t\tif awsErr, ok := cpErr.(awserr.Error); ok && awsErr.Code() == \"NoCredentialProviders\" {\n\t\t\tvar err error\n\t\t\tcreds, err = getCredentialsFromSession(c)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcp, cpErr = creds.Get()\n\t\t}\n\t}\n\tif cpErr != nil {\n\t\treturn nil, errNoValidCredentialSources\n\t}\n\n\t// create a new session to test credentails\n\tsess, err := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(\"us-east-1\"),\n\t\tCredentials: creds,\n\t})\n\n\t// validate session\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error creating session from STS. (%v)\", err)\n\t}\n\n\tvar stsconn *sts.STS\n\t// we need to assume another role before creating an ALKS client\n\tif c.AssumeRole.RoleARN != \"\" {\n\t\tarCreds := stscreds.NewCredentials(sess, c.AssumeRole.RoleARN, func(p *stscreds.AssumeRoleProvider) {\n\t\t\tif c.AssumeRole.SessionName != \"\" {\n\t\t\t\tp.RoleSessionName = c.AssumeRole.SessionName\n\t\t\t}\n\n\t\t\tif c.AssumeRole.ExternalID != \"\" {\n\t\t\t\tp.ExternalID = &c.AssumeRole.ExternalID\n\t\t\t}\n\n\t\t\tif c.AssumeRole.Policy != \"\" {\n\t\t\t\tp.Policy = &c.AssumeRole.Policy\n\t\t\t}\n\t\t})\n\n\t\tcp, cpErr = arCreds.Get()\n\t\tif cpErr != nil {\n\t\t\treturn nil, fmt.Errorf(\"The role %q cannot be assumed. Please verify the role ARN, role policies and your base AWS credentials\", c.AssumeRole.RoleARN)\n\t\t}\n\n\t\tstsconn = sts.New(sess, &aws.Config{\n\t\t\tRegion: aws.String(\"us-east-1\"),\n\t\t\tCredentials: arCreds,\n\t\t})\n\t} else {\n\t\tstsconn = sts.New(sess)\n\t}\n\n\t// make a basic api call to test creds are valid\n\t_, serr := stsconn.GetCallerIdentity(&sts.GetCallerIdentityInput{})\n\t// check for valid creds\n\tif serr != nil {\n\t\treturn nil, serr\n\t}\n\n\t// got good creds, create alks sts client\n\tclient, err := alks.NewSTSClient(c.URL, cp.AccessKeyID, cp.SecretAccessKey, cp.SessionToken)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 1. Check if calling for a specific account\n\tif len(c.Account) > 0 && len(c.Role) > 0 {\n\t\t// 2. Generate client specified\n\t\tclient, err = generateNewClient(c, client)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tclient.SetUserAgent(fmt.Sprintf(\"alks-terraform-provider-%s\", getPluginVersion()))\n\n\tlog.Println(\"[INFO] ALKS Client configured\")\n\n\treturn client, nil\n}", "func (o *Okta) GetSessionToken() (string, error) {\n\tp := &payload{\n\t\tUser: o.User,\n\t\tPass: o.Pass,\n\t\tOptions: map[string]bool{\n\t\t\t\"multiOptionalFactorEnroll\": false,\n\t\t\t\"warnBeforePasswordExpired\": false,\n\t\t},\n\t}\n\tpJSON, err := json.Marshal(p)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tr, err := o.C.Post(o.AuthAPI, \"application/json\", bytes.NewBuffer(pJSON))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer r.Body.Close()\n\tbody, _ := ioutil.ReadAll(r.Body)\n\tif r.StatusCode != 200 {\n\t\terr = fmt.Errorf(\"Error: %s\", body)\n\t\treturn \"\", err\n\t}\n\n\tstatus := gjson.GetBytes(body, \"status\").String()\n\tsessionToken := \"\"\n\tif status == \"SUCCESS\" {\n\t\tsessionToken = gjson.GetBytes(body, \"sessionToken\").String()\n\t} else {\n\t\terr = fmt.Errorf(\"Error: %s\", status)\n\t\treturn \"\", err\n\t}\n\n\treturn sessionToken, nil\n}", "func (p *gceTokenProvider) mintAccessToken(ctx context.Context) (*Token, error) {\n\ttokenJSON, err := metadataClient.Get(\"instance/service-accounts/\" + p.account + \"/token\")\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"auth/gce: metadata server call failed\").Tag(transient.Tag).Err()\n\t}\n\n\tvar res struct {\n\t\tAccessToken string `json:\"access_token\"`\n\t\tExpiresInSec int `json:\"expires_in\"`\n\t\tTokenType string `json:\"token_type\"`\n\t}\n\tswitch err = json.NewDecoder(strings.NewReader(tokenJSON)).Decode(&res); {\n\tcase err != nil:\n\t\treturn nil, errors.Annotate(err, \"auth/gce: invalid token JSON from metadata\").Tag(transient.Tag).Err()\n\tcase res.ExpiresInSec == 0 || res.AccessToken == \"\":\n\t\treturn nil, errors.Reason(\"auth/gce: incomplete token received from metadata\").Tag(transient.Tag).Err()\n\t}\n\n\ttok := oauth2.Token{\n\t\tAccessToken: res.AccessToken,\n\t\tTokenType: res.TokenType,\n\t\tExpiry: clock.Now(ctx).Add(time.Duration(res.ExpiresInSec) * time.Second),\n\t}\n\n\treturn &Token{\n\t\t// Replicate the hidden magic state added by computeSource.Token().\n\t\tToken: *tok.WithExtra(map[string]any{\n\t\t\t\"oauth2.google.tokenSource\": \"compute-metadata\",\n\t\t\t\"oauth2.google.serviceAccount\": p.account,\n\t\t}),\n\t\tIDToken: NoIDToken,\n\t\tEmail: p.Email(),\n\t}, nil\n}", "func (f JwtFactory) NewAccessToken(userSID, username, host, clientID, nonce string, groups []auth.Group) (string, error) {\r\n\tt := jwt.New(jwt.GetSigningMethod(\"RS256\"))\r\n\tgroupSids := []string{}\r\n\tgroupNiceNames := []string{}\r\n\tfor _, group := range groups {\r\n\t\tgroupSids = append(groupSids, group.SID)\r\n\t\tgroupNiceNames = append(groupNiceNames, group.NiceName)\r\n\t}\r\n\r\n\tt.Claims = &struct {\r\n\t\tUserSid string `json:\"userSID\"`\r\n\t\tUsername string `json:\"username\"`\r\n\t\tGroups string `json:\"groups\"`\r\n\t\tGroupsNiceName string `json:\"groupsNiceName\"`\r\n\r\n\t\t// Purpose defines what this JWT is for, either access_token or\r\n\t\t// id_token.\r\n\t\tPurpose string `json:\"purpose\"`\r\n\r\n\t\tjwt.StandardClaims\r\n\t}{\r\n\t\tuserSID,\r\n\t\tusername,\r\n\t\tstrings.Join(groupSids, \",\"),\r\n\t\tstrings.Join(groupNiceNames, \",\"),\r\n\t\t\"access_token\",\r\n\t\tgetStandardClaims(host, username, clientID),\r\n\t}\r\n\r\n\treturn f.sign(t)\r\n}", "func getAWSCredentials(keychainName string, keychainProfile string) (*credentials.Credentials, error) {\n\n\t// Open the keyring which holds the credentials\n\tring, _ := keyring.Open(keyring.Config{\n\t\tServiceName: \"aws-vault\",\n\t\tAllowedBackends: []keyring.BackendType{keyring.KeychainBackend},\n\t\tKeychainName: keychainName,\n\t\tKeychainTrustApplication: true,\n\t})\n\n\t// Prepare options for the vault before creating the provider\n\tvConfig, err := vault.LoadConfigFromEnv()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to load AWS config from environment\")\n\t}\n\tvOptions := vault.VaultOptions{\n\t\tConfig: vConfig,\n\t\tMfaPrompt: prompt.Method(\"terminal\"),\n\t}\n\tvOptions = vOptions.ApplyDefaults()\n\terr = vOptions.Validate()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to validate aws-vault options\")\n\t}\n\n\t// Get a new provider to retrieve the credentials\n\tprovider, err := vault.NewVaultProvider(ring, keychainProfile, vOptions)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to create aws-vault provider\")\n\t}\n\tcredVals, err := provider.Retrieve()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to retrieve aws credentials from aws-vault\")\n\t}\n\treturn credentials.NewStaticCredentialsFromCreds(credVals), nil\n}", "func (s *Signer) identityToken(ctx context.Context) (string, error) {\n\ttok := s.options.IdentityToken\n\tif s.options.PrivateKeyPath == \"\" && s.options.IdentityToken == \"\" {\n\t\t// We only attempt to pull from the providers if the option is set\n\t\tif !s.options.EnableTokenProviders {\n\t\t\ts.log().Warn(\"No token set in options and OIDC providers are disabled\")\n\t\t\treturn \"\", nil\n\t\t}\n\n\t\ts.log().Info(\"No identity token was provided. Attempting to get one from supported providers.\")\n\t\ttoken, err := s.impl.TokenFromProviders(ctx, s.log())\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"getting identity token from providers: %w\", err)\n\t\t}\n\t\ttok = token\n\t}\n\treturn tok, nil\n}", "func (a *Client) V2GetCredentials(ctx context.Context, params *V2GetCredentialsParams) (*V2GetCredentialsOK, error) {\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"V2GetCredentials\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v2/clusters/{cluster_id}/credentials\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &V2GetCredentialsReader{formats: a.formats},\n\t\tAuthInfo: a.authInfo,\n\t\tContext: ctx,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*V2GetCredentialsOK), nil\n\n}", "func GenerateKubeconfigFromTokenSecret(clusterName string, contextNamespace string, apiServerHost string, secret *corev1.Secret) ([]byte, error) {\n\tif apiServerHost == \"\" {\n\t\treturn nil, errors.New(\"api server host is required\")\n\t}\n\n\tmatched, _ := regexp.MatchString(`^https:\\/\\/localhost:\\d{1,5}$`, apiServerHost)\n\tif matched {\n\t\tapiServerHost = \"https://kubernetes.default.svc.cluster.local\"\n\t}\n\n\ttoken, ok := secret.Data[corev1.ServiceAccountTokenKey]\n\tif !ok {\n\t\treturn nil, errors.New(\"no \" + corev1.ServiceAccountTokenKey + \" found on secret\")\n\t}\n\n\tkubeConfig := &clientcmdv1.Config{\n\t\tAPIVersion: \"v1\",\n\t\tKind: \"Config\",\n\t\tPreferences: clientcmdv1.Preferences{\n\t\t\tColors: false,\n\t\t},\n\t\tClusters: []clientcmdv1.NamedCluster{\n\t\t\t{\n\t\t\t\tName: clusterName,\n\t\t\t\tCluster: clientcmdv1.Cluster{\n\t\t\t\t\tServer: apiServerHost,\n\t\t\t\t\tInsecureSkipTLSVerify: false,\n\t\t\t\t\tCertificateAuthorityData: secret.Data[corev1.ServiceAccountRootCAKey],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tAuthInfos: []clientcmdv1.NamedAuthInfo{\n\t\t\t{\n\t\t\t\tName: clusterName,\n\t\t\t\tAuthInfo: clientcmdv1.AuthInfo{\n\t\t\t\t\tToken: string(token),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tContexts: []clientcmdv1.NamedContext{\n\t\t\t{\n\t\t\t\tName: clusterName,\n\t\t\t\tContext: clientcmdv1.Context{\n\t\t\t\t\tCluster: clusterName,\n\t\t\t\t\tAuthInfo: clusterName,\n\t\t\t\t\tNamespace: contextNamespace,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tCurrentContext: clusterName,\n\t}\n\n\treturn yaml.Marshal(kubeConfig)\n}", "func (t *TokenAuthenticator) AuthenticateToken(ctx context.Context, token string) (*authenticator.Response, bool, error) {\n\ttokenID, tokenSecret, err := bootstraptokenutil.ParseToken(token)\n\tif err != nil {\n\t\t// Token isn't of the correct form, ignore it.\n\t\treturn nil, false, nil\n\t}\n\n\tsecretName := bootstrapapi.BootstrapTokenSecretPrefix + tokenID\n\tsecret, err := t.lister.Get(secretName)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tklog.V(3).Infof(\"No secret of name %s to match bootstrap bearer token\", secretName)\n\t\t\treturn nil, false, nil\n\t\t}\n\t\treturn nil, false, err\n\t}\n\n\tif secret.DeletionTimestamp != nil {\n\t\ttokenErrorf(secret, \"is deleted and awaiting removal\")\n\t\treturn nil, false, nil\n\t}\n\n\tif string(secret.Type) != string(bootstrapapi.SecretTypeBootstrapToken) || secret.Data == nil {\n\t\ttokenErrorf(secret, \"has invalid type, expected %s.\", bootstrapapi.SecretTypeBootstrapToken)\n\t\treturn nil, false, nil\n\t}\n\n\tts := bootstrapsecretutil.GetData(secret, bootstrapapi.BootstrapTokenSecretKey)\n\tif subtle.ConstantTimeCompare([]byte(ts), []byte(tokenSecret)) != 1 {\n\t\ttokenErrorf(secret, \"has invalid value for key %s.\", bootstrapapi.BootstrapTokenSecretKey)\n\t\treturn nil, false, nil\n\t}\n\n\tid := bootstrapsecretutil.GetData(secret, bootstrapapi.BootstrapTokenIDKey)\n\tif id != tokenID {\n\t\ttokenErrorf(secret, \"has invalid value for key %s.\", bootstrapapi.BootstrapTokenIDKey)\n\t\treturn nil, false, nil\n\t}\n\n\tif bootstrapsecretutil.HasExpired(secret, time.Now()) {\n\t\t// logging done in isSecretExpired method.\n\t\treturn nil, false, nil\n\t}\n\n\tif bootstrapsecretutil.GetData(secret, bootstrapapi.BootstrapTokenUsageAuthentication) != \"true\" {\n\t\ttokenErrorf(secret, \"not marked %s=true.\", bootstrapapi.BootstrapTokenUsageAuthentication)\n\t\treturn nil, false, nil\n\t}\n\n\tgroups, err := bootstrapsecretutil.GetGroups(secret)\n\tif err != nil {\n\t\ttokenErrorf(secret, \"has invalid value for key %s: %v.\", bootstrapapi.BootstrapTokenExtraGroupsKey, err)\n\t\treturn nil, false, nil\n\t}\n\n\treturn &authenticator.Response{\n\t\tUser: &user.DefaultInfo{\n\t\t\tName: bootstrapapi.BootstrapUserPrefix + string(id),\n\t\t\tGroups: groups,\n\t\t},\n\t}, true, nil\n}", "func (k ApiKey) Authenticate(ctx context.Context, es *elasticsearch.Client) (*SecurityInfo, error) {\n\n\ttoken := fmt.Sprintf(\"%s%s\", authPrefix, k.Token())\n\n\treq := esapi.SecurityAuthenticateRequest{\n\t\tHeader: map[string][]string{AuthKey: []string{token}},\n\t}\n\n\tres, err := req.Do(ctx, es)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"apikey auth request %s: %w\", k.Id, err)\n\t}\n\n\tif res.Body != nil {\n\t\tdefer res.Body.Close()\n\t}\n\n\tif res.IsError() {\n\t\treturn nil, fmt.Errorf(\"apikey auth response %s: %s\", k.Id, res.String())\n\t}\n\n\tvar info SecurityInfo\n\tdecoder := json.NewDecoder(res.Body)\n\tif err := decoder.Decode(&info); err != nil {\n\t\treturn nil, fmt.Errorf(\"apikey auth parse %s: %w\", k.Id, err)\n\t}\n\n\treturn &info, nil\n}", "func ExchangeKeyForToken(config oauth2.Config, appID, accessKey string) (*oauth2.Token, error) {\n\treturn config.PasswordCredentialsToken(context.TODO(), appID, accessKey)\n}", "func (azureTokenProvider) GetToken(uri string) (*auth.Token, error) {\n\ttoken, err := azure.GetAzureADPodIdentityToken(\"https://servicebus.azure.net\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &auth.Token{\n\t\tTokenType: auth.CBSTokenTypeJWT,\n\t\tToken: token.AccessToken,\n\t\tExpiry: token.ExpiresOn,\n\t}, nil\n}", "func (a *Client) GetClusterCredentials(params *GetClusterCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*GetClusterCredentialsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetClusterCredentialsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetClusterCredentials\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/clusters/{name}/credentials\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetClusterCredentialsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetClusterCredentialsOK), nil\n\n}", "func (s *StsTokenCredential) GetBearerToken() string {\n\treturn \"\"\n}", "func (i *IMDSConfig) getNewToken() (err error) {\n\t// Create request\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(http.MethodPut, imdsBase+tokenEndpoint, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ec2macosinit: error while creating new HTTP request: %s\\n\", err)\n\t}\n\treq.Header.Set(tokenRequestTTLHeader, strconv.FormatInt(int64(imdsTokenTTL), 10))\n\n\t// Make request\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ec2macosinit: error while requesting new token: %s\\n\", err)\n\t}\n\n\t// Validate response code\n\tif resp.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"ec2macosinit: received a non-200 status code from IMDS: %d - %s\\n\",\n\t\t\tresp.StatusCode,\n\t\t\tresp.Status,\n\t\t)\n\t}\n\n\t// Set returned value\n\ti.token, err = ioReadCloserToString(resp.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ec2macosinit: error reading response body: %s\\n\", err)\n\t}\n\n\treturn nil\n}", "func (p *Provider) GetToken(code string) (*oauth2.Token, error) {\n\ttok, err := p.config.Exchange(oauth2.NoContext, code)\n\treturn tok, err\n}", "func (p *Provider) GetToken(code string) (*oauth2.Token, error) {\n\ttok, err := p.config.Exchange(oauth2.NoContext, code)\n\treturn tok, err\n}", "func NewTokenCommand(sl service.CommandServicer) (*cobra.Command, error) {\n\tvar oArgs tokenArgs\n\tcmd := &cobra.Command{\n\t\tUse: \"token\",\n\t\tShort: \"requests a token for the System assigned or Managed Identity on the Azure instance\",\n\t\tRun: xcobra.RunWithCtx(func(ctx context.Context, cmd *cobra.Command, args []string) error {\n\t\t\tif oArgs.MIResID != \"\" && (oArgs.ClientID == \"\" || oArgs.ObjectID == \"\") {\n\t\t\t\terr := errors.New(\"when specifying the managed identity resource id, client-id and object-id are required\")\n\t\t\t\tsl.GetPrinter().ErrPrintf(\"%v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tm, err := sl.GetMetadater()\n\t\t\tif err != nil {\n\t\t\t\tsl.GetPrinter().ErrPrintf(\"unable to build Metadater service: %v\\n\", err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tri := azmeta.ResourceAndIdentity{\n\t\t\t\tResource: oArgs.Resource,\n\t\t\t}\n\n\t\t\tif oArgs.MIResID != \"\" {\n\t\t\t\tri.ManagedIdentityID = &oArgs.MIResID\n\t\t\t\tclientID, err := uuid.Parse(oArgs.ClientID)\n\t\t\t\tif err != nil {\n\t\t\t\t\tsl.GetPrinter().ErrPrintf(\"client ID could not be parsed into a uuid: %v\\n\", err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tri.ClientID = &clientID\n\n\t\t\t\tobjectID, err := uuid.Parse(oArgs.ObjectID)\n\t\t\t\tif err != nil {\n\t\t\t\t\tsl.GetPrinter().ErrPrintf(\"object id could not be parsed into a uuid: %v\\n\", err)\n\t\t\t\t}\n\t\t\t\tri.ObjectID = &objectID\n\t\t\t}\n\n\t\t\ttoken, err := m.GetIdentityToken(ctx, ri)\n\t\t\tif err != nil {\n\t\t\t\tsl.GetPrinter().ErrPrintf(\"unable to fetch identity token: %v\\n\", err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn sl.GetPrinter().Print(token)\n\t\t}),\n\t}\n\n\tcmd.Flags().StringVarP(&oArgs.Resource, \"resource\", \"r\", \"\", \"A string indicating the App ID URI of the target resource. It also appears in the aud (audience) claim of the issued token. This example requests a token to access Azure Resource Manager, which has an App ID URI of https://management.azure.com/. For more services and resource IDs see: https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities.\")\n\tcmd.Flags().StringVarP(&oArgs.MIResID, \"mi-res\", \"m\", \"\", \"(Optional) Azure resource ID for the managed identity you would like the token for. This is required if the instance has multiple user assigned identities.\")\n\tcmd.Flags().StringVar(&oArgs.ObjectID, \"object-id\", \"\", \"(Optional) Object ID for the managed identity you would like to use. Required if the VM has multiple user assigned identities.\")\n\tcmd.Flags().StringVar(&oArgs.ClientID, \"client-id\", \"\", \"(Optional) Client ID for the managed identity you would like to use. Required if the VM has multiple user assigned identities.\")\n\terr := cmd.MarkFlagRequired(\"resource\")\n\treturn cmd, err\n}", "func GetTokenWithLogin(client TokenAuthHandler) (string, error) {\n\tusername := os.Getenv(\"VAULT_USERNAME\")\n\tpassword := os.Getenv(\"VAULT_PASSWORD\")\n\n\tif username == \"\" || password == \"\" {\n\t\treturn \"\", fmt.Errorf(\"Must set VAULT_USERNAME and VAULT_PASSWORD\")\n\t}\n\n\tttl := GetTTL()\n\n\toptions := map[string]interface{}{\n\t\t\"password\": password,\n\t\t\"ttl\": ttl,\n\t\t\"max_ttl\": ttl,\n\t}\n\n\ttoken, err := client.Login(username, password, options)\n\tif err != nil {\n\t\treturn \"\", err // Errors are nicely wrapped already\n\t}\n\n\tif tokenFile := os.Getenv(\"VAULT_TOKEN_FILE\"); tokenFile != \"\" {\n\t\terr = ioutil.WriteFile(tokenFile, []byte(token), 0600)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error writing Vault token file: %s\", err)\n\t\t}\n\t}\n\n\treturn token, nil\n}", "func (s *ClusterAgentsService) GetAgentToken(pid interface{}, aid int, id int, options ...RequestOptionFunc) (*AgentToken, *Response, error) {\n\tproject, err := parseID(pid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\turi := fmt.Sprintf(\"projects/%s/cluster_agents/%d/tokens/%d\", PathEscape(project), aid, id)\n\n\treq, err := s.client.NewRequest(http.MethodGet, uri, nil, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tat := new(AgentToken)\n\tresp, err := s.client.Do(req, at)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn at, resp, nil\n}", "func (defaultActorTokensProvider) GenerateIDToken(ctx context.Context, serviceAccount, audience string) (tok string, err error) {\n\terr = withCredentialsClient(ctx, func(client *iam.CredentialsClient) (err error) {\n\t\ttok, err = client.GenerateIDToken(ctx, serviceAccount, audience, true, nil)\n\t\treturn\n\t})\n\treturn\n}", "func (c *ConcreteClient) getToken(ctx context.Context) (*gocloak.JWT, error) {\n\ttoken, err := c.keycloak.LoginClient(ctx, c.clientID, c.clientSecret, c.realm)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get token: %w\", err)\n\t}\n\n\trRes, err := c.keycloak.RetrospectToken(ctx, token.AccessToken, c.clientID, c.clientSecret, c.realm)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to retrospect token: %w\", err)\n\t}\n\n\tif !*rRes.Active {\n\t\treturn nil, fmt.Errorf(\"token is not active\")\n\t}\n\n\treturn token, nil\n}", "func (s *SessHelper) GetToken(appid, uuid string) (string, error) {\n\treturn \"\", nil\n}", "func (p *credentialProvider) Retrieve() (aws.Credentials, error) {\n\tawscred := aws.Credentials{\n\t\tSecretAccessKey: p.SecretAccessKey,\n\t\tAccessKeyID: p.AccessKeyID,\n\t}\n\n\treturn awscred, nil\n}", "func GetToken() (string, string, error) {\n\tvar cfg config\n\terr := envconfig.Init(&cfg)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"cannot read configurations from environment variables\")\n\t}\n\n\tidProviderConfig := authentication.BuildIdProviderConfig(authentication.EnvConfig{\n\t\tDomain: cfg.Domain,\n\t\tUserEmail: cfg.TestUserEmail,\n\t\tUserPassword: cfg.TestUserPassword,\n\t\tClientTimeout: time.Second * 10,\n\t})\n\n\ttoken, err := authentication.GetToken(idProviderConfig)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"cannot get JWT token\")\n\t}\n\treturn token, cfg.Domain, nil\n}", "func GetCredentials(isExternal bool) *credentials.Credentials {\n\tmu.Lock()\n\tif credentialChain == nil {\n\t\tcredProviders := defaults.CredProviders(defaults.Config(), defaults.Handlers())\n\t\tcredProviders = append(credProviders, providers.NewRotatingSharedCredentialsProvider())\n\t\tcredentialChain = credentials.NewCredentials(&credentials.ChainProvider{\n\t\t\tVerboseErrors: false,\n\t\t\tProviders: credProviders,\n\t\t})\n\t}\n\tmu.Unlock()\n\n\t// credentials.Credentials is concurrency-safe, so lock not needed here\n\tv, err := credentialChain.Get()\n\tif err != nil {\n\t\tseelog.Errorf(\"Error getting ECS instance credentials from default chain: %s\", err)\n\t} else {\n\t\tseelog.Infof(\"Successfully got ECS instance credentials from provider: %s\", v.ProviderName)\n\t}\n\treturn credentialChain\n}", "func (m *Application) GetTokenEncryptionKeyId()(*string) {\n return m.tokenEncryptionKeyId\n}", "func (irkit *Irkit) RequestClientToken() (string, error) {\n\turl := irkit.Address + \"/keys\"\n\treq, _ := http.NewRequest(\"POST\", url, nil)\n\treq.Header.Set(\"X-Requested-With\", \"curl\")\n\n\tclient := new(http.Client)\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\treturn \"can not read\" + url, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\t//get response\n\tresult, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\n\t\treturn \"can not read\", err\n\t}\n\n\t//json\n\tvar data interface{}\n\terr = json.Unmarshal(result, &data)\n\tif err != nil {\n\t\tfmt.Println(result)\n\t\treturn \"error\", err\n\t}\n\n\t//read data\n\ts, err := dproxy.New(data).M(\"clienttoken\").String()\n\tif err != nil {\n\t\treturn \"err\", err\n\t}\n\n\treturn s, nil\n}", "func NewEncryptedTokenForClient(credentials *credentials.Value, accountAccessKey string, actions []string) (string, error) {\n\tif credentials != nil {\n\t\tencryptedClaims, err := encryptClaims(&TokenClaims{\n\t\t\tSTSAccessKeyID: credentials.AccessKeyID,\n\t\t\tSTSSecretAccessKey: credentials.SecretAccessKey,\n\t\t\tSTSSessionToken: credentials.SessionToken,\n\t\t\tAccountAccessKey: accountAccessKey,\n\t\t\tActions: actions,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn encryptedClaims, nil\n\t}\n\treturn \"\", errors.New(\"provided credentials are empty\")\n}", "func (a *Client) GetToken(params *GetTokenParams) (*GetTokenOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetTokenParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getToken\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/asset/tokens/{symbol}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetTokenReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetTokenOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for getToken: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (authProvider *ecrAuthProvider) getAuthConfigFromECR(image string, key cacheKey, authData *apicontainer.ECRAuthData) (types.AuthConfig, error) {\n\t// Create ECR client to get the token\n\tclient, err := authProvider.factory.GetClient(authData)\n\tif err != nil {\n\t\treturn types.AuthConfig{}, err\n\t}\n\n\tlog.Debugf(\"Calling ECR.GetAuthorizationToken for %s\", image)\n\tecrAuthData, err := client.GetAuthorizationToken(authData.RegistryID)\n\tif err != nil {\n\t\treturn types.AuthConfig{}, err\n\t}\n\tif ecrAuthData == nil {\n\t\treturn types.AuthConfig{}, fmt.Errorf(\"ecr auth: missing AuthorizationData in ECR response for %s\", image)\n\t}\n\n\t// Verify the auth data has the correct format for ECR\n\tif ecrAuthData.ProxyEndpoint != nil &&\n\t\tstrings.HasPrefix(proxyEndpointScheme+image, aws.StringValue(ecrAuthData.ProxyEndpoint)) &&\n\t\tecrAuthData.AuthorizationToken != nil {\n\n\t\t// Cache the new token\n\t\tauthProvider.tokenCache.Set(key.String(), ecrAuthData)\n\t\treturn extractToken(ecrAuthData)\n\t}\n\treturn types.AuthConfig{}, fmt.Errorf(\"ecr auth: AuthorizationData is malformed for %s\", image)\n}", "func (a *Client) GetAccessToken(params *GetAccessTokenParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccessTokenOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAccessTokenParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getAccessToken\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/oauth2/v1/token\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetAccessTokenReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetAccessTokenOK), nil\n\n}" ]
[ "0.683445", "0.6011437", "0.59397644", "0.5844146", "0.5737358", "0.5637542", "0.55660355", "0.5565645", "0.55008286", "0.54758614", "0.5445974", "0.5379046", "0.5367993", "0.5357562", "0.53379583", "0.5315221", "0.53070855", "0.5271072", "0.5250263", "0.5228849", "0.52215916", "0.52214515", "0.52167344", "0.5202735", "0.51913124", "0.5187544", "0.51839316", "0.51786166", "0.5156491", "0.51455384", "0.51319945", "0.51290834", "0.5128401", "0.5107094", "0.5105195", "0.5098141", "0.50972444", "0.5089317", "0.50863314", "0.5083121", "0.50519264", "0.504756", "0.5047455", "0.5044776", "0.5018699", "0.50052947", "0.49898577", "0.49779797", "0.49744546", "0.49674016", "0.49602753", "0.4954612", "0.49482977", "0.49449003", "0.49412316", "0.4925703", "0.49206102", "0.49020907", "0.48988178", "0.4893948", "0.48816124", "0.48581582", "0.4852323", "0.48457542", "0.4844954", "0.48417926", "0.48315975", "0.48289153", "0.48277977", "0.48264727", "0.48237997", "0.48227102", "0.4821703", "0.48160878", "0.4809743", "0.48039374", "0.47968447", "0.47952873", "0.4785817", "0.4785386", "0.4783854", "0.47791553", "0.47481158", "0.47289437", "0.47289437", "0.47222817", "0.47200492", "0.4715568", "0.4714203", "0.47128713", "0.47074395", "0.47059566", "0.47054753", "0.47042894", "0.46997848", "0.46944472", "0.4690611", "0.46899685", "0.4688695", "0.4686388" ]
0.52305365
19
GetFolders fetches complete information about specified folders. For details refer to
func (api *API) GetFolders(ids []types.FolderID, params *parameters.GetFolders) (*types.Folders, error) { s := make([]string, 0, len(ids)) for _, id := range ids { s = append(s, string(id)) } path := fmt.Sprintf("/folders/%s", strings.Join(s, ",")) qp, err := query.Values(params) if err != nil { return nil, err } data, err := api.get(path, &qp) if err != nil { return nil, err } return types.NewFoldersFromJSON(data) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *OrgHelper) GetFolders(orgId string) (map[string]string, error) {\n\tlog := zapr.NewLogger(zap.L())\n\t// Map from the name of the folder to an id in the form folders/{folder_id} which is what delete expects\n\tfolders := map[string]string{}\n\n\taddToMap := func(r *crmV2.ListFoldersResponse) error {\n\t\tfor _, f := range r.Folders {\n\t\t\tfolders[f.DisplayName] = f.Name\n\t\t}\n\t\treturn nil\n\t}\n\terr := o.CrmV2.Folders.List().Parent(orgId).Pages(context.Background(), addToMap)\n\n\tif err != nil {\n\t\tlog.Error(err, \"Error listing folders\")\n\t\treturn nil, err\n\t}\n\treturn folders, nil\n}", "func (s kw_rest_folder) Folders(params ...interface{}) (children []KiteObject, err error) {\n\tif len(params) == 0 {\n\t\tparams = SetParams(Query{\"deleted\": false})\n\t}\n\terr = s.DataCall(APIRequest{\n\t\tMethod: \"GET\",\n\t\tPath: SetPath(\"/rest/folders/%d/folders\", s.folder_id),\n\t\tOutput: &children,\n\t\tParams: SetParams(params, Query{\"with\": \"(path,currentUserRole)\"}),\n\t}, -1, 1000)\n\n\treturn\n}", "func (b *BigIP) Folders() (*Folders, error) {\n\tvar folders Folders\n\terr, _ := b.getForEntity(&folders, uriSys, uriFolder)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &folders, nil\n}", "func (r *FoldersService) List() *FoldersListCall {\n\tc := &FoldersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\treturn c\n}", "func (s *Server) getMusicFolders(w http.ResponseWriter, r *http.Request) {\n\twriteXML(w, func(c *container) {\n\t\tc.MusicFolders = &musicFoldersContainer{\n\t\t\tMusicFolders: []musicFolder{{\n\t\t\t\tID: 0,\n\t\t\t\tName: filepath.Base(s.cfg.MusicDirectory),\n\t\t\t}},\n\t\t}\n\t})\n}", "func (_m *GrafanaClient) GetFolders() ([]*grafana.Folder, error) {\n\tret := _m.Called()\n\n\tvar r0 []*grafana.Folder\n\tif rf, ok := ret.Get(0).(func() []*grafana.Folder); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]*grafana.Folder)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (o GetFoldersResultOutput) Folders() GetFoldersFolderArrayOutput {\n\treturn o.ApplyT(func(v GetFoldersResult) []GetFoldersFolder { return v.Folders }).(GetFoldersFolderArrayOutput)\n}", "func (p *FileInf) DlFolders() error {\r\n\tif p.Progress {\r\n\t\tif p.ShowFileInf {\r\n\t\t\tfmt.Printf(\"File finformation is retrieved from a folder '%s'.\\n\", p.FileName)\r\n\t\t} else {\r\n\t\t\tfmt.Printf(\"Files are downloaded from a folder '%s'.\\n\", p.FileName)\r\n\t\t}\r\n\t\tfmt.Println(\"Getting values to download.\")\r\n\t}\r\n\tfolT := &folderTree{}\r\n\tif p.getOwner() {\r\n\t\tq := \"mimeType='application/vnd.google-apps.folder' and trashed=false\"\r\n\t\tfields := \"files(id,mimeType,name,parents,size),nextPageToken\"\r\n\t\tfm := p.GetListLoop(q, fields)\r\n\t\tfT1 := &folderTr{Search: p.FileID}\r\n\t\tfolT = createFolderTreeID(fm, p.FileID, []string{}, fT1).getDlFoldersS(p.FileName)\r\n\t} else {\r\n\t\tfT2 := &folderTr{Search: p.FileID}\r\n\t\tfolT = p.getAllfoldersRecursively(p.FileID, []string{}, fT2).getDlFoldersS(p.FileName)\r\n\t}\r\n\tfileList := p.getFilesFromFolder(folT)\r\n\tp.dupChkFoldersFiles(fileList)\r\n\tif p.ShowFileInf {\r\n\t\tp.FolderTree = fileList\r\n\t\tp.Msgar = append(p.Msgar, fmt.Sprintf(\"File list in folder '%s' was retrieved.\", p.FileName))\r\n\t\treturn nil\r\n\t}\r\n\tp.Msgar = append(p.Msgar, fmt.Sprintf(\"Files were downloaded from folder '%s'.\", p.FileName))\r\n\tdlres := p.initDownload(fileList)\r\n\tif dlres != nil {\r\n\t\treturn dlres\r\n\t}\r\n\treturn nil\r\n}", "func (service *FolderServiceImpl) GetAll(username string, sortBy string, sortOrder string) ([]models.Folder, error) {\n\tfolders := make([]models.Folder, 0, len(service.folders))\n\tfor _, value := range service.folders {\n\t\tfolders = append(folders, *value)\n\t}\n\n\tif sortBy == \"sort_name\" {\n\t\tsort.Slice(folders, func(i, j int) bool {\n\t\t\tif sortOrder == \"asc\" {\n\t\t\t\treturn folders[i].Name < folders[j].Name\n\t\t\t} else if sortOrder == \"dsc\" {\n\t\t\t\treturn folders[i].Name > folders[j].Name\n\t\t\t} else {\n\t\t\t\treturn true\n\t\t\t}\n\t\t})\n\t} else if sortBy == \"sort_time\" {\n\t\tsort.Slice(folders, func(i, j int) bool {\n\t\t\tif sortOrder == \"asc\" {\n\t\t\t\treturn folders[i].CreatedAt.Before(folders[j].CreatedAt)\n\t\t\t} else if sortOrder == \"dsc\" {\n\t\t\t\treturn folders[i].CreatedAt.After(folders[j].CreatedAt)\n\t\t\t} else {\n\t\t\t\treturn true\n\t\t\t}\n\t\t})\n\t} else {\n\t\tsort.Slice(folders, func(i, j int) bool {\n\t\t\treturn folders[i].Name < folders[j].Name\n\t\t})\n\t}\n\n\treturn folders, nil\n}", "func GetFolder(ctx *pulumi.Context,\n\tname string, id pulumi.ID, state *FolderState, opts ...pulumi.ResourceOpt) (*Folder, error) {\n\tinputs := make(map[string]interface{})\n\tif state != nil {\n\t\tinputs[\"title\"] = state.Title\n\t\tinputs[\"uid\"] = state.Uid\n\t}\n\ts, err := ctx.ReadResource(\"grafana:index/folder:Folder\", name, id, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Folder{s: s}, nil\n}", "func (s *IMAPConnection) Folders() ([]string, error) {\n\n\tvar res []string\n\n\tmailboxes := make(chan *imap.MailboxInfo, 15)\n\tdone := make(chan error, 1)\n\tgo func() {\n\t\tdone <- s.conn.List(\"\", \"*\", mailboxes)\n\t}()\n\n\t// For each result save the name\n\tfor m := range mailboxes {\n\t\tres = append(res, m.Name)\n\t}\n\n\t// Wait for completion\n\tif err := <-done; err != nil {\n\t\treturn res, err\n\t}\n\n\t//\n\t// Sort the list of mailboxes in a case-insensitive fashion.\n\t//\n\tsort.Slice(res, func(i, j int) bool {\n\t\treturn strings.ToLower(res[i]) < strings.ToLower(res[j])\n\t})\n\n\treturn res, nil\n}", "func (i *ImageService) GetLayerFolders(img *image.Image, rwLayer layer.RWLayer) ([]string, error) {\n\treturn nil, errdefs.NotImplemented(errors.New(\"not implemented\"))\n}", "func (m *User) GetContactFolders()([]ContactFolderable) {\n return m.contactFolders\n}", "func (m *User) GetMailFolders()([]MailFolderable) {\n return m.mailFolders\n}", "func (m *MockUserDB) GetFoldersList(uid uint64, kind string) ([]*UserModel.Folder, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetFoldersList\", uid, kind)\n\tret0, _ := ret[0].([]*UserModel.Folder)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockInterface) GetFoldersList(arg0 *userService.FolderUidType) (*userService.FolderList, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetFoldersList\", arg0)\n\tret0, _ := ret[0].(*userService.FolderList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (pstFile *File) GetSubFolders(folder Folder, formatType string) ([]Folder, error) {\n\ttableContext, err := pstFile.GetSubFolderTableContext(folder, formatType)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar subFolders []Folder\n\n\tfor _, tableContextRows := range tableContext {\n\t\thasSubFolders := false\n\n\t\tfor _, tableContextColumn := range tableContextRows {\n\t\t\tif tableContextColumn.PropertyID == 12289 {\n\t\t\t\tlog.Infof(\"Display name: %s\", string(tableContextColumn.Data))\n\t\t\t} else if tableContextColumn.PropertyID == 13834 {\n\t\t\t\thasSubFolders = tableContextColumn.ReferenceHNID == 1\n\t\t\t} else if tableContextColumn.PropertyID == 26610 {\n\t\t\t\tif !hasSubFolders {\n\t\t\t\t\t// This is supposed to be a sub-folder but\n\t\t\t\t\t// if there are actually no sub-folders this references a folder that doesn't exist.\n\t\t\t\t\t// This caused an issue where the table context was not found (because the folder doesn't exist).\n\t\t\t\t\t// References go-pst issue #1.\n\t\t\t\t\t// java-libpst doesn't perform this check so I assumed \"26610\" always indicated there is a sub-folder.\n\t\t\t\t\t// Special thanks to James McLeod (https://github.com/Jmcleodfoss/pstreader) for telling me to check if there are actually sub-folders.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tidentifierType := tableContextColumn.ReferenceHNID & 0x1F\n\n\t\t\t\tif identifierType == IdentifierTypeNormalFolder || identifierType == IdentifierTypeSearchFolder {\n\t\t\t\t\t// Find the data node from the reference HNID.\n\t\t\t\t\tnodeBTreeOffset, err := pstFile.GetNodeBTreeOffset(formatType)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\n\t\t\t\t\tnode, err := pstFile.FindBTreeNode(nodeBTreeOffset, tableContextColumn.ReferenceHNID, formatType)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\n\t\t\t\t\tdataIdentifier, err := node.GetDataIdentifier(formatType)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\n\t\t\t\t\tblockBTreeOffset, err := pstFile.GetBlockBTreeOffset(formatType)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\n\t\t\t\t\tdataNode, err := pstFile.FindBTreeNode(blockBTreeOffset, dataIdentifier, formatType)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\n\t\t\t\t\theapOnNode, err := pstFile.GetHeapOnNode(dataNode, formatType)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\n\t\t\t\t\tpropertyContext, err := pstFile.GetPropertyContext(heapOnNode, formatType)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\n\t\t\t\t\tsubFolders = append(subFolders, Folder{\n\t\t\t\t\t\tIdentifier: tableContextColumn.ReferenceHNID,\n\t\t\t\t\t\tPropertyContext: propertyContext,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tlog.Infof(\"It's a message!\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn subFolders, nil\n}", "func (u *User) ListFolders(opts ...Option) ([]*Folder, error) {\n\treturn listFolders(u.client, u.id(\"/users/%d/folders\"), nil, opts)\n}", "func (fs *MediaScan) Folders()\t(string, string)\t{\n\treturn fs.baseFolder, fs.subFolder\n}", "func (c *client) WorkspaceFolders(ctx context.Context) (result []WorkspaceFolder, err error) {\n\terr = c.Conn.Call(ctx, MethodWorkspaceWorkspaceFolders, nil, &result)\n\n\treturn result, err\n}", "func (service *FolderServiceImpl) Get(id int) (*models.Folder, error) {\n\tf, exists := service.folders[id]\n\tif !exists {\n\t\treturn nil, errors.New(\"folder does not exist\")\n\t}\n\n\treturn f, nil\n}", "func (_DappboxManager *DappboxManagerSession) ReturnAllDappboxFolders(dappboxAddress common.Address, index *big.Int) (string, string, common.Address, *big.Int, bool, bool, error) {\n\treturn _DappboxManager.Contract.ReturnAllDappboxFolders(&_DappboxManager.CallOpts, dappboxAddress, index)\n}", "func (t TaskService) GetTaskFolders() (*TaskFolder, error) {\n\treturn t.GetTaskFolder(\"\\\\\")\n}", "func (_DappboxManager *DappboxManagerCallerSession) ReturnAllDappboxFolders(dappboxAddress common.Address, index *big.Int) (string, string, common.Address, *big.Int, bool, bool, error) {\n\treturn _DappboxManager.Contract.ReturnAllDappboxFolders(&_DappboxManager.CallOpts, dappboxAddress, index)\n}", "func (f *Fs) listSharedFolders(ctx context.Context) (entries fs.DirEntries, err error) {\n\tstarted := false\n\tvar res *sharing.ListFoldersResult\n\tfor {\n\t\tif !started {\n\t\t\targ := sharing.ListFoldersArgs{\n\t\t\t\tLimit: 100,\n\t\t\t}\n\t\t\terr := f.pacer.Call(func() (bool, error) {\n\t\t\t\tres, err = f.sharing.ListFolders(&arg)\n\t\t\t\treturn shouldRetry(ctx, err)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tstarted = true\n\t\t} else {\n\t\t\targ := sharing.ListFoldersContinueArg{\n\t\t\t\tCursor: res.Cursor,\n\t\t\t}\n\t\t\terr := f.pacer.Call(func() (bool, error) {\n\t\t\t\tres, err = f.sharing.ListFoldersContinue(&arg)\n\t\t\t\treturn shouldRetry(ctx, err)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"list continue: %w\", err)\n\t\t\t}\n\t\t}\n\t\tfor _, entry := range res.Entries {\n\t\t\tleaf := f.opt.Enc.ToStandardName(entry.Name)\n\t\t\td := fs.NewDir(leaf, time.Time{}).SetID(entry.SharedFolderId)\n\t\t\tentries = append(entries, d)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tif res.Cursor == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn entries, nil\n}", "func (_m *Client) GetFolders(_a0 context.Context, _a1 build.GetFoldersArgs) (*[]build.Folder, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 *[]build.Folder\n\tif rf, ok := ret.Get(0).(func(context.Context, build.GetFoldersArgs) *[]build.Folder); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*[]build.Folder)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, build.GetFoldersArgs) error); ok {\n\t\tr1 = rf(_a0, _a1)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (fr *folderTr) getDlFoldersS(searchFolderName string) *folderTree {\r\n\tfT := &folderTree{}\r\n\tfT.Folders = append(fT.Folders, fr.Search)\r\n\tfT.Names = append(fT.Names, searchFolderName)\r\n\tfT.IDs = append(fT.IDs, []string{fr.Search})\r\n\tfor _, e := range fr.Temp {\r\n\t\tfor _, f := range e {\r\n\t\t\tfT.Folders = append(fT.Folders, f.ID)\r\n\t\t\tvar tmp []string\r\n\t\t\ttmp = append(tmp, f.Tree...)\r\n\t\t\ttmp = append(tmp, f.ID)\r\n\t\t\tfT.IDs = append(fT.IDs, tmp)\r\n\t\t\tfT.Names = append(fT.Names, f.Name)\r\n\t\t}\r\n\t}\r\n\treturn fT\r\n}", "func (u *User) Folders(opts ...Option) <-chan *Folder {\n\treturn foldersChannel(\n\t\tu.client, u.id(\"/users/%d/folders\"),\n\t\tConcurrentErrorHandler, opts, nil,\n\t)\n}", "func getRemoteFolder(uid string) (*grizzly.Resource, error) {\n\tclient := new(http.Client)\n\th := FolderHandler{}\n\tif uid == \"General\" || uid == \"general\" {\n\t\tfolder := Folder{\n\t\t\t\"id\": 0.0,\n\t\t\t\"uid\": uid,\n\t\t\t\"title\": \"General\",\n\t\t}\n\t\tresource := grizzly.NewResource(h.APIVersion(), h.Kind(), uid, folder)\n\t\treturn &resource, nil\n\t}\n\tgrafanaURL, err := getGrafanaURL(\"api/folders/\" + uid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", grafanaURL, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif grafanaToken, ok := getGrafanaToken(); ok {\n\t\treq.Header.Set(\"Authorization\", \"Bearer \"+grafanaToken)\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tswitch {\n\tcase resp.StatusCode == http.StatusNotFound:\n\t\treturn nil, fmt.Errorf(\"couldn't fetch folder '%s' from remote: %w\", uid, grizzly.ErrNotFound)\n\tcase resp.StatusCode >= 400:\n\t\treturn nil, errors.New(resp.Status)\n\t}\n\n\tdata, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar f Folder\n\tif err := json.Unmarshal(data, &f); err != nil {\n\t\treturn nil, grizzly.APIErr{Err: err, Body: data}\n\t}\n\tresource := grizzly.NewResource(h.APIVersion(), h.Kind(), uid, f)\n\treturn &resource, nil\n}", "func (client *Client) GetFolder(request *GetFolderRequest) (_result *GetFolderResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &GetFolderResponse{}\n\t_body, _err := client.GetFolderWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func FoldersNew(cfg *xdsconfig.Config, st *st.SyncThing) *Folders {\n\tfile, _ := xdsconfig.FoldersConfigFilenameGet()\n\treturn &Folders{\n\t\tfileOnDisk: file,\n\t\tConf: cfg,\n\t\tLog: cfg.Log,\n\t\tSThg: st,\n\t\tfolders: make(map[string]*folder.IFOLDER),\n\t\tregisterCB: []RegisteredCB{},\n\t}\n}", "func (f *Folders) Get(id string) *folder.IFOLDER {\n\tif id == \"\" {\n\t\treturn nil\n\t}\n\tfc, exist := f.folders[id]\n\tif !exist {\n\t\treturn nil\n\t}\n\treturn fc\n}", "func (r *Readarr) GetRootFoldersContext(ctx context.Context) ([]*RootFolder, error) {\n\tvar output []*RootFolder\n\n\treq := starr.Request{URI: bpRootFolder}\n\tif err := r.GetInto(ctx, req, &output); err != nil {\n\t\treturn nil, fmt.Errorf(\"api.Get(%s): %w\", &req, err)\n\t}\n\n\treturn output, nil\n}", "func (service HomesyncServerService) GetFolderTree() map[string]foldermonitor.FileInfo {\n\t//should call remote server\n\treq, _ := http.NewRequest(\"GET\", service.BaseUrl+\"api/tree\", nil)\n\treq.Header.Add(\"username\", service.Username)\n\n\tclient := &http.Client{}\n\tresponse, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tbody, err := ioutil.ReadAll(response.Body)\n\tdefer response.Body.Close()\n\n\t//var result TreeResult\n\tvar jsonResult map[string]map[string]foldermonitor.FileInfo\n\terr = json.Unmarshal(body, &jsonResult)\n\n\treturn jsonResult[\"data\"]\n}", "func (r *FoldersService) Search(searchfoldersrequest *SearchFoldersRequest) *FoldersSearchCall {\n\tc := &FoldersSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.searchfoldersrequest = searchfoldersrequest\n\treturn c\n}", "func (m *ItemMailFoldersRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemMailFoldersRequestBuilderGetRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MailFolderCollectionResponseable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateMailFolderCollectionResponseFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MailFolderCollectionResponseable), nil\n}", "func (f *FFS) GetFolder(ctx context.Context, ipfsRevProxyAddr string, c cid.Cid, outputDir string) error {\n\ttoken := ctx.Value(AuthKey).(string)\n\tipfs, err := newDecoratedIPFSAPI(ipfsRevProxyAddr, token)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating decorated IPFS client: %s\", err)\n\t}\n\tn, err := ipfs.Unixfs().Get(ctx, ipfspath.IpfsPath(c))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting folder DAG from IPFS: %s\", err)\n\t}\n\terr = files.WriteTo(n, outputDir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"saving folder DAG to output folder: %s\", err)\n\t}\n\treturn nil\n}", "func (b *BigIP) GetFolder(name string) (*Folder, error) {\n\tvar folder Folder\n\terr, ok := b.getForEntity(&folder, uriSys, uriFolder, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\n\treturn &folder, nil\n}", "func (mr *MockUserDBMockRecorder) GetFoldersList(uid, kind interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetFoldersList\", reflect.TypeOf((*MockUserDB)(nil).GetFoldersList), uid, kind)\n}", "func NewGetVMFoldersOK() *GetVMFoldersOK {\n\treturn &GetVMFoldersOK{}\n}", "func (mr *MockInterfaceMockRecorder) GetFoldersList(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetFoldersList\", reflect.TypeOf((*MockInterface)(nil).GetFoldersList), arg0)\n}", "func (o *User) GetMailFolders() []MicrosoftGraphMailFolder {\n\tif o == nil || o.MailFolders == nil {\n\t\tvar ret []MicrosoftGraphMailFolder\n\t\treturn ret\n\t}\n\treturn *o.MailFolders\n}", "func (r *Readarr) GetRootFolders() ([]*RootFolder, error) {\n\treturn r.GetRootFoldersContext(context.Background())\n}", "func (vc *client) GetFolder(folderPath string) (*object.Folder, error) {\n\tlog.Info(fmt.Sprintf(\"Getting Folder `%s`\", folderPath))\n\n\tfolder, err := vc.finder.Folder(vc.context, folderPath)\n\tif err != nil {\n\t\tlog.Error(err, fmt.Sprintf(\"Error getting Folder `%s`\", folderPath))\n\t\treturn nil, err\n\t}\n\n\treturn folder, nil\n}", "func (_DappboxManager *DappboxManagerCallerSession) ReturnAllDappboxSubFolders(dappboxAddress common.Address, index *big.Int) (string, string, *big.Int, bool, bool, error) {\n\treturn _DappboxManager.Contract.ReturnAllDappboxSubFolders(&_DappboxManager.CallOpts, dappboxAddress, index)\n}", "func (p *FileInf) getAllfoldersRecursively(id string, parents []string, fls *folderTr) *folderTr {\r\n\tq := \"'\" + id + \"' in parents and mimeType='application/vnd.google-apps.folder' and trashed=false\"\r\n\tfields := \"files(id,mimeType,name,parents,size),nextPageToken\"\r\n\tfm := p.GetListLoop(q, fields)\r\n\tvar temp forFTTemp\r\n\tfor _, e := range fm.Files {\r\n\t\tForFt := &forFT{\r\n\t\t\tID: e.ID,\r\n\t\t\tName: e.Name,\r\n\t\t\tParent: func() string {\r\n\t\t\t\tif len(e.Parents) > 0 {\r\n\t\t\t\t\treturn e.Parents[0]\r\n\t\t\t\t}\r\n\t\t\t\treturn \"\"\r\n\t\t\t}(),\r\n\t\t\tTree: append(parents, id),\r\n\t\t}\r\n\t\ttemp.Temp = append(temp.Temp, *ForFt)\r\n\t}\r\n\tif len(temp.Temp) > 0 {\r\n\t\tfls.Temp = append(fls.Temp, temp.Temp)\r\n\t\tfor _, e := range temp.Temp {\r\n\t\t\tp.getAllfoldersRecursively(e.ID, e.Tree, fls)\r\n\t\t}\r\n\t}\r\n\treturn fls\r\n}", "func (_DappboxManager *DappboxManagerSession) ReturnAllDappboxSubFolders(dappboxAddress common.Address, index *big.Int) (string, string, *big.Int, bool, bool, error) {\n\treturn _DappboxManager.Contract.ReturnAllDappboxSubFolders(&_DappboxManager.CallOpts, dappboxAddress, index)\n}", "func (_DappboxManager *DappboxManagerCaller) ReturnAllDappboxFolders(opts *bind.CallOpts, dappboxAddress common.Address, index *big.Int) (string, string, common.Address, *big.Int, bool, bool, error) {\n\tvar (\n\t\tret0 = new(string)\n\t\tret1 = new(string)\n\t\tret2 = new(common.Address)\n\t\tret3 = new(*big.Int)\n\t\tret4 = new(bool)\n\t\tret5 = new(bool)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t\tret2,\n\t\tret3,\n\t\tret4,\n\t\tret5,\n\t}\n\terr := _DappboxManager.contract.Call(opts, out, \"returnAllDappboxFolders\", dappboxAddress, index)\n\treturn *ret0, *ret1, *ret2, *ret3, *ret4, *ret5, err\n}", "func get_directories(cache *cache.Cache, db *dropbox.Dropbox, path string) []dropbox.Entry {\n\treturn get(cache, db, path, true)\n}", "func (c *Sharing) ListSharedFolders(ctx context.Context, in *ListSharedFolderInput) (out *ListSharedFolderOutput, err error) {\n\tbody, err := c.call(ctx, \"/sharing/list_folders\", in)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer body.Close()\n\n\terr = json.NewDecoder(body).Decode(&out)\n\treturn\n}", "func (fs *MediaScan) SetFolders(baseFolder, subFolder string)\t{\n\tfs.baseFolder = baseFolder\n\tfs.subFolder = subFolder\n}", "func (g Graph) getDrives(w http.ResponseWriter, r *http.Request, unrestricted bool) {\n\tsanitizedPath := strings.TrimPrefix(r.URL.Path, \"/graph/v1.0/\")\n\t// Parse the request with odata parser\n\todataReq, err := godata.ParseRequest(r.Context(), sanitizedPath, r.URL.Query())\n\tif err != nil {\n\t\tg.logger.Err(err).Interface(\"query\", r.URL.Query()).Msg(\"query error\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tg.logger.Debug().\n\t\tInterface(\"query\", r.URL.Query()).\n\t\tBool(\"unrestricted\", unrestricted).\n\t\tMsg(\"Calling getDrives\")\n\tctx := r.Context()\n\n\tfilters, err := generateCs3Filters(odataReq)\n\tif err != nil {\n\t\tg.logger.Err(err).Interface(\"query\", r.URL.Query()).Msg(\"query error\")\n\t\terrorcode.NotSupported.Render(w, r, http.StatusNotImplemented, err.Error())\n\t\treturn\n\t}\n\tres, err := g.ListStorageSpacesWithFilters(ctx, filters, unrestricted)\n\tswitch {\n\tcase err != nil:\n\t\tg.logger.Error().Err(err).Msg(ListStorageSpacesTransportErr)\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\tcase res.Status.Code != cs3rpc.Code_CODE_OK:\n\t\tif res.Status.Code == cs3rpc.Code_CODE_NOT_FOUND {\n\t\t\t// return an empty list\n\t\t\trender.Status(r, http.StatusOK)\n\t\t\trender.JSON(w, r, &listResponse{})\n\t\t\treturn\n\t\t}\n\t\tg.logger.Error().Err(err).Msg(ListStorageSpacesReturnsErr)\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, res.Status.Message)\n\t\treturn\n\t}\n\n\twdu, err := url.Parse(g.config.Spaces.WebDavBase + g.config.Spaces.WebDavPath)\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"error parsing url\")\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tspaces, err := g.formatDrives(ctx, wdu, res.StorageSpaces)\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"error encoding response as json\")\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tspaces, err = sortSpaces(odataReq, spaces)\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"error sorting the spaces list\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\trender.Status(r, http.StatusOK)\n\trender.JSON(w, r, &listResponse{Value: spaces})\n}", "func (client *Client) ListFoldersForParent(request *ListFoldersForParentRequest) (_result *ListFoldersForParentResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &ListFoldersForParentResponse{}\n\t_body, _err := client.ListFoldersForParentWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (m *MockFoldersRepo) Get(arg0 FoldersFilter) ([]domain.Folder, error) {\n\tret := m.ctrl.Call(m, \"Get\", arg0)\n\tret0, _ := ret[0].([]domain.Folder)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func GetSubFolderList(root string) (folderList []string) {\n\tfiles, err := ioutil.ReadDir(root)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\n\tfor _, file := range files {\n\t\tif file.IsDir() {\n\t\t\tfolderList = append(folderList, file.Name())\n\t\t}\n\t}\n\treturn\n}", "func (o *User) GetMailFoldersOk() ([]MicrosoftGraphMailFolder, bool) {\n\tif o == nil || o.MailFolders == nil {\n\t\tvar ret []MicrosoftGraphMailFolder\n\t\treturn ret, false\n\t}\n\treturn *o.MailFolders, true\n}", "func (p *FileInf) getFilesFromFolder(folderTree *folderTree) *fileListDl {\r\n\tf := &fileListDl{}\r\n\tf.SearchedFolder.ID = p.FileID\r\n\tf.SearchedFolder.Name = p.FileName\r\n\tf.SearchedFolder.MimeType = p.MimeType\r\n\tf.SearchedFolder.Owners = p.Owners\r\n\tf.SearchedFolder.CreatedTime = p.CreatedTime\r\n\tf.SearchedFolder.ModifiedTime = p.ModifiedTime\r\n\tf.FolderTree = folderTree\r\n\tvar mType string\r\n\tif len(p.InputtedMimeType) > 0 {\r\n\t\tfor i, e := range p.InputtedMimeType {\r\n\t\t\tif i == 0 {\r\n\t\t\t\tmType = \" and (mimeType='\" + e + \"'\"\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tmType += \" or mimeType='\" + e + \"'\"\r\n\t\t}\r\n\t\tmType += \")\"\r\n\t}\r\n\tfor i, id := range folderTree.Folders {\r\n\t\tq := \"'\" + id + \"' in parents and mimeType != 'application/vnd.google-apps.folder' and trashed=false\" + mType\r\n\t\tfields := \"files(createdTime,description,id,mimeType,modifiedTime,name,owners,parents,permissions,shared,size,webContentLink,webViewLink),nextPageToken\"\r\n\t\tfm := p.GetListLoop(q, fields)\r\n\t\tvar fe fileListEle\r\n\t\tfe.FolderTree = folderTree.IDs[i]\r\n\t\tfe.Files = append(fe.Files, fm.Files...)\r\n\t\tf.FileList = append(f.FileList, fe)\r\n\t}\r\n\tf.TotalNumberOfFolders = int64(len(f.FolderTree.Folders))\r\n\tf.TotalNumberOfFiles = func() int64 {\r\n\t\tvar c int64\r\n\t\tfor _, e := range f.FileList {\r\n\t\t\tc += int64(len(e.Files))\r\n\t\t}\r\n\t\treturn c\r\n\t}()\r\n\treturn f\r\n}", "func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {\n\tif f.opt.SharedFiles {\n\t\treturn f.listReceivedFiles(ctx)\n\t}\n\tif f.opt.SharedFolders {\n\t\treturn f.listSharedFolders(ctx)\n\t}\n\n\troot := f.slashRoot\n\tif dir != \"\" {\n\t\troot += \"/\" + dir\n\t}\n\n\tstarted := false\n\tvar res *files.ListFolderResult\n\tfor {\n\t\tif !started {\n\t\t\targ := files.ListFolderArg{\n\t\t\t\tPath: f.opt.Enc.FromStandardPath(root),\n\t\t\t\tRecursive: false,\n\t\t\t\tLimit: 1000,\n\t\t\t}\n\t\t\tif root == \"/\" {\n\t\t\t\targ.Path = \"\" // Specify root folder as empty string\n\t\t\t}\n\t\t\terr = f.pacer.Call(func() (bool, error) {\n\t\t\t\tres, err = f.srv.ListFolder(&arg)\n\t\t\t\treturn shouldRetry(ctx, err)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tswitch e := err.(type) {\n\t\t\t\tcase files.ListFolderAPIError:\n\t\t\t\t\tif e.EndpointError != nil && e.EndpointError.Path != nil && e.EndpointError.Path.Tag == files.LookupErrorNotFound {\n\t\t\t\t\t\terr = fs.ErrorDirNotFound\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tstarted = true\n\t\t} else {\n\t\t\targ := files.ListFolderContinueArg{\n\t\t\t\tCursor: res.Cursor,\n\t\t\t}\n\t\t\terr = f.pacer.Call(func() (bool, error) {\n\t\t\t\tres, err = f.srv.ListFolderContinue(&arg)\n\t\t\t\treturn shouldRetry(ctx, err)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"list continue: %w\", err)\n\t\t\t}\n\t\t}\n\t\tfor _, entry := range res.Entries {\n\t\t\tvar fileInfo *files.FileMetadata\n\t\t\tvar folderInfo *files.FolderMetadata\n\t\t\tvar metadata *files.Metadata\n\t\t\tswitch info := entry.(type) {\n\t\t\tcase *files.FolderMetadata:\n\t\t\t\tfolderInfo = info\n\t\t\t\tmetadata = &info.Metadata\n\t\t\tcase *files.FileMetadata:\n\t\t\t\tfileInfo = info\n\t\t\t\tmetadata = &info.Metadata\n\t\t\tdefault:\n\t\t\t\tfs.Errorf(f, \"Unknown type %T\", entry)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Only the last element is reliably cased in PathDisplay\n\t\t\tentryPath := metadata.PathDisplay\n\t\t\tleaf := f.opt.Enc.ToStandardName(path.Base(entryPath))\n\t\t\tremote := path.Join(dir, leaf)\n\t\t\tif folderInfo != nil {\n\t\t\t\td := fs.NewDir(remote, time.Time{}).SetID(folderInfo.Id)\n\t\t\t\tentries = append(entries, d)\n\t\t\t} else if fileInfo != nil {\n\t\t\t\to, err := f.newObjectWithInfo(ctx, remote, fileInfo)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tentries = append(entries, o)\n\t\t\t}\n\t\t}\n\t\tif !res.HasMore {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn entries, nil\n}", "func ListFolders(path string, ignorelist map[string]int) ([]string, error) {\n\td, err := os.Open(path)\n\tif err != nil {\n\t\treturn []string{}, errors.Wrap(err, fmt.Sprintf(\"error while listing content of %s\", path))\n\t}\n\tfis, err := d.Readdir(-1)\n\tif err != nil {\n\t\treturn []string{}, errors.Wrap(err, fmt.Sprintf(\"failed to list content of folder %s\", path))\n\t}\n\tlist := []string{}\n\tfor _, fi := range fis {\n\t\tif !fi.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tif fi.Name() == \".git\" {\n\t\t\tcontinue\n\t\t}\n\t\t// Now we are sure that the file info is a directory and is not .git\n\t\tif ignorelist[fi.Name()] != 0 {\n\t\t\tcontinue\n\t\t}\n\t\tlist = append(list, strings.Replace(filepath.Join(path, fi.Name()), filepath.Join(os.Getenv(\"GOROOT\"), \"src\")+\"/\", \"\", -1))\n\t\tsubdir := filepath.Join(path, fi.Name())\n\t\tsublist, err := ListFolders(subdir, ignorelist)\n\t\tif err != nil {\n\t\t\treturn []string{}, errors.Wrap(err, fmt.Sprintf(\"failed to list content of %s\", subdir))\n\t\t}\n\t\tlist = append(list, sublist...)\n\t}\n\td.Close()\n\tsort.Strings(list)\n\treturn list, nil\n}", "func (a *PhonebookAccess1) GetFolder() (string, error) {\n\tv, err := a.GetProperty(\"Folder\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Value().(string), nil\n}", "func initFolders() (err error) {\n\tif len(os.Args) > 1 {\n\t\tsrtgearsRoot = os.Args[1]\n\t}\n\tif srtgearsRoot, err = filepath.Abs(srtgearsRoot); err != nil {\n\t\treturn\n\t}\n\n\trlsBldFldr = filepath.Join(srtgearsRoot, relativeRlsBldFldr)\n\ttargetFolder = filepath.Join(srtgearsRoot, relativeTargetFldr)\n\n\t// Check folders:\n\tfor _, folder := range []string{rlsBldFldr, targetFolder} {\n\t\tfi, err := os.Stat(folder)\n\t\tif os.IsNotExist(err) {\n\t\t\treturn fmt.Errorf(\"Folder does not exist: %s\", folder)\n\t\t}\n\t\tif !fi.IsDir() {\n\t\t\treturn fmt.Errorf(\"Path is not a folder: %s\", folder)\n\t\t}\n\t}\n\treturn\n}", "func (out Outlooky) GetItems(folder *ole.IDispatch) *ole.IDispatch {\n\titems, err := out.CallMethod(folder, \"Items\")\n\tutil.Catch(err, \"Failed retrieving items.\")\n\n\treturn items.ToIDispatch()\n}", "func (o *MicrosoftGraphMailSearchFolder) GetIncludeNestedFolders() bool {\n\tif o == nil || o.IncludeNestedFolders == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IncludeNestedFolders\n}", "func (op *ListSharedAccessOp) FolderIds(val ...string) *ListSharedAccessOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"folder_ids\", strings.Join(val, \",\"))\n\t}\n\treturn op\n}", "func (_m *GrafanaClient) GetDashboards(folderId int) ([]*grafana.Dashboard, error) {\n\tret := _m.Called(folderId)\n\n\tvar r0 []*grafana.Dashboard\n\tif rf, ok := ret.Get(0).(func(int) []*grafana.Dashboard); ok {\n\t\tr0 = rf(folderId)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]*grafana.Dashboard)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(int) error); ok {\n\t\tr1 = rf(folderId)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (_DappboxManager *DappboxManagerCaller) ReturnAllDappboxSubFolders(opts *bind.CallOpts, dappboxAddress common.Address, index *big.Int) (string, string, *big.Int, bool, bool, error) {\n\tvar (\n\t\tret0 = new(string)\n\t\tret1 = new(string)\n\t\tret2 = new(*big.Int)\n\t\tret3 = new(bool)\n\t\tret4 = new(bool)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t\tret2,\n\t\tret3,\n\t\tret4,\n\t}\n\terr := _DappboxManager.contract.Call(opts, out, \"returnAllDappboxSubFolders\", dappboxAddress, index)\n\treturn *ret0, *ret1, *ret2, *ret3, *ret4, err\n}", "func (_DappboxManager *DappboxManagerSession) ReturnAllDappboxRemoteFolders(dappboxAddress common.Address, index *big.Int) (string, common.Address, common.Address, bool, bool, error) {\n\treturn _DappboxManager.Contract.ReturnAllDappboxRemoteFolders(&_DappboxManager.CallOpts, dappboxAddress, index)\n}", "func (client *Client) GetFolderWithOptions(request *GetFolderRequest, runtime *util.RuntimeOptions) (_result *GetFolderResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.FolderId)) {\n\t\tquery[\"FolderId\"] = request.FolderId\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"GetFolder\"),\n\t\tVersion: tea.String(\"2020-03-31\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &GetFolderResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func foldersConfigRead(file string, folders *[]folder.FolderConfig) error {\n\tif !common.Exists(file) {\n\t\treturn fmt.Errorf(\"No folder config file found (%s)\", file)\n\t}\n\n\tffMutex.Lock()\n\tdefer ffMutex.Unlock()\n\n\tfd, err := os.Open(file)\n\tdefer fd.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdata := xmlFolders{}\n\terr = xml.NewDecoder(fd).Decode(&data)\n\tif err == nil {\n\t\t*folders = data.Folders\n\t}\n\treturn err\n}", "func (_DappboxManager *DappboxManagerCallerSession) ReturnAllDappboxRemoteFolders(dappboxAddress common.Address, index *big.Int) (string, common.Address, common.Address, bool, bool, error) {\n\treturn _DappboxManager.Contract.ReturnAllDappboxRemoteFolders(&_DappboxManager.CallOpts, dappboxAddress, index)\n}", "func (*ListFoldersResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_resourcemanager_v1_folder_service_proto_rawDescGZIP(), []int{2}\n}", "func (o GetFoldersResultOutput) Ids() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetFoldersResult) []string { return v.Ids }).(pulumi.StringArrayOutput)\n}", "func (*ListFoldersRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_resourcemanager_v1_folder_service_proto_rawDescGZIP(), []int{1}\n}", "func (c *FoldersGetCall) Fields(s ...googleapi.Field) *FoldersGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func (q *qnap) GetList(path string) (map[string]bool, error) {\n\tm, err := q.dispatch(\"/cgi-bin/filemanager/utilRequest.cgi\", \"get_list\", url.Values{\"start\": {\"0\"}, \"limit\": {\"10000\"}, \"path\": {path}})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\titems := make(map[string]bool, int(m[\"total\"].(float64)))\n\tfor _, item_intf := range m[\"datas\"].([]interface{}) {\n\t\titem := item_intf.(map[string]interface{})\n\t\t//fmt.Printf(\"item %s, folder: %v\\n\", item[\"filename\"], item[\"isfolder\"])\n\t\titems[item[\"filename\"].(string)] = item[\"isfolder\"].(float64) != 0\n\t}\n\treturn items, nil\n}", "func (o *User) GetContactFolders() []MicrosoftGraphContactFolder {\n\tif o == nil || o.ContactFolders == nil {\n\t\tvar ret []MicrosoftGraphContactFolder\n\t\treturn ret\n\t}\n\treturn *o.ContactFolders\n}", "func NewFoldersModule(ctx *Context, hideOutput bool) Module {\n\twork := newFoldersWorker(ctx)\n\tif hideOutput {\n\t\treturn newModule(work)\n\t}\n\trend := newFoldersRenderer(work)\n\treturn newModule(work, rend)\n}", "func (*WorkspaceFoldersResponse_WorkspaceFolders) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{10, 0}\n}", "func GetFolder(folderName string) string {\n\treturn filepath.Join(GetBasePath(), folderName)\n}", "func (m *SynchronizationSchema) GetDirectories()([]DirectoryDefinitionable) {\n val, err := m.GetBackingStore().Get(\"directories\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]DirectoryDefinitionable)\n }\n return nil\n}", "func (g Graph) GetDrives(w http.ResponseWriter, r *http.Request) {\n\tg.getDrives(w, r, false)\n}", "func (o *MicrosoftGraphMailSearchFolder) GetChildFoldersOk() ([]MicrosoftGraphMailFolder, bool) {\n\tif o == nil || o.ChildFolders == nil {\n\t\tvar ret []MicrosoftGraphMailFolder\n\t\treturn ret, false\n\t}\n\treturn *o.ChildFolders, true\n}", "func (me *XsdGoPkgHasElems_Folder) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElems_Folder; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor _, x := range me.Folders {\r\n\t\t\tif err = x.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func (o *MicrosoftGraphMailSearchFolder) GetChildFolders() []MicrosoftGraphMailFolder {\n\tif o == nil || o.ChildFolders == nil {\n\t\tvar ret []MicrosoftGraphMailFolder\n\t\treturn ret\n\t}\n\treturn *o.ChildFolders\n}", "func (fl *FolderList) ReadDirAll(ctx context.Context) (res []fuse.Dirent, err error) {\n\tfl.fs.vlog.CLogf(ctx, libkb.VLog1, \"FL ReadDirAll\")\n\tdefer func() {\n\t\terr = fl.fs.processError(ctx, libkbfs.ReadMode, err)\n\t}()\n\tsession, err := fl.fs.config.KBPKI().GetCurrentSession(ctx)\n\tisLoggedIn := err == nil\n\n\tvar favs []favorites.Folder\n\tif isLoggedIn {\n\t\tfavs, err = fl.fs.config.KBFSOps().GetFavorites(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tres = make([]fuse.Dirent, 0, len(favs))\n\tfor _, fav := range favs {\n\t\tif fav.Type != fl.tlfType {\n\t\t\tcontinue\n\t\t}\n\t\tpname, err := tlf.CanonicalToPreferredName(\n\t\t\tsession.Name, tlf.CanonicalName(fav.Name))\n\t\tif err != nil {\n\t\t\tfl.fs.log.Errorf(\"CanonicalToPreferredName: %q %v\", fav.Name, err)\n\t\t\tcontinue\n\t\t}\n\t\tres = append(res, fuse.Dirent{\n\t\t\tType: fuse.DT_Dir,\n\t\t\tName: string(pname),\n\t\t})\n\t}\n\treturn res, nil\n}", "func (o *User) GetContactFoldersOk() ([]MicrosoftGraphContactFolder, bool) {\n\tif o == nil || o.ContactFolders == nil {\n\t\tvar ret []MicrosoftGraphContactFolder\n\t\treturn ret, false\n\t}\n\treturn *o.ContactFolders, true\n}", "func (s kw_rest_folder) Find(path string, params ...interface{}) (result KiteObject, err error) {\n\tif len(params) == 0 {\n\t\tparams = SetParams(Query{\"deleted\": false})\n\t}\n\n\tfolder_path := SplitPath(path)\n\n\tvar current []KiteObject\n\n\tif s.folder_id <= 0 {\n\t\tcurrent, err = s.TopFolders(params)\n\t} else {\n\t\tcurrent, err = s.Folder(s.folder_id).Contents(params)\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar found bool\n\n\tfolder_len := len(folder_path) - 1\n\n\tfor i, f := range folder_path {\n\t\tfound = false\n\t\tfor _, c := range current {\n\t\t\tif strings.ToLower(f) == strings.ToLower(c.Name) {\n\t\t\t\tresult = c\n\t\t\t\tif i < folder_len && c.Type == \"d\" {\n\t\t\t\t\tcurrent, err = s.Folder(c.ID).Contents(params)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t} else if i == folder_len {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif found == false {\n\t\t\treturn result, ErrNotFound\n\t\t}\n\t}\n\n\treturn result, ErrNotFound\n}", "func (s *Store) ScanEntityFolders() (map[string]interface{}, error) {\n\tentities, err := s.fetchEntities(s.DataDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcacheEntities, err := s.fetchEntities(s.CacheDir)\n\tif err != nil {\n\t\treturn entities, err\n\t}\n\tfor entity := range cacheEntities {\n\t\tentities[entity] = true\n\t}\n\treturn entities, nil\n}", "func TestFolders(t *testing.T) {\n api := New(*login, *password, *port, *verbose)\n\n Log(\"Testing AddFolder\")\n\n addFolderResponse, err := api.AddFolder(TmpDir)\n\n if err != nil {\n t.Errorf(\"Error making request to add new folder: %s\", err)\n return\n }\n\n if addFolderResponse.Error != 0 {\n t.Errorf(\"Error adding new folder\")\n return\n }\n\n Log(\"Testing GetFolders\")\n\n getFoldersResponse, err := api.GetFolders()\n\n if err != nil {\n t.Errorf(\"Error making request to get all folders: %s\", err)\n return\n }\n\n if len(*getFoldersResponse) == 0 {\n t.Errorf(\"Expected at least 1 folder\")\n return\n }\n\n found := false\n var testDir Folder\n for _, v := range *getFoldersResponse {\n if v.Dir == TmpDir {\n found = true\n testDir = v\n }\n }\n\n if !found {\n t.Errorf(\"Expected to find %s\", TmpDir)\n return\n }\n\n Log(\"Testing GetFolder\")\n\n getFolderResponse, err := api.GetFolder(testDir.Secret)\n if err != nil {\n t.Errorf(\"Error making request to get a single folder: %s\", err)\n return\n }\n\n if len(*getFolderResponse) != 1 {\n t.Errorf(\"Expected a single folder in response\")\n return\n }\n\n if (*getFolderResponse)[0].Dir != TmpDir {\n t.Errorf(\"Expected %s to be %s\", (*getFolderResponse)[0].Dir, TmpDir)\n return\n }\n\n Debug(\"Sleeping for 15 seconds to allow BTSync to pick up new file.\")\n\n time.Sleep(15000 * time.Millisecond)\n\n Log(\"Testing GetFiles\")\n\n getFilesResponse, err := api.GetFiles(testDir.Secret)\n if err != nil {\n t.Errorf(\"Error making request to get files: %s\", err)\n return\n }\n\n if len(*getFilesResponse) != 1 {\n t.Errorf(\"Expected 1 file\")\n return\n }\n\n if (*getFilesResponse)[0].Name != path.Base(TmpFile.Name()) {\n t.Errorf(\"Expected %s to be %s\", (*getFilesResponse)[0].Name, path.Base(TmpFile.Name()))\n return\n }\n\n Log(\"Testing SetFilePrefs\")\n\n setFilePrefsResponse, err := api.SetFilePrefs(testDir.Secret, path.Base(TmpFile.Name()), 1)\n if err != nil {\n t.Errorf(\"Error making request to set file preferences: %s\", err)\n return\n }\n\n if len(*setFilePrefsResponse) != 1 {\n t.Errorf(\"Expected response to have a length of 1\")\n }\n\n if (*setFilePrefsResponse)[0].State != \"created\" {\n t.Errorf(\"Expected file object in response\")\n return\n }\n\n Log(\"Testing GetFolderPeers\")\n _, err = api.GetFolderPeers(testDir.Secret)\n if err != nil {\n t.Errorf(\"Error making request to get folder peers: %s\", err)\n return\n }\n\n Log(\"Testing GetSecrets\")\n\n getSecretsResponse, err := api.GetSecrets(true)\n if err != nil {\n t.Errorf(\"Error requesting secrets\")\n return\n }\n\n if getSecretsResponse.Encryption == \"\" {\n t.Errorf(\"Expected response to have an encrypted key\")\n return\n }\n\n getSecretsResponse, err = api.GetSecretsForSecret(getSecretsResponse.ReadOnly)\n if err != nil {\n t.Errorf(\"Error requesting secrets for secret: %s\", getSecretsResponse.ReadOnly)\n return\n }\n\n if getSecretsResponse.ReadOnly == \"\" {\n t.Errorf(\"Expected response to have a read only key\")\n return\n }\n\n Log(\"Testing GetFolderPrefs\")\n\n getFolderPrefsResponse, err := api.GetFolderPrefs(testDir.Secret)\n if err != nil {\n t.Errorf(\"Error requesting prefs for folder\")\n return\n }\n\n if getFolderPrefsResponse.SearchLAN != 1 {\n t.Errorf(\"Exepected search_lan to be 1\")\n return\n }\n\n Log(\"Testing SetFolderPrefs\")\n\n prefs := &FolderPreferences{\n SearchLAN: 1,\n SelectiveSync: 1,\n UseDHT: 1,\n UseHosts: 1,\n UseRelayServer: 1,\n UseSyncTrash: 1,\n UseTracker: 1,\n }\n\n _, err = api.SetFolderPrefs(testDir.Secret, prefs)\n if err != nil {\n t.Errorf(\"Error making request to set folder preferences\")\n return\n }\n\n}", "func (m *ItemOutlookRequestBuilder) TaskFolders()(*ItemOutlookTaskFoldersRequestBuilder) {\n return NewItemOutlookTaskFoldersRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (m *User) SetContactFolders(value []ContactFolderable)() {\n m.contactFolders = value\n}", "func (c *Sharing) ListSharedFoldersContinue(ctx context.Context, in *ListSharedFolderContinueInput) (out *ListSharedFolderOutput, err error) {\n\tbody, err := c.call(ctx, \"/sharing/list_folders/continue\", in)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer body.Close()\n\n\terr = json.NewDecoder(body).Decode(&out)\n\treturn\n}", "func (c *folderSummaryService) foldersToHandle() []string {\n\t// We only recalculate summaries if someone is listening to events\n\t// (a request to /rest/events has been made within the last\n\t// pingEventInterval).\n\n\tc.lastEventReqMut.Lock()\n\tlast := c.lastEventReq\n\tc.lastEventReqMut.Unlock()\n\tif time.Since(last) > defaultEventTimeout {\n\t\treturn nil\n\t}\n\n\tc.foldersMut.Lock()\n\tres := make([]string, 0, len(c.folders))\n\tfor folder := range c.folders {\n\t\tres = append(res, folder)\n\t\tdelete(c.folders, folder)\n\t}\n\tc.foldersMut.Unlock()\n\treturn res\n}", "func (a *AmazonConnectionsApiService) BrowseBucketFolders(ctx _context.Context, amazonConnectionId string, bucketId string) ApiBrowseBucketFoldersRequest {\n\treturn ApiBrowseBucketFoldersRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tamazonConnectionId: amazonConnectionId,\n\t\tbucketId: bucketId,\n\t}\n}", "func (c *FoldersListCall) Pages(ctx context.Context, f func(*ListFoldersResponse) error) error {\n\tc.ctx_ = ctx\n\tdefer c.PageToken(c.urlParams_.Get(\"pageToken\")) // reset paging to original point\n\tfor {\n\t\tx, err := c.Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif x.NextPageToken == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tc.PageToken(x.NextPageToken)\n\t}\n}", "func (client *Client) ListFoldersForParentWithOptions(request *ListFoldersForParentRequest, runtime *util.RuntimeOptions) (_result *ListFoldersForParentResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.PageNumber)) {\n\t\tquery[\"PageNumber\"] = request.PageNumber\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PageSize)) {\n\t\tquery[\"PageSize\"] = request.PageSize\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ParentFolderId)) {\n\t\tquery[\"ParentFolderId\"] = request.ParentFolderId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.QueryKeyword)) {\n\t\tquery[\"QueryKeyword\"] = request.QueryKeyword\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"ListFoldersForParent\"),\n\t\tVersion: tea.String(\"2020-03-31\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &ListFoldersForParentResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (f *Folders) LoadConfig() error {\n\tvar flds []folder.FolderConfig\n\tvar stFlds []folder.FolderConfig\n\n\t// load from disk\n\tif f.Conf.Options.NoFolderConfig {\n\t\tf.Log.Infof(\"Don't read folder config file (-no-folderconfig option is set)\")\n\t} else if f.fileOnDisk != \"\" {\n\t\tf.Log.Infof(\"Use folder config file: %s\", f.fileOnDisk)\n\t\terr := foldersConfigRead(f.fileOnDisk, &flds)\n\t\tif err != nil {\n\t\t\tif strings.HasPrefix(err.Error(), \"No folder config\") {\n\t\t\t\tf.Log.Warnf(err.Error())\n\t\t\t} else {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t} else {\n\t\tf.Log.Warnf(\"Folders config filename not set\")\n\t}\n\n\t// Retrieve initial Syncthing config (just append don't overwrite existing ones)\n\tif f.SThg != nil {\n\t\tf.Log.Infof(\"Retrieve syncthing folder config\")\n\t\tif err := f.SThg.FolderLoadFromStConfig(&stFlds); err != nil {\n\t\t\t// Don't exit on such error, just log it\n\t\t\tf.Log.Errorf(err.Error())\n\t\t}\n\t} else {\n\t\tf.Log.Infof(\"Syncthing support is disabled.\")\n\t}\n\n\t// Merge syncthing folders into XDS folders\n\tfor _, stf := range stFlds {\n\t\tfound := false\n\t\tfor i, xf := range flds {\n\t\t\tif xf.ID == stf.ID {\n\t\t\t\tfound = true\n\t\t\t\t// sanity check\n\t\t\t\tif xf.Type != folder.TypeCloudSync {\n\t\t\t\t\tflds[i].Status = folder.StatusErrorConfig\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// add it\n\t\tif !found {\n\t\t\tflds = append(flds, stf)\n\t\t}\n\t}\n\n\t// Detect ghost project\n\t// (IOW existing in xds file config and not in syncthing database)\n\tif f.SThg != nil {\n\t\tfor i, xf := range flds {\n\t\t\t// only for syncthing project\n\t\t\tif xf.Type != folder.TypeCloudSync {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfound := false\n\t\t\tfor _, stf := range stFlds {\n\t\t\t\tif stf.ID == xf.ID {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tflds[i].Status = folder.StatusErrorConfig\n\t\t\t}\n\t\t}\n\t}\n\n\t// Update folders\n\tf.Log.Infof(\"Loading initial folders config: %d folders found\", len(flds))\n\tfor _, fc := range flds {\n\t\tif _, err := f.createUpdate(fc, false, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Save config on disk\n\terr := f.SaveConfig()\n\n\treturn err\n}", "func (c *Client) DescribeRootFolders(ctx context.Context, params *DescribeRootFoldersInput, optFns ...func(*Options)) (*DescribeRootFoldersOutput, error) {\n\tif params == nil {\n\t\tparams = &DescribeRootFoldersInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"DescribeRootFolders\", params, optFns, addOperationDescribeRootFoldersMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*DescribeRootFoldersOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (c *folderSummaryService) listenForUpdates() {\n\tsub := events.Default.Subscribe(events.LocalIndexUpdated | events.RemoteIndexUpdated | events.StateChanged | events.RemoteDownloadProgress | events.DeviceConnected | events.FolderWatchStateChanged)\n\tdefer events.Default.Unsubscribe(sub)\n\n\tfor {\n\t\t// This loop needs to be fast so we don't miss too many events.\n\n\t\tselect {\n\t\tcase ev := <-sub.C():\n\t\t\tif ev.Type == events.DeviceConnected {\n\t\t\t\t// When a device connects we schedule a refresh of all\n\t\t\t\t// folders shared with that device.\n\n\t\t\t\tdata := ev.Data.(map[string]string)\n\t\t\t\tdeviceID, _ := protocol.DeviceIDFromString(data[\"id\"])\n\n\t\t\t\tc.foldersMut.Lock()\n\t\t\tnextFolder:\n\t\t\t\tfor _, folder := range c.cfg.Folders() {\n\t\t\t\t\tfor _, dev := range folder.Devices {\n\t\t\t\t\t\tif dev.DeviceID == deviceID {\n\t\t\t\t\t\t\tc.folders[folder.ID] = struct{}{}\n\t\t\t\t\t\t\tcontinue nextFolder\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tc.foldersMut.Unlock()\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// The other events all have a \"folder\" attribute that they\n\t\t\t// affect. Whenever the local or remote index is updated for a\n\t\t\t// given folder we make a note of it.\n\n\t\t\tdata := ev.Data.(map[string]interface{})\n\t\t\tfolder := data[\"folder\"].(string)\n\n\t\t\tswitch ev.Type {\n\t\t\tcase events.StateChanged:\n\t\t\t\tif data[\"to\"].(string) == \"idle\" && data[\"from\"].(string) == \"syncing\" {\n\t\t\t\t\t// The folder changed to idle from syncing. We should do an\n\t\t\t\t\t// immediate refresh to update the GUI. The send to\n\t\t\t\t\t// c.immediate must be nonblocking so that we can continue\n\t\t\t\t\t// handling events.\n\n\t\t\t\t\tc.foldersMut.Lock()\n\t\t\t\t\tselect {\n\t\t\t\t\tcase c.immediate <- folder:\n\t\t\t\t\t\tdelete(c.folders, folder)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tc.folders[folder] = struct{}{}\n\t\t\t\t\t}\n\t\t\t\t\tc.foldersMut.Unlock()\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\t// This folder needs to be refreshed whenever we do the next\n\t\t\t\t// refresh.\n\n\t\t\t\tc.foldersMut.Lock()\n\t\t\t\tc.folders[folder] = struct{}{}\n\t\t\t\tc.foldersMut.Unlock()\n\t\t\t}\n\n\t\tcase <-c.stop:\n\t\t\treturn\n\t\t}\n\t}\n}", "func GetFolderUrl(folderUid string, slug string) string {\n\treturn fmt.Sprintf(\"/dashboards/f/%s/%s\", folderUid, slug)\n}" ]
[ "0.77136666", "0.74261993", "0.6873142", "0.68712914", "0.64235854", "0.6373968", "0.6323923", "0.6316812", "0.62594694", "0.62539285", "0.6205685", "0.61883754", "0.60822505", "0.6066212", "0.60560465", "0.60389054", "0.600604", "0.5950822", "0.5908433", "0.58883536", "0.5863334", "0.58517694", "0.5822393", "0.58175296", "0.58119094", "0.5765912", "0.5741585", "0.5717056", "0.5715562", "0.56971323", "0.56874365", "0.5677339", "0.5658591", "0.5654008", "0.564955", "0.5638499", "0.56278527", "0.56233066", "0.5613425", "0.55956835", "0.55909884", "0.54669243", "0.54582477", "0.54286367", "0.54257107", "0.54234666", "0.5422777", "0.53788745", "0.5356327", "0.5355093", "0.53311133", "0.5315368", "0.5293374", "0.52870417", "0.5285607", "0.5244707", "0.520455", "0.520391", "0.5182358", "0.5178559", "0.51706195", "0.5162014", "0.51428634", "0.5142026", "0.51382226", "0.5090764", "0.5068951", "0.5050007", "0.5047875", "0.5045873", "0.50445", "0.50400186", "0.50334865", "0.5032354", "0.5008722", "0.50011", "0.49991712", "0.49966598", "0.4984667", "0.4982931", "0.4957881", "0.4943743", "0.49425188", "0.49262443", "0.4919783", "0.49129084", "0.49088344", "0.48954076", "0.48910823", "0.48862362", "0.4884951", "0.488426", "0.48686072", "0.48610857", "0.48499677", "0.48496404", "0.4828197", "0.48222136", "0.4817007", "0.48122007" ]
0.7636499
1
ReadChatLogsArchive opens chat logs archive.
func ReadChatLogsArchive(fileName string) (*ChatLogsArchive, error) { r, err := zip.OpenReader(fileName) if err != nil && !errors.Is(err, os.ErrNotExist) { return nil, err } wf, err := os.Create(filepath.Join(os.TempDir(), fileName)) if err != nil { if r != nil { r.Close() } return nil, err } fmt.Println(wf.Name()) return &ChatLogsArchive{ fileName: fileName, r: r, wf: wf, w: zip.NewWriter(wf), }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a *ChatLogsArchive) ReadChatLog(accountName string, fileName string) (Messages, error) {\n\tif a.r == nil {\n\t\treturn nil, nil\n\t}\n\n\tlogFilePath := strings.Join([]string{accountName, fileName}, \"/\")\n\tf, err := a.r.Open(logFilePath)\n\n\t// Do not return error if file doesn't exists.\n\tif errors.Is(err, os.ErrNotExist) {\n\t\treturn nil, nil\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open chat log %s: %w\", logFilePath, err)\n\t}\n\tdefer f.Close()\n\n\tmessages, err := ReadMessages(f)\n\tif err != nil {\n\t\treturn messages, fmt.Errorf(\"unable to read chat log %s: %w\", logFilePath, err)\n\t}\n\n\treturn messages, nil\n}", "func (c *Client) ReadLogs(namespace, podName, containerName string, lastContainerLog bool, tail *int64) (string, error) {\n\treturn \"ContainerLogs\", nil\n}", "func ReadArchive(rr RecordReader) (*Archive, error) {\n\ta := &Archive{\n\t\tFiles: make(map[string]Record),\n\t}\n\terr := ForEachRecord(rr, func(r Record) error {\n\t\treturn a.WriteRecord(r)\n\t})\n\treturn a, err\n}", "func ReadArchive(rr RecordReader) (*Archive, error) {\n\ta := &Archive{\n\t\tFiles: make(map[string]Record),\n\t}\n\terr := ForEachRecord(rr, func(r Record) error {\n\t\treturn a.WriteRecord(r)\n\t})\n\treturn a, err\n}", "func readArchive(archive string) error {\n\t// Open the zip file specified by name and return a ReadCloser.\n\trc, err := zip.OpenReader(archive)\t\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rc.Close()\n\t// Iterate through the files in the zip file to read the file contents.\n\tfor _, file := range rc.File {\n\t\tfrc, err := file.Open()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer frc.Close()\n\t\tfmt.Fprintf(os.Stdout, \"Contents of the file %s:\\n\", file.Name)\n\t\t// Write the contents into Stdout\n\t\tcopied, err := io.Copy(os.Stdout, frc)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Check the size of the file.\n\t\tif uint64(copied) != file.UncompressedSize64 {\n\t\t\treturn fmt.Errorf(\"Length of the file contents doesn't match with the file %s\", file.Name)\n\t\t}\n\t\tfmt.Println()\n\t}\n\treturn nil\n}", "func (a *ChatLogsArchive) Close() error {\n\tif a.r != nil {\n\t\t_ = a.r.Close()\n\t}\n\n\twrittenFileName := a.wf.Name()\n\n\terr := a.w.Close()\n\tif err != nil {\n\t\ta.wf.Close()\n\t\t_ = os.Remove(writtenFileName)\n\t\treturn fmt.Errorf(\"error closing .zip file %s: %w\", a.wf.Name(), err)\n\t}\n\n\terr = a.wf.Close()\n\tif err != nil {\n\t\t_ = os.Remove(writtenFileName)\n\t\treturn fmt.Errorf(\"error closing file %s: %w\", writtenFileName, err)\n\t}\n\n\terr = MoveFile(writtenFileName, a.fileName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error overwriting file %s with %s: %w\", a.fileName, writtenFileName, err)\n\t}\n\n\treturn nil\n}", "func (c *Chat) ReadChatFull() []LogLineParsed {\n\tif c.logger.hasWrapped {\n\t\treturn append(\n\t\t\tc.logger.ChatLines[c.logger.writeCursor:],\n\t\t\tc.logger.ChatLines[:c.logger.writeCursor]...)\n\t}\n\n\treturn c.logger.ChatLines[:c.logger.writeCursor]\n}", "func ReadLogs(filePath string) (plog.Logs, error) {\n\tb, err := os.ReadFile(filePath)\n\tif err != nil {\n\t\treturn plog.Logs{}, err\n\t}\n\tif strings.HasSuffix(filePath, \".yaml\") || strings.HasSuffix(filePath, \".yml\") {\n\t\tvar m map[string]interface{}\n\t\tif err = yaml.Unmarshal(b, &m); err != nil {\n\t\t\treturn plog.Logs{}, err\n\t\t}\n\t\tb, err = json.Marshal(m)\n\t\tif err != nil {\n\t\t\treturn plog.Logs{}, err\n\t\t}\n\t}\n\tunmarshaler := plog.JSONUnmarshaler{}\n\treturn unmarshaler.UnmarshalLogs(b)\n}", "func (cl *CompositeLogger) ReadLog(offset, length int64) (string, error) {\n\treturn cl.loggers[0].ReadLog(offset, length)\n}", "func (c *Client) GetLogs(ctx context.Context, params logs.Request) (<-chan logs.Message, error) {\n\n\tlogRequest, err := c.newRequest(http.MethodGet, \"/system/logs\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot connect to OpenFaaS on URL: %s\", c.GatewayURL.String())\n\t}\n\n\tlogRequest.URL.RawQuery = reqAsQueryValues(params).Encode()\n\n\tres, err := c.doRequest(ctx, logRequest)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot connect to OpenFaaS on URL: %s\", c.GatewayURL.String())\n\t}\n\n\tlogStream := make(chan logs.Message, 1000)\n\tswitch res.StatusCode {\n\tcase http.StatusOK:\n\t\tgo func() {\n\t\t\tdefer close(logStream)\n\t\t\tdefer res.Body.Close()\n\n\t\t\tdecoder := json.NewDecoder(res.Body)\n\t\t\tfor decoder.More() {\n\t\t\t\tmsg := logs.Message{}\n\t\t\t\terr := decoder.Decode(&msg)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"cannot parse log results: %s\\n\", err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlogStream <- msg\n\t\t\t}\n\t\t}()\n\tcase http.StatusUnauthorized:\n\t\treturn nil, fmt.Errorf(\"unauthorized access, run \\\"faas-cli login\\\" to setup authentication for this server\")\n\tdefault:\n\t\tbytesOut, err := ioutil.ReadAll(res.Body)\n\t\tif err == nil {\n\t\t\treturn nil, fmt.Errorf(\"server returned unexpected status code: %d - %s\", res.StatusCode, string(bytesOut))\n\t\t}\n\t}\n\treturn logStream, nil\n}", "func readRawLogs(client kubernetes.Interface, namespace, podID string, logOptions *v1.PodLogOptions) (\n\tstring, error) {\n\treadCloser, err := openStream(client, namespace, podID, logOptions)\n\tif err != nil {\n\t\treturn err.Error(), nil\n\t}\n\n\tdefer readCloser.Close()\n\n\tresult, err := ioutil.ReadAll(readCloser)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(result), nil\n}", "func (s *inMemoryLogStore) Read(id string) (io.ReadCloser, error) {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\n\tl, ok := s.logs[id]\n\tif !ok {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tch := make(chan []byte)\n\tl.Mu.Lock()\n\tl.Reader[ch] = struct{}{}\n\tl.Mu.Unlock()\n\treturn ioutil.NopCloser(&logSessionReader{\n\t\tLog: l,\n\t\tR: ch,\n\t}), nil\n}", "func (a *ChatLogsArchive) WriteChatLog(accountName string, fileName string, messages Messages) error {\n\tlogFilePath := strings.Join([]string{accountName, fileName}, \"/\")\n\n\tf, err := a.w.Create(logFilePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating file %s: %w\", logFilePath, err)\n\t}\n\n\terr = messages.Write(f)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing file %s: %w\", logFilePath, err)\n\t}\n\n\treturn nil\n}", "func (client *WebAppsClient) GetContainerLogsZip(ctx context.Context, resourceGroupName string, name string, options *WebAppsGetContainerLogsZipOptions) (WebAppsGetContainerLogsZipResponse, error) {\n\treq, err := client.getContainerLogsZipCreateRequest(ctx, resourceGroupName, name, options)\n\tif err != nil {\n\t\treturn WebAppsGetContainerLogsZipResponse{}, err\n\t}\n\tresp, err := client.pl.Do(req)\n\tif err != nil {\n\t\treturn WebAppsGetContainerLogsZipResponse{}, err\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) {\n\t\treturn WebAppsGetContainerLogsZipResponse{}, client.getContainerLogsZipHandleError(resp)\n\t}\n\treturn WebAppsGetContainerLogsZipResponse{RawResponse: resp}, nil\n}", "func (l *JSONFileLogger) ReadLogs(config logger.ReadConfig) *logger.LogWatcher {\n\tlogWatcher := logger.NewLogWatcher()\n\n\tgo l.readLogs(logWatcher, config)\n\treturn logWatcher\n}", "func (e *Environment) Readlog(lines int) ([]string, error) {\n\tr, err := e.client.ContainerLogs(context.Background(), e.Id, types.ContainerLogsOptions{\n\t\tShowStdout: true,\n\t\tShowStderr: true,\n\t\tTail: strconv.Itoa(lines),\n\t})\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tdefer r.Close()\n\n\tvar out []string\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\tout = append(out, scanner.Text())\n\t}\n\n\treturn out, nil\n}", "func listArchive() {\n files, err := ioutil.ReadDir(settings.PATH_ARCHIVE)\n utils.CheckError(err)\n\n fmt.Printf(\"| %s:\\n\", settings.User.Hash)\n for _, file := range files {\n fmt.Println(\"|\", file.Name())\n }\n}", "func (c *Consumer) RecentLogs(appGuid string, authToken string) ([]*events.LogMessage, error) {\n\tmessages := make([]*events.LogMessage, 0, 200)\n\tcallback := func(envelope *events.Envelope) error {\n\t\tmessages = append(messages, envelope.GetLogMessage())\n\t\treturn nil\n\t}\n\terr := c.readTC(appGuid, authToken, \"recentlogs\", callback)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn messages, nil\n}", "func (c *Client) ReadLog(offset int, length int) (string, error) {\n\tvar log string\n\terr := c.Call(\"supervisor.readLog\", []interface{}{offset, length}, &log)\n\n\treturn log, err\n}", "func readChat(w http.ResponseWriter, r *http.Request, chatId uuid.UUID, db *bolt.DB) {\n\t// Ensure chat exists\n\tchat, err := models.FindChat(chatId, db)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: failed to query database for specified chat\")\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\treturn\n\t} else if chat == nil {\n\t\tresponses.Error(w, http.StatusNotFound, \"specified chat does not exist\")\n\t\treturn\n\t}\n\n\t// Get user\n\tself, err := models.FindUser(r.Header.Get(\"X-BPI-Username\"), db)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: failed to query database for requesting user: %v\\n\", err)\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\treturn\n\t}\n\n\t// Check that user in chat\n\tfor _, c := range self.Chats {\n\t\tif c == chatId.String() {\n\t\t\tresponses.SuccessWithData(w, map[string]string{\n\t\t\t\t\"user1\": chat.User1,\n\t\t\t\t\"user2\": chat.User2,\n\t\t\t\t\"last_message\": chat.Messages[len(chat.Messages)-1],\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t}\n\n\tresponses.Error(w, http.StatusForbidden, \"user not in specified chat\")\n}", "func (l *Logger) Read(n int) ([]LogEntry, error) {\n\tentries, err := l.client.readLog(n)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tids := make(map[int64]*LogEntry)\n\tlogEntries := make([]LogEntry, 0, len(entries))\n\tfor _, le := range entries {\n\t\tentry, ok := ids[le.ID]\n\t\tif !ok {\n\t\t\tnewEntry := LogEntry{\n\t\t\t\tTime: time.Unix(le.Time, 0).UTC(),\n\t\t\t\tRemoteAddr: le.RemoteAddr,\n\t\t\t\tHijacked: le.Hijacked,\n\t\t\t\tQtype: le.Qtype,\n\t\t\t\tQuestion: le.Question,\n\t\t\t}\n\t\t\tlogEntries = append(logEntries, newEntry)\n\t\t\tentry = &logEntries[len(logEntries)-1]\n\t\t\tids[le.ID] = entry\n\t\t}\n\t\tif le.Answer != \"\" {\n\t\t\tentry.Answers = append(entry.Answers, le.Answer)\n\t\t}\n\t}\n\treturn logEntries, nil\n}", "func (a *ChatLogsArchive) ListChatLogFileNames(accountName string) (absolutePaths []string, relativePaths []string, err error) {\n\tif a.r == nil {\n\t\treturn nil, nil, nil\n\t}\n\n\tvar logFileNames []string\n\tfor _, f := range a.r.File {\n\t\t// Take only .txt files.\n\t\tif filepath.Ext(f.Name) != \".txt\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tpath := filepath.Dir(f.Name)\n\t\tif path != accountName {\n\t\t\tcontinue\n\t\t}\n\n\t\tfileName := filepath.Base(f.Name)\n\t\tif !IsReservedFileName(fileName) {\n\t\t\tabsolutePaths = append(absolutePaths, f.Name)\n\t\t\trelativePaths = append(logFileNames, fileName)\n\t\t}\n\t}\n\n\treturn\n}", "func ReadEventsLogs(c *gin.Context) {\n\tvar event EventLogQuery\n\t// Bind request query data to our event query\n\tif err := c.ShouldBindJSON(&event); err != nil {\n\t\tlog.Println(\"Can't bind event logs query:\", err)\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, map[string]string{\n\t\t\t\"status\": \"bad\",\n\t\t\t\"error\": \"Can't bind event logs query: \" + err.Error(),\n\t\t})\n\t\treturn\n\t}\n\t// Get contract events logs\n\tlogs, err := utils.ReadEventsLogs(context.Background(), event.Address, event.FromBlock, event.ToBlock)\n\tif err != nil {\n\t\tlog.Println(\"Can't get event logs:\", err)\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, map[string]string{\n\t\t\t\"status\": \"bad\",\n\t\t\t\"error\": \"Can't get event logs: \" + err.Error(),\n\t\t})\n\t\treturn\n\t}\n\t// Send logs at response\n\tc.JSON(http.StatusOK, logs)\n}", "func (l *LogController) ReadLog(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\t// Make sure that the writer supports flushing.\n\tflusher, ok := w.(http.Flusher)\n\tif !ok {\n\t\tInternalServerError(\"Streaming unsupported!\").WriteTo(w)\n\t\treturn\n\t}\n\n\tvar query service.LogQuery\n\terr := decoder.Decode(&query, r.URL.Query())\n\tif err != nil {\n\t\tlog.Errorf(\"Error while parsing query string %v\", err)\n\t\tBadRequest(fmt.Sprintf(\"Unable to parse query string: %s\", err)).WriteTo(w)\n\t\treturn\n\t}\n\n\tlogLineCh := make(chan string)\n\tstopCh := make(chan struct{})\n\n\t// Set the headers related to event streaming.\n\tw.Header().Set(\"Content-Type\", \"text/event-stream\")\n\tw.Header().Set(\"Cache-Control\", \"no-cache\")\n\tw.Header().Set(\"Connection\", \"keep-alive\")\n\tw.Header().Set(\"Transfer-Encoding\", \"chunked\")\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tclose(stopCh)\n\t\t\t\treturn\n\t\t\tcase logLine := <-logLineCh:\n\t\t\t\t// Write to the ResponseWriter\n\t\t\t\t_, err := w.Write(([]byte(logLine)))\n\t\t\t\tif err != nil {\n\t\t\t\t\tInternalServerError(err.Error()).WriteTo(w)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Send the response over network\n\t\t\t\t// although it's not guaranteed to reach client if it sits behind proxy\n\t\t\t\tflusher.Flush()\n\t\t\t}\n\t\t}\n\t}()\n\n\tif err := l.LogService.StreamLogs(logLineCh, stopCh, &query); err != nil {\n\t\tInternalServerError(err.Error()).WriteTo(w)\n\t\treturn\n\t}\n}", "func (c *Container) Logs(ctx context.Context, opts ...LogsReadOption) (io.ReadCloser, error) {\n\tvar cfg LogReadConfig\n\tfor _, o := range opts {\n\t\to(&cfg)\n\t}\n\n\twithLogConfig := func(req *http.Request) error {\n\t\tdata, err := json.Marshal(&cfg)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"error encoding log read config\")\n\t\t}\n\t\treq.Body = ioutil.NopCloser(bytes.NewReader(data))\n\t\treturn nil\n\t}\n\n\t// Here we do not want to limit the response size since we are returning a log stream, so we perform this manually\n\t// instead of with httputil.DoRequest\n\tresp, err := c.tr.Do(ctx, http.MethodGet, version.Join(ctx, \"/container/\"+c.id+\"/logs\"), withLogConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbody := resp.Body\n\thttputil.LimitResponse(ctx, resp)\n\treturn body, httputil.CheckResponseError(resp)\n}", "func (l *LogTree) Read(dn DN, opts ...LogReadOption) (*LogReader, error) {\n\tl.journal.mu.RLock()\n\tdefer l.journal.mu.RUnlock()\n\n\tvar backlog int\n\tvar stream bool\n\tvar recursive bool\n\tvar leveledSeverity Severity\n\tvar onlyRaw, onlyLeveled bool\n\n\tfor _, opt := range opts {\n\t\tif opt.withBacklog > 0 || opt.withBacklog == BacklogAllAvailable {\n\t\t\tbacklog = opt.withBacklog\n\t\t}\n\t\tif opt.withStream {\n\t\t\tstream = true\n\t\t}\n\t\tif opt.withChildren {\n\t\t\trecursive = true\n\t\t}\n\t\tif opt.leveledWithMinimumSeverity != \"\" {\n\t\t\tleveledSeverity = opt.leveledWithMinimumSeverity\n\t\t}\n\t\tif opt.onlyLeveled {\n\t\t\tonlyLeveled = true\n\t\t}\n\t\tif opt.onlyRaw {\n\t\t\tonlyRaw = true\n\t\t}\n\t}\n\n\tif onlyLeveled && onlyRaw {\n\t\treturn nil, ErrRawAndLeveled\n\t}\n\n\tvar filters []filter\n\tif onlyLeveled {\n\t\tfilters = append(filters, filterOnlyLeveled)\n\t}\n\tif onlyRaw {\n\t\tfilters = append(filters, filterOnlyRaw)\n\t}\n\tif recursive {\n\t\tfilters = append(filters, filterSubtree(dn))\n\t} else {\n\t\tfilters = append(filters, filterExact(dn))\n\t}\n\tif leveledSeverity != \"\" {\n\t\tfilters = append(filters, filterSeverity(leveledSeverity))\n\t}\n\n\tvar entries []*entry\n\tif backlog > 0 || backlog == BacklogAllAvailable {\n\t\t// TODO(q3k): pass over the backlog count to scanEntries/getEntries, instead of discarding them here.\n\t\tif recursive {\n\t\t\tentries = l.journal.scanEntries(filters...)\n\t\t} else {\n\t\t\tentries = l.journal.getEntries(dn, filters...)\n\t\t}\n\t\tif backlog != BacklogAllAvailable && len(entries) > backlog {\n\t\t\tentries = entries[:backlog]\n\t\t}\n\t}\n\n\tvar sub *subscriber\n\tif stream {\n\t\tsub = &subscriber{\n\t\t\t// TODO(q3k): make buffer size configurable\n\t\t\tdataC: make(chan *LogEntry, 128),\n\t\t\tdoneC: make(chan struct{}),\n\t\t\tfilters: filters,\n\t\t}\n\t\tl.journal.subscribe(sub)\n\t}\n\n\tlr := &LogReader{}\n\tlr.Backlog = make([]*LogEntry, len(entries))\n\tfor i, entry := range entries {\n\t\tlr.Backlog[i] = entry.external()\n\t}\n\tif stream {\n\t\tlr.Stream = sub.dataC\n\t\tlr.done = sub.doneC\n\t\tlr.missed = &sub.missed\n\t}\n\treturn lr, nil\n}", "func readLog(filename string) ([]byte, error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tvar r io.Reader = f\n\tif strings.HasSuffix(filename, \".gz\") {\n\t\tr, err = gzip.NewReader(f)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn ioutil.ReadAll(r)\n}", "func (s *Server) ReadLogfile(len int) ([]string, error) {\n\treturn s.Environment.Readlog(len)\n}", "func ReadLog() ([]logentry){\n\tscanner := bufio.NewScanner(os.Stdin)\n\tvar log []logentry\n\tfor scanner.Scan() {\n\t\tstr := scanner.Text()\n\t\tif(len(str) > 0){\n\t\t\tmatch := validLogEntry.FindStringSubmatch(str)\n\t\t\tdate, _ := time.Parse(\"2006-01-02 15:04\", match[1])\n\t\t\t// parse logtype\n\t\t\tguardId := 0\n\t\t\tlogtype := -1\n\t\t\tif match[2] == \"wakes up\" {\n\t\t\t\tlogtype = awake\n\t\t\t} else if match[2] == \"falls asleep\" {\n\t\t\t\tlogtype = asleep\n\t\t\t} else {\n\t\t\t\tlogtype = shift\n\t\t\t\tmatchShift := validBeginShift.FindStringSubmatch(match[2]);\n\t\t\t\tguardId, _ = strconv.Atoi(matchShift[1]);\n\t\t\t}\n\n\t\t\tlog = append(log, logentry{\n\t\t\t\tdate,\n\t\t\t\tlogtype,\n\t\t\t\tguardId})\n\t\t}\n\t}\n\tsort.Slice(log,func(i, j int) bool {\n\t\treturn log[i].date.Before(log[j].date);\n\t});\n\treturn log;\n}", "func (flogs *fileLogs) StreamAll(dataID, version dvid.UUID, ch chan storage.LogMessage) error {\n\tdefer close(ch)\n\n\tk := string(dataID + \"-\" + version)\n\tfilename := filepath.Join(flogs.path, k)\n\n\tflogs.RLock()\n\tfl, found := flogs.files[k]\n\tflogs.RUnlock()\n\tif found {\n\t\t// close then reopen later.\n\t\tfl.Lock()\n\t\tfl.Close()\n\t\tflogs.Lock()\n\t\tdelete(flogs.files, k)\n\t\tflogs.Unlock()\n\t}\n\n\tf, err := os.OpenFile(filename, os.O_RDONLY, 0755)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\tdata, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\tf.Close()\n\n\tif len(data) > 0 {\n\t\tvar pos uint32\n\t\tfor {\n\t\t\tif len(data) < int(pos+6) {\n\t\t\t\tdvid.Criticalf(\"malformed filelog %q at position %d\\n\", filename, pos)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tentryType := binary.LittleEndian.Uint16(data[pos : pos+2])\n\t\t\tsize := binary.LittleEndian.Uint32(data[pos+2 : pos+6])\n\t\t\tpos += 6\n\t\t\tdatabuf := data[pos : pos+size]\n\t\t\tpos += size\n\t\t\tch <- storage.LogMessage{EntryType: entryType, Data: databuf}\n\t\t\tif len(data) == int(pos) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif found {\n\t\tf2, err2 := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND|os.O_SYNC, 0755)\n\t\tif err2 != nil {\n\t\t\tdvid.Errorf(\"unable to reopen write log %s: %v\\n\", k, err)\n\t\t} else {\n\t\t\tflogs.Lock()\n\t\t\tflogs.files[k] = &fileLog{File: f2}\n\t\t\tflogs.Unlock()\n\t\t}\n\t\tfl.Unlock()\n\t}\n\treturn nil\n}", "func loadLogs(path string) ([]Log, error) {\n\t// Create the file if it does not exist\n\tf, err := os.OpenFile(path+\"/logs.json\", os.O_RDWR|os.O_CREATE|os.O_EXCL, 0644)\n\tif err == nil {\n\t\t// New file. Write empty list to it\n\t\t_, err = f.WriteString(\"[]\")\n\t\tif err != nil {\n\t\t\tf.Close()\n\t\t\treturn []Log{}, err\n\t\t}\n\t}\n\tf.Close()\n\n\t// Load the file\n\tlogs := &[]Log{}\n\tdata, err := ioutil.ReadFile(path + \"/logs.json\")\n\tif err != nil {\n\t\treturn []Log{}, err\n\t}\n\n\terr = json.Unmarshal(data, &logs)\n\tif err != nil {\n\t\treturn []Log{}, err\n\t}\n\n\treturn *logs, nil\n}", "func (cl *CompositeLogger) ReadTailLog(offset, length int64) (string, int64, bool, error) {\n\treturn cl.loggers[0].ReadTailLog(offset, length)\n}", "func readArchive(work <-chan t, done <-chan struct{}) chan t {\n\tout := make(chan t, 50) // Oo, I learned from Guido that there's a bug in this code\n\tgo func(input <-chan t, output chan<- t, done <-chan struct{}) {\n\t\tdefer close(out)\n\t\tfor item := range input {\n\t\t\titem = process(item, \"archive\") // HL\n\t\t\tselect {\n\t\t\tcase output <- item: // HL\n\t\t\tcase <-done: // HL\n\t\t\t\treturn // HL\n\t\t\t}\n\t\t}\n\t}(work, out, done)\n\treturn out\n}", "func ReadMsgAPI(ServerVars *Variables, c string, k string, w *http.ResponseWriter, t time.Time) {\n\tServerVars.ChannelListMu.Lock()\n\tdefer ServerVars.ChannelListMu.Unlock()\n\n\t_, exists := ServerVars.ChannelList[c] //Checking if the channel exists or not\n\tif !exists {\n\t\t_, err := (*w).Write([]byte(fmt.Sprintf(\"No channel exists with the name %s\\n\", c)))\n\t\tCheckError(ServerVars, err)\n\t\treturn\n\t}\n\n\tif ServerVars.ChannelList[c].Access == \"private\" && k != ServerVars.ChannelList[c].Key { // If the channnel is private, verify if key is correct or not\n\t\t_, err := (*w).Write([]byte(fmt.Sprintf(\"Key is not valid for the private channel %s\\n\", c)))\n\t\tCheckError(ServerVars, err)\n\t\treturn\n\t}\n\n\tServerVars.ChannelList[c].Mu.Lock()\n\tbt, err := ioutil.ReadFile(fmt.Sprintf(\"%s/%s.json\", ServerVars.Conf.ChDataFolder, c)) // Reading json file containing the history\n\tCheckError(ServerVars, err)\n\tServerVars.ChannelList[c].Mu.Unlock()\n\n\tvar Dhist []Data\n\terr = json.Unmarshal(bt, &Dhist) // Converting json encoding to slice of type Data\n\tCheckError(ServerVars, err)\n\n\tts := t.Format(\"2006-01-02 15:04:05\")\n\tServerVars.ActivityLogsChannel <- fmt.Sprintf(ServerVars.LogActivityFormat, \"Read Message History\", \"\", c, \"API\", ts) // Log Activity\n\n\tfor k := range Dhist { //Iterating over messages\n\t\tts = Dhist[k].Time.Format(\"2006-01-02 15:04:05\")\n\t\ttxt := fmt.Sprintf(\"\\nMessage: %s\\nSent by: %s\\nTime: %s\\n\\n\", Dhist[k].Msg, Colors[\"Blue\"](Dhist[k].Username), Colors[\"Yellow\"](ts))\n\t\t_, err := (*w).Write([]byte(txt)) // Sending msg to user \"k\"\n\t\tCheckError(ServerVars, err)\n\t}\n}", "func (client *Client) ListApplicationLogsWithChan(request *ListApplicationLogsRequest) (<-chan *ListApplicationLogsResponse, <-chan error) {\n\tresponseChan := make(chan *ListApplicationLogsResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ListApplicationLogs(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (svc *AccessLogService) StreamAccessLogs(stream accessloggrpc.AccessLogService_StreamAccessLogsServer) error {\n\tvar logName string\n\tfor {\n\t\tmsg, err := stream.Recv()\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\tif msg.Identifier != nil {\n\t\t\tlogName = msg.Identifier.LogName\n\t\t}\n\t\tswitch entries := msg.LogEntries.(type) {\n\t\tcase *accessloggrpc.StreamAccessLogsMessage_HttpLogs:\n\t\t\tfor _, entry := range entries.HttpLogs.LogEntry {\n\t\t\t\tif entry != nil {\n\t\t\t\t\tcommon := entry.CommonProperties\n\t\t\t\t\treq := entry.Request\n\t\t\t\t\tresp := entry.Response\n\t\t\t\t\tif common == nil {\n\t\t\t\t\t\tcommon = &alf.AccessLogCommon{}\n\t\t\t\t\t}\n\t\t\t\t\tif req == nil {\n\t\t\t\t\t\treq = &alf.HTTPRequestProperties{}\n\t\t\t\t\t}\n\t\t\t\t\tif resp == nil {\n\t\t\t\t\t\tresp = &alf.HTTPResponseProperties{}\n\t\t\t\t\t}\n\t\t\t\t\tsvc.log(fmt.Sprintf(\"[%s%s] %s %s %s %d %s %s\",\n\t\t\t\t\t\tlogName, time.Now().Format(time.RFC3339), req.Authority, req.Path, req.Scheme,\n\t\t\t\t\t\tresp.ResponseCode.GetValue(), req.RequestId, common.UpstreamCluster))\n\t\t\t\t}\n\t\t\t}\n\t\tcase *accessloggrpc.StreamAccessLogsMessage_TcpLogs:\n\t\t\tfor _, entry := range entries.TcpLogs.LogEntry {\n\t\t\t\tif entry != nil {\n\t\t\t\t\tcommon := entry.CommonProperties\n\t\t\t\t\tif common == nil {\n\t\t\t\t\t\tcommon = &alf.AccessLogCommon{}\n\t\t\t\t\t}\n\t\t\t\t\tsvc.log(fmt.Sprintf(\"[%s%s] tcp %s %s\",\n\t\t\t\t\t\tlogName, time.Now().Format(time.RFC3339), common.UpstreamLocalAddress, common.UpstreamCluster))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func LogFileOpenRead(baseFileName string) (log *LogFile, err error) {\n\tlog = new(LogFile)\n\tlog.byteOrder = binary.LittleEndian\n\n\t// Open for reading from the start of the file\n\tlog.entryReadFile, err = os.Open(logFileName(baseFileName))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tlog.entryReadFile.Close()\n\t\t}\n\t}()\n\n\t// Open & read in the meta file\n\tlog.metaFile, err = os.Open(metaFileName(baseFileName))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tlog.metaFile.Close()\n\t\t}\n\t}()\n\n\tmetaData, err := log.readMetaData()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t\n\t// Update the log from the metadata\n\tlog.headOffset = metaData.HeadOffset\n\tlog.tailOffset = metaData.TailOffset\n\tlog.NumEntries = metaData.NumEntries\n\tlog.maxSizeBytes = metaData.MaxSizeBytes\n\tlog.numSizeBytes = metaData.NumSizeBytes\n\tlog.wrapNum = metaData.WrapNum\n\n\t// position us at the start of the entry data file\n\t// seek to tail - want to read from tail to head\n\tstdlog.Printf(\"seek to tail: %v\\n\", metaData.TailOffset)\n\t_, err = log.entryReadFile.Seek(int64(metaData.TailOffset), 0)\n\n\treturn log, err\n}", "func (c *Client) Logs(ctx context.Context, namespace, podName, containerName string, lastContainerLog bool, tail *int64, follow bool) (io.ReadCloser, error) {\n\tretVal := ioutil.NopCloser(strings.NewReader(\"ContainerLogs\"))\n\treturn retVal, nil\n}", "func (s *server) FetchLogs(ctx context.Context, body *pb.LogRequest) (*pb.LogResponse, error) {\n\tappName := body.GetName()\n\ttail := body.GetTail()\n\n\tdata, err := docker.ReadLogs(appName, tail)\n\n\tif err != nil && err.Error() != \"EOF\" {\n\t\treturn nil, err\n\t}\n\treturn &pb.LogResponse{\n\t\tSuccess: true,\n\t\tData: data,\n\t}, nil\n}", "func chatroom() {\n\tarchive := list.New()\n\tsubscribers := list.New()\n\n\tfor {\n\t\tselect {\n\t\tcase ch := <-subscribe:\n\t\t\tvar events []Event\n\t\t\tfor e := archive.Front(); e != nil; e = e.Next() {\n\t\t\t\tevents = append(events, e.Value.(Event))\n\t\t\t}\n\t\t\tsubscriber := make(chan Event, 10)\n\t\t\tsubscribers.PushBack(subscriber)\n\t\t\tch <- Subscription{events, subscriber}\n\n\t\tcase event := <-publish:\n\t\t\tfor ch := subscribers.Front(); ch != nil; ch = ch.Next() {\n\t\t\t\tch.Value.(chan Event) <- event\n\t\t\t}\n\t\t\tif archive.Len() >= archiveSize {\n\t\t\t\tarchive.Remove(archive.Front())\n\t\t\t}\n\t\t\tarchive.PushBack(event)\n\n\t\tcase unsub := <-unsubscribe:\n\t\t\tfor ch := subscribers.Front(); ch != nil; ch = ch.Next() {\n\t\t\t\tif ch.Value.(chan Event) == unsub {\n\t\t\t\t\tsubscribers.Remove(ch)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *Server) LogReader(tail int) (*bufio.Reader, error) {\n\tlogs, err := s.ContainerLogs(\n\t\tcontext.Background(),\n\t\ts.ContainerID,\n\t\tdocker.ContainerLogsOptions{\n\t\t\tShowStdout: true,\n\t\t\tShowStderr: true,\n\t\t\tTail: strconv.Itoa(tail),\n\t\t\tFollow: true,\n\t\t},\n\t)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting docker container logs: %s\", err)\n\t}\n\n\treturn bufio.NewReader(logs), nil\n}", "func ShipContainerCommandLogs(\n\tctx context.Context,\n\tr io.ReadCloser,\n\tstdtype stdcopy.StdType,\n\tp events.Publisher[docker.Event],\n) {\n\tfor scan := bufio.NewScanner(r); scan.Scan(); {\n\t\tline := scan.Text()\n\t\tif len(strings.TrimSpace(line)) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar level, log string\n\t\tif matches := logLevel.FindStringSubmatch(line); len(matches) == 3 {\n\t\t\tlevel, log = matches[1], matches[2]\n\t\t} else {\n\t\t\tlevel, log = model.LogLevelInfo, line\n\t\t}\n\n\t\tif err := p.Publish(ctx, docker.NewTypedLogEvent(level, log, stdtype)); err != nil {\n\t\t\tlogrus.WithError(err).Trace(\"log stream terminated\")\n\t\t\treturn\n\t\t}\n\t}\n}", "func TestReadExistingLogs(t *testing.T) {\n\tt.Parallel()\n\toperator, logReceived, tempDir := newTestFileOperator(t, nil)\n\n\t// Create a file, then start\n\ttemp := openTemp(t, tempDir)\n\twriteString(t, temp, \"testlog1\\ntestlog2\\n\")\n\n\trequire.NoError(t, operator.Start(testutil.NewMockPersister(\"test\")))\n\tdefer func() {\n\t\trequire.NoError(t, operator.Stop())\n\t}()\n\n\twaitForMessage(t, logReceived, \"testlog1\")\n\twaitForMessage(t, logReceived, \"testlog2\")\n}", "func GetLogs(hash string, sinceId int) ([]*log.Log, error) {\n\tlogs := make([]*log.Log, 0)\n\n\tfile, err := getOpenedFileWithHash(hash)\n\n\tif err != nil {\n\t\treturn logs, err\n\t}\n\n\tfor _, log := range file.GetLogs() {\n\t\tif log.Id > sinceId {\n\t\t\tlogs = append(logs, log)\n\t\t}\n\t}\n\n\treturn logs, nil\n}", "func (e *Engine) StreamLogs(ctx context.Context, containerID string) (io.ReadCloser, error) {\n\treturn e.api.ContainerLogs(ctx, containerID, types.ContainerLogsOptions{\n\t\tShowStdout: true,\n\t\tShowStderr: true,\n\t\tFollow: true,\n\t})\n}", "func (router *Router) getLogs(w http.ResponseWriter, r *http.Request) {\n\tclusterName := r.URL.Query().Get(\"cluster\")\n\tnamespace := r.URL.Query().Get(\"namespace\")\n\tname := r.URL.Query().Get(\"name\")\n\tcontainer := r.URL.Query().Get(\"container\")\n\tregex := r.URL.Query().Get(\"regex\")\n\tsince := r.URL.Query().Get(\"since\")\n\ttail := r.URL.Query().Get(\"tail\")\n\tprevious := r.URL.Query().Get(\"previous\")\n\tfollow := r.URL.Query().Get(\"follow\")\n\n\tlog.WithFields(logrus.Fields{\"cluster\": clusterName, \"namespace\": namespace, \"name\": name, \"container\": container, \"regex\": regex, \"since\": since, \"previous\": previous, \"follow\": follow}).Tracef(\"getLogs\")\n\n\tcluster := router.clusters.GetCluster(clusterName)\n\tif cluster == nil {\n\t\terrresponse.Render(w, r, nil, http.StatusBadRequest, \"Invalid cluster name\")\n\t\treturn\n\t}\n\n\tparsedSince, err := strconv.ParseInt(since, 10, 64)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not parse since parameter\")\n\t\treturn\n\t}\n\n\tparsedTail, err := strconv.ParseInt(tail, 10, 64)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not parse tail parameter\")\n\t\treturn\n\t}\n\n\tparsedPrevious, err := strconv.ParseBool(previous)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not parse previous parameter\")\n\t\treturn\n\t}\n\n\tparsedFollow, err := strconv.ParseBool(follow)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not parse follow parameter\")\n\t\treturn\n\t}\n\n\t// If the parsedFollow parameter was set to true, we stream the logs via an WebSocket connection instead of\n\t// returning a json response.\n\tif parsedFollow {\n\t\tvar upgrader = websocket.Upgrader{}\n\n\t\tif router.config.WebSocket.AllowAllOrigins {\n\t\t\tupgrader.CheckOrigin = func(r *http.Request) bool { return true }\n\t\t}\n\n\t\tc, err := upgrader.Upgrade(w, r, nil)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Errorf(\"Could not upgrade connection\")\n\t\t\treturn\n\t\t}\n\t\tdefer c.Close()\n\n\t\tc.SetPongHandler(func(string) error { return nil })\n\n\t\tgo func() {\n\t\t\tticker := time.NewTicker(pingPeriod)\n\t\t\tdefer ticker.Stop()\n\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ticker.C:\n\t\t\t\t\tif err := c.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\n\t\terr = cluster.StreamLogs(r.Context(), c, namespace, name, container, parsedSince, parsedTail, parsedFollow)\n\t\tif err != nil {\n\t\t\tc.WriteMessage(websocket.TextMessage, []byte(\"Could not stream logs: \"+err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tlog.Tracef(\"Logs stream was closed\")\n\t\treturn\n\t}\n\n\tlogs, err := cluster.GetLogs(r.Context(), namespace, name, container, regex, parsedSince, parsedTail, parsedPrevious)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadGateway, \"Could not get logs\")\n\t\treturn\n\t}\n\n\tlog.WithFields(logrus.Fields{\"count\": len(logs)}).Tracef(\"getLogs\")\n\trender.JSON(w, r, struct {\n\t\tLogs string `json:\"logs\"`\n\t}{logs})\n}", "func (cli *DockerCli) GetContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) {\n\tres, err := cli.client.ContainerLogs(ctx, container, options)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\treturn res, nil\n}", "func RetrieveMongoChatMessages(req *saver.RetrieveMessagesRequest,\n\tresp *saver.RetrieveMessagesResponse) error {\n\n\tchannels := len(req.ChatChannels)\n\tif channels == 0 {\n\t\tLogger.Error(req.Owner, req.Appid, \"\", \"RetrieveMongoChatMessages\",\n\t\t\t\"Retrieve messages from storage failed\", \"there isn't any channel information\")\n\t\treturn errors.New(\"there isn't any channel information\")\n\t}\n\n\tresp.Inbox = make(map[string][]*saver.ChatMessage, channels)\n\tresp.LatestID = make(map[string]uint64, channels)\n\tresp.LastReadID = make(map[string]uint64, channels)\n\terrorInfo := \"\"\n\tfor key, info := range req.ChatChannels {\n\t\tinfo.Channel = key //ensure that data consistency\n\t\tswitch key {\n\t\tcase saver.ChatChannelIMInbox, saver.ChatChannelIMOutbox, saver.ChatChannelIM:\n\t\t\t// we don't do anything if get empty owner, just return as operation is successful but count it as failed\n\t\t\tif req.Owner == \"\" {\n\t\t\t\trequestStat.AtomicAddRetrieveImFails(1)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresp.Outbox = make(map[string][]*saver.ChatMessage, channels)\n\t\t\tif err := RetrieveImRecords(req.Appid, req.Owner, info, req.TraceSN, resp); err != nil {\n\t\t\t\terrorInfo = fmt.Sprint(errorInfo, \"IM Error[\", err.Error(), \"] \")\n\t\t\t\trequestStat.AtomicAddRetrieveImFails(1)\n\t\t\t} else {\n\t\t\t\trequestStat.AtomicAddRetrieveIms(1)\n\t\t\t}\n\t\tcase saver.ChatChannelNotify:\n\t\t\t// we don't do anything if get empty owner, just return as operation is successful but count it as failed\n\t\t\tif req.Owner == \"\" {\n\t\t\t\trequestStat.AtomicAddRetrievePeerFails(1)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := RetrieveNotificationRecords(req.Appid, req.Owner, info, req.TraceSN, resp); err != nil {\n\t\t\t\terrorInfo = fmt.Sprint(errorInfo, \"Peer Error[\", err.Error(), \"] \")\n\t\t\t\trequestStat.AtomicAddRetrievePeerFails(1)\n\t\t\t} else {\n\t\t\t\trequestStat.AtomicAddRetrievePeers(1)\n\t\t\t}\n\t\tcase saver.ChatChannelPublic:\n\t\t\tif err := RetrievePublicRecordsFromCache(req.Appid, req.Owner, info, req.TraceSN, resp); err != nil {\n\t\t\t\terrorInfo = fmt.Sprint(errorInfo, \"Public/hot Error[\", err.Error(), \"] \")\n\t\t\t} else {\n\t\t\t\trequestStat.AtomicAddRetrievePublics(1)\n\t\t\t}\n\t\tdefault:\n\t\t\terr := fmt.Sprint(fmt.Sprintf(\"%s channel is not supported now\", info.Channel),\n\t\t\t\t\" Invalid channel information:\", info)\n\t\t\terrorInfo = fmt.Sprint(errorInfo, \"Unsupported channel:[\", err, \"] \")\n\t\t}\n\t}\n\n\tif errorInfo == \"\" {\n\t\tLogger.Trace(\"\", req.Appid, \"\", \"RetrieveMongoChatMessages\",\n\t\t\t\"Request\", req, \"Response\", resp)\n\t\treturn nil\n\t}\n\tLogger.Error(req.Owner, req.Appid, \"\", \"RetrieveMongoChatMessages\", \"Retrieve message operation has error\",\n\t\terrorInfo)\n\treturn errors.New(errorInfo)\n}", "func (s *EventSub) Read(ctx context.Context, sink chan<- *Event) error {\n\t// First read into the past.\n\tif err := s.readPast(ctx, sink); err != nil {\n\t\treturn errors.WithMessage(err, \"reading logs\")\n\t}\n\t// Then wait for new events.\n\tif err := s.readFuture(ctx, sink); err != nil {\n\t\treturn errors.WithMessage(err, \"reading logs\")\n\t}\n\treturn nil\n}", "func WithChildren() LogReadOption { return LogReadOption{withChildren: true} }", "func (c *Chat) ReadChatLine() *LogLineParsed {\n\tif c.logger.readCursor == c.logger.writeCursor {\n\t\treturn nil\n\t}\n\n\tl := &c.logger.ChatLines[c.logger.readCursor]\n\tc.logger.readCursor++\n\tif c.logger.readCursor > numInteralLogLines {\n\t\tc.logger.readCursor -= numInteralLogLines\n\t}\n\n\treturn l\n}", "func openArchive(u string) (ar Archive, err error) {\n\treadCloser, err := openReader(u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t_ = readCloser.Close()\n\t\t}\n\t}()\n\n\tct, r, err := detectContentType(readCloser)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch ct {\n\tcase \"application/x-gzip\":\n\t\tr, err = gzip.NewReader(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\tcase \"application/zip\":\n\t\treturn newZipArchive(r, readCloser)\n\t}\n\n\treturn &tarArchive{\n\t\tCloser: readCloser,\n\t\ttr: tar.NewReader(r),\n\t}, nil\n}", "func readLogfileRecent(v *gocui.View, logfile stat.Logfile) (int64, []byte, error) {\n\t// Calculate necessary number of lines and buffer size depending on size available screen.\n\tx, y := v.Size()\n\tlinesLimit := y - 1 // available number of lines\n\tbufsize := x * y * 2 // max size of used buffer - don't need to read log more than that amount\n\n\tinfo, err := os.Stat(logfile.Path)\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\n\t// Do nothing if logfile is not changed or empty.\n\tif info.Size() == logfile.Size || info.Size() == 0 {\n\t\treturn info.Size(), nil, nil\n\t}\n\n\t// Read the log for necessary number of lines or until bufsize reached.\n\tbuf, err := logfile.Read(linesLimit, bufsize)\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\n\t// return the log's size and buffer content\n\treturn info.Size(), buf, nil\n}", "func (l *FileLog) read(path string) {\n\tl.init() // start with a fresh entries log\n\n\tf, err := os.OpenFile(path, os.O_RDONLY, os.ModePerm)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\tsc := bufio.NewScanner(f)\n\tfor sc.Scan() {\n\t\tentry := new(Entry)\n\t\tif err = entry.Load(sc.Bytes()); err != nil {\n\t\t\treturn\n\t\t}\n\t\tl.entries = append(l.entries, entry)\n\t}\n}", "func (l *Log) Read(n int) []string {\n\tif n >= len(l.Entries) {\n\t\treturn l.Entries\n\t}\n\treturn l.Entries[len(l.Entries)-n:]\n}", "func GitArchive(dir, ref, format string) (io.ReadCloser, error) {\n\t// Build archive using git-archive\n\targs := []string{\"git\", \"archive\", \"--format=\" + format, ref}\n\n\tcmd := exec.Command(args[0], args[1:]...)\n\t// Set directory to repo's\n\tcmd.Dir = dir\n\n\t// Get stream\n\treturn CmdStream(cmd, nil)\n}", "func WithStream() LogReadOption { return LogReadOption{withStream: true} }", "func (m *arangodb) collectContainerLogs(w io.Writer, containerID string) error {\n\tsince := time.Now().Add(-time.Minute * 10)\n\tm.log.Debugf(\"fetching logs from %s\", containerID)\n\tif err := m.dockerHost.Client.Logs(dc.LogsOptions{\n\t\tContainer: containerID,\n\t\tOutputStream: w,\n\t\tRawTerminal: true,\n\t\tStdout: true,\n\t\tStderr: true,\n\t\tSince: since.Unix(),\n\t\tTimestamps: false,\n\t}); err != nil && errors.Cause(err) != io.EOF {\n\t\tm.log.Debugf(\"failed to fetching logs from %s: %v\", containerID, err)\n\t\treturn maskAny(err)\n\t}\n\tm.log.Debugf(\"done fetching logs from %s\", containerID)\n\treturn nil\n}", "func (lb *LogBuffer) ReadSince(i int64) ([]LogEntry, int64) {\n\toffset := lb.offset\n\tnRead := int64(0)\n\tentries := []LogEntry{}\n\tif i >= offset {\n\t\treturn entries, offset\n\t}\n\n\t// if i is so far in the past that we're more than logBufSize\n\t// behind then skip forward until we're caught up with the current\n\t// buffer\n\tif i+lb.capacity < offset {\n\t\ti = offset - lb.capacity\n\t}\n\n\t// entries can wrap around to the start of the buffer so skipt the\n\t// slice tricks, iterate through everything.\n\tentries = make([]LogEntry, 0, offset-i)\n\tfor ; i < offset; i++ {\n\t\tbufLoc := i % lb.capacity\n\t\tnRead++\n\t\tentries = append(entries, lb.buf[bufLoc])\n\t}\n\n\t// returns string, lines read, current offset\n\treturn entries, offset\n}", "func (sysLogConn *Connection) ReadLogMessage() string {\n\treturn <-sysLogConn.logReader\n}", "func (t TestFactoryT) ReadArchiveBatch(name string) (*Batch, error) {\n\tbatch, err := t.ReadBatch(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor i, column := range batch.Columns {\n\t\tif column != nil {\n\t\t\tarchiveColumn := convertToArchiveVectorParty(column.(*cVectorParty), batch)\n\t\t\tbatch.Columns[i] = archiveColumn\n\t\t}\n\t}\n\tbatch.RWMutex = &sync.RWMutex{}\n\treturn batch, nil\n}", "func (c *LogsController) Show(w http.ResponseWriter, r *http.Request) {\n\t// get the variables from mux\n\tvars := mux.Vars(r)\n\tcontainerId := vars[\"containerId\"]\n\n\t// open the read stream from docker\n\treader, err := docker.DockerConn.ContainerLogs(context.Background(), containerId,\n\t\ttypes.ContainerLogsOptions{\n\t\t\tShowStdout: true,\n\t\t\tShowStderr: true,\n\t\t\tFollow: true,\n\t\t\tTimestamps: true,\n\t\t\tDetails: false,\n\t\t})\n\n\t// if the reader fails return an internal server error\n\tif c.CheckError(err, http.StatusInternalServerError, w) {\n\t\treturn\n\t}\n\n\t// close the reader after we're done with it\n\tdefer reader.Close()\n\n\t// upgrade the connection for websockets\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif c.CheckError(err, http.StatusInternalServerError, w) {\n\t\treturn\n\t}\n\n\t// create a new scanner and read from it until it closes\n\tscanner := bufio.NewScanner(reader)\n\tfor scanner.Scan() {\n\t\ttext := []rune(scanner.Text())\n\t\terr = conn.WriteMessage(websocket.TextMessage, []byte(string(text)))\n\t\tif c.CheckError(err, http.StatusInternalServerError, w) {\n\t\t\treturn\n\t\t}\n\t}\n\tif err = scanner.Err(); err != nil {\n\t\tif c.CheckError(scanner.Err(), http.StatusInternalServerError, w) {\n\t\t\treturn\n\t\t}\n\t}\n}", "func (s *VarlinkInterface) GetContainerLogs(ctx context.Context, c VarlinkCall, name_ string) error {\n\treturn c.ReplyMethodNotImplemented(ctx, \"io.podman.GetContainerLogs\")\n}", "func (flogs *fileLogs) ReadBinary(dataID, version dvid.UUID) ([]byte, error) {\n\tk := string(dataID + \"-\" + version)\n\tfilename := filepath.Join(flogs.path, k)\n\tdata, err := ioutil.ReadFile(filename)\n\tif os.IsNotExist(err) {\n\t\treturn nil, nil\n\t}\n\treturn data, err\n}", "func (o *GetLogsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetLogsOK(o.writer)\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 401:\n\t\tresult := NewGetLogsUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewGetLogsNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (r *objReader) parseArchive(verbose bool) error {\n\tr.readFull(r.tmp[:8]) // consume header (already checked)\n\tfor r.offset < r.limit {\n\t\tif err := r.readFull(r.tmp[:60]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata := r.tmp[:60]\n\n\t\t// Each file is preceded by this text header (slice indices in first column):\n\t\t//\t 0:16\tname\n\t\t//\t16:28 date\n\t\t//\t28:34 uid\n\t\t//\t34:40 gid\n\t\t//\t40:48 mode\n\t\t//\t48:58 size\n\t\t//\t58:60 magic - `\\n\n\t\t// We only care about name, size, and magic, unless in verbose mode.\n\t\t// The fields are space-padded on the right.\n\t\t// The size is in decimal.\n\t\t// The file data - size bytes - follows the header.\n\t\t// Headers are 2-byte aligned, so if size is odd, an extra padding\n\t\t// byte sits between the file data and the next header.\n\t\t// The file data that follows is padded to an even number of bytes:\n\t\t// if size is odd, an extra padding byte is inserted betw the next header.\n\t\tif len(data) < 60 {\n\t\t\treturn errTruncatedArchive\n\t\t}\n\t\tif !bytes.Equal(data[58:60], archiveMagic) {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tname := trimSpace(data[0:16])\n\t\tvar err error\n\t\tget := func(start, end, base, bitsize int) int64 {\n\t\t\tif err != nil {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tvar v int64\n\t\t\tv, err = strconv.ParseInt(trimSpace(data[start:end]), base, bitsize)\n\t\t\treturn v\n\t\t}\n\t\tsize := get(48, 58, 10, 64)\n\t\tvar (\n\t\t\tmtime int64\n\t\t\tuid, gid int\n\t\t\tmode os.FileMode\n\t\t)\n\t\tif verbose {\n\t\t\tmtime = get(16, 28, 10, 64)\n\t\t\tuid = int(get(28, 34, 10, 32))\n\t\t\tgid = int(get(34, 40, 10, 32))\n\t\t\tmode = os.FileMode(get(40, 48, 8, 32))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tdata = data[60:]\n\t\tfsize := size + size&1\n\t\tif fsize < 0 || fsize < size {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tswitch name {\n\t\tcase \"__.PKGDEF\":\n\t\t\tr.a.Entries = append(r.a.Entries, Entry{\n\t\t\t\tName: name,\n\t\t\t\tType: EntryPkgDef,\n\t\t\t\tMtime: mtime,\n\t\t\t\tUid: uid,\n\t\t\t\tGid: gid,\n\t\t\t\tMode: mode,\n\t\t\t\tData: Data{r.offset, size},\n\t\t\t})\n\t\t\tr.skip(size)\n\t\tdefault:\n\t\t\tvar typ EntryType\n\t\t\tvar o *GoObj\n\t\t\toffset := r.offset\n\t\t\tp, err := r.peek(8)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif bytes.Equal(p, goobjHeader) {\n\t\t\t\ttyp = EntryGoObj\n\t\t\t\to = &GoObj{}\n\t\t\t\tr.parseObject(o, size)\n\t\t\t} else {\n\t\t\t\ttyp = EntryNativeObj\n\t\t\t\tr.skip(size)\n\t\t\t}\n\t\t\tr.a.Entries = append(r.a.Entries, Entry{\n\t\t\t\tName: name,\n\t\t\t\tType: typ,\n\t\t\t\tMtime: mtime,\n\t\t\t\tUid: uid,\n\t\t\t\tGid: gid,\n\t\t\t\tMode: mode,\n\t\t\t\tData: Data{offset, size},\n\t\t\t\tObj: o,\n\t\t\t})\n\t\t}\n\t\tif size&1 != 0 {\n\t\t\tr.skip(1)\n\t\t}\n\t}\n\treturn nil\n}", "func UnmarshalLogs(in []byte) ([]*ethtypes.Log, error) {\n\tlogs := []*ethtypes.Log{}\n\terr := ModuleCdc.UnmarshalBinaryLengthPrefixed(in, &logs)\n\treturn logs, err\n}", "func (s *VicStreamProxy) StreamContainerLogs(ctx context.Context, name string, out io.Writer, started chan struct{}, showTimestamps bool, followLogs bool, since int64, tailLines int64) error {\n\top := trace.FromContext(ctx, \"\")\n\tdefer trace.End(trace.Begin(\"\", op))\n\topID := op.ID()\n\n\tif s.client == nil {\n\t\treturn errors.NillPortlayerClientError(\"StreamProxy\")\n\t}\n\n\tclose(started)\n\n\tparams := containers.NewGetContainerLogsParamsWithContext(op).\n\t\tWithID(name).\n\t\tWithFollow(&followLogs).\n\t\tWithTimestamp(&showTimestamps).\n\t\tWithSince(&since).\n\t\tWithTaillines(&tailLines).\n\t\tWithOpID(&opID)\n\t_, err := s.client.Containers.GetContainerLogs(params, out)\n\tif err != nil {\n\t\tswitch err := err.(type) {\n\t\tcase *containers.GetContainerLogsNotFound:\n\t\t\treturn errors.NotFoundError(name)\n\t\tcase *containers.GetContainerLogsInternalServerError:\n\t\t\treturn errors.InternalServerError(\"Server error from the interaction port layer\")\n\t\tdefault:\n\t\t\t//Check for EOF. Since the connection, transport, and data handling are\n\t\t\t//encapsulated inside of Swagger, we can only detect EOF by checking the\n\t\t\t//error string\n\t\t\tif strings.Contains(err.Error(), SwaggerSubstringEOF) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn errors.InternalServerError(fmt.Sprintf(\"Unknown error from the interaction port layer: %s\", err))\n\t\t}\n\t}\n\n\treturn nil\n}", "func ReadJournalTail(ctx context.Context, unit string, numFromTail uint64) (goio.ReadCloser, error) {\n\treturn readJournalOutput(ctx, unit, 0, numFromTail)\n}", "func GetChanHistory(tdlibClient *client.Client, chatID int64, fromMessageID int64, toMessageID int64) (messages []*client.Message) {\n\tvar totalMessages int\n\n\tmessagesSet := make(map[int]*client.Message)\n\ttotalLimit := 99999999999\n\n\t// Read first message (newest) separetely, because messageReading does not return exactly message - fromMessageId\n\tif fromMessageID != 0 {\n\t\tlastMessage, err := tdlibClient.GetMessage(&client.GetMessageRequest{ChatId: chatID, MessageId: fromMessageID})\n\t\tcheckError(err, \"Getting chan history\")\n\t\tmessagesSet[int(lastMessage.Id)] = lastMessage\n\t}\nmessageReading:\n\tfor {\n\t\tfmt.Println(\"Retriving messages from \", fromMessageID, \"..\")\n\t\tchanHistory, err := tdlibClient.GetChatHistory(&client.GetChatHistoryRequest{\n\t\t\tChatId: chatID,\n\t\t\tLimit: 100,\n\t\t\tOnlyLocal: false,\n\t\t\tFromMessageId: fromMessageID,\n\t\t})\n\t\tcheckError(err, \"Getting chan history\")\n\t\tif chanHistory.TotalCount == 0 {\n\t\t\tbreak\n\t\t}\n\t\tfor _, m := range chanHistory.Messages {\n\t\t\tif totalLimit > 0 && totalMessages >= totalLimit {\n\t\t\t\tbreak messageReading\n\t\t\t}\n\t\t\t// Read to needed MessageID\n\t\t\tif toMessageID == m.Id {\n\t\t\t\tbreak messageReading\n\t\t\t}\n\t\t\ttotalMessages++\n\n\t\t\t// Read next set of messages\n\t\t\tfromMessageID = m.Id\n\t\t\tmessagesSet[int(m.Id)] = m\n\t\t}\n\t}\n\n\tmessagesIDsSorted := make([]int, 0, len(messagesSet))\n\n\tfor k := range messagesSet {\n\t\tmessagesIDsSorted = append(messagesIDsSorted, k)\n\t}\n\tsort.Ints(messagesIDsSorted)\n\tfor _, i := range messagesIDsSorted {\n\t\tmessages = append(messages, messagesSet[i])\n\t}\n\n\treturn\n}", "func TestReadNewLogs(t *testing.T) {\n\tt.Parallel()\n\toperator, logReceived, tempDir := newTestFileOperator(t, nil)\n\n\trequire.NoError(t, operator.Start(testutil.NewMockPersister(\"test\")))\n\tdefer func() {\n\t\trequire.NoError(t, operator.Stop())\n\t}()\n\n\t// Create a new file\n\ttemp := openTemp(t, tempDir)\n\twriteString(t, temp, \"testlog\\n\")\n\n\t// Expect the message to come through\n\twaitForMessage(t, logReceived, \"testlog\")\n}", "func (client AppsClient) DownloadQueryLogs(ctx context.Context, appID uuid.UUID) (result ReadCloser, err error) {\n\treq, err := client.DownloadQueryLogsPreparer(ctx, appID)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"DownloadQueryLogs\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.DownloadQueryLogsSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"DownloadQueryLogs\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.DownloadQueryLogsResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"programmatic.AppsClient\", \"DownloadQueryLogs\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func chatroom() {\n\tarchive := list.New()\n\tsubscribers := list.New()\n\n\tfor {\n\t\tselect {\n\t\tcase ch := <-subscribe:\n\t\t\tvar events []Event\n\t\t\tfor e := archive.Front(); e != nil; e = e.Next() {\n\t\t\t\tevents = append(events, e.Value.(Event))\n\t\t\t}\n\t\t\tsubscriber := make(chan Event, 10)\n\t\t\tsubscribers.PushBack(subscriber)\n\t\t\tch <- Subscription{events, subscriber}\n\n\t\tcase event := <-publish:\n\t\t\t// {{{ クソ\n\t\t\tevent.RoomInfo.Updated = false\n\t\t\tif event.Type == \"join\" {\n\t\t\t\tif _, already := info.Users[event.User.ScreenName]; !already {\n\t\t\t\t\tinfo.Users[event.User.ScreenName] = event.User\n\t\t\t\t}\n\t\t\t\tevent.RoomInfo = info\n\t\t\t\tevent.RoomInfo.Updated = true\n\t\t\t}\n\t\t\tif event.Type == \"leave\" {\n\t\t\t\tdelete(info.Users, event.User.ScreenName)\n\t\t\t\tevent.RoomInfo = info\n\t\t\t\tevent.RoomInfo.Updated = true\n\t\t\t}\n\t\t\t// }}}\n\t\t\tfor ch := subscribers.Front(); ch != nil; ch = ch.Next() {\n\t\t\t\tch.Value.(chan Event) <- event\n\t\t\t}\n\t\t\tif event.Type == \"message\" {\n\t\t\t\tsound, soundError := factory.SoundFromText(event.Text, event.User)\n\t\t\t\tif soundError == nil {\n\t\t\t\t\t//fmt.Printf(\"このサウンドをアーカイブ:\\t%+v\\n\", sound)\n\t\t\t\t\tif SoundTrack.Len() >= soundArchiveSize {\n\t\t\t\t\t\tSoundTrack.Remove(SoundTrack.Front())\n\t\t\t\t\t}\n\t\t\t\t\tSoundTrack.PushBack(sound)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif archive.Len() >= archiveSize {\n\t\t\t\tarchive.Remove(archive.Front())\n\t\t\t}\n\t\t\tarchive.PushBack(event)\n\n\t\tcase unsub := <-unsubscribe:\n\t\t\tfor ch := subscribers.Front(); ch != nil; ch = ch.Next() {\n\t\t\t\tif ch.Value.(chan Event) == unsub {\n\t\t\t\t\tsubscribers.Remove(ch)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (mc *MockContainer) GetContainerLogs(container.GetLogOptions) (io.ReadCloser, error) {\n\treturn mc.MockGetContainerLogs()\n}", "func (d *Deployment) TailLogs(ctx context.Context, opts *LogOptions) ([]LogChan, error) {\n\tdp, err := d.Load(d.Factory, opts.Path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif dp.Spec.Selector == nil || len(dp.Spec.Selector.MatchLabels) == 0 {\n\t\treturn nil, fmt.Errorf(\"No valid selector found on Deployment %s\", opts.Path)\n\t}\n\n\treturn podLogs(ctx, dp.Spec.Selector.MatchLabels, opts)\n}", "func (client *Client) ListAuthenticationLogsWithChan(request *ListAuthenticationLogsRequest) (<-chan *ListAuthenticationLogsResponse, <-chan error) {\n\tresponseChan := make(chan *ListAuthenticationLogsResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ListAuthenticationLogs(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (s *BackupSlave) readBackupSlavePump() {\n\tdefer func() {\n\t\ts.conn.Close()\n\t}()\n\tfor {\n\t\t_, message, err := s.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tvar data BackupMessage\n\t\terr = json.Unmarshal(message, &data)\n\t\tif err != nil {\n\t\t\tlog.Println(\"cannot unmarshal: \", err)\n\t\t}\n\n\t\tlog.Println(string(data.Message))\n\t\t// Add new message to local log\n\t\tRoomLog.Lock()\n\t\tRoomLog.v[data.Hub_id] = append(RoomLog.v[data.Hub_id], data.Message)\n\t\tRoomLog.Unlock()\n\t}\n}", "func (fmd *FakeMysqlDaemon) ReadBinlogFilesTimestamps(ctx context.Context, req *mysqlctlpb.ReadBinlogFilesTimestampsRequest) (*mysqlctlpb.ReadBinlogFilesTimestampsResponse, error) {\n\treturn nil, nil\n}", "func (c *Client) GetChatEventLog(ctx context.Context, request *GetChatEventLogRequest) (*ChatEvents, error) {\n\tvar result ChatEvents\n\n\tif err := c.rpc.Invoke(ctx, request, &result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "func (self *File_Client) ReadDir(path interface{}, recursive interface{}, thumbnailHeight interface{}, thumbnailWidth interface{}) (string, error) {\n\n\t// Create a new client service...\n\trqst := &filepb.ReadDirRequest{\n\t\tPath: Utility.ToString(path),\n\t\tRecursive: Utility.ToBool(recursive),\n\t\tThumnailHeight: int32(Utility.ToInt(thumbnailHeight)),\n\t\tThumnailWidth: int32(Utility.ToInt(thumbnailWidth)),\n\t}\n\n\tstream, err := self.c.ReadDir(context.Background(), rqst)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Here I will create the final array\n\tdata := make([]byte, 0)\n\tfor {\n\t\tmsg, err := stream.Recv()\n\t\tif err == io.EOF {\n\t\t\t// end of stream...\n\t\t\tbreak\n\t\t}\n\n\t\tdata = append(data, msg.Data...)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn string(data), nil\n}", "func GetMessageList(dirPath string) ([]os.FileInfo, error){\n dirPath = strings.TrimPrefix(dirPath, \"\\\"\")\n dirPath = strings.TrimRight(dirPath, \"\\\";\")\n files, err := ioutil.ReadDir(dirPath)\n\tif err != nil {\n log.Print(err)\n return nil, err\n }\n sort.Slice(files, func(i,j int) bool{\n return files[i].ModTime().Unix() < files[j].ModTime().Unix()\n })\n return files, err\n}", "func (d *aciDriver) getContainerLogs(ctx context.Context, aciRG string, aciName string, linesOutput int) (int, error) {\n\tlog.Debug(\"Getting Logs from Invocation Image\")\n\tcontainerClient, err := az.GetContainerClient(d.subscriptionID, d.loginInfo.Authorizer, d.userAgent)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"Error getting Container Client: %v\", err)\n\t}\n\n\tlogs, err := containerClient.ListLogs(ctx, aciRG, aciName, aciName, nil)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"Error getting container logs :%v\", err)\n\t}\n\n\tlines := strings.Split(strings.TrimSuffix(*logs.Content, \"\\n\"), \"\\n\")\n\tnoOfLines := len(lines)\n\tfor currentLine := linesOutput; currentLine < noOfLines; currentLine++ {\n\t\t_, err := fmt.Println(lines[currentLine])\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"Error writing container logs :%v\", err)\n\t\t}\n\n\t}\n\n\treturn noOfLines, nil\n}", "func (c *PaperTrailClient) DownloadArchive(date string) error {\n\treq, err := c.NewRequest(fmt.Sprintf(URLFormat, date))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := c.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tfile, err := os.OpenFile(fmt.Sprintf(\"./%s.tsv.gz\", date), os.O_RDWR|os.O_CREATE, 0444)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := io.Copy(file, resp.Body); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func GetLogs(reqID string, pod model.PodLogRequest, r store.StateData) {\n\tdata, err := json.Marshal(pod)\n\tif err != nil {\n\t\tlog.Print(\"ERROR WHILE MARSHALLING POD DETAILS\")\n\t}\n\treqType := \"logs\"\n\texternalData := string(data)\n\tpayload := model.ClusterAction{\n\t\tProjectID: reqID,\n\t\tAction: &model.ActionPayload{\n\t\t\tRequestType: reqType,\n\t\t\tExternalData: &externalData,\n\t\t},\n\t}\n\tif clusterChan, ok := r.ConnectedCluster[pod.ClusterID]; ok {\n\t\tclusterChan <- &payload\n\t} else if reqChan, ok := r.WorkflowLog[reqID]; ok {\n\t\tresp := model.PodLogResponse{\n\t\t\tPodName: pod.PodName,\n\t\t\tWorkflowRunID: pod.WorkflowRunID,\n\t\t\tPodType: pod.PodType,\n\t\t\tLog: \"CLUSTER ERROR : CLUSTER NOT CONNECTED\",\n\t\t}\n\t\treqChan <- &resp\n\t\tclose(reqChan)\n\t}\n}", "func ParseLogs(r io.Reader) ([]*LogLine, error) {\n\td := json.NewDecoder(r)\n\tlogs := []*LogLine{}\n\n\tfor {\n\t\tline := LogLine{}\n\t\tif err := d.Decode(&line); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn logs, nil\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tlogs = append(logs, &line)\n\t}\n}", "func (r *Raft) compactLogs(snapIdx uint64) error {\n\tdefer metrics.MeasureSince([]string{\"raft\", \"compactLogs\"}, time.Now())\n\t// Determine log ranges to compact\n\tminLog, err := r.logs.FirstIndex()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get first log index: %v\", err)\n\t}\n\n\t// Check if we have enough logs to truncate\n\tlastLogIdx, _ := r.getLastLog()\n\n\t// Use a consistent value for trailingLogs for the duration of this method\n\t// call to avoid surprising behaviour.\n\ttrailingLogs := r.config().TrailingLogs\n\tif lastLogIdx <= trailingLogs {\n\t\treturn nil\n\t}\n\n\t// Truncate up to the end of the snapshot, or `TrailingLogs`\n\t// back from the head, which ever is further back. This ensures\n\t// at least `TrailingLogs` entries, but does not allow logs\n\t// after the snapshot to be removed.\n\tmaxLog := min(snapIdx, lastLogIdx-trailingLogs)\n\n\tif minLog > maxLog {\n\t\tr.logger.Info(\"no logs to truncate\")\n\t\treturn nil\n\t}\n\n\tr.logger.Info(\"compacting logs\", \"from\", minLog, \"to\", maxLog)\n\n\t// Compact the logs\n\tif err := r.logs.DeleteRange(minLog, maxLog); err != nil {\n\t\treturn fmt.Errorf(\"log compaction failed: %v\", err)\n\t}\n\treturn nil\n}", "func getPodLogs(namespace string, podName string, containerName string) (string, error) {\n\tpodLogOptions := &corev1.PodLogOptions{\n\t\tContainer: containerName,\n\t\tFollow: false,\n\t}\n\n\tlogStream, err := Td.Client.CoreV1().Pods(namespace).GetLogs(podName, podLogOptions).Stream(context.TODO())\n\tif err != nil {\n\t\treturn \"Error in opening stream\", err\n\t}\n\n\t//nolint: errcheck\n\t//#nosec G307\n\tdefer logStream.Close()\n\tbuf := new(bytes.Buffer)\n\t_, err = buf.ReadFrom(logStream)\n\tif err != nil {\n\t\treturn \"Error reading from pod logs stream\", err\n\t}\n\treturn buf.String(), nil\n}", "func (p *ZunProvider) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, tail int) (string, error) {\n\treturn \"not support in Zun Provider\", nil\n}", "func (a *Archive) ReadAll(name string) ([]byte, error) {\n\te, err := a.GetFileInfo(name)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\trawContents := make([]byte, e.CompressedSize)\n\tif n, err := a.reader.ReadAt(rawContents, e.Offset); err != nil {\n\t\treturn []byte{}, err\n\t} else if int64(n) < e.CompressedSize {\n\t\treturn []byte{}, ErrIOMisc\n\t}\n\n\tfileContents := make([]byte, 0, e.Size)\n\tbuf := make([]byte, 10*1024)\n\treader := lz4.NewReader(bytes.NewReader(rawContents))\n\tfor n, err := reader.Read(buf); err != io.EOF; n, err = reader.Read(buf) {\n\t\tfileContents = append(fileContents, buf[:n]...)\n\t}\n\n\treturn fileContents, nil\n}", "func (d *Dao) ThirtyDayArchiveCache(c context.Context, mid int64, ty string) (res []*data.ThirtyDay, err error) {\n\tvar (\n\t\tconn = d.mc.Get(c)\n\t\tr *memcache.Item\n\t)\n\tdefer conn.Close()\n\t// get cache\n\tr, err = conn.Get(keyThirtyDayArchive(mid, ty))\n\tif err != nil {\n\t\tif err == memcache.ErrNotFound {\n\t\t\terr = nil\n\t\t} else {\n\t\t\tlog.Error(\"conn.Get(%d) error(%v)\", mid, err)\n\t\t}\n\t\treturn\n\t}\n\tif err = conn.Scan(r, &res); err != nil {\n\t\tlog.Error(\"json.Unmarshal(%s) error(%v)\", r.Value, err)\n\t\tres = nil\n\t}\n\treturn\n}", "func (eth *EthClient) GetLogs(q ethereum.FilterQuery) ([]Log, error) {\n\tvar results []Log\n\terr := eth.Call(&results, \"eth_getLogs\", utils.ToFilterArg(q))\n\treturn results, err\n}", "func (c *DockerContainer) GetContainerLogs(opts GetLogOptions) (io.ReadCloser, error) {\n\treturn c.DockerClient.ContainerLogs(c.Ctx, c.ID, types.ContainerLogsOptions{\n\t\tShowStderr: opts.Stderr,\n\t\tFollow: opts.Follow,\n\t\tShowStdout: opts.Stdout,\n\t})\n}", "func (a *Client) GetLogs(params *GetLogsParams, authInfo runtime.ClientAuthInfoWriter) (*GetLogsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetLogsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Get Logs\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/{organization}/{project}/_apis/release/releases/{releaseId}/logs\",\n\t\tProducesMediaTypes: []string{\"application/zip\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetLogsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetLogsOK), nil\n\n}", "func (r resource) getPodLogs(out chan<- LogLine, name string, opts *k8s.PodLogOptions) error {\n\trc, err := k8s.GetPodLogs(r.k8s, r.Namespace, name, opts)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get logs\")\n\t}\n\trdr := bufio.NewReader(rc)\n\tif opts.Follow {\n\t\tlog.Printf(\"pod \\\"%s\\\": start streaming\", name)\n\t}\n\tfor {\n\t\tline, err := rdr.ReadBytes('\\n')\n\t\tif err == io.EOF {\n\t\t\tif opts.Follow {\n\t\t\t\tlog.Printf(\"pod \\\"%s\\\": end streaming\", name)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"read\")\n\t\t}\n\t\tout <- LogLine{r, name, string(line)}\n\t}\n\treturn nil\n}", "func GetActivityLogs(host string, verifyTLS bool, apiKey string, page int, number int) ([]models.ActivityLog, Error) {\n\tvar params []queryParam\n\tif page != 0 {\n\t\tparams = append(params, queryParam{Key: \"page\", Value: fmt.Sprint(page)})\n\t}\n\tif number != 0 {\n\t\tparams = append(params, queryParam{Key: \"per_page\", Value: fmt.Sprint(number)})\n\t}\n\n\turl, err := generateURL(host, \"/v3/logs\", params)\n\tif err != nil {\n\t\treturn nil, Error{Err: err, Message: \"Unable to generate url\"}\n\t}\n\n\tstatusCode, _, response, err := GetRequest(url, verifyTLS, apiKeyHeader(apiKey))\n\tif err != nil {\n\t\treturn nil, Error{Err: err, Message: \"Unable to fetch activity logs\", Code: statusCode}\n\t}\n\n\tvar result map[string]interface{}\n\terr = json.Unmarshal(response, &result)\n\tif err != nil {\n\t\treturn nil, Error{Err: err, Message: \"Unable to parse API response\", Code: statusCode}\n\t}\n\n\tvar logs []models.ActivityLog\n\tfor _, log := range result[\"logs\"].([]interface{}) {\n\t\tlog, ok := log.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, Error{Err: fmt.Errorf(\"Unexpected type parsing activity log, expected map[string]interface{}, got %T\", log), Message: \"Unable to parse API response\", Code: statusCode}\n\t\t}\n\t\tparsedLog := models.ParseActivityLog(log)\n\t\tlogs = append(logs, parsedLog)\n\t}\n\treturn logs, Error{}\n}", "func (o *GetActivitiesLogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetActivitiesLogOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewGetActivitiesLogBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 401:\n\t\tresult := NewGetActivitiesLogUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 409:\n\t\tresult := NewGetActivitiesLogConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (cmr *Consumer) Receive() ([]*LogEntry, error) {\n\tbuf := make([]*LogEntry, 1024)\n\terr := cmr.server.Decode(&buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf, nil\n}", "func (client *Client) ListApplicationLogs(request *ListApplicationLogsRequest) (response *ListApplicationLogsResponse, err error) {\n\tresponse = CreateListApplicationLogsResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (r *Runtime) copyFromDockerArchive(ctx context.Context, ref types.ImageReference, options *CopyOptions) ([]string, error) {\n\t// There may be more than one image inside the docker archive, so we\n\t// need a quick glimpse inside.\n\treader, readerRef, err := dockerArchiveTransport.NewReaderForReference(&r.systemContext, ref)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err := reader.Close(); err != nil {\n\t\t\tlogrus.Errorf(\"Closing reader of docker archive: %v\", err)\n\t\t}\n\t}()\n\n\treturn r.copyFromDockerArchiveReaderReference(ctx, reader, readerRef, options)\n}", "func klog_read(size int) ([]byte,error) {\n\tres\t:= make([]byte, size)\n\t_,err:= syscall.Klogctl( KLOG_READ, res)\n\tif err != nil {\n\t\treturn []byte{},err\n\t}\n\n\treturn res,nil\n}" ]
[ "0.7586045", "0.58952755", "0.53183043", "0.53183043", "0.5279923", "0.52486664", "0.52229095", "0.5184954", "0.5160827", "0.5146177", "0.51336867", "0.5071155", "0.5051781", "0.5022018", "0.49877", "0.49694368", "0.49560058", "0.49444798", "0.4885502", "0.48442796", "0.4818854", "0.48048857", "0.47773966", "0.47255927", "0.471308", "0.46723187", "0.46581292", "0.46573877", "0.46536353", "0.46499306", "0.46491966", "0.4635231", "0.4633864", "0.460035", "0.45988575", "0.45972982", "0.45817325", "0.45801932", "0.45654476", "0.45634782", "0.45616797", "0.45534483", "0.45326653", "0.45240548", "0.45049012", "0.4492539", "0.44750595", "0.44706035", "0.44555825", "0.4452814", "0.44510156", "0.44505236", "0.4445009", "0.44387814", "0.44282606", "0.4421968", "0.44151223", "0.44109628", "0.44092393", "0.440778", "0.43995064", "0.4395713", "0.4393801", "0.43934163", "0.43892366", "0.43886375", "0.43788785", "0.4376024", "0.43725514", "0.4371306", "0.43684906", "0.4353084", "0.4348594", "0.4347521", "0.4342744", "0.4341242", "0.43200338", "0.4317802", "0.43133414", "0.43121937", "0.4308767", "0.43063557", "0.43036294", "0.42896563", "0.42882568", "0.42810035", "0.42783782", "0.42741537", "0.42582735", "0.4258049", "0.4243953", "0.42431012", "0.42391047", "0.42316294", "0.42292687", "0.42279664", "0.4224339", "0.42204884", "0.42203972", "0.42203864" ]
0.79333687
0
Close closes internal .zip reader, writer and replaces old .zip file with the new one.
func (a *ChatLogsArchive) Close() error { if a.r != nil { _ = a.r.Close() } writtenFileName := a.wf.Name() err := a.w.Close() if err != nil { a.wf.Close() _ = os.Remove(writtenFileName) return fmt.Errorf("error closing .zip file %s: %w", a.wf.Name(), err) } err = a.wf.Close() if err != nil { _ = os.Remove(writtenFileName) return fmt.Errorf("error closing file %s: %w", writtenFileName, err) } err = MoveFile(writtenFileName, a.fileName) if err != nil { return fmt.Errorf("error overwriting file %s with %s: %w", a.fileName, writtenFileName, err) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func WriterClose(w *zip.Writer,) error", "func ReadCloserClose(rc *zip.ReadCloser,) error", "func (z zipReader) Close() error {\n\tz.b.Reset()\n\treturn z.s.CloseSend()\n}", "func (z *zipFile) Close() error {\n\terr := z.Writer.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn z.f.Close()\n}", "func (w *RWWrapper) Close() {\n\tif w.gz != nil {\n\t\tw.gz.Close()\n\t}\n}", "func (f *File) Close() {\n\tf.handleConcatenatedFiles()\n\tif f.AddInitPy {\n\t\tif err := f.AddInitPyFiles(); err != nil {\n\t\t\tlog.Fatalf(\"%s\", err)\n\t\t}\n\t}\n\tif err := f.w.Close(); err != nil {\n\t\tlog.Fatalf(\"Failed to finalise zip file: %s\", err)\n\t}\n\tif err := f.f.Close(); err != nil {\n\t\tlog.Fatalf(\"Failed to close file: %s\", err)\n\t}\n}", "func (w *writer) Close() error {\n\tw.Lock()\n\tdefer w.Unlock()\n\n\terr := w.bzip2In.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = io.Copy(w.w, w.bzip2Out)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tw.bzip2.Wait()\n\treturn nil\n}", "func WriterFlush(w *zip.Writer,) error", "func (z *Writer) Close() error {\n\tif err := z.checkError(); err != nil {\n\t\treturn err\n\t}\n\tif z.closed {\n\t\treturn nil\n\t}\n\n\tz.closed = true\n\tif !z.wroteHeader {\n\t\t_, err := z.Write(nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tz.compressCurrent(true)\n\tif err := z.checkError(); err != nil {\n\t\treturn err\n\t}\n\tclose(z.results)\n\tchecksum := z.digest.Sum32()\n\t// ZLIB (RFC 1950) is big-endian, unlike GZIP (RFC 1952).\n\tbinary.BigEndian.PutUint32(z.scratch[:], checksum)\n\t_, err := z.w.Write(z.scratch[0:4])\n\tif err != nil {\n\t\tz.pushError(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *cloner) writeZip(zipReader io.Reader, etag string) (string, error) {\n\tf, err := os.CreateTemp(c.cli.config.cacheDir, \"sample-apps-tmp-\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not create temporary file: %w\", err)\n\t}\n\tcleanTemp := true\n\tdefer func() {\n\t\tf.Close()\n\t\tif cleanTemp {\n\t\t\tos.Remove(f.Name())\n\t\t}\n\t}()\n\tif _, err := io.Copy(f, zipReader); err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not write sample apps to file: %s: %w\", f.Name(), err)\n\t}\n\tf.Close()\n\tpath := filepath.Join(c.cli.config.cacheDir, sampleAppsNamePrefix)\n\tif etag != \"\" {\n\t\tpath += \"_\" + etag\n\t}\n\tpath += \".zip\"\n\tif err := os.Rename(f.Name(), path); err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not move sample apps to %s\", path)\n\t}\n\tcleanTemp = false\n\treturn path, nil\n}", "func (p *Packer) Close() error {\n\tp.writeFooter()\n\treturn p.outFile.Close()\n}", "func (e *ExcelFile) Close() error {\n\treturn e.zipFile.Close()\n}", "func (w *Writer) Close() error {\n\tif w.lz4Stream != nil {\n\t\tC.LZ4_freeStream(w.lz4Stream)\n\t\tw.lz4Stream = nil\n\t}\n\treturn nil\n}", "func (r *reader) Close() error {\n\tif r.lz4Stream != nil {\n\t\tC.LZ4_freeStreamDecode(r.lz4Stream)\n\t\tr.lz4Stream = nil\n\t}\n\n\tC.free(r.left)\n\tC.free(r.right)\n\treturn nil\n}", "func (cw compressingWriter) Close() error {\n\tz := cw.WriteCloser.(*gzip.Writer)\n\terr := z.Flush()\n\tcw.p.Put(z)\n\treturn err\n}", "func UnzipImpl(reader *zip.Reader, dest string, verbose bool) error {\n for _, f := range reader.File {\n zipped, err := f.Open()\n if err != nil {\n return errors.New(\"unzip: Unable to open [\" + f.Name + \"]\")\n }\n\n defer zipped.Close()\n\n path := filepath.Join(dest, f.Name)\n if f.FileInfo().IsDir() {\n os.MkdirAll(path, f.Mode())\n if verbose {\n fmt.Println(\"Creating directory\", path)\n }\n } else {\n // Ensure we create the parent folder\n err := os.MkdirAll(filepath.Dir(path), os.ModePerm)\n if err != nil {\n return errors.New(\"unzip: Unable to create parent folder [\" + path + \"]\")\n }\n\n writer, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, f.Mode())\n if err != nil {\n return errors.New(\"unzip: Unable to create [\" + path + \"]\")\n }\n\n defer writer.Close()\n\n if _, err = io.Copy(writer, zipped); err != nil {\n return errors.New(\"unzip: Unable to create content in [\" + path + \"]\")\n }\n\n if verbose {\n fmt.Println(\"Decompressing : \", path)\n }\n }\n }\n return nil\n}", "func (w *writer) Close() error {\n\tif !atomic.CompareAndSwapInt32(&w.closed, 0, 1) {\n\t\treturn nil\n\t}\n\tif w.rotationURL == \"\" {\n\t\treturn nil\n\t}\n\tif w.rotationPath != \"\" {\n\t\tsrc := url.Path(w.destURL)\n\t\tif err := os.Rename(src, w.rotationPath); err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to rename: %v to %v\", src, w.rotationPath)\n\t\t}\n\t}\n\tgo func() {\n\t\tif err := w.closeQuietly(); err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t}()\n\treturn nil\n}", "func (a *ArchiveReader) Close() error {\n\treturn a.reader.Close()\n}", "func (a *InfluxArchiver) Close() error {\n\treturn nil\n}", "func (a *BinaryApplier) Close() (err error) {\n\tif a.closed {\n\t\treturn nil\n\t}\n\n\ta.closed = true\n\tif !a.dirty {\n\t\t_, err = copyFrom(a.dst, a.src, 0)\n\t} else {\n\t\t// do nothing, applying a binary fragment copies all data\n\t}\n\treturn err\n}", "func Unzip(src, dest string) (err error) {\n\tdest = filepath.Clean(dest) + string(os.PathSeparator)\n\n\tr, err := zip.OpenReader(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fs.CheckClose(r, &err)\n\n\tif err := file.MkdirAll(dest, 0755); err != nil {\n\t\treturn err\n\t}\n\n\t// Closure to address file descriptors issue with all the deferred .Close() methods\n\textractAndWriteFile := func(f *zip.File) error {\n\t\tpath := filepath.Join(dest, f.Name)\n\t\t// Check for Zip Slip: https://github.com/rclone/rclone/issues/3529\n\t\tif !strings.HasPrefix(path, dest) {\n\t\t\treturn fmt.Errorf(\"%s: illegal file path\", path)\n\t\t}\n\n\t\trc, err := f.Open()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer fs.CheckClose(rc, &err)\n\n\t\tif f.FileInfo().IsDir() {\n\t\t\tif err := file.MkdirAll(path, 0755); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tif err := file.MkdirAll(filepath.Dir(path), 0755); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tf, err := file.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer fs.CheckClose(f, &err)\n\n\t\t\t_, err = io.Copy(f, rc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor _, f := range r.File {\n\t\terr := extractAndWriteFile(f)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func Unzip(src, dest string) error {\n\tr, err := zip.OpenReader(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif err := r.Close(); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\tos.MkdirAll(dest, 0755)\n\n\t// Closure to address file descriptors issue with all the deferred .Close() methods\n\textractAndWriteFile := func(f *zip.File) error {\n\t\trc, err := f.Open()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer func() {\n\t\t\tif err := rc.Close(); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}()\n\n\t\tthePath := filepath.Join(dest, f.Name)\n\n\t\tif f.FileInfo().IsDir() {\n\t\t\tos.MkdirAll(thePath, f.Mode())\n\t\t} else {\n\t\t\tos.MkdirAll(filepath.Dir(thePath), f.Mode())\n\t\t\tf, err := os.OpenFile(thePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tdefer func() {\n\t\t\t\tif err := f.Close(); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\t_, err = io.Copy(f, rc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tfor _, f := range r.File {\n\t\terr := extractAndWriteFile(f)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (w *Writer) Close() error {\n\tif w.w == nil {\n\t\treturn nil\n\t}\n\n\tvar (\n\t\terrz error\n\t\terrc error\n\t)\n\n\terrz = w.wz.Close()\n\tif w.wc != nil {\n\t\twc := w.wc\n\t\tw.wc = nil\n\t\terrc = wc.Close()\n\t}\n\n\tw.w = nil\n\tw.wz = nil\n\n\tif errz != nil {\n\t\treturn fmt.Errorf(\"npz: could not close npz archive: %w\", errz)\n\t}\n\n\tif errc != nil {\n\t\treturn fmt.Errorf(\"npz: could not close npz file: %w\", errc)\n\t}\n\n\treturn nil\n}", "func (d *decompressor) Close() error {\n\tvar err error\n\tfor d.buf.Len() > 0 {\n\t\t_, err = d.writeUncompressed()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\td.closed = true\n\treturn nil\n}", "func Unzip(src, dest string) error {\n\tr, err := zip.OpenReader(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer r.Close()\n\n\tfor _, f := range r.File {\n\t\trc, err := f.Open()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rc.Close()\n\n\t\tpath := filepath.Join(dest, f.Name)\n\t\tif f.FileInfo().IsDir() {\n\t\t\tos.MkdirAll(path, f.Mode())\n\t\t} else {\n\t\t\tf, err := os.OpenFile(\n\t\t\t\tpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer f.Close()\n\t\t\t// kopiert aus reader in writer\n\t\t\t_, err = io.Copy(f, rc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (izm *InputZipsManager) reopen(miz *ManagedInputZip) error {\n\tif miz.realInputZip.IsOpen() {\n\t\tif miz != izm.openInputZips {\n\t\t\tmiz.unlink()\n\t\t\tizm.openInputZips.link(miz)\n\t\t}\n\t\treturn nil\n\t}\n\tif izm.nOpenZips >= izm.maxOpenZips {\n\t\tif err := izm.close(izm.openInputZips.older); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := miz.realInputZip.Open(); err != nil {\n\t\treturn err\n\t}\n\tizm.openInputZips.link(miz)\n\tizm.nOpenZips++\n\treturn nil\n}", "func (w *Writer) Close() error {\n\t// Flush the last file's content.\n\tif err := w.tw.Flush(); err != nil {\n\t\treturn err\n\t}\n\t// Close chunk and index writer.\n\tif err := w.cw.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn w.iw.Close()\n}", "func (s *stagingSink) Close() error {\n\t// Close the underlying storage.\n\tif err := s.storage.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"unable to close underlying storage\")\n\t}\n\n\t// Compute the final digest.\n\tdigest := s.digester.Sum(nil)\n\n\t// Compute where the file should be relocated.\n\tdestination, prefix, err := pathForStaging(s.stager.root, s.path, digest)\n\tif err != nil {\n\t\tos.Remove(s.storage.Name())\n\t\treturn errors.Wrap(err, \"unable to compute staging destination\")\n\t}\n\n\t// Ensure the prefix directory exists.\n\tif err = s.stager.ensurePrefixExists(prefix); err != nil {\n\t\tos.Remove(s.storage.Name())\n\t\treturn errors.Wrap(err, \"unable to create prefix directory\")\n\t}\n\n\t// Relocate the file to the destination.\n\tif err = os.Rename(s.storage.Name(), destination); err != nil {\n\t\tos.Remove(s.storage.Name())\n\t\treturn errors.Wrap(err, \"unable to relocate file\")\n\t}\n\n\t// Success.\n\treturn nil\n}", "func (fw *Writer) Close() (err error) {\n\tif fw.open {\n\t\t// if any functions here panic, we set open to be false so\n\t\t// that this doesn't get called again\n\t\tfw.open = false\n\t\tif fw.rowGroupWriter != nil {\n\t\t\tfw.nrows += fw.rowGroupWriter.nrows\n\t\t\tfw.rowGroupWriter.Close()\n\t\t}\n\t\tfw.rowGroupWriter = nil\n\t\tdefer func() {\n\t\t\tierr := fw.sink.Close()\n\t\t\tif err != nil {\n\t\t\t\tif ierr != nil {\n\t\t\t\t\terr = fmt.Errorf(\"error on close:%w, %s\", err, ierr)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\terr = ierr\n\t\t}()\n\n\t\tfileEncryptProps := fw.props.FileEncryptionProperties()\n\t\tif fileEncryptProps == nil { // non encrypted file\n\t\t\tif fw.FileMetadata, err = fw.metadata.Finish(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = writeFileMetadata(fw.FileMetadata, fw.sink)\n\t\t\treturn err\n\t\t}\n\n\t\treturn fw.closeEncryptedFile(fileEncryptProps)\n\t}\n\treturn nil\n}", "func (u *Updater) Apply(reader io.Reader) error {\n\ttmpPath := os.TempDir()\n\terr := archiver.TarGz.Read(reader, tmpPath)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could not unzip the asset\")\n\t}\n\n\ttargetPath, err := osext.Executable()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could not get the executable path\")\n\t}\n\n\tupdateDir := filepath.Dir(targetPath)\n\tfilename := filepath.Base(targetPath)\n\n\tnewPath := filepath.Join(updateDir, fmt.Sprintf(\".%s.new\", filename))\n\tfp, err := os.OpenFile(newPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0755)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could not open the file\")\n\t}\n\n\tdefer fp.Close()\n\n\tnewBytes, err := ioutil.ReadFile(path.Join(tmpPath, filename))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could not find new binary\")\n\t}\n\n\t_, err = io.Copy(fp, bytes.NewReader(newBytes))\n\n\t// if we don't call fp.Close(), windows won't let us move the new executable\n\t// because the file will still be \"in use\"\n\tfp.Close()\n\n\toldPath := filepath.Join(updateDir, fmt.Sprintf(\".%s.old\", filename))\n\n\t// delete any existing old exec file - this is necessary on Windows for two reasons:\n\t// 1. after a successful update, Windows can't remove the .old file because the process is still running\n\t// 2. windows rename operations fail if the destination file already exists\n\t_ = os.Remove(oldPath)\n\n\t// move the existing executable to a new file in the same directory\n\terr = os.Rename(targetPath, oldPath)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could move the new binary to path\")\n\t}\n\n\t// move the new exectuable in to become the new program\n\terr = os.Rename(newPath, targetPath)\n\tif err != nil {\n\t\t// move unsuccessful\n\t\t//\n\t\t// The filesystem is now in a bad state. We have successfully\n\t\t// moved the existing binary to a new location, but we couldn't move the new\n\t\t// binary to take its place. That means there is no file where the current executable binary\n\t\t// used to be!\n\t\t// Try to rollback by restoring the old binary to its original path.\n\t\terr = os.Rename(oldPath, targetPath)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"There was an error while renaming the binary\")\n\t\t}\n\t}\n\n\terrRemove := os.Remove(oldPath)\n\t// windows has trouble with removing old binaries, so hide it instead\n\tif errRemove != nil {\n\t\t_ = hideFile(oldPath)\n\t}\n\n\treturn nil\n}", "func (w *singleWarcFileWriter) close() error {\n\tif w.currentFile != nil {\n\t\tf := w.currentFile\n\t\tw.currentFile = nil\n\t\tw.currentFileName = \"\"\n\t\tif err := f.Close(); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to close file: %s: %w\", f.Name(), err)\n\t\t}\n\t\tif err := fileutil.Rename(f.Name(), strings.TrimSuffix(f.Name(), w.opts.openFileSuffix)); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to rename file: %s: %w\", f.Name(), err)\n\t\t}\n\t}\n\treturn nil\n}", "func (dec *ZstdDecompressor) Close() {\n\tdec.decoder.Close()\n}", "func unzip(src string) error {\n r, err := zip.OpenReader(src)\n if err != nil {\n return err\n }\n defer func() {\n if err := r.Close(); err != nil {\n panic(err)\n }\n }()\n dest := filepath.Dir(src)\n\n // Closure to address file descriptors issue with all the deferred .Close() methods\n extractAndWriteFile := func(f *zip.File) error {\n rc, err := f.Open()\n if err != nil {\n return err\n }\n defer func() {\n if err := rc.Close(); err != nil {\n panic(err)\n }\n }()\n path := filepath.Join(dest, f.Name)\n\n if f.FileInfo().IsDir() {\n os.MkdirAll(path, f.Mode())\n } else {\n f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())\n if err != nil {\n return err\n }\n defer func() {\n if err := f.Close(); err != nil {\n panic(err)\n }\n }()\n _, err = io.Copy(f, rc)\n if err != nil {\n return err\n }\n }\n return nil\n }\n\n for _, f := range r.File {\n err := extractAndWriteFile(f)\n if err != nil {\n return err\n }\n }\n\n return nil\n}", "func (w *fileWAL) close() error {\n\tif w.f != nil {\n\t\terr := w.f.Close()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tw.f = nil\n\tw.lastReadOffset = 0\n\treturn nil\n}", "func Unzip(src []byte, dest string) error {\n\tr := openZip(src)\n\tos.MkdirAll(dest, 0755)\n\t// Closure to address file descriptors issue with all the deferred .Close() methods\n\textractAndWriteFile := func(f *zip.File) error {\n\n\t\tpath := filepath.Join(dest, f.Name)\n\t\tisLink := f.FileInfo().Mode()&os.ModeSymlink == os.ModeSymlink\n\n\t\t// dir\n\t\tif f.FileInfo().IsDir() && !isLink {\n\t\t\treturn os.MkdirAll(path, f.Mode())\n\t\t}\n\n\t\t// open file\n\t\trc, err := f.Open()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rc.Close()\n\n\t\t// link\n\t\tif isLink {\n\t\t\tbuf, err := ioutil.ReadAll(rc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn os.Symlink(string(buf), path)\n\t\t}\n\n\t\t// file\n\t\t// eventually create a missing ddir\n\t\terr = os.MkdirAll(filepath.Dir(path), 0755)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfile, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer file.Close()\n\t\t_, err = io.Copy(file, rc)\n\t\treturn err\n\t}\n\tfor _, f := range r.File {\n\t\terr := extractAndWriteFile(f)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\treturn nil\n}", "func (z *Zip) UnZip(src, dest string) error {\n\tr, err := zip.OpenReader(file.ReplacePathSeparator(src))\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, fileOpenedOnZip := range r.File {\n\t\tcontentFileOpenedOnZip, err := fileOpenedOnZip.Open()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = z.createFileAndFolderToUnZip(file.ReplacePathSeparator(dest), contentFileOpenedOnZip, fileOpenedOnZip)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn r.Close()\n}", "func (c *CompressingResponseWriter) Close() error {\n\tif c.isCompressorClosed() {\n\t\treturn errors.New(\"Compressing error: tried to close already closed compressor\")\n\t}\n\n\tc.compressor.Close()\n\tif ENCODING_GZIP == c.encoding {\n\t\tcurrentCompressorProvider.ReleaseGzipWriter(c.compressor.(*gzip.Writer))\n\t}\n\tif ENCODING_DEFLATE == c.encoding {\n\t\tcurrentCompressorProvider.ReleaseZlibWriter(c.compressor.(*zlib.Writer))\n\t}\n\t// gc hint needed?\n\tc.compressor = nil\n\treturn nil\n}", "func NewWriter(w io.Writer) *zip.Writer", "func (c *Compressor) Close() error {\n\tif err := c.wc.Close(); err != nil {\n\t\treturn err\n\t}\n\tif c.uw != nil {\n\t\treturn c.uw.Close()\n\t}\n\treturn nil\n}", "func (it *BucketFileContentUpdateIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "func (w *ReadWriter) Close() error {\n\tif w.withErr != nil {\n\t\treturn w.withErr\n\t}\n\tw.b = w.b[0:0]\n\treturn nil\n}", "func (dc *Decompressor) Close() error {\n\tif dc.ct == NoCompression {\n\t\tpanic(\"no suppose to reach here\")\n\t} else if dc.ct == Snappy {\n\t\treturn dc.ur.Close()\n\t} else {\n\t\tpanic(\"unknown compression type\")\n\t}\n}", "func (w *BatchedFileWriter) Close() error {\n\tif w.compressOnClose {\n\t\treturn w.compressAndCloseLog()\n\t}\n\n\treturn w.file.Close()\n}", "func Unarchive(reader io.ReaderAt, readerSize int64, outFilePath string, progress ProgressFunc) (err error) {\n\tvar zipReader *zip.Reader\n\tvar j int\n\n\tzipReader, err = zip.NewReader(reader, readerSize)\n\tif err == nil {\n\t\tfor j = 0; j < len(zipReader.File) && err == nil; j++ {\n\t\t\terr = unarchiveFile(zipReader.File[j], outFilePath, progress)\n\t\t}\n\n\t}\n\treturn\n}", "func (w *FileWriter) Close() (err error) {\n\tw.Lock()\n\tdefer w.Unlock()\n\n\t// Rotate before closing\n\tif err := w.rotateIfNeeded(); err != nil {\n\t\treturn err\n\t}\n\n\t// Close the file if we did not rotate\n\tif err := w.current.Close(); err != nil {\n\t\treturn err\n\t}\n\n\tw.current = nil\n\treturn nil\n}", "func (w *RotateWriter) close() error {\n\tif w.fp == nil {\n\t\treturn nil\n\t}\n\tw.fp = nil\n\treturn w.fp.Close()\n}", "func (it *BucketNewFileIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "func (wf *WarcFileReader) Close() error {\n\tinputBufPool.Put(wf.bufferedReader)\n\treturn wf.file.Close()\n}", "func (w *Writer) Close() error {\n\tw.finishPublicSection()\n\thb := w.headerBytes()\n\n\tbuf := bytes.NewBuffer(hb)\n\tw.Stats.Footer = Footer{\n\t\tRefIndexOffset: w.Stats.BlockStats[BlockTypeRef].IndexOffset,\n\t\tObjOffset: w.Stats.BlockStats[BlockTypeObj].Offset,\n\t\tObjIndexOffset: w.Stats.BlockStats[BlockTypeObj].IndexOffset,\n\t\tLogOffset: w.Stats.BlockStats[BlockTypeLog].Offset,\n\t\tLogIndexOffset: w.Stats.BlockStats[BlockTypeLog].IndexOffset,\n\t}\n\n\tf := w.Stats.Footer\n\tf.ObjOffset = f.ObjOffset<<5 | uint64(w.Stats.ObjectIDLen)\n\n\tif err := binary.Write(buf, binary.BigEndian, &f); err != nil {\n\t\treturn err\n\t}\n\n\th := crc32.NewIEEE()\n\th.Write(buf.Bytes())\n\tcrc := h.Sum32()\n\n\tbinary.Write(buf, binary.BigEndian, crc)\n\n\tw.paddedWriter.pendingPadding = 0\n\tn, err := w.paddedWriter.Write(buf.Bytes(), 0)\n\tif n != footerSize {\n\t\tlog.Panicf(\"footer size %d\", n)\n\t}\n\treturn err\n}", "func (w *Writer) Close() error {\n\tif err := w.lock(); err != nil {\n\t\treturn err\n\t}\n\tdefer w.unlock()\n\n\tb, err := json.Marshal(&w.manifest)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := w.sendBytesLocked(manifestFileName, b); err != nil {\n\t\treturn err\n\t}\n\n\tb, err = json.Marshal(w.repositories)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshaling repositories: %w\", err)\n\t}\n\tif err := w.sendBytesLocked(legacyRepositoriesFileName, b); err != nil {\n\t\treturn fmt.Errorf(\"writing config json file: %w\", err)\n\t}\n\n\tif err := w.tar.Close(); err != nil {\n\t\treturn err\n\t}\n\tw.tar = nil // Mark the Writer as closed.\n\treturn nil\n}", "func (w *Writer) Close() error {}", "func (z *zstdReader) Close() error {\n\treturn z.src.Close()\n}", "func (i *Index) Close() error {\n\tif err := i.mmap.Sync(gommap.MS_SYNC); err != nil {\n\t\treturn lib.Wrap(err, \"Unable to sync mmap\")\n\t}\n\n\tif err := i.file.Sync(); err != nil {\n\t\treturn lib.Wrap(err, \"Unable to sync file\")\n\t}\n\n\tif err := i.file.Truncate(int64(i.size)); err != nil {\n\t\treturn lib.Wrap(err, \"Unable to truncate file\")\n\t}\n\n\treturn i.file.Close()\n}", "func (r *XmlReader) Close() {\n\t// TODO: implement\n}", "func unzip(src io.ReadCloser) (io.ReadCloser, error) {\n\t// Write the zip file to a temporary file on disk.\n\tfile, err := os.Create(TmpFileLoc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tfile.Close()\n\t\tsrc.Close()\n\t}()\n\tif _, err := io.Copy(file, src); err != nil {\n\t\treturn nil, err\n\t}\n\t// Open the temporary file and extract the first zipped file.\n\tr, err := zip.OpenReader(TmpFileLoc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(r.File) == 0 {\n\t\treturn nil, fmt.Errorf(\"unzip %s: empty zip file\", TmpFileLoc)\n\t}\n\tf := r.File[0] // Assuming that the zip file contains only a single file.\n\treturn f.Open()\n}", "func (z *Zip) Unlock(r io.Reader, password string) (io.Reader, error) {\n\tvar (\n\t\tresult = bytes.Buffer{}\n\t\tbs, _ = ioutil.ReadAll(r)\n\t\tbuf = bytes.NewReader(bs)\n\t)\n\tziprd, err := zip.NewReader(buf, buf.Size())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, file := range ziprd.File {\n\t\tif file.IsEncrypted() {\n\t\t\tfile.SetPassword(password)\n\t\t}\n\t\tfrd, err := file.Open()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdefer frd.Close()\n\n\t\t_, err = io.Copy(&result, frd)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &result, nil\n}", "func (directory) Close() error { return nil }", "func (w *writer) Close() {\n\tw.mutex.Lock()\n\tw.isClosed = true\n\tw.updateStateLocked(false, 0)\n\tw.mutex.Unlock()\n\tw.free.Close()\n}", "func Unzip(src, dest string) error {\n\tr, err := zip.OpenReader(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer r.Close()\n\n\tfor _, f := range r.File {\n\t\trc, err := f.Open()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rc.Close()\n\n\t\tfpath := filepath.Join(dest, f.Name)\n\t\tif f.FileInfo().IsDir() {\n\t\t\tos.MkdirAll(fpath, f.Mode())\n\t\t} else {\n\t\t\tvar fdir string\n\t\t\tif lastIndex := strings.LastIndex(fpath, string(os.PathSeparator)); lastIndex > -1 {\n\t\t\t\tfdir = fpath[:lastIndex]\n\t\t\t}\n\n\t\t\terr = os.MkdirAll(fdir, f.Mode())\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tf, err := os.OpenFile(\n\t\t\t\tfpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer f.Close()\n\n\t\t\t_, err = io.Copy(f, rc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (d *archiveImageDestination) Close() error {\n\tif d.closeWriter {\n\t\treturn d.writer.Close()\n\t}\n\treturn nil\n}", "func (cfp *FsPool) Close() error {\n\tif cfp.reader != nil {\n\t\terr := cfp.reader.Close()\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\n\t\tcfp.reader = nil\n\t\tcfp.fileIndex = -1\n\t}\n\n\treturn nil\n}", "func unarchive(rd io.Reader, update *Package) error {\n\tfmap := update.getFileMap()\n\tretVal := reflect.ValueOf(update).Elem()\n\n\tgzf, err := gzip.NewReader(io.LimitReader(rd, MaxFileSize))\n\tif err != nil {\n\t\treturn chkitErrors.Wrap(ErrUnpack, err)\n\t}\n\tdefer gzf.Close()\n\n\ttarf := tar.NewReader(gzf)\n\n\tfor {\n\t\theader, nextErr := tarf.Next()\n\t\tif nextErr == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif nextErr != nil {\n\t\t\treturn chkitErrors.Wrap(ErrUnpack, nextErr)\n\t\t}\n\n\t\tif header.Typeflag == tar.TypeReg {\n\t\t\tfield, updateFile := fmap[strings.TrimPrefix(header.Name, \"./\")]\n\t\t\tif updateFile {\n\t\t\t\t// this is our file, unpack it\n\t\t\t\tbuf := bytes.NewBuffer([]byte{})\n\t\t\t\tif _, copyErr := io.Copy(buf, tarf); copyErr != nil {\n\t\t\t\t\treturn chkitErrors.Wrap(ErrUnpack, copyErr)\n\t\t\t\t}\n\n\t\t\t\tretVal.Field(field).Set(reflect.ValueOf(io.Reader(buf)))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (x *FzZipWriter) Free() {\n\tif x != nil {\n\t\tC.free(unsafe.Pointer(x))\n\t}\n}", "func (m *FileSource) Close() error { return nil }", "func (enc *Encoder) Close() error {\n\tif err := enc.ensureHeaderWritten(); err != nil {\n\t\treturn err\n\t}\n\n\t// Close the assetMap variable and write asset names.\n\tif _, err := fmt.Fprint(enc.w, \"}\\n\\n\"); err != nil {\n\t\treturn err\n\t} else if err := enc.writeAssetNames(); err != nil {\n\t\treturn err\n\t}\n\n\t// Write generic types & functions.\n\tif err := enc.writeFileType(); err != nil {\n\t\treturn err\n\t} else if err := enc.writeAssetFuncs(); err != nil {\n\t\treturn err\n\t} else if err := enc.writeFileSystem(); err != nil {\n\t\treturn err\n\t} else if err := enc.writeHashFuncs(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (w *DecryptBlocksWriter) Close() error {\n\tif w.decrypter != nil {\n\t\terr := w.decrypter.Close()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif closer, ok := w.writer.(io.Closer); ok {\n\t\treturn closer.Close()\n\t}\n\treturn nil\n}", "func (t *TarFile) Close() error {\n\terr := t.Writer.Close()\n\treturn err\n}", "func (p *Paket) Close() error {\n\terr := p.file.Close()\n\tp.key = nil\n\tp.table = nil\n\tp.file = nil\n\tp = nil\n\treturn err\n}", "func (w *Writer) Close() error {\n\tw.closed = true\n\t// Note: new levels can be created while closing, so the number of iterations\n\t// necessary can increase as the levels are being closed. The number of ranges\n\t// will decrease per level as long as the range size is in general larger than\n\t// a serialized header. Levels stop getting created when the top level chunk\n\t// writer has been closed and the number of ranges it has is one.\n\tfor i := 0; i < len(w.levels); i++ {\n\t\tl := w.levels[i]\n\t\tif err := l.tw.Flush(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := l.cw.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// (bryce) this method of terminating the index can create garbage (level\n\t\t// above the final level).\n\t\tif l.cw.AnnotationCount() == 1 && l.cw.ChunkCount() == 1 {\n\t\t\tbreak\n\t\t}\n\t}\n\t// Write the final index level to the path.\n\tobjW, err := w.objC.Writer(w.ctx, w.path)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttw := tar.NewWriter(objW)\n\tif err := w.serialize(tw, w.root); err != nil {\n\t\treturn err\n\t}\n\tif err := tw.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn objW.Close()\n}", "func (r *Scanner) Close() error {\n\terr1 := r.journalDir.Close()\n\terr2 := r.file.Close()\n\tif err1 != nil {\n\t\treturn err1\n\t}\n\treturn err2\n}", "func (i *UploadShrinker) Close() error {\n\treturn i.f.Close()\n}", "func (e *Extractor) Close() error {\n\tif e.state < statePre {\n\t\treturn errPrematureClose\n\t}\n\treturn e.be.close()\n}", "func (x *Reader) Close() error {\n\tx.Reader = nil\n\tif x.File != nil {\n\t\tif err := x.File.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tx.File = nil\n\t}\n\treturn nil\n}", "func (w *writer) Close() error {\n\tfor name, file := range w.files {\n\t\tif file != nil {\n\t\t\tfile.Close()\n\t\t\tdelete(w.files, name)\n\t\t}\n\t}\n\treturn nil\n}", "func (xlsxw *XLSXWriter) Close(ctx context.Context) error {\n\tif xlsxw.closer != nil {\n\t\terrFl := xlsxw.bWr.Flush()\n\t\terrCl := xlsxw.closer.Close()\n\t\txlsxw.closer = nil\n\n\t\tif errCl != nil {\n\t\t\treturn errCl\n\t\t}\n\n\t\treturn errFl\n\t}\n\treturn errors.New(\"already closed\")\n\n}", "func (it *MonsterAccessControlContractUpgradeIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "func (f *FileRotator) Close() error {\n\tf.fileLock.Lock()\n\tdefer f.fileLock.Unlock()\n\n\t// Stop the ticker and flush for one last time\n\tf.flushTicker.Stop()\n\tf.flushBuffer()\n\n\t// Stop the go routines\n\tif !f.closed {\n\t\tclose(f.doneCh)\n\t\tclose(f.purgeCh)\n\t\tf.closed = true\n\t\tf.currentFile.Close()\n\t}\n\n\treturn nil\n}", "func (it *RegistryOperatorContractUpgraderUpdatedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "func (fw *Writer) Close() {\n\tfb := fw.buf\n\tif fb.numRecords > 0 {\n\t\tlog.Debug.Printf(\"%v: Start flush (close)\", fb.label)\n\t\tfw.FlushBuf()\n\t} else {\n\t\tfw.bufFreePool.pool.Put(fb)\n\t\tfw.buf = nil\n\t}\n\tif fw.out != nil {\n\t\tfw.rio.Wait()\n\t\tindex := biopb.PAMFieldIndex{\n\t\t\tMagic: FieldIndexMagic,\n\t\t\tVersion: pamutil.DefaultVersion,\n\t\t\tBlocks: fw.blockIndexes,\n\t\t}\n\t\tlog.Debug.Printf(\"creating index with %d blocks\", len(index.Blocks))\n\t\tdata, err := index.Marshal()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tfw.rio.SetTrailer(data)\n\t\tif err := fw.rio.Finish(); err != nil {\n\t\t\tfw.err.Set(err)\n\t\t}\n\t\tif err := fw.out.Close(vcontext.Background()); err != nil {\n\t\t\tfw.err.Set(errors.E(err, fmt.Sprintf(\"fieldio close %s\", fw.out.Name())))\n\t\t}\n\t}\n}", "func (it *KeepRegistryOperatorContractUpgraderUpdatedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "func (si *ScanIterator) Close() {\n\t// Cleanup\n}", "func (z *Writer) Close() error {\n\tif !z.Header.done {\n\t\tif err := z.writeHeader(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := z.Flush(); err != nil {\n\t\treturn err\n\t}\n\tif err := z.close(); err != nil {\n\t\treturn err\n\t}\n\tz.freeBuffers()\n\n\tif debugFlag {\n\t\tdebug(\"writing last empty block\")\n\t}\n\tif err := z.writeUint32(0); err != nil {\n\t\treturn err\n\t}\n\tif z.NoChecksum {\n\t\treturn nil\n\t}\n\tchecksum := z.checksum.Sum32()\n\tif debugFlag {\n\t\tdebug(\"stream checksum %x\", checksum)\n\t}\n\treturn z.writeUint32(checksum)\n}", "func (fr *FragmentReader) Close() error {\n\tvar errA, errB = fr.decomp.Close(), fr.raw.Close()\n\tif errA != nil {\n\t\treturn errA\n\t}\n\treturn errB\n}", "func Zip(ctx context.Context, body io.Reader, location string, rename Renamer) error {\n\textractor := Extractor{\n\t\tFS: fs{},\n\t}\n\n\treturn extractor.Zip(ctx, body, location, rename)\n}", "func (self *Transcoder) Close() (err error) {\n\tfor _, stream := range self.streams {\n\t\tif stream.aenc != nil {\n\t\t\tstream.aenc.Close()\n\t\t\tstream.aenc = nil\n\t\t}\n\t\tif stream.adec != nil {\n\t\t\tstream.adec.Close()\n\t\t\tstream.adec = nil\n\t\t}\n\t}\n\tself.streams = nil\n\treturn\n}", "func (p *BinlogFile) Close() {\n\tif p.reader != nil {\n\t\tp.reader.Close()\n\t\tp.reader = nil\n\t}\n}", "func (it *CrowdsaleWalletUpdatedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "func (l *revWriter) Close() error {\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\treturn l.close()\n}", "func (pt *Postailer) Close() error {\n\tdefer pt.file.Close()\n\treturn savePos(pt.posFile, pt.pos)\n}", "func AddToZip(zip *zip.Writer, zipQ chan FetchedStream) error {\n\tfetched := <-zipQ\n\tif fetched.Err != nil {\n\t\tfmt.Printf(\"Error in fetching stream , stream name %s, err %s\", fetched.Name, fetched.Err.Error())\n\t\treturn fetched.Err\n\t}\n\tdefer fetched.Stream.Close()\n\turlEntry, err := zip.Create(fetched.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"Adding stream entry to zip %s\\n\", fetched.Name)\n\tdefer fetched.Stream.Close()\n\tio.Copy(urlEntry, fetched.Stream)\n\treturn nil\n}", "func (trans *Transcoder) Close() (err error) {\n\tfor _, stream := range trans.streams {\n\t\tif stream.aenc != nil {\n\t\t\tstream.aenc.Close()\n\t\t\tstream.aenc = nil\n\t\t}\n\t\tif stream.adec != nil {\n\t\t\tstream.adec.Close()\n\t\t\tstream.adec = nil\n\t\t}\n\t}\n\ttrans.streams = nil\n\treturn\n}", "func (r *bodyReader) Close() error {\n\tswitch r.contentEncoding {\n\tcase \"\":\n\t\treturn nil\n\tcase \"gzip\":\n\t\treturn r.r.Close()\n\tdefault:\n\t\tpanic(\"Unreachable\")\n\t}\n}", "func (f *IndexFile) Close() error {\n\t// Wait until all references are released.\n\tf.wg.Wait()\n\n\tf.sblk = SeriesBlock{}\n\tf.tblks = nil\n\tf.mblk = MeasurementBlock{}\n\tf.seriesN = 0\n\treturn mmap.Unmap(f.data)\n}", "func (npw *Writer) Close() error {\n\tif npw.closed {\n\t\treturn nil\n\t}\n\n\tnpw.closed = true\n\n\tblockBufOffset := npw.offset % BigBlockSize\n\n\tif blockBufOffset > 0 {\n\t\tblockIndex := npw.offset / BigBlockSize\n\t\terr := npw.Pool.Downstream.Store(BlockLocation{FileIndex: npw.FileIndex, BlockIndex: blockIndex}, npw.blockBuf[:blockBufOffset])\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (x *FzArchive) Free() {\n\tif x != nil {\n\t\tC.free(unsafe.Pointer(x))\n\t}\n}", "func (h *Handler) processZip(zipPath string) {\n\tdefer h.SY.WG.Done()\n\tzr, err := zip.OpenReader(zipPath)\n\tif err != nil {\n\t\th.LOG.E.Printf(\"incorrect zip archive %s\\n\", zipPath)\n\t\th.moveFile(zipPath, err)\n\t\treturn\n\t}\n\tdefer zr.Close()\n\n\tfor _, file := range zr.File {\n\t\th.LOG.D.Print(ZipEntryInfo(file))\n\t\tif filepath.Ext(file.Name) != \".fb2\" {\n\t\t\th.LOG.E.Printf(\"file %s from %s has not FB2 format\\n\", file.Name, filepath.Base(zipPath))\n\t\t\tcontinue\n\t\t}\n\t\tif h.DB.IsInStock(file.Name, file.CRC32) {\n\t\t\th.LOG.I.Printf(\"file %s from %s is in stock already and has been skipped\\n\", file.Name, filepath.Base(zipPath))\n\t\t\tcontinue\n\t\t}\n\t\tif file.UncompressedSize == 0 {\n\t\t\th.LOG.E.Printf(\"file %s from %s has size of zero\\n\", file.Name, filepath.Base(zipPath))\n\t\t\tcontinue\n\t\t}\n\t\tf, _ := file.Open()\n\t\tvar p parser.Parser\n\t\tswitch filepath.Ext(file.Name) {\n\t\tcase \".fb2\":\n\t\t\tp, err = fb2.NewFB2(f)\n\t\t\tif err != nil {\n\t\t\t\th.LOG.I.Printf(\"file %s from %s has error: %s\\n\", file.Name, filepath.Base(zipPath), err.Error())\n\t\t\t\tf.Close()\n\t\t\t\tcontinue\n\t\t\t}\n\t\tdefault:\n\t\t\th.LOG.E.Printf(\"file %s has not supported format \\\"%s\\\"\\n\", file.Name, filepath.Ext(file.Name))\n\t\t}\n\t\th.LOG.D.Println(p)\n\t\tbook := &model.Book{\n\t\t\tFile: file.Name,\n\t\t\tCRC32: file.CRC32,\n\t\t\tArchive: filepath.Base(zipPath),\n\t\t\tSize: int64(file.UncompressedSize),\n\t\t\tFormat: p.GetFormat(),\n\t\t\tTitle: p.GetTitle(),\n\t\t\tSort: p.GetSort(),\n\t\t\tYear: p.GetYear(),\n\t\t\tPlot: p.GetPlot(),\n\t\t\tCover: p.GetCover(),\n\t\t\tLanguage: p.GetLanguage(),\n\t\t\tAuthors: p.GetAuthors(),\n\t\t\tGenres: p.GetGenres(),\n\t\t\tSerie: p.GetSerie(),\n\t\t\tSerieNum: p.GetSerieNumber(),\n\t\t\tUpdated: time.Now().Unix(),\n\t\t}\n\t\tif !h.acceptLanguage(book.Language.Code) {\n\t\t\th.LOG.E.Printf(\"publication language \\\"%s\\\" is not accepted, file %s from %s has been skipped\\n\", book.Language.Code, file.Name, filepath.Base(zipPath))\n\t\t\tcontinue\n\t\t}\n\t\th.adjustGenges(book)\n\t\th.DB.NewBook(book)\n\t\tf.Close()\n\t\th.LOG.I.Printf(\"file %s from %s has been added\\n\", file.Name, filepath.Base(zipPath))\n\n\t\t// runtime.Gosched()\n\t}\n\th.moveFile(zipPath, nil)\n\t<-h.SY.Quota\n}", "func (it *Univ2SwapIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "func (a *Archiver) Close() error {\n\treturn a.db.Close()\n}", "func (w *FormSerializationWriter) Close() error {\n\tw.writer = make([]string, 0)\n\treturn nil\n}", "func (e Embedder) Close() error {\n\terr := e.writer.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(e.origin, binary.BigEndian, embedFsFootprint{\n\t\tsignature,\n\t\te.offset,\n\t})\n\n\treturn err\n}" ]
[ "0.717301", "0.65392286", "0.6537931", "0.6523064", "0.631727", "0.6281689", "0.6138125", "0.5992227", "0.5911283", "0.58061427", "0.57715905", "0.57247275", "0.5722166", "0.5644056", "0.5580495", "0.550835", "0.5488001", "0.547102", "0.547033", "0.5405504", "0.5405358", "0.5371109", "0.5337497", "0.53266966", "0.529893", "0.5295124", "0.5283617", "0.5259095", "0.52365506", "0.5234465", "0.5233157", "0.52330995", "0.5193609", "0.51795846", "0.5162007", "0.5148811", "0.5144549", "0.5138408", "0.5104131", "0.51014173", "0.5093408", "0.50813085", "0.5075931", "0.5067289", "0.5056238", "0.5049486", "0.50169325", "0.49747822", "0.49609178", "0.4957385", "0.49514022", "0.49476436", "0.49335936", "0.49310863", "0.4925743", "0.49161884", "0.4915179", "0.49139562", "0.4910919", "0.49067754", "0.49028832", "0.489702", "0.4884893", "0.48841226", "0.4876974", "0.48689732", "0.48682246", "0.48671427", "0.48373038", "0.48312828", "0.48231572", "0.4814572", "0.48018348", "0.47989392", "0.47978246", "0.47971815", "0.4788157", "0.4779991", "0.4779613", "0.4779057", "0.47736663", "0.47732255", "0.4772332", "0.47681364", "0.47628805", "0.4757418", "0.47378343", "0.4736848", "0.47354594", "0.47325706", "0.47256517", "0.47206613", "0.4717841", "0.47049528", "0.47032058", "0.4699055", "0.4697513", "0.4693547", "0.4692765", "0.468578" ]
0.63897073
4
GetAccountNames extracts account names from the archive.
func (a *ChatLogsArchive) GetAccountNames() ([]string, error) { if a.r == nil { return nil, nil } var accountNamesMap = make(map[string]interface{}) for _, f := range a.r.File { // Take only .txt files. if filepath.Ext(f.Name) != ".txt" { continue } path := filepath.Dir(f.Name) // Take files from 1st level directories only. if path != "" && !strings.ContainsAny(path, "/\\") { accountNamesMap[path] = nil } } var accountNames []string for accountName := range accountNamesMap { accountNames = append(accountNames, accountName) } return accountNames, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getAccounts() ([]string, error) {\n\tout, err := exec.Command(\"ykman\", \"oath\", \"accounts\", \"list\").Output()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//fmt.Printf(\"Cmd out:\\n%s\\n\", out)\n\treturn strings.Split(strings.ReplaceAll(string(out), \"\\r\\n\", \"\\n\"), \"\\n\"), nil\n}", "func GetAZNameList() (names []string) {\n\tazs, _ := GetAZs()\n\tazlist := make([]string, len(*azs))\n\n\tfor i, az := range *azs {\n\t\tazlist[i] = az.Name\n\t}\n\treturn azlist\n}", "func (t *SimpleChaincode) query_account_names (stub shim.ChaincodeStubInterface, args []string) pb.Response {\n if len(args) != 0 {\n return shim.Error(fmt.Sprintf(\"Incorrect number of arguments. Expecting 0 arguments, got %v\", args))\n }\n\n // only Admin is allowed to query_account_names\n if !transactor_is_admin(stub) {\n return shim.Error(\"Only admin user is authorized to query_account_names\")\n }\n\n account_names,err := get_account_names_(stub)\n if err != nil {\n return shim.Error(fmt.Sprintf(\"Could not query_account_names due to error %v\", err.Error()))\n }\n\n var bytes []byte\n if len(account_names) == 0 {\n bytes = []byte(\"[]\")\n } else {\n // Serialize account names as JSON\n bytes,err = json.Marshal(account_names)\n if err != nil {\n return shim.Error(fmt.Sprintf(\"Serializing account names failed in query_account_names because json.Marshal failed with error %v\", err))\n }\n }\n fmt.Printf(\"query_account_names response: %s\\n\", string(bytes))\n return shim.Success(bytes)\n}", "func (mw loggingMiddleware) GetAccounts(ctx context.Context) (accounts []Account, err error) {\n\tdefer func(begin time.Time) {\n\t\tmw.logger.Log(\"method\", \"GetAddresses\", \"took\", time.Since(begin), \"err\", err)\n\t}(time.Now())\n\treturn mw.next.GetAccounts(ctx)\n}", "func (client *ClientImpl) GetAccounts(ctx context.Context, args GetAccountsArgs) (*[]Account, error) {\n\tqueryParams := url.Values{}\n\tif args.OwnerId != nil {\n\t\tqueryParams.Add(\"ownerId\", (*args.OwnerId).String())\n\t}\n\tif args.MemberId != nil {\n\t\tqueryParams.Add(\"memberId\", (*args.MemberId).String())\n\t}\n\tif args.Properties != nil {\n\t\tqueryParams.Add(\"properties\", *args.Properties)\n\t}\n\tlocationId, _ := uuid.Parse(\"229a6a53-b428-4ffb-a835-e8f36b5b4b1e\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"7.1-preview.1\", nil, queryParams, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue []Account\n\terr = client.Client.UnmarshalCollectionBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "func (h *HUOBIHADAX) GetAccounts() ([]Account, error) {\n\ttype response struct {\n\t\tResponse\n\t\tAccountData []Account `json:\"data\"`\n\t}\n\n\tvar result response\n\terr := h.SendAuthenticatedHTTPRequest(http.MethodGet, huobihadaxAccounts, url.Values{}, &result)\n\n\tif result.ErrorMessage != \"\" {\n\t\treturn nil, errors.New(result.ErrorMessage)\n\t}\n\treturn result.AccountData, err\n}", "func (api *API) GetAccounts(ctx context.Context, names ...string) ([]*Account, error) {\n\tvar resp []*Account\n\terr := api.call(ctx, \"get_accounts\", []interface{}{names}, &resp)\n\treturn resp, err\n}", "func (c *GethClient) Accounts(ctx context.Context) ([]string, error) {\n\tvar result []string\n\terr := c.rpcCli.CallContext(ctx, &result, \"personal_listAccounts\")\n\treturn result, err\n}", "func (h *HUOBI) GetAccounts(ctx context.Context) ([]Account, error) {\n\tresult := struct {\n\t\tAccounts []Account `json:\"data\"`\n\t}{}\n\terr := h.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodGet, huobiAccounts, url.Values{}, nil, &result, false)\n\treturn result.Accounts, err\n}", "func (m *Workbook) GetNames()([]WorkbookNamedItemable) {\n return m.names\n}", "func (hc *Client) GetAccounts() ([]Account, error) {\n\tvar (\n\t\tresult AccountResponse\n\t)\n\tendpoint := fmt.Sprintf(\"%s/v1/account/accounts\", huobiEndpoint)\n\tres, err := hc.sendRequest(\n\t\thttp.MethodGet,\n\t\tendpoint,\n\t\tmap[string]string{},\n\t\ttrue,\n\t)\n\tif err != nil {\n\t\treturn result.Data, err\n\t}\n\terr = json.Unmarshal(res, &result)\n\tif result.Status != StatusOK.String() {\n\t\treturn result.Data, fmt.Errorf(\"received unexpect status: err=%s code=%s msg=%s\",\n\t\t\tresult.Status,\n\t\t\tresult.ErrorCode,\n\t\t\tresult.ErrorMessage)\n\t}\n\treturn result.Data, err\n}", "func (lbase *Logbase) GetCatalogNames() (names []string, err error) {\n\tvar nscan int = 0 // Number of file objects scanned\n\n\tfindCatalogFile := func(fpath string, fileInfo os.FileInfo, inerr error) (err error) {\n\t\tstat, err := os.Stat(fpath)\n\t\tif err != nil {return}\n\n\t\tif nscan > 0 && stat.IsDir() {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\tnscan++\n\n\t\tfname := filepath.Base(fpath)\n\t\tif strings.HasPrefix(fname, CATALOG_FILENAME_PREFIX) {\n\t\t\tcatname := strings.TrimPrefix(fname, CATALOG_FILENAME_PREFIX)\n\t\t\tif catname != MASTER_CATALOG_NAME {\n\t\t\t\tnames = append(names, catname)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\terr = filepath.Walk(lbase.abspath, findCatalogFile)\n\treturn\n}", "func (p *bitsharesAPI) GetAccounts(accounts ...objects.GrapheneObject) ([]objects.Account, error) {\n\tvar result []objects.Account\n\terr := p.call(p.databaseAPIID, \"get_accounts\", &result, accounts)\n\treturn result, err\n}", "func (e *Ethereum) Accounts() ([]string, error) {\n\tvar accounts []string\n\terr := e.rpcClient.CallContext(e.ctx, &accounts, \"eth_accounts\")\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"fail to call rpc.CallContext(eth_accounts)\")\n\t}\n\n\treturn accounts, nil\n}", "func (tx *ReleaseFromEndowment) GetAccountAddresses(app *App) ([]string, error) {\n\trfea, err := tx.GetSource(app)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"getting RFE SV\")\n\t}\n\treturn []string{rfea.String(), tx.Destination.String()}, nil\n}", "func (m *WorkbookWorksheet) GetNames()([]WorkbookNamedItemable) {\n return m.names\n}", "func (f *CredentialsFile) GetProfilesNames() (names []string) {\n\tif f.Content != nil {\n\t\tfor _, p := range f.Content.SectionStrings() {\n\t\t\tif strings.ToLower(p) != \"default\" {\n\t\t\t\tnames = append(names, p)\n\t\t\t}\n\t\t}\n\t}\n\tsort.Strings(names)\n\treturn\n}", "func (n *NameProvider) GetJSONNames(subject interface{}) []string {\n\tn.lock.Lock()\n\tdefer n.lock.Unlock()\n\ttpe := reflect.Indirect(reflect.ValueOf(subject)).Type()\n\tnames, ok := n.index[tpe]\n\tif !ok {\n\t\tnames = n.makeNameIndex(tpe)\n\t}\n\n\tres := make([]string, 0, len(names.jsonNames))\n\tfor k := range names.jsonNames {\n\t\tres = append(res, k)\n\t}\n\treturn res\n}", "func (o GetAscriptsResultOutput) Names() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetAscriptsResult) []string { return v.Names }).(pulumi.StringArrayOutput)\n}", "func (o GetAlarmContactsResultOutput) Names() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetAlarmContactsResult) []string { return v.Names }).(pulumi.StringArrayOutput)\n}", "func (ks *KeyStore) Accounts() ([]*accounts.Account, error) {\n\t// List all the files from the keystore folder\n\tfiles, err := ioutil.ReadDir(ks.keydir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taccounts := []*accounts.Account{}\n\tfor _, fi := range files {\n\t\tpath := ks.storage.JoinPath(fi.Name())\n\t\t// Skip any non-key files from the folder\n\t\tif nonKeyFile(fi) {\n\t\t\tks.ui.Logf(\"Ignoring file on account scan: %s\\n\", path)\n\t\t\tcontinue\n\t\t}\n\t\tacc, err := readAccount(path)\n\t\tif err != nil {\n\t\t\tks.ui.Errorf(\"Error while reading keystore account from path: %s, %v\\n\", path, err)\n\t\t\tcontinue\n\t\t}\n\t\taccounts = append(accounts, acc)\n\t}\n\treturn accounts, nil\n}", "func (sb S3Buckets) getBucketNames(targetBuckets []*s3.Bucket, configObj config.Config) ([]*string, error) {\n\tvar bucketNames []*string\n\tbucketCh := make(chan *S3Bucket, len(targetBuckets))\n\tvar wg sync.WaitGroup\n\n\tfor _, bucket := range targetBuckets {\n\t\twg.Add(1)\n\t\tgo func(bucket *s3.Bucket) {\n\t\t\tdefer wg.Done()\n\t\t\tsb.getBucketInfo(bucket, bucketCh, configObj)\n\t\t}(bucket)\n\t}\n\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(bucketCh)\n\t}()\n\n\t// Start reading from the channel as soon as the data comes in - so that skip\n\t// messages are shown to the user as soon as possible\n\tfor bucketData := range bucketCh {\n\t\tif bucketData.Error != nil {\n\t\t\tlogging.Logger.Debugf(\"Skipping - Bucket %s - region - %s - error: %s\", bucketData.Name, sb.Region, bucketData.Error)\n\t\t\tcontinue\n\t\t}\n\t\tif !bucketData.IsValid {\n\t\t\tlogging.Logger.Debugf(\"Skipping - Bucket %s - region - %s - %s\", bucketData.Name, sb.Region, bucketData.InvalidReason)\n\t\t\tcontinue\n\t\t}\n\n\t\tbucketNames = append(bucketNames, aws.String(bucketData.Name))\n\t}\n\n\treturn bucketNames, nil\n}", "func extractIconNames() []string {\n\tvar iconNamesFromData = make([]string, len(icons))\n\ti := 0\n\tfor k := range icons {\n\t\ticonNamesFromData[i] = k\n\t\ti++\n\t}\n\n\tsort.Strings(iconNamesFromData)\n\treturn iconNamesFromData\n}", "func (o GetFoldersResultOutput) Names() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetFoldersResult) []string { return v.Names }).(pulumi.StringArrayOutput)\n}", "func (a *Api) GetAccounts(ctx echo.Context) error {\n\t// var result []Account\n\tvar accounts []Account\n\n\tdbResult := a.DB.Find(&accounts)\n\tif dbResult.Error != nil {\n\t\treturn sendApiError(ctx, http.StatusInternalServerError, \"DB error\")\n\t}\n\n\treturn ctx.JSONPretty(http.StatusOK, accounts, \" \")\n}", "func (controller *AccountController) GetAccounts(ctx *gin.Context) {\n\tinfo, err := authStuff.GetLoginInfoFromCtx(ctx)\n\tif err != nil {\n\t\tresponse, _ := restapi.NewErrorResponse(err.Error()).Marshal()\n\t\tfmt.Fprint(ctx.Writer, string(response))\n\t\tctx.Abort()\n\t\treturn\n\t}\n\n\taccs, err := controller.service.GetAccounts(info.Name)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\"user\": info.Name}).WithError(err).Error(\"Account Error GetAll\")\n\n\t\tresponse, _ := restapi.NewErrorResponse(\"Could not get accounts because: \" + err.Error()).Marshal()\n\t\tfmt.Fprint(ctx.Writer, string(response))\n\t\tctx.Abort()\n\t\treturn\n\t}\n\tresponse, _ := restapi.NewOkResponse(accs).Marshal()\n\tfmt.Fprint(ctx.Writer, string(response))\n\tctx.Next()\n\n}", "func (o GetRegistryEnterpriseNamespacesResultOutput) Names() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetRegistryEnterpriseNamespacesResult) []string { return v.Names }).(pulumi.StringArrayOutput)\n}", "func (s *Service) GetAccounts(budgetID string, f *api.Filter) (*SearchResultSnapshot, error) {\n\tresModel := struct {\n\t\tData struct {\n\t\t\tAccounts []*Account `json:\"accounts\"`\n\t\t\tServerKnowledge uint64 `json:\"server_knowledge\"`\n\t\t} `json:\"data\"`\n\t}{}\n\n\turl := fmt.Sprintf(\"/budgets/%s/accounts\", budgetID)\n\tif f != nil {\n\t\turl = fmt.Sprintf(\"%s?%s\", url, f.ToQuery())\n\t}\n\tif err := s.c.GET(url, &resModel); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &SearchResultSnapshot{\n\t\tAccounts: resModel.Data.Accounts,\n\t\tServerKnowledge: resModel.Data.ServerKnowledge,\n\t}, nil\n}", "func GzipAssetNames() []string {\n\tnames := make([]string, 0, len(_gzipbindata))\n\tfor name := range _gzipbindata {\n\t\tnames = append(names, name)\n\t}\n\treturn names\n}", "func GzipAssetNames() []string {\n\tnames := make([]string, 0, len(_gzipbindata))\n\tfor name := range _gzipbindata {\n\t\tnames = append(names, name)\n\t}\n\treturn names\n}", "func GzipAssetNames() []string {\n\tnames := make([]string, 0, len(_gzipbindata))\n\tfor name := range _gzipbindata {\n\t\tnames = append(names, name)\n\t}\n\treturn names\n}", "func GetAccounts() (accounts []TestAccount, err error) {\n\tam := accountModule.NewAccountManager(TestKeystorePath)\n\tif len(am.Accounts) == 0 {\n\t\terr = fmt.Errorf(\"no ethereum accounts found in the directory [%s]\", TestKeystorePath)\n\t\treturn\n\t}\n\tfor _, a := range am.Accounts {\n\t\tvar keyBin []byte\n\t\tvar key *ecdsa.PrivateKey\n\t\tkeyBin, err = am.GetPrivateKey(a.Address, TestPassword)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tkey, err = crypto.ToECDSA(keyBin)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\taccounts = append(accounts, TestAccount{\n\t\t\tAddress: a.Address,\n\t\t\tPrivateKey: key,\n\t\t})\n\t}\n\treturn\n}", "func GetAccounts(w http.ResponseWriter, r *http.Request) {\n\tdb, erro := database.Connect()\n\tif erro != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, erro)\n\t\treturn\n\t}\n\tdefer db.Close()\n\trepository := repositories.NewAccountRepository(db)\n\taccounts, erro := repository.FindAll()\n\tif erro != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, erro)\n\t\treturn\n\t}\n\tresponses.JSON(w, http.StatusOK, accounts)\n}", "func (k *proxy) GetResourceNames(ctx context.Context, groupVersion, kind string, options []client.ListOption, prefix string) ([]string, error) {\n\tclient, err := k.NewClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tobjList, err := listObjByGVK(ctx, client, groupVersion, kind, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar comps []string\n\tfor _, item := range objList.Items {\n\t\tname := item.GetName()\n\n\t\tif strings.HasPrefix(name, prefix) {\n\t\t\tcomps = append(comps, name)\n\t\t}\n\t}\n\n\treturn comps, nil\n}", "func (bot *Engine) GetExchangeNames(enabledOnly bool) []string {\n\texchanges := bot.GetExchanges()\n\tvar response []string\n\tfor i := range exchanges {\n\t\tif !enabledOnly || (enabledOnly && exchanges[i].IsEnabled()) {\n\t\t\tresponse = append(response, exchanges[i].GetName())\n\t\t}\n\t}\n\treturn response\n}", "func (owner *WalletOwnerAPI) Accounts() (*[]libwallet.AccountPathMapping, error) {\n\tparams := struct {\n\t\tToken string `json:\"token\"`\n\t}{\n\t\tToken: owner.token,\n\t}\n\tparamsBytes, err := json.Marshal(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tenvl, err := owner.client.EncryptedRequest(\"accounts\", paramsBytes, owner.sharedSecret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif envl == nil {\n\t\treturn nil, errors.New(\"WalletOwnerAPI: Empty RPC Response from grin-wallet\")\n\t}\n\tif envl.Error != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"code\": envl.Error.Code,\n\t\t\t\"message\": envl.Error.Message,\n\t\t}).Error(\"WalletOwnerAPI: RPC Error during Accounts\")\n\t\treturn nil, errors.New(string(envl.Error.Code) + \"\" + envl.Error.Message)\n\t}\n\tvar result Result\n\tif err = json.Unmarshal(envl.Result, &result); err != nil {\n\t\treturn nil, err\n\t}\n\tif result.Err != nil {\n\t\treturn nil, errors.New(string(result.Err))\n\t}\n\tvar accounts []libwallet.AccountPathMapping\n\tif err = json.Unmarshal(result.Ok, &accounts); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &accounts, nil\n}", "func (o GetInstanceAttachmentsResultOutput) Names() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetInstanceAttachmentsResult) []string { return v.Names }).(pulumi.StringArrayOutput)\n}", "func (api *PublicEthereumAPI) Accounts() ([]common.Address, error) {\n\tapi.logger.Debug(\"eth_accounts\")\n\tapi.keyringLock.Lock()\n\tdefer api.keyringLock.Unlock()\n\n\taddresses := make([]common.Address, 0) // return [] instead of nil if empty\n\n\tinfos, err := api.clientCtx.Keybase.List()\n\tif err != nil {\n\t\treturn addresses, err\n\t}\n\n\tfor _, info := range infos {\n\t\taddressBytes := info.GetPubKey().Address().Bytes()\n\t\taddresses = append(addresses, common.BytesToAddress(addressBytes))\n\t}\n\n\treturn addresses, nil\n}", "func (a *Atlante) SheetNames() (sheets []string) {\n\tif a == nil || len(a.sheets) == 0 {\n\t\treturn sheets\n\t}\n\tsheets = make([]string, len(a.sheets))\n\ta.sLock.RLock()\n\ti := 0\n\tfor k := range a.sheets {\n\t\tsheets[i] = k\n\t\ti++\n\t}\n\ta.sLock.RUnlock()\n\tsort.Strings(sheets)\n\treturn sheets\n}", "func (o ServicePrincipalOutput) ServicePrincipalNames() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ServicePrincipal) pulumi.StringArrayOutput { return v.ServicePrincipalNames }).(pulumi.StringArrayOutput)\n}", "func (w *Wallet) GetAccounts() (accounts []*Account) {\n\taccounts = make([]*Account, 0, len(w.accounts))\n\tfor _, account := range w.accounts {\n\t\taccounts = append(accounts, account)\n\t}\n\treturn\n}", "func GetAccounts(w http.ResponseWriter, r *http.Request) {\n\n\tjson.NewEncoder(w).Encode(nil)\n}", "func (c *Cluster) GetProfileNames(project string) ([]string, error) {\n\terr := c.Transaction(context.TODO(), func(ctx context.Context, tx *ClusterTx) error {\n\t\tenabled, err := cluster.ProjectHasProfiles(context.Background(), tx.tx, project)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Check if project has profiles: %w\", err)\n\t\t}\n\n\t\tif !enabled {\n\t\t\tproject = \"default\"\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tq := `\nSELECT profiles.name\n FROM profiles\n JOIN projects ON projects.id = profiles.project_id\nWHERE projects.name = ?\n`\n\tinargs := []any{project}\n\tvar name string\n\toutfmt := []any{name}\n\tresult, err := queryScan(c, q, inargs, outfmt)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tresponse := []string{}\n\tfor _, r := range result {\n\t\tresponse = append(response, r[0].(string))\n\t}\n\n\treturn response, nil\n}", "func (a *Client) GetAccounts(params *GetAccountsParams) (*GetAccountsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAccountsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getAccounts\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/AccountService/Accounts\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetAccountsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetAccountsOK), nil\n\n}", "func (o GetAvailabilityZonesResultOutput) Names() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetAvailabilityZonesResult) []string { return v.Names }).(pulumi.StringArrayOutput)\n}", "func (authcl *Client) SearchAccount(query string) ([]gin.Account, error) {\n\tvar accs []gin.Account\n\n\tparams := url.Values{}\n\tparams.Add(\"q\", query)\n\taddress := fmt.Sprintf(\"/api/accounts?%s\", params.Encode())\n\tres, err := authcl.Get(address)\n\tif err != nil {\n\t\treturn accs, err\n\t} else if res.StatusCode != http.StatusOK {\n\t\treturn accs, fmt.Errorf(\"[Account search] Failed. Server returned: %s\", res.Status)\n\t}\n\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn accs, err\n\t}\n\n\terr = json.Unmarshal(body, &accs)\n\treturn accs, err\n}", "func (api *API) LookupAccounts(ctx context.Context, lowerBoundName string, limit uint16) ([]string, error) {\n\tvar resp []string\n\terr := api.call(ctx, \"lookup_accounts\", []interface{}{lowerBoundName, limit}, &resp)\n\treturn resp, err\n}", "func (this *SIPMessage) GetHeaderNames() *list.List {\n\treturn this.headers\n\t// ListIterator li = this.headers.listIterator();\n\t// LinkedList retval = new LinkedList();\n\t// while (li.hasNext()) {\n\t// SIPHeader sipHeader = (SIPHeader) li.next();\n\t// String name = sipHeader.GetName();\n\t// retval.add(name);\n\t// }\n\t// return retval.listIterator();\n}", "func (s *Identity) AccountsGET(w http.ResponseWriter, r *http.Request) {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\twriteResponse(s.addresses, w, r)\n}", "func (r *NucypherAccountRepository) GetAccounts(createdBy string) ([]*model.NucypherAccount, error) {\n\tvar accounts []*model.NucypherAccount\n\n\tif err := r.store.db.Select(&accounts,\n\t\t\"SELECT account_id, name, organization_id, address, signing_key, encrypting_key, balance, tokens, is_active, is_private, created_by, created_at FROM nucypher_accounts WHERE created_by=$1\",\n\t\tcreatedBy,\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn accounts, nil\n}", "func (s *walletService) GetAccounts(ctx context.Context) ([]Account, error) {\n\ta, err := s.model.SelectAccounts(ctx)\n\treturn a, err\n}", "func (kc *k8sCluster) deploymentNames(c context.Context, namespace string) ([]string, error) {\n\tvar objNames []objName\n\tif err := kc.client.List(c, kates.Query{Kind: \"Deployment\", Namespace: namespace}, &objNames); err != nil {\n\t\treturn nil, err\n\t}\n\tnames := make([]string, len(objNames))\n\tfor i, n := range objNames {\n\t\tnames[i] = n.Name\n\t}\n\treturn names, nil\n}", "func GetAllAccounts(w http.ResponseWriter, r *http.Request) {\n\t// Fetch the accounts.\n\n\tgetAccountsInput, err := parseGetAccountsInput(r)\n\n\tif err != nil {\n\t\tlog.Print(err)\n\t\tresponse.WriteRequestValidationError(w, fmt.Sprintf(\"Error parsing query params\"))\n\t\treturn\n\t}\n\n\tresult, err := Dao.GetAccounts(getAccountsInput)\n\n\tif err != nil {\n\t\tlog.Print(err)\n\t\tresponse.WriteServerError(w)\n\t\treturn\n\t}\n\n\t// Serialize them for the JSON response.\n\taccountResponses := []*response.AccountResponse{}\n\n\tfor _, a := range result.Results {\n\t\tacctRes := response.AccountResponse(*a)\n\t\taccountResponses = append(accountResponses, &acctRes)\n\t}\n\n\t// If the DB result has next keys, then the URL to retrieve the next page is put into the Link header.\n\tif len(result.NextKeys) > 0 {\n\t\tnextURL := response.BuildNextURL(r, result.NextKeys, baseRequest)\n\t\tw.Header().Add(\"Link\", fmt.Sprintf(\"<%s>; rel=\\\"next\\\"\", nextURL.String()))\n\t}\n\n\terr = json.NewEncoder(w).Encode(accountResponses)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\tresponse.WriteServerError(w)\n\t}\n}", "func GetNames(result []interface{})[]string{\n\tvar names []string\n\tfor _, poi := range result {\n\t\t//fmt.Println(poi.(map[string]interface{})[\"name\"])\n\t\tnames = append(names, poi.(map[string]interface{})[\"name\"].(string))\n\t}\n\treturn names\n}", "func getNamesOfFileInfo(fileInfoSlice []fs.DirEntry) (namesSlice []string) {\n\tfor _, element := range fileInfoSlice {\n\t\tnamesSlice = append(namesSlice, element.Name())\n\t}\n\treturn\n}", "func (p *Provider) getServiceNames(application marathon.Application) []string {\n\tlabelServiceProperties := extractServiceProperties(application.Labels)\n\tvar names []string\n\n\tfor k := range labelServiceProperties {\n\t\tnames = append(names, k)\n\t}\n\tif len(names) == 0 {\n\t\tnames = append(names, \"\")\n\t}\n\treturn names\n}", "func Names() []string {\n\tvar names []string\n\tfor name := range directory {\n\t\tnames = append(names, name)\n\t}\n\tsort.Strings(names)\n\treturn names\n}", "func (r OpenstackAdapter) GetImageNames() ([]string, error) {\n\tvar apbNames []string\n\tvar projects []string\n\n\tif len(r.Config.Org) == 0 {\n\t\ttoken, err := r.getUnscopedToken()\n\t\tif err != nil {\n\t\t\treturn apbNames, err\n\t\t}\n\t\tprojects, err = r.getObjectList(token, \"projects\", \"/identity/v3/auth/projects\", \"\")\n\t\tif err != nil {\n\t\t\treturn apbNames, err\n\t\t}\n\t} else {\n\t\tprojects = append(projects, r.Config.Org)\n\t}\n\n\tfor _, project := range projects {\n\t\tfor _, service := range services {\n\t\t\tapbNames = append(apbNames, fmt.Sprintf(\"openstack-%v-%v-project-apb\", service, project))\n\t\t}\n\t}\n\n\treturn apbNames, nil\n}", "func (ch *blockchain) GetAccountTxs(acc [20]byte) (accTxs txindex.AccountTxs, err error) {\n\treturn ch.txidx.GetAccountTxs(acc)\n}", "func (w *ServerInterfaceWrapper) GetAccounts(ctx echo.Context) error {\n\tvar err error\n\n\tctx.Set(ApiKeyAuthScopes, []string{\"\"})\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.GetAccounts(ctx)\n\treturn err\n}", "func (s SegmentProperties) GetSegmentNames() []string {\n\tvar names []string\n\tfor name := range s {\n\t\tnames = append(names, name)\n\t}\n\treturn names\n}", "func Accounts(client *ticketmatic.Client) ([]*ticketmatic.AccountInfo, error) {\n\tr := client.NewRequest(\"GET\", \"/_/tools/accounts\", \"json\")\n\n\tvar obj []*ticketmatic.AccountInfo\n\terr := r.Run(&obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn obj, nil\n}", "func (a *AmoCrm) GetAccount(with []string) (*Account, error) {\n\tvar account *Account\n\treturn account, a.getItem([]string{accountEntity}, nil, &entitiesQuery{With: with}, &account)\n}", "func (s S) Accounts() []v1.ServiceAccount {\n\treturn s.accounts\n}", "func ListAccounts(w http.ResponseWriter, r *http.Request) {\n\tisAdmin := false\n\tif oauth, ok := OAuthToken(r); ok {\n\t\tisAdmin = oauth.Match.Contains(\"account-admin\")\n\t}\n\n\tvar accounts []data.Account\n\tsearch := r.URL.Query().Get(\"q\")\n\tif search != \"\" {\n\t\taccounts = data.SearchAccounts(search)\n\t} else {\n\t\taccounts = data.ListAccounts()\n\t}\n\n\tmarshal := make([]data.AccountMarshaler, 0, len(accounts))\n\tfor i := 0; i < len(accounts); i++ {\n\t\tacc := &accounts[i]\n\t\tmarshal = append(marshal, data.AccountMarshaler{\n\t\t\tWithMail: isAdmin || acc.IsEmailPublic,\n\t\t\tWithAffiliation: isAdmin || acc.IsAffiliationPublic,\n\t\t\tAccount: acc,\n\t\t})\n\t}\n\n\tw.Header().Add(\"Cache-Control\", \"no-cache\")\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tenc := json.NewEncoder(w)\n\terr := enc.Encode(marshal)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (s *AccountService) GetAccounts() ([]Account, error) {\n\turl := \"manage\"\n\treq, err := s.client.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := s.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn parseAccounts(resp)\n}", "func (s *Service) GetAccounts() ([]entity.Account, error) {\n\treturn s.repo.GetAccounts()\n}", "func (o *Service) GetNames() []string {\n\tif o == nil || o.Names == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.Names\n}", "func (a *Client) ListServiceAccountNames(params *ListServiceAccountNamesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListServiceAccountNamesOK, *ListServiceAccountNamesNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListServiceAccountNamesParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"ListServiceAccountNames\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/orgs/{owner}/sa/names\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &ListServiceAccountNamesReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *ListServiceAccountNamesOK:\n\t\treturn value, nil, nil\n\tcase *ListServiceAccountNamesNoContent:\n\t\treturn nil, value, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ListServiceAccountNamesDefault)\n\treturn nil, nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (f *File) GetProfileNames() []string {\n\treturn f.data.ProfileNames\n}", "func (Dependency *Dependency) GetApplicationAndServiceNames() (string, string) {\n\tif strings.Contains(Dependency.Reference, \".\") {\n\t\tsplitted := strings.Split(Dependency.Reference, \".\")\n\t\treturn splitted[0], splitted[1]\n\t}\n\treturn Dependency.Reference, \"\"\n}", "func AssetNames() []string {\n\tnames := make([]string, 0, len(_escData))\n\tfor name, entry := range _escData {\n\t\tif !entry.isDir {\n\t\t\tnames = append(names, name[1:])\n\t\t}\n\t}\n\treturn names\n}", "func getSwiftObjectNames(t *testing.T, osClient *gophercloud.ServiceClient, container string) (objectNames []string) {\n\t_ = objects.List(osClient, container, nil).EachPage(func(page pagination.Page) (bool, error) {\n\t\t// Get a slice of object names\n\t\tnames, err := objects.ExtractNames(page)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error extracting object names from page: %s\", err)\n\t\t}\n\t\tfor _, object := range names {\n\t\t\tobjectNames = append(objectNames, object)\n\t\t}\n\n\t\treturn true, nil\n\t})\n\treturn\n}", "func listArchive() {\n files, err := ioutil.ReadDir(settings.PATH_ARCHIVE)\n utils.CheckError(err)\n\n fmt.Printf(\"| %s:\\n\", settings.User.Hash)\n for _, file := range files {\n fmt.Println(\"|\", file.Name())\n }\n}", "func (c *Client) GetAccountTags() (*GetAccountTagsResponse, error) {\n\tresp := &GetAccountTagsResponse{}\n\terr := c.Do(\"get_account_tags\", nil, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "func (m *MegaCorp) getAllAccounts() (accts []*Account) {\n\trg := Me.NewRangeGetter(Ledger, \"account\", \"\", false)\n\tfor rg.HasNext() {\n\t\tvar act Account\n\t\ttx := rg.Next()\n\t\tutil.FromJSON([]byte(tx.Value), &act)\n\t\taccts = append(accts, &act)\n\t}\n\treturn\n}", "func (a Authorizers) Names() []string {\n\tresult := make([]string, 0, len(a))\n\tfor k, _ := range a {\n\t\tresult = append(result, k)\n\t}\n\treturn result\n}", "func parseAccounts(resp *http.Response) ([]Account, error) {\n\tdoc, err := goquery.NewDocumentFromResponse(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taccounts := []Account{}\n\tvar accErr interface{}\n\n\tdoc.Find(\".setup-accounts .section.group\").Not(\".setup-heading\").EachWithBreak(func(i int, s *goquery.Selection) bool {\n\t\tacc, err := parseAccount(s)\n\t\tif err != nil {\n\t\t\taccErr = err\n\t\t\treturn false\n\t\t}\n\t\taccounts = append(accounts, *acc)\n\t\treturn true\n\t})\n\n\tif accErr != nil {\n\t\treturn nil, accErr.(error)\n\t}\n\treturn accounts, nil\n}", "func (o GetSecretsResultOutput) Names() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetSecretsResult) []string { return v.Names }).(pulumi.StringArrayOutput)\n}", "func encryptNameForAccounts(name string, accounts ...*api.Account) ([]api.EncryptedNameRequest, error) {\n\tencryptedNames := make([]api.EncryptedNameRequest, len(accounts))\n\tfor i, account := range accounts {\n\t\tvar err error\n\t\tencryptedNames[i], err = encryptNameForAccount(name, account)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn encryptedNames, nil\n}", "func (b *Bitcoind) ListAccounts(minconf int32) (accounts map[string]float64, err error) {\n\tr, err := b.client.call(\"listaccounts\", []int32{minconf})\n\tif err = handleError(err, &r); err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(r.Result, &accounts)\n\treturn\n}", "func (a *ChatLogsArchive) ListChatLogFileNames(accountName string) (absolutePaths []string, relativePaths []string, err error) {\n\tif a.r == nil {\n\t\treturn nil, nil, nil\n\t}\n\n\tvar logFileNames []string\n\tfor _, f := range a.r.File {\n\t\t// Take only .txt files.\n\t\tif filepath.Ext(f.Name) != \".txt\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tpath := filepath.Dir(f.Name)\n\t\tif path != accountName {\n\t\t\tcontinue\n\t\t}\n\n\t\tfileName := filepath.Base(f.Name)\n\t\tif !IsReservedFileName(fileName) {\n\t\t\tabsolutePaths = append(absolutePaths, f.Name)\n\t\t\trelativePaths = append(logFileNames, fileName)\n\t\t}\n\t}\n\n\treturn\n}", "func (r *ProtocolIncus) GetNetworkACLNames() ([]string, error) {\n\tif !r.HasExtension(\"network_acl\") {\n\t\treturn nil, fmt.Errorf(`The server is missing the required \"network_acl\" API extension`)\n\t}\n\n\t// Fetch the raw URL values.\n\turls := []string{}\n\tbaseURL := \"/network-acls\"\n\t_, err := r.queryStruct(\"GET\", baseURL, nil, \"\", &urls)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse it.\n\treturn urlsToResourceNames(baseURL, urls...)\n}", "func (service *AccountService) GetAccountKeys(ctx context.Context, req *protoAccount.GetAccountKeysRequest, res *protoAccount.AccountKeysResponse) error {\n\tkeys, err := repoAccount.FindAccountKeys(service.DB, req.AccountIDs)\n\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\tres.Status = constRes.Nonentity\n\t\tres.Message = \"no accounts by those IDs\"\n\tcase err != nil:\n\t\tlog.Println(\"FindAccountKeys error: \", err.Error())\n\t\tres.Status = constRes.Error\n\t\tres.Message = err.Error()\n\tdefault:\n\t\tres.Status = constRes.Success\n\t\tres.Data = &protoAccount.KeysList{\n\t\t\tKeys: keys,\n\t\t}\n\t}\n\n\treturn nil\n}", "func (statics AssestStruct) GetFileNames(dir string) []string {\n\tnames := make([]string, len(statics.Files))\n\tfor name := range statics.Files {\n\t\tnames = append(names, name)\n\t}\n\treturn names\n}", "func (c *Client) GetAddressesByAccountT(account string) ([]string, error) {\n\treturn c.GetAddressesByAccountTAsync(account).ReceiveT()\n}", "func GetAccountInfoPrefix() []byte {\n\treturn accountInfoSubstore\n}", "func UConverterGetAvailableNames() (_swig_ret []string)", "func (k Keeper) GetAllRecryptAccount(ctx sdk.Context) (list []types.RecryptAccount) {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RecryptAccountKey))\n\titerator := sdk.KVStorePrefixIterator(store, []byte{})\n\n\tdefer iterator.Close()\n\n\tfor ; iterator.Valid(); iterator.Next() {\n\t\tvar val types.RecryptAccount\n\t\tk.cdc.MustUnmarshalBinaryBare(iterator.Value(), &val)\n\t\tlist = append(list, val)\n\t}\n\n\treturn\n}", "func ImportNames(f *zip.File) *map[int64]string {\n\tfmt.Printf(\"%+v\\n\", f.FileHeader.Name)\n\n\tzipFile, zfErr := f.Open()\n\tif zfErr != nil {\n\t\tfmt.Println(\"f.Open():\", zfErr)\n\t\treturn nil\n\t}\n\n\tdecoder := yaml.NewDecoder(zipFile)\n\tjsonData := make([]models.RawName, 0)\n\tunmErr := decoder.Decode(&jsonData)\n\tif unmErr != nil {\n\t\tfmt.Println(\"Unmarshal:\", unmErr)\n\t\treturn nil\n\t}\n\n\tresult := make(map[int64]string)\n\tfor _, value := range jsonData {\n\t\tresult[value.ItemID] = value.ItemName\n\t}\n\n\treturn &result\n\n}", "func GetShardNames(total int) (names []string) {\n\tfor i := 0; i < total; i++ {\n\t\tnames = append(names, GetShardName(i, total))\n\t}\n\treturn\n}", "func (r *ReorderSupergroupActiveUsernamesRequest) GetUsernames() (value []string) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.Usernames\n}", "func (o *NumbersACH) GetAccount() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Account\n}", "func (ak AccountKeeper) IterateAccounts(ctx sdk.Context, cb func(account exported.Account) (stop bool)) {\n\tstore := ctx.KVStore(ak.key)\n\titerator := sdk.KVStorePrefixIterator(store, types.AddressStoreKeyPrefix)\n\n\tdefer iterator.Close()\n\tfor ; iterator.Valid(); iterator.Next() {\n\t\taccount := ak.decodeAccount(iterator.Value())\n\n\t\tif cb(account) {\n\t\t\tbreak\n\t\t}\n\t}\n}", "func ListAssetNames() []string {\n\treturn assetNames\n}", "func (db *InMemoryDB) GetAccounts(userID string) []model.Account {\n\taccountMap := db.getAccountMap(userID)\n\n\tresult := make([]model.Account, 0)\n\tfor _, value := range accountMap {\n\t\tresult = append(result, value)\n\t}\n\tsort.Slice(result, func(i, j int) bool {\n\t\treturn result[i].Payer < result[j].Payer\n\t})\n\treturn result\n}", "func (am *AccountManager) ListAccounts(minconf int) map[string]float64 {\n\t// Create and fill a map of account names and their balances.\n\tpairs := make(map[string]float64)\n\tfor _, a := range am.AllAccounts() {\n\t\tpairs[a.name] = a.CalculateBalance(minconf)\n\t}\n\treturn pairs\n}", "func (a *APITest) GetProfileNames() []string {\n\n\tprofileNames := []string{}\n\n\tfor profileName := range a.userProfiles {\n\t\tprofileNames = append(profileNames, profileName)\n\t}\n\n\treturn profileNames\n}", "func (dcr *ExchangeWallet) fundingAccounts() []string {\n\tif dcr.unmixedAccount == \"\" {\n\t\treturn []string{dcr.primaryAcct}\n\t}\n\treturn []string{dcr.primaryAcct, dcr.tradingAccount}\n}", "func getAccountID(s State, n int) string {\n\tsa := make([]string, 0)\n\tfor k := range s.Accounts {\n\t\tsa = append(sa, k)\n\t}\n\tsort.Sort(sort.StringSlice(sa))\n\treturn sa[n]\n}" ]
[ "0.5756021", "0.5566366", "0.5505465", "0.54526526", "0.53302103", "0.5316402", "0.53071326", "0.5280768", "0.5209631", "0.5203751", "0.519399", "0.5191344", "0.5148179", "0.5140566", "0.50883037", "0.5075973", "0.50589436", "0.5050583", "0.50384873", "0.50335526", "0.50285417", "0.5015031", "0.5009977", "0.49932185", "0.4978818", "0.496936", "0.49649423", "0.4963462", "0.49598524", "0.49598524", "0.49598524", "0.49556044", "0.4954083", "0.4946022", "0.49424005", "0.49261403", "0.49155885", "0.49094024", "0.48940173", "0.4863325", "0.48484424", "0.48459837", "0.48396063", "0.48374224", "0.48048052", "0.4801559", "0.479305", "0.47927326", "0.47797897", "0.47783026", "0.47767776", "0.4765686", "0.47618994", "0.4761824", "0.4751928", "0.47493428", "0.47325283", "0.4717161", "0.46951035", "0.468686", "0.46770084", "0.4670875", "0.46707758", "0.46650502", "0.4663235", "0.4661327", "0.46545848", "0.46528396", "0.46417177", "0.46409225", "0.46394458", "0.4637844", "0.46365884", "0.4635804", "0.46348742", "0.463128", "0.4616415", "0.46134955", "0.4612248", "0.46055263", "0.46034497", "0.46017015", "0.4592443", "0.45841774", "0.45760405", "0.4565943", "0.4554255", "0.45514375", "0.4548919", "0.45419827", "0.45385116", "0.4519743", "0.4517359", "0.45044404", "0.4503458", "0.4502784", "0.45009208", "0.449104", "0.44871005", "0.44844672" ]
0.79037297
0
ListChatLogFileNames returns list of chat log files for the specified account name inside of archive.
func (a *ChatLogsArchive) ListChatLogFileNames(accountName string) (absolutePaths []string, relativePaths []string, err error) { if a.r == nil { return nil, nil, nil } var logFileNames []string for _, f := range a.r.File { // Take only .txt files. if filepath.Ext(f.Name) != ".txt" { continue } path := filepath.Dir(f.Name) if path != accountName { continue } fileName := filepath.Base(f.Name) if !IsReservedFileName(fileName) { absolutePaths = append(absolutePaths, f.Name) relativePaths = append(logFileNames, fileName) } } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a *ChatLogsArchive) GetAccountNames() ([]string, error) {\n\tif a.r == nil {\n\t\treturn nil, nil\n\t}\n\n\tvar accountNamesMap = make(map[string]interface{})\n\tfor _, f := range a.r.File {\n\t\t// Take only .txt files.\n\t\tif filepath.Ext(f.Name) != \".txt\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tpath := filepath.Dir(f.Name)\n\n\t\t// Take files from 1st level directories only.\n\t\tif path != \"\" && !strings.ContainsAny(path, \"/\\\\\") {\n\t\t\taccountNamesMap[path] = nil\n\t\t}\n\t}\n\n\tvar accountNames []string\n\tfor accountName := range accountNamesMap {\n\t\taccountNames = append(accountNames, accountName)\n\t}\n\n\treturn accountNames, nil\n}", "func (a *ChatLogsArchive) ReadChatLog(accountName string, fileName string) (Messages, error) {\n\tif a.r == nil {\n\t\treturn nil, nil\n\t}\n\n\tlogFilePath := strings.Join([]string{accountName, fileName}, \"/\")\n\tf, err := a.r.Open(logFilePath)\n\n\t// Do not return error if file doesn't exists.\n\tif errors.Is(err, os.ErrNotExist) {\n\t\treturn nil, nil\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open chat log %s: %w\", logFilePath, err)\n\t}\n\tdefer f.Close()\n\n\tmessages, err := ReadMessages(f)\n\tif err != nil {\n\t\treturn messages, fmt.Errorf(\"unable to read chat log %s: %w\", logFilePath, err)\n\t}\n\n\treturn messages, nil\n}", "func ListLogFiles() ([]FileInfo, error) {\n\treturn logging.listLogFiles()\n}", "func (c *Client) LoggerList(ctx context.Context) ([]types.Logger, error) {\n\tresp, err := c.get(ctx, \"/log/list\", nil, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"HTTP request failed: %v\", err)\n\t}\n\n\tvar loggers []types.Logger\n\tif err := json.NewDecoder(resp.body).Decode(&loggers); err != nil {\n\t\treturn nil, fmt.Errorf(\"decoding reply failed: %v\", err)\n\t}\n\n\treturn loggers, nil\n}", "func (l Logfiles) FileNames() []string {\n\ts := make([]string, len(l))\n\tfor _, logfile := range l {\n\t\ts = append(s, logfile.FileName)\n\t}\n\treturn s\n}", "func GetMessageList(dirPath string) ([]os.FileInfo, error){\n dirPath = strings.TrimPrefix(dirPath, \"\\\"\")\n dirPath = strings.TrimRight(dirPath, \"\\\";\")\n files, err := ioutil.ReadDir(dirPath)\n\tif err != nil {\n log.Print(err)\n return nil, err\n }\n sort.Slice(files, func(i,j int) bool{\n return files[i].ModTime().Unix() < files[j].ModTime().Unix()\n })\n return files, err\n}", "func FindLogFiles(path string) ([]string, []string, error) {\n\tif path == \"\" || path == \"console\" {\n\t\treturn nil, nil, os.ErrInvalid\n\t}\n\tif !FileExists(path) {\n\t\treturn nil, nil, os.ErrNotExist\n\t}\n\tfileDir, fileName := filepath.Split(path)\n\tbaseName, ext := SplitExt(fileName)\n\tpattern := regexp.MustCompile(`^\\.\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$`)\n\tif fileDir == \"\" {\n\t\tfileDir = \".\"\n\t}\n\tfiles, err := os.ReadDir(fileDir)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tlogs := make([]string, 0)\n\tdates := make([]string, 0)\n\tlogs = append(logs, path)\n\tdates = append(dates, \"\")\n\tfor _, file := range files {\n\t\tif strings.HasPrefix(file.Name(), baseName) && strings.HasSuffix(file.Name(), ext) {\n\t\t\ttailPart := strings.TrimPrefix(file.Name(), baseName)\n\t\t\tdatePart := strings.TrimSuffix(tailPart, ext)\n\t\t\tif pattern.MatchString(datePart) {\n\t\t\t\tlogs = append(logs, filepath.Join(fileDir, file.Name()))\n\t\t\t\tdates = append(dates, datePart[1:])\n\t\t\t}\n\t\t}\n\t}\n\treturn logs, dates, nil\n}", "func listChats(w http.ResponseWriter, r *http.Request, db *bolt.DB) {\n\t// Get self\n\tself, err := models.FindUser(r.Header.Get(\"X-BPI-Username\"), db)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: failed to query database for requesting user\")\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\treturn\n\t}\n\n\t// Return empty array if none\n\tif len(self.Chats) == 0 {\n\t\tresponses.SuccessWithData(w, []string{})\n\t\treturn\n\t}\n\n\tresponses.SuccessWithData(w, self.Chats)\n}", "func (client *Client) ListAuthenticationLogsWithChan(request *ListAuthenticationLogsRequest) (<-chan *ListAuthenticationLogsResponse, <-chan error) {\n\tresponseChan := make(chan *ListAuthenticationLogsResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ListAuthenticationLogs(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func listFiles(path string) func(string) []string {\n\treturn func(line string) []string {\n\t\tnames := make([]string, 0)\n\t\tfiles, _ := ioutil.ReadDir(path)\n\t\tfor _, f := range files {\n\t\t\tnames = append(names, f.Name())\n\t\t}\n\t\treturn names\n\t}\n}", "func (a *ChatLogsArchive) WriteChatLog(accountName string, fileName string, messages Messages) error {\n\tlogFilePath := strings.Join([]string{accountName, fileName}, \"/\")\n\n\tf, err := a.w.Create(logFilePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating file %s: %w\", logFilePath, err)\n\t}\n\n\terr = messages.Write(f)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing file %s: %w\", logFilePath, err)\n\t}\n\n\treturn nil\n}", "func (b *BucketManager) ListFilesInTimeSlot(property string, ts string) ([]string, error) {\n\tsvc := s3.New(b.session)\n\tlogFiles := regexp.MustCompile(`([a-zA-Z0-9]+)\\.([0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2})\\.([a-z0-9]+)\\.gz`)\n\tresp, _ := svc.ListObjects(&s3.ListObjectsInput{\n\t\tBucket: &b.bucket,\n\t\tPrefix: aws.String(fmt.Sprintf(\"%s.%s.\", property, ts)),\n\t})\n\tif len(resp.Contents) == 0 {\n\t\treturn nil, errors.New(\"no log files matching the requested parameters in the bucket\")\n\t}\n\tvar files []string\n\tfor _, key := range resp.Contents {\n\t\tif logFiles.MatchString(*key.Key) {\n\t\t\tfiles = append(files, *key.Key)\n\t\t}\n\t}\n\treturn files, nil\n}", "func GetChatList(UserId int) (res []*x.PB_ChatView) {\n\tchats, err := x.NewChat_Selector().UserId_Eq(UserId).OrderBy_UpdatedMs_Desc().GetRows(base.DB)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, chat := range chats {\n\t\tv := &x.PB_ChatView{\n\t\t\tChatKey: chat.ChatKey,\n\t\t\tRoomKey: chat.RoomKey,\n\t\t\tRoomTypeEnum: int32(chat.RoomTypeEnum),\n\t\t\tUserId: int32(chat.UserId),\n\t\t\tPeerUserId: int32(chat.PeerUserId),\n\t\t\tGroupId: int64(chat.GroupId),\n\t\t\tCreatedTime: int32(chat.CreatedTime),\n\t\t\tSeq: int32(chat.Seq),\n\t\t\tSeenSeq: int32(chat.SeenSeq),\n\t\t\tUpdatedMs: int64(chat.UpdatedMs),\n\t\t}\n\t\tv.UserView = view_service.UserViewAndMe(chat.PeerUserId, UserId)\n\n\t\tres = append(res, v)\n\t}\n\n\treturn\n}", "func listArchive() {\n files, err := ioutil.ReadDir(settings.PATH_ARCHIVE)\n utils.CheckError(err)\n\n fmt.Printf(\"| %s:\\n\", settings.User.Hash)\n for _, file := range files {\n fmt.Println(\"|\", file.Name())\n }\n}", "func ReadChatLogsArchive(fileName string) (*ChatLogsArchive, error) {\n\tr, err := zip.OpenReader(fileName)\n\tif err != nil && !errors.Is(err, os.ErrNotExist) {\n\t\treturn nil, err\n\t}\n\n\twf, err := os.Create(filepath.Join(os.TempDir(), fileName))\n\tif err != nil {\n\t\tif r != nil {\n\t\t\tr.Close()\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tfmt.Println(wf.Name())\n\n\treturn &ChatLogsArchive{\n\t\tfileName: fileName,\n\t\tr: r,\n\t\twf: wf,\n\t\tw: zip.NewWriter(wf),\n\t}, nil\n}", "func (lbase *Logbase) GetCatalogNames() (names []string, err error) {\n\tvar nscan int = 0 // Number of file objects scanned\n\n\tfindCatalogFile := func(fpath string, fileInfo os.FileInfo, inerr error) (err error) {\n\t\tstat, err := os.Stat(fpath)\n\t\tif err != nil {return}\n\n\t\tif nscan > 0 && stat.IsDir() {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\tnscan++\n\n\t\tfname := filepath.Base(fpath)\n\t\tif strings.HasPrefix(fname, CATALOG_FILENAME_PREFIX) {\n\t\t\tcatname := strings.TrimPrefix(fname, CATALOG_FILENAME_PREFIX)\n\t\t\tif catname != MASTER_CATALOG_NAME {\n\t\t\t\tnames = append(names, catname)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\terr = filepath.Walk(lbase.abspath, findCatalogFile)\n\treturn\n}", "func (kc *MessageBufferHandle) dirList(path string) ([]string, error) {\n\n\tfiles, err := ioutil.ReadDir(path) // sorted\n\tvar results []string\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar count = 0\n\tkc.bufferList = kc.bufferList[:0]\n\tfor _, f := range files {\n\t\tname := f.Name()\n\n\t\tif name[0:1] == readyPrefix {\n\t\t\tcount++\n\t\t\tkc.appendBuffers(f)\n\t\t\tresults = append(results, name)\n\t\t}\n\t}\n\t//fmt.Println(\"DIRLIST, found=\", count)\n\treturn results, nil\n}", "func (client *Client) ListApplicationLogsWithChan(request *ListApplicationLogsRequest) (<-chan *ListApplicationLogsResponse, <-chan error) {\n\tresponseChan := make(chan *ListApplicationLogsResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ListApplicationLogs(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func getHistoryFileList(dir string) ([]historyItem, error) {\n\tfileInfos, err := os.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thfileList := []historyItem{}\n\tfor _, fi := range fileInfos {\n\t\tif fi.IsDir() {\n\t\t\tcontinue\n\t\t}\n\n\t\t// another suffix\n\t\t// ex: tiup-history-0.bak\n\t\ti, err := strconv.Atoi((strings.TrimPrefix(fi.Name(), historyPrefix)))\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfInfo, _ := fi.Info()\n\t\thfileList = append(hfileList, historyItem{\n\t\t\tpath: filepath.Join(dir, fi.Name()),\n\t\t\tindex: i,\n\t\t\tinfo: fInfo,\n\t\t})\n\t}\n\n\tsort.Slice(hfileList, func(i, j int) bool {\n\t\treturn hfileList[i].index > hfileList[j].index\n\t})\n\n\treturn hfileList, nil\n}", "func ConfigFileList() ([]string, error) {\n\tccm_path := os.Getenv(\"CCM_REPO_PATH\")\n\tconfig_file_path := ccm_path + \"/ccm_configs/\"\n\t//fmt.Println(config_file_path)\n\tfile_data, err := ioutil.ReadDir(config_file_path)\n\tERRHandler(err, \"read ccm_configs dir\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar ConfigFiles []string\n\tfor _, file_info := range file_data {\n\t\tconfig_file := file_info.Name()\n\t\tConfigFiles = append(ConfigFiles, config_file)\n\t}\n\n\treturn ConfigFiles, nil\n}", "func (cfg *Config) ListConfigFiles() []string {\n\tobjects := cfg.Client.ListObjects(configBucket, \"\", true, make(chan struct{}, 1))\n\tresults := []string{}\n\tfor object := range objects {\n\t\tresults = append(results, object.Key)\n\t}\n\treturn results\n}", "func (c *Context) ListTournaments() []string {\n\tlist, err := filepath.Glob(path.Join(c.AppDir(), fmt.Sprintf(\"*.%v\", fileExtension)))\n\tif err != nil {\n\t\tc.Log.Error(err.Error())\n\t\treturn []string{}\n\t}\n\tre := regexp.MustCompile(fmt.Sprintf(\".*(\\\\\\\\|/)([^\\\\\\\\/]+)\\\\.%v$\", fileExtension))\n\tfor key := range list {\n\t\tlist[key] = string(re.ReplaceAll([]byte(list[key]), []byte(\"$2\")))\n\t}\n\treturn list\n}", "func (client *Client) ListAuthenticationLogsWithCallback(request *ListAuthenticationLogsRequest, callback func(response *ListAuthenticationLogsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListAuthenticationLogsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListAuthenticationLogs(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (cli *OpsGenieTeamClient) ListLogs(req team.ListTeamLogsRequest) (*team.ListTeamLogsResponse, error) {\n\treq.APIKey = cli.apiKey\n\tresp, err := cli.sendRequest(cli.buildGetRequest(teamLogsURL, req))\n\n\tif resp == nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar listTeamLogsResp team.ListTeamLogsResponse\n\n\tif err = resp.Body.FromJsonTo(&listTeamLogsResp); err != nil {\n\t\tmessage := \"Server response can not be parsed, \" + err.Error()\n\t\tlogging.Logger().Warn(message)\n\t\treturn nil, errors.New(message)\n\t}\n\treturn &listTeamLogsResp, nil\n}", "func (fs *Fs) ListFiles(dir string) []string {\n\tvar s []string\n\tfiles, err := ioutil.ReadDir(filepath.Join(fs.Path, dir))\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot list files in %s, %s\", filepath.Join(fs.Path, dir), err.Error())\n\t}\n\tfor _, file := range files {\n\t\tif !file.IsDir() {\n\t\t\ts = append(s, file.Name())\n\t\t}\n\t}\n\treturn s\n}", "func (client *Client) ListAuthenticationLogs(request *ListAuthenticationLogsRequest) (response *ListAuthenticationLogsResponse, err error) {\n\tresponse = CreateListAuthenticationLogsResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (fs EmbedFs) ListDir(path string) ([]string, error) {\n\tresult := []string{}\n\n\tfor _, entry := range fs.files {\n\t\trootName := filepath.Join(\"/\", entry.name)\n\t\tif strings.HasPrefix(rootName, filepath.Join(path, \"/\")) {\n\t\t\tresult = append(result, entry.name)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func (s *Snuffler) GetFileMatchList() []string {\n\tmatchList := make([]string, len(s.files))\n\tfor i, cf := range s.files {\n\t\tmatchList[i] = cf.fileName\n\t}\n\treturn matchList\n}", "func (c *Sharing) ListSharedFileMembers(ctx context.Context, in *ListSharedFileMembersInput) (out *ListSharedMembersOutput, err error) {\n\tbody, err := c.call(ctx, \"/sharing/list_file_members\", in)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer body.Close()\n\n\terr = json.NewDecoder(body).Decode(&out)\n\treturn\n}", "func (client JobClient) ListByAccountSender(req *http.Request) (*http.Response, error) {\n return client.Send(req, azure.DoRetryWithRegistration(client.Client))\n }", "func (l *FileWriter) oldLogFiles() ([]logInfo, error) {\n\tfiles, err := ioutil.ReadDir(l.dir())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can't read log file directory: %s\", err)\n\t}\n\n\tlogFiles := []logInfo{}\n\tif len(files) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tfor _, e := range files {\n\t\tlogFiles = append(logFiles, e)\n\t}\n\n\tsort.Sort(byName(logFiles))\n\treturn logFiles, nil\n}", "func ListFileNames(dirPath, prefix, suffix string) ([]string, error) {\n\tf, err := os.Open(dirPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfileInfos, err := f.Readdir(-1)\n\t_ = f.Close()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar files []string\n\n\tfor _, info := range fileInfos {\n\t\tname := info.Name()\n\n\t\tif prefix != \"\" && !strings.HasPrefix(name, prefix) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif suffix != \"\" && !strings.HasSuffix(name, suffix) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfiles = append(files, name)\n\t}\n\n\treturn files, nil\n}", "func (f *Fs) listReceivedFiles(ctx context.Context) (entries fs.DirEntries, err error) {\n\tstarted := false\n\tvar res *sharing.ListFilesResult\n\tfor {\n\t\tif !started {\n\t\t\targ := sharing.ListFilesArg{\n\t\t\t\tLimit: 100,\n\t\t\t}\n\t\t\terr := f.pacer.Call(func() (bool, error) {\n\t\t\t\tres, err = f.sharing.ListReceivedFiles(&arg)\n\t\t\t\treturn shouldRetry(ctx, err)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tstarted = true\n\t\t} else {\n\t\t\targ := sharing.ListFilesContinueArg{\n\t\t\t\tCursor: res.Cursor,\n\t\t\t}\n\t\t\terr := f.pacer.Call(func() (bool, error) {\n\t\t\t\tres, err = f.sharing.ListReceivedFilesContinue(&arg)\n\t\t\t\treturn shouldRetry(ctx, err)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"list continue: %w\", err)\n\t\t\t}\n\t\t}\n\t\tfor _, entry := range res.Entries {\n\t\t\tfmt.Printf(\"%+v\\n\", entry)\n\t\t\tentryPath := entry.Name\n\t\t\to := &Object{\n\t\t\t\tfs: f,\n\t\t\t\turl: entry.PreviewUrl,\n\t\t\t\tremote: entryPath,\n\t\t\t\tmodTime: *entry.TimeInvited,\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tentries = append(entries, o)\n\t\t}\n\t\tif res.Cursor == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn entries, nil\n}", "func LogsList(number string) error {\n\tcli, err := newBkCli()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn cli.tailLogs(number)\n}", "func ListAttachmentsFile(inFile string, conf *pdf.Configuration) ([]string, error) {\n\tf, err := os.Open(inFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\treturn ListAttachments(f, conf)\n}", "func fileList(folder string, fileChannel chan string) error {\n\treturn filepath.Walk(folder, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil || info.IsDir() {\n\t\t\treturn err\n\t\t}\n\t\tfileChannel <- path\n\t\treturn nil\n\t})\n}", "func (f *FileStore) List() ([]string, error) {\n\tkeys := make([]string, 0)\n\tfiles, err := f.filesystem.ReadDir(f.directoryPath)\n\tif err != nil {\n\t\treturn keys, err\n\t}\n\tfor _, f := range files {\n\t\tif !strings.HasPrefix(f.Name(), tmpPrefix) {\n\t\t\tkeys = append(keys, f.Name())\n\t\t}\n\t}\n\treturn keys, nil\n}", "func (c *ServerConn) NameList(path string) (entries []string, err error) {\n\tconn, err := c.cmdDataConnFrom(0, \"NLST %s\", path)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tr := &response{conn, c}\n\tdefer r.Close()\n\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\tentries = append(entries, scanner.Text())\n\t}\n\tif err = scanner.Err(); err != nil {\n\t\treturn entries, err\n\t}\n\treturn\n}", "func (client *Client) ListApplicationLogs(request *ListApplicationLogsRequest) (response *ListApplicationLogsResponse, err error) {\n\tresponse = CreateListApplicationLogsResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func dirList(path string) ([]string, error) {\n\tnames := []string{}\n\tfiles, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\tlog.Printf(\"Template error: %v\", err)\n\t\treturn names, nil\n\t}\n\tfor _, f := range files {\n\t\tnames = append(names, f.Name())\n\t}\n\treturn names, nil\n}", "func ListFiles(dir string) (files []string, err error) {\n\tdlist, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn files, err\n\t}\n\n\tfor _, f := range dlist {\n\t\tif strings.Contains(f.Name(), Fext) {\n\t\t\tfiles = append(files, dir+\"/\"+f.Name())\n\t\t}\n\t}\n\treturn files, err\n}", "func List() []string {\n\tvar ret []string\n\tfor k := range loggers {\n\t\tret = append(ret, k)\n\t}\n\treturn ret\n}", "func ListAttachments(rs io.ReadSeeker, conf *pdf.Configuration) ([]string, error) {\n\tif conf == nil {\n\t\tconf = pdf.NewDefaultConfiguration()\n\t}\n\n\tfromStart := time.Now()\n\tctx, durRead, durVal, durOpt, err := readValidateAndOptimize(rs, conf, fromStart)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfromWrite := time.Now()\n\tlist, err := pdf.AttachList(ctx.XRefTable)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdurWrite := time.Since(fromWrite).Seconds()\n\tdurTotal := time.Since(fromStart).Seconds()\n\tlog.Stats.Printf(\"XRefTable:\\n%s\\n\", ctx)\n\tpdf.TimingStats(\"list files\", durRead, durVal, durOpt, durWrite, durTotal)\n\n\treturn list, nil\n}", "func (e *EventLog) getFilesWithMatchDatePattern() []string {\n\tvar validFileNames []string\n\tif allFiles, err := e.fileSystem.ReadDir(e.eventLogPath); err == nil {\n\t\tfor _, fileInfo := range allFiles {\n\t\t\tfileName := fileInfo.Name()\n\t\t\tif !fileInfo.Mode().IsDir() && e.isValidFileName(fileName) {\n\t\t\t\tvalidFileNames = append(validFileNames, fileName)\n\t\t\t}\n\t\t}\n\t}\n\treturn validFileNames\n}", "func ListMessages(privkey *[ed25519.PrivateKeySize]byte, lastMessageTime int64, server string, cacert []byte) (messages []MessageMeta, err error) {\n\tvar authtoken []byte\n\tlastcounter := uint64(times.NowNano())\n\tpubkey := splitKey(privkey)\n\ti := 3 // This should skip error and a collision, but stop if it's an ongoing parallel access\nCallLoop:\n\tfor {\n\t\tif authtoken == nil {\n\t\t\tauthtoken = walletauth.CreateToken(pubkey, privkey, lastcounter+1)\n\t\t}\n\t\tmessages, lastcounter, err = listMessages(authtoken, lastMessageTime, server, cacert)\n\t\tif err == walletauth.ErrReplay {\n\t\t\tauthtoken = nil\n\t\t\tif i > 0 {\n\t\t\t\ti--\n\t\t\t\tcontinue CallLoop\n\t\t\t}\n\t\t}\n\t\tbreak CallLoop\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn messages, nil\n}", "func ListDir(dirPth string, suffix string) (files []string, err error) {\n\tfiles = make([]string, 0, 10)\n\tdir, err := ioutil.ReadDir(dirPth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuffix = strings.ToUpper(suffix) //忽略后缀匹配的大小写\n\tfor _, fi := range dir {\n\t\tif fi.IsDir() { // 忽略目录\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasSuffix(strings.ToUpper(fi.Name()), suffix) { //匹配文件\n\t\t\tfiles = append(files, fi.Name())\n\t\t}\n\t}\n\treturn files, nil\n}", "func ListFilesByDateMatching(directory string, pattern string) ([]os.FileInfo, error) {\n\tfilteredFiles := []os.FileInfo{}\n\tfilter, err := regexp.Compile(pattern)\n\tif err != nil {\n\t\treturn filteredFiles, err\n\t}\n\n\tfiles, err := ioutil.ReadDir(directory)\n\tif err != nil {\n\t\treturn filteredFiles, err\n\t}\n\n\tsort.Sort(FilesByDate(files))\n\n\tfor _, file := range files {\n\t\tif file.IsDir() || file.Mode()&os.ModeSymlink == os.ModeSymlink {\n\t\t\tcontinue // ### continue, skip symlinks and directories ###\n\t\t}\n\t\tif filter.MatchString(file.Name()) {\n\t\t\tfilteredFiles = append(filteredFiles, file)\n\t\t}\n\t}\n\n\treturn filteredFiles, nil\n}", "func (client *Client) ListApplicationLogsWithCallback(request *ListApplicationLogsRequest, callback func(response *ListApplicationLogsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListApplicationLogsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListApplicationLogs(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func ListFiles(ctx context.Context, store store.Store, repositoryID int, commit string, pattern *regexp.Regexp) ([]string, error) {\n\tout, err := execGitCommand(ctx, store, repositoryID, \"ls-tree\", \"--name-only\", \"-r\", commit, \"--\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar matching []string\n\tfor _, path := range strings.Split(out, \"\\n\") {\n\t\tif pattern.MatchString(path) {\n\t\t\tmatching = append(matching, path)\n\t\t}\n\t}\n\n\treturn matching, nil\n}", "func (m *Maildir) List(dir string) (map[string]*lib.Message, error) {\n\tif !lib.StringInSlice(dir, lib.Subdirs) {\n\t\treturn nil, errors.New(\"dir must be :new, :cur, or :tmp\")\n\t}\n\n\tkeys, err := m.getDirListing(dir)\n\tif err != nil {\n\t\treturn nil, errors.New(\"failed to get directory listing\")\n\t}\n\tsort.Sort(sort.StringSlice(keys))\n\n\t// map keys to message objects\n\tkeyMap := make(map[string]*lib.Message)\n\tfor i := 0; i < len(keys); i++ {\n\t\tkeyMap[keys[i]] = m.Get(keys[i])\n\t}\n\n\treturn keyMap, nil\n}", "func ListLogEvents(group, name, region string) error {\n\tsvc := assertCloudWatch(region)\n\tstartTime := time.Now().Add(-10 * time.Minute)\n\teventParams := &cloudwatchlogs.GetLogEventsInput{\n\t\tLogGroupName: aws.String(group),\n\t\tLogStreamName: aws.String(name),\n\t\tStartTime: aws.Int64(startTime.Unix() * 1000),\n\t}\n\teventPage := 0\n\teventErr := svc.GetLogEventsPages(eventParams, func(events *cloudwatchlogs.GetLogEventsOutput, lastPage bool) bool {\n\t\teventPage++\n\t\tfor _, event := range events.Events {\n\t\t\tval := time.Unix(*event.Timestamp/1000, 0)\n\t\t\tfmt.Println(fmt.Sprintf(\"[%v] %v\", val.Format(\"2006-01-02 15:04:05 MST\"), *event.Message))\n\t\t}\n\t\treturn eventPage <= 3\n\t})\n\tif eventErr != nil {\n\t\treturn eventErr\n\t}\n\treturn nil\n}", "func ListListenersFile() []*os.File {\n\tvar files []*os.File\n\tfor _, server := range servers {\n\t\tfiles = append(files, server.handler.ListListenersFile(nil)...)\n\t}\n\treturn files\n}", "func (ml *messageLog) List(find defs.MessageFindFunc, filter defs.MessageFunc) int {\r\n\tml.lock.Lock()\r\n\tdefer ml.lock.Unlock()\r\n\r\n\tlength := len(ml.log.entries)\r\n\tindex, ok := find()\r\n\tif ok {\r\n\t\tfor index < length {\r\n\t\t\tif filter(index, ml.log.entries[index].ServiceKey, ml.log.entries[index].Message) {\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t\tindex++\r\n\t\t}\r\n\t}\r\n\treturn length\r\n}", "func (a LocalApi) ListLogs() ([]Log, error) {\n\treturn loadLogs(a.path)\n}", "func (s *HangoutsChatWebhooksService) List(ctx context.Context) (webhooks []Webhook, err error) {\n\tvar r webhooksResponse\n\terr = s.client.request(ctx, http.MethodGet, \"v1/hangouts-chat-webhooks\", nil, &r)\n\treturn r.Webhooks, err\n}", "func listFiles(folder string) []string {\n\tvar files []string\n\tfilepath.Walk(folder, func(fp string, info os.FileInfo, err error) error {\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tparts := strings.SplitAfter(fp, fmt.Sprintf(\"%s%c\", folder, os.PathSeparator))\n\t\tnfp := strings.Join(parts[1:], string(os.PathSeparator))\n\t\tfiles = append(files, nfp)\n\t\treturn nil\n\t})\n\n\treturn files\n}", "func (h *ConversationHandler) ListConversations(c echo.Context) error {\n\trecipient := c.Param(\"to\")\n\n\t// additional query params (to satisfy challenege requirements)\n\tstartParam := c.QueryParam(\"start\")\n\tuntilParam := c.QueryParam(\"until\")\n\tlimitParam := c.QueryParam(\"limit\")\n\n\tvar start, until time.Time\n\tvar err error\n\tlimit := 100 // set a default limit to 100\n\tif startParam != \"\" {\n\t\tstart, err = time.Parse(\"2006-01-02\", startParam)\n\t\tif err != nil {\n\t\t\treturn handleError(c, err)\n\t\t}\n\t} else {\n\t\tstart = time.Now().AddDate(0, 0, -30)\n\t}\n\n\tif untilParam != \"\" {\n\t\tuntil, err = time.Parse(\"2006-01-02\", untilParam)\n\t\tif err != nil {\n\t\t\treturn handleError(c, err)\n\t\t}\n\t} else {\n\t\tuntil = time.Now()\n\t}\n\n\tif limitParam != \"\" {\n\t\tlimit, err = strconv.Atoi(limitParam)\n\t\tif err != nil {\n\t\t\treturn handleError(c, err)\n\t\t}\n\t}\n\n\tconvos, err := h.DB.ListConversations(recipient, start, until)\n\n\tif err != nil {\n\t\treturn handleError(c, err)\n\t}\n\n\t// Now filter the messages\n\tmessages := []*models.Message{}\n\tfor _, convo := range convos {\n\t\tfor _, msg := range convo.Messages {\n\t\t\tif len(messages) >= limit {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif msg.Recipient == recipient {\n\t\t\t\tmessages = append(messages, msg)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(messages) > 0 {\n\t\treturn c.JSON(http.StatusOK, messages)\n\t}\n\n\t// this shouldn't normally happen, but if there are orphaned conversations, we don't want to return empty messages\n\treturn handleError(c, constants.ErrNotFound)\n}", "func (r *ChangeLogsService) List(profileId int64) *ChangeLogsListCall {\n\tc := &ChangeLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\treturn c\n}", "func (l *FileLog) matchingFiles(fromUTC, toUTC time.Time, order types.EventOrder) ([]eventFile, error) {\n\tvar dirs []string\n\tvar err error\n\tif l.SearchDirs != nil {\n\t\tdirs, err = l.SearchDirs()\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t} else {\n\t\tdirs = []string{l.Dir}\n\t}\n\n\tvar filtered []eventFile\n\tfor _, dir := range dirs {\n\t\t// scan the log directory:\n\t\tdf, err := os.Open(dir)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tdefer df.Close()\n\t\tentries, err := df.Readdir(-1)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tfor i := range entries {\n\t\t\tfi := entries[i]\n\t\t\tif fi.IsDir() || filepath.Ext(fi.Name()) != LogfileExt {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfd, err := ParseFileTime(fi.Name())\n\t\t\tif err != nil {\n\t\t\t\tl.Warningf(\"Failed to parse audit log file %q format: %v\", fi.Name(), err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// File rounding in current logs is non-deterministic,\n\t\t\t// as Round function used in rotateLog can round up to the lowest\n\t\t\t// or the highest period. That's why this has to check both\n\t\t\t// periods.\n\t\t\t// Previous logic used modification time what was flaky\n\t\t\t// as it could be changed by migrations or simply moving files\n\t\t\tif fd.After(fromUTC.Add(-1*l.RotationPeriod)) && fd.Before(toUTC.Add(l.RotationPeriod)) {\n\t\t\t\teventFile := eventFile{\n\t\t\t\t\tFileInfo: fi,\n\t\t\t\t\tpath: filepath.Join(dir, fi.Name()),\n\t\t\t\t}\n\t\t\t\tfiltered = append(filtered, eventFile)\n\t\t\t}\n\t\t}\n\t}\n\t// sort all accepted files by date\n\tvar toSort sort.Interface\n\tswitch order {\n\tcase types.EventOrderAscending:\n\t\ttoSort = byDate(filtered)\n\tcase types.EventOrderDescending:\n\t\ttoSort = sort.Reverse(byDate(filtered))\n\tdefault:\n\t\treturn nil, trace.BadParameter(\"invalid event order: %v\", order)\n\t}\n\tsort.Sort(toSort)\n\treturn filtered, nil\n}", "func (c *cloner) listZipFiles() ([]zipFile, error) {\n\tdirEntries, err := os.ReadDir(c.cli.config.cacheDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar zipFiles []zipFile\n\tfor _, entry := range dirEntries {\n\t\text := filepath.Ext(entry.Name())\n\t\tif ext != \".zip\" {\n\t\t\tcontinue\n\t\t}\n\t\tif !strings.HasPrefix(entry.Name(), sampleAppsNamePrefix) {\n\t\t\tcontinue\n\t\t}\n\t\tfi, err := entry.Info()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tname := fi.Name()\n\t\tetag := \"\"\n\t\tparts := strings.Split(name, \"_\")\n\t\tif len(parts) == 2 {\n\t\t\tetag = strings.TrimSuffix(parts[1], ext)\n\t\t}\n\t\tzipFiles = append(zipFiles, zipFile{\n\t\t\tpath: filepath.Join(c.cli.config.cacheDir, name),\n\t\t\tetag: etag,\n\t\t\tmodTime: fi.ModTime(),\n\t\t})\n\t}\n\treturn zipFiles, nil\n}", "func getLogins(domain string) []string {\n\t// first, search for DOMAIN/USERNAME.gpg\n\t// then, search for DOMAIN.gpg\n\tmatches, _ := zglob.Glob(PwStoreDir + \"**/\" + domain + \"*/*.gpg\")\n\tmatches2, _ := zglob.Glob(PwStoreDir + \"**/\" + domain + \"*.gpg\")\n\tmatches = append(matches, matches2...)\n\n\tentries := make([]string, 0)\n\n\tfor _, file := range matches {\n\t\tfile = strings.TrimSuffix(strings.Replace(file, PwStoreDir, \"\", 1), \".gpg\")\n\t\tentries = append(entries, file)\n\t}\n\n\treturn entries\n}", "func (a *Archiver) readdirnames(dir *os.File) chan string {\n\tretval := make(chan string, 256)\n\tgo func(dir *os.File) {\n\t\tfor {\n\t\t\tnames, err := dir.Readdirnames(256)\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else if err != nil {\n\t\t\t\ta.Logger.Warning(\"error reading directory:\", err.Error())\n\t\t\t}\n\t\t\tfor _, name := range names {\n\t\t\t\tretval <- name\n\t\t\t}\n\t\t}\n\t\tclose(retval)\n\t}(dir)\n\treturn retval\n}", "func getChatList(client *tdlib.Client, limit int, haveFullChatList bool) ([]*tdlib.Chat, error) {\n\n\tvar allChats []*tdlib.Chat\n\n\tif !haveFullChatList && limit > len(allChats) {\n\t\toffsetOrder := int64(math.MaxInt64)\n\t\toffsetChatID := int64(0)\n\t\tvar chatList = tdlib.NewChatListMain()\n\t\tvar lastChat *tdlib.Chat\n\n\t\tif len(allChats) > 0 {\n\t\t\tlastChat = allChats[len(allChats)-1]\n\t\t\tfor i := 0; i < len(lastChat.Positions); i++ {\n\t\t\t\t//Find the main chat list\n\t\t\t\tif lastChat.Positions[i].List.GetChatListEnum() == tdlib.ChatListMainType {\n\t\t\t\t\toffsetOrder = int64(lastChat.Positions[i].Order)\n\t\t\t\t}\n\t\t\t}\n\t\t\toffsetChatID = lastChat.ID\n\t\t}\n\n\t\t// get chats (ids) from tdlib\n\t\tchats, err := client.GetChats(chatList, tdlib.JSONInt64(offsetOrder),\n\t\t\toffsetChatID, int32(limit-len(allChats)))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(chats.ChatIDs) == 0 {\n\t\t\thaveFullChatList = true\n\t\t\treturn allChats, nil\n\t\t}\n\n\t\tfor _, chatID := range chats.ChatIDs {\n\t\t\t// get chat info from tdlib\n\t\t\tchat, err := client.GetChat(chatID)\n\t\t\tif err == nil {\n\t\t\t\tallChats = append(allChats, chat)\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\t// return getChatList(client, limit, allChats, false)\n\t}\n\treturn allChats, nil\n}", "func dirlist(conn net.Conn) {\n\tdefer conn.Write([]byte(\"\\n\"))\n\tdir, err := os.Open(\".\")\n\tif err != nil {\n\t\tconn.Write([]byte(err.Error()))\n\t}\n\n\tnames, err := dir.Readdirnames(-1)\n\tif err != nil {\n\t\tconn.Write([]byte(err.Error()))\n\t}\n\n\tfor _, name := range names {\n\t\tconn.Write([]byte(name + \"\\n\"))\n\t}\n}", "func ListFiles(dir string) []string {\n\tvar out []string\n\terr := filepath.Walk(dir, func(path string, f os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !f.IsDir() {\n\t\t\tout = append(out, path)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlogs.WithFields(logs.Fields{\n\t\t\t\"Directory\": dir,\n\t\t\t\"Error\": err,\n\t\t}).Println(\"Unable to read directory\")\n\t\treturn nil\n\t}\n\treturn out\n}", "func FetchAllUsers(logFilePath string) user.FetchAll {\n\treturn func() ([]user.User, error) {\n\t\tvar sc *bufio.Scanner\n\t\t{\n\t\t\tlogFile, err := os.OpenFile(logFilePath, os.O_RDONLY, 0)\n\t\t\tif err != nil {\n\t\t\t\treturn make([]user.User, 0), err\n\t\t\t}\n\t\t\tdefer logFile.Close()\n\t\t\tsc = bufio.NewScanner(logFile)\n\t\t}\n\n\t\tm := chat.Message{}\n\t\tuserNameMap := make(map[string]bool)\n\t\tus := make([]user.User, 0)\n\t\tfor sc.Scan() {\n\t\t\terr := json.Unmarshal(sc.Bytes(), &m)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif _, ok := userNameMap[m.From]; !ok {\n\t\t\t\tuserNameMap[m.From] = true\n\t\t\t\tus = append(us, user.User{Name: m.From})\n\t\t\t}\n\t\t}\n\t\treturn us, nil\n\t}\n}", "func (c *Config) List(name string) (keys []string, err error) {\n\tconfigDir, err := c.configDirectory()\n\tif err != nil {\n\t\treturn\n\t}\n\tdir := path.Join(configDir, name)\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, file := range files {\n\t\tkeys = append(keys, file.Name())\n\t}\n\tsort.Strings(keys)\n\treturn\n}", "func listFiles(dirname string) []string {\n\tf, _ := os.Open(dirname)\n\n\tnames, _ := f.Readdirnames(-1)\n\tf.Close()\n\n\tsort.Strings(names)\n\n\tdirs := []string{}\n\tfiles := []string{}\n\n\t// sort: directories in front of files\n\tfor _, name := range names {\n\t\tpath := filepath.Join(dirname, name)\n\t\tfio, err := os.Lstat(path)\n\n\t\tif nil != err {\n\t\t\tlogger.Warnf(\"Can't read file info [%s]\", path)\n\n\t\t\tcontinue\n\t\t}\n\n\t\tif fio.IsDir() {\n\t\t\t// exclude the .git, .svn, .hg direcitory\n\t\t\tif \".git\" == fio.Name() || \".svn\" == fio.Name() || \".hg\" == fio.Name() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdirs = append(dirs, name)\n\t\t} else {\n\t\t\t// exclude the .DS_Store directory on Mac OS X\n\t\t\tif \".DS_Store\" == fio.Name() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfiles = append(files, name)\n\t\t}\n\t}\n\n\treturn append(dirs, files...)\n}", "func (self *FileBaseDataStore) ListChildren(\n\tconfig_obj *api_proto.Config,\n\turn string,\n\toffset uint64, length uint64) ([]string, error) {\n\tresult := []string{}\n\n\tchildren, err := listChildren(config_obj, urn)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tsort.Slice(children, func(i, j int) bool {\n\t\treturn children[i].ModTime().Unix() > children[j].ModTime().Unix()\n\t})\n\n\turn = strings.TrimSuffix(urn, \"/\")\n\tfor i := offset; i < offset+length; i++ {\n\t\tif i >= uint64(len(children)) {\n\t\t\tbreak\n\t\t}\n\n\t\tname := UnsanitizeComponent(children[i].Name())\n\t\tif !strings.HasSuffix(name, \".db\") {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(\n\t\t\tresult,\n\t\t\turn+\"/\"+strings.TrimSuffix(name, \".db\"))\n\t}\n\treturn result, nil\n}", "func ListFilenames(path string) []os.FileInfo {\n Trace.Println(\"listFilenames(\" + path + \")\")\n\n files, err := ioutil.ReadDir(path)\n if err != nil {\n Error.Println(err)\n os.Exit(1)\n }\n\n return files\n}", "func (z *Zone) GetNameServerList() ([]*NameServerRecord) {\n\tmutableMutex.Lock()\n\tdefer mutableMutex.Unlock()\n\tif z.NameServerList == nil {\n\t\tz.NameServerList = make([]*NameServerRecord, 0)\n\t}\n\tnewNameServerList := make([]*NameServerRecord, len(z.NameServerList))\n\tcopy(newNameServerList, z.NameServerList)\n\treturn newNameServerList\n}", "func LogFile(filepath string) ([]event.EloEvent, error) {\n\tevents := []event.EloEvent{}\n\n\tit, err := NewFieldsIterator(filepath)\n\tdefer it.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor {\n\t\tlineNum, m, err := it.Next()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif lineNum < 0 {\n\t\t\tbreak // EOF\n\t\t}\n\t\tevent, err := EloEvent(m)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing event from line %d: %v\", lineNum, err)\n\t\t}\n\t\tif event != nil {\n\t\t\tevents = append(events, event)\n\t\t}\n\t}\n\n\treturn events, nil\n}", "func getFileList(dir string) ([]string, error) {\n\tvar fileNames []string\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn fileNames, err\n\t}\n\n\tfor _, file := range files {\n\t\tif !file.IsDir() && filepath.Ext(file.Name()) == \".out\" {\n\t\t\tfileNames = append(fileNames, file.Name())\n\t\t}\n\t}\n\treturn fileNames, nil\n}", "func List() []string {\n\tvar keys []string\n\tfor k := range loggers {\n\t\tkeys = append(keys, k)\n\t}\n\treturn keys\n}", "func (service *Service) ListFiles(repositoryURL, referenceName, username, password string, dirOnly, hardRefresh bool, includedExts []string, tlsSkipVerify bool) ([]string, error) {\n\trepoKey := generateCacheKey(repositoryURL, referenceName, username, password, strconv.FormatBool(tlsSkipVerify), strconv.FormatBool(dirOnly))\n\n\tif service.cacheEnabled && hardRefresh {\n\t\t// Should remove the cache explicitly, so that the following normal list can show the correct result\n\t\tservice.repoFileCache.Remove(repoKey)\n\t}\n\n\tif service.repoFileCache != nil {\n\t\t// lookup the files cache first\n\t\tcache, ok := service.repoFileCache.Get(repoKey)\n\t\tif ok {\n\t\t\tfiles, success := cache.([]string)\n\t\t\tif success {\n\t\t\t\t// For the case while searching files in a repository without include extensions for the first time,\n\t\t\t\t// but with include extensions for the second time\n\t\t\t\tincludedFiles := filterFiles(files, includedExts)\n\t\t\t\treturn includedFiles, nil\n\t\t\t}\n\t\t}\n\t}\n\n\toptions := fetchOption{\n\t\tbaseOption: baseOption{\n\t\t\trepositoryUrl: repositoryURL,\n\t\t\tusername: username,\n\t\t\tpassword: password,\n\t\t\ttlsSkipVerify: tlsSkipVerify,\n\t\t},\n\t\treferenceName: referenceName,\n\t\tdirOnly: dirOnly,\n\t}\n\n\tvar (\n\t\tfiles []string\n\t\terr error\n\t)\n\tif isAzureUrl(options.repositoryUrl) {\n\t\tfiles, err = service.azure.listFiles(context.TODO(), options)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tfiles, err = service.git.listFiles(context.TODO(), options)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tincludedFiles := filterFiles(files, includedExts)\n\tif service.cacheEnabled && service.repoFileCache != nil {\n\t\tservice.repoFileCache.Add(repoKey, includedFiles)\n\t\treturn includedFiles, nil\n\t}\n\treturn includedFiles, nil\n}", "func GetChatList(pageSize int, pageToken string) (g *m.GroupListData, err error) {\n\tres, err := HttpRequest.Debug(Debug).\n\t\tSetHeaders(map[string]string{\"Authorization\": GetAuthorization()}).\n\t\tGet(\n\t\t\tfmt.Sprintf(\"%s%s\", FeishuAPI, APIChatList),\n\t\t\tfmt.Sprintf(\"page_size=%d&page_token=%s\", pageSize, pageToken),\n\t\t)\n\tgl := &m.GroupListResp{}\n\tif err = res.Json(gl); err != nil {\n\t\treturn\n\t}\n\tif gl.Code == 0 {\n\t\treturn gl.Data, nil\n\t}\n\treturn nil, errors.New(gl.Msg)\n}", "func (a *AccMaster) List() []string {\n\tlist := make([]string, 0)\n\tfor _, v := range a.accName {\n\t\tlist = append(list, v)\n\t}\n\treturn list\n}", "func (r *LoggingRepository) List(ctx context.Context, teamID, userID string) ([]*model.Member, error) {\n\tstart := time.Now()\n\trecords, err := r.upstream.List(ctx, teamID, userID)\n\n\tlogger := r.logger.With().\n\t\tStr(\"request\", r.requestID(ctx)).\n\t\tStr(\"method\", \"list\").\n\t\tDur(\"duration\", time.Since(start)).\n\t\tStr(\"team\", teamID).\n\t\tStr(\"user\", userID).\n\t\tLogger()\n\n\tif err != nil {\n\t\tlogger.Warn().\n\t\t\tErr(err).\n\t\t\tMsg(\"failed to fetch members\")\n\t} else {\n\t\tlogger.Debug().\n\t\t\tMsg(\"\")\n\t}\n\n\treturn records, err\n}", "func (client BastionClient) ListWorkRequestLogs(ctx context.Context, request ListWorkRequestLogsRequest) (response ListWorkRequestLogsResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listWorkRequestLogs, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = ListWorkRequestLogsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListWorkRequestLogsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListWorkRequestLogsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListWorkRequestLogsResponse\")\n\t}\n\treturn\n}", "func (p *GetService) GetFileList(request string, reply *string) error {\n\tbuffer := make([]byte, 1024)\n\tbuffer, _ = json.Marshal(fileList)\n\t*reply = string(buffer)\n\treturn nil\n}", "func (l *Location) List() ([]string, error) {\n\n\tvar filenames []string\n\tclient, err := l.fileSystem.Client(l.Authority)\n\tif err != nil {\n\t\treturn filenames, err\n\t}\n\t// start timer once action is completed\n\tdefer l.fileSystem.connTimerStart()\n\n\tfileinfos, err := client.ReadDir(l.Path())\n\tif err != nil {\n\t\tif err == os.ErrNotExist {\n\t\t\treturn filenames, nil\n\t\t}\n\t\treturn filenames, err\n\t}\n\tfor _, fileinfo := range fileinfos {\n\t\tif !fileinfo.IsDir() {\n\t\t\tfilenames = append(filenames, fileinfo.Name())\n\t\t}\n\t}\n\n\treturn filenames, nil\n}", "func GetList(path string) ([]string, error) {\n\tftpConn, err := connect()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer ftpConn.Quit()\n\tvar entries []string\n\tentries, err = ftpConn.NameList(path)\n\tif err != nil {\n\t\treturn entries, &FTPError{\n\t\t\tMessage: fmt.Sprintf(\"获取路径%s下文件列表失败\", path),\n\t\t\tOriginErr: err,\n\t\t}\n\t}\n\n\treturn entries, nil\n}", "func (act Account) List(f Filter) (NotificationList, error) {\n\tvar rl NotificationList\n\terr := f.validate()\n\tif err != nil {\n\t\treturn rl, err\n\t}\n\terr = common.SendGetRequest(fmt.Sprintf(notifications.List, act.AccountSid)+f.getQueryString(), act, &rl)\n\treturn rl, err\n}", "func listFiles(svc *storage.Service, bucketName string, filePrefix string) ([]string, error) {\n\t// List all objects in a bucket using pagination\n\tvar files []string\n\ttoken := \"\"\n\tfor {\n\t\tcall := svc.Objects.List(bucketName)\n\t\tcall.Prefix(filePrefix)\n\t\tif token != \"\" {\n\t\t\tcall = call.PageToken(token)\n\t\t}\n\t\tres, err := call.Do()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, object := range res.Items {\n\t\t\tfiles = append(files, object.Name)\n\t\t}\n\t\tif token = res.NextPageToken; token == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn files, nil\n}", "func (f *fileCredentialCache) List() []*AuthEntry {\n\tregistryCache := f.init()\n\n\t// optimize allocation for copy\n\tentries := make([]*AuthEntry, 0, len(registryCache.Registries))\n\n\tfor _, entry := range registryCache.Registries {\n\t\tentries = append(entries, entry)\n\t}\n\n\treturn entries\n}", "func ListFiles(dir string) ([]string, error) {\n\tvar files []string\n\terr := filepath.Walk(dir, func(active string, info os.FileInfo, err error) error {\n\t\t// ignore directories\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trel, err := filepath.Rel(dir, active)\n\t\tfiles = append(files, rel)\n\t\treturn nil\n\t})\n\treturn files, err\n}", "func (l Util) List(root string, buff []string, rec bool, ext string) (r []string, err error) {\n\tr = buff\n\tentries, err := l.ReadDir(l.path(root))\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, e := range entries {\n\t\tp := path.Join(root, e.Name())\n\t\tif e.IsDir() {\n\t\t\tif rec {\n\t\t\t\tr, err = l.List(p, r, true, ext)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tidx := strings.LastIndex(e.Name(), \".\")\n\t\t\tif idx == -1 {\n\t\t\t\tif ext == \"\" {\n\t\t\t\t\tr = append(r, p)\n\t\t\t\t}\n\t\t\t} else if ext == \"\" || e.Name()[idx+1:] == ext {\n\t\t\t\tr = append(r, p)\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn\n}", "func (client BastionClient) listWorkRequestLogs(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/workRequests/{workRequestId}/logs\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListWorkRequestLogsResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func sendFilelist(filelist []os.FileInfo) error {\n\tvar filelistArr []string\n\n\t// Remove directories from list and make it a slice of filenames\n\tfor _, file := range filelist {\n\t\tif !file.IsDir() {\n\t\t\tfilelistArr = append(filelistArr, file.Name())\n\t\t}\n\t}\n\n\tfilelistJSON, err := json.Marshal(filelistArr)\n\tif err != nil {\n\t\tlog.Error(\"Error marshalling filelist to JSON: \", err)\n\t\treturn err\n\t}\n\n\treturn messaging.ClientSend(\"FULL_LIST\", string(filelistJSON))\n}", "func (c *Client) GetLogfilesForDeploymentJSON(deploymentid string) (string, []error) {\n\treturn c.getJSON(\"deployments/\" + deploymentid + \"/logfiles\")\n}", "func readdirnames(dirfd int) (names []string, err error) {\n\tnames = make([]string, 0, 100)\n\tvar buf [STATMAX]byte\n\n\tfor {\n\t\tn, e := Read(dirfd, buf[:])\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\tif n == 0 {\n\t\t\tbreak\n\t\t}\n\t\tfor b := buf[:n]; len(b) > 0; {\n\t\t\tvar s []byte\n\t\t\ts, b = gdirname(b)\n\t\t\tif s == nil {\n\t\t\t\treturn nil, ErrBadStat\n\t\t\t}\n\t\t\tnames = append(names, string(s))\n\t\t}\n\t}\n\treturn\n}", "func (client *Client) ListSQLExecAuditLog(request *ListSQLExecAuditLogRequest) (response *ListSQLExecAuditLogResponse, err error) {\n\tresponse = CreateListSQLExecAuditLogResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func FileReaddirnames(f *os.File, n int) ([]string, error)", "func readDirNames(fs http.FileSystem, dirname string) ([]string, error) {\n\tf, err := fs.Open(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tinfos, err := f.Readdir(-1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnames := make([]string, 0, len(infos))\n\tfor _, info := range infos {\n\t\tnames = append(names, info.Name())\n\t}\n\tsort.Strings(names)\n\treturn names, nil\n}", "func (client ApplicationsClient) ListKeyCredentialsSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "func GetBackupFileList() []string {\n\tholddisk.Lock()\n\tdefer holddisk.Unlock()\n\tfiles, err := ioutil.ReadDir(backupfolder)\n\tif err != nil {\n\t\tlog.Errorf(\"Unable to list file from backup directory. Err=%v\", err)\n\t\treturn []string{}\n\t}\n\tlst := make([]string, 0, len(files))\n\tfor _, f := range files {\n\t\tif f.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\ts := f.Name()\n\t\tif !strings.HasSuffix(s, \".dat\") {\n\t\t\tcontinue\n\t\t}\n\t\ts = strings.Replace(s, backupfolder, \"\", 1)\n\t\ts = strings.Replace(s, \".dat\", \"\", 1)\n\t\ts = strings.TrimSpace(s)\n\t\tlst = append(lst, s)\n\t}\n\tsort.Strings(lst)\n\treturn lst\n}", "func fileNames(tdir string, filenames ...string) []string {\n\tflist := []string{}\n\tfor _, fname := range filenames {\n\t\tflist = append(flist, filepath.Join(tdir, fname))\n\t}\n\treturn flist\n}", "func List(home string) ([]Stat, error) {\n\terr := ensureDir(home)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tchildren, err := os.ReadDir(home)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar futures []Stat\n\tfor _, child := range children {\n\t\tif !child.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tname := child.Name()\n\n\t\tf := Open(home, name)\n\t\tcomplete, err := f.isComplete()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfutures = append(futures, Stat{name, complete})\n\t}\n\treturn futures, nil\n}", "func (s *RaftServer) ListEntries(_ context.Context, _ *raftapi.Empty) (*raftapi.EntryListResponse, error) {\n\tlist, err := s.logRepo.List()\n\tif err != nil {\n\t\treturn nil, model.NewRaftError(&s.member, err)\n\t}\n\tvar logEntries = make([]*raftapi.LogEntry, 0)\n\tfor _, entry := range list {\n\t\tlogEntries = append(logEntries, &raftapi.LogEntry{\n\t\t\tTerm: entry.Term,\n\t\t\tValue: entry.Value,\n\t\t})\n\t}\n\tresponse := &raftapi.EntryListResponse{Entries: logEntries}\n\treturn response, nil\n}", "func (s *Service) WatchLogs(req *WatchLogsRequest, srv FFSAPI_WatchLogsServer) error {\n\ti, err := s.getInstanceByToken(srv.Context())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar opts []api.GetLogsOption\n\tif req.Jid != \"\" {\n\t\topts = append(opts, api.WithJidFilter(ffs.JobID(req.Jid)))\n\t}\n\n\tc, err := cid.Decode(req.Cid)\n\tif err != nil {\n\t\treturn err\n\t}\n\tch := make(chan ffs.LogEntry, 100)\n\tgo func() {\n\t\terr = i.WatchLogs(srv.Context(), ch, c, opts...)\n\t\tclose(ch)\n\t}()\n\tfor l := range ch {\n\t\treply := &WatchLogsReply{\n\t\t\tLogEntry: &LogEntry{\n\t\t\t\tCid: c.String(),\n\t\t\t\tJid: l.Jid.String(),\n\t\t\t\tTime: l.Timestamp.Unix(),\n\t\t\t\tMsg: l.Msg,\n\t\t\t},\n\t\t}\n\t\tif err := srv.Send(reply); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}" ]
[ "0.64427686", "0.5752387", "0.54061437", "0.52472806", "0.51847076", "0.5143666", "0.5082753", "0.50507474", "0.49688727", "0.49046537", "0.48984817", "0.4883243", "0.48223332", "0.4808702", "0.48069456", "0.47883275", "0.47777826", "0.47636014", "0.47596166", "0.47275025", "0.47235882", "0.46793476", "0.4672616", "0.46512493", "0.46460423", "0.4623442", "0.45867056", "0.4573881", "0.45707747", "0.457068", "0.45688748", "0.45467043", "0.45336273", "0.4529768", "0.45053625", "0.448773", "0.4480621", "0.44705942", "0.44620374", "0.445123", "0.4445709", "0.44125158", "0.43862462", "0.43767694", "0.43717304", "0.43715435", "0.4356353", "0.43484426", "0.43453944", "0.43447557", "0.43419456", "0.4339046", "0.43299946", "0.43226826", "0.4321578", "0.4317684", "0.43173072", "0.43128383", "0.43076047", "0.4304093", "0.4294178", "0.4270174", "0.42695197", "0.42665142", "0.42619643", "0.42617545", "0.4247383", "0.4238496", "0.42366245", "0.42322475", "0.42282876", "0.422683", "0.4226297", "0.42262262", "0.42249572", "0.42245862", "0.42074534", "0.42054862", "0.4199546", "0.4187523", "0.4173882", "0.41731894", "0.41587755", "0.41461954", "0.4146015", "0.41175717", "0.41161683", "0.41161245", "0.41153237", "0.41144484", "0.41129866", "0.41127917", "0.41067636", "0.41056064", "0.40982476", "0.40979686", "0.40962332", "0.40921023", "0.40918908", "0.40906328" ]
0.84880215
0
ReadChatLog read chat log file for specified account. fileName must be relatiive to the chat logs directory.
func (a *ChatLogsArchive) ReadChatLog(accountName string, fileName string) (Messages, error) { if a.r == nil { return nil, nil } logFilePath := strings.Join([]string{accountName, fileName}, "/") f, err := a.r.Open(logFilePath) // Do not return error if file doesn't exists. if errors.Is(err, os.ErrNotExist) { return nil, nil } if err != nil { return nil, fmt.Errorf("unable to open chat log %s: %w", logFilePath, err) } defer f.Close() messages, err := ReadMessages(f) if err != nil { return messages, fmt.Errorf("unable to read chat log %s: %w", logFilePath, err) } return messages, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ReadChatLogsArchive(fileName string) (*ChatLogsArchive, error) {\n\tr, err := zip.OpenReader(fileName)\n\tif err != nil && !errors.Is(err, os.ErrNotExist) {\n\t\treturn nil, err\n\t}\n\n\twf, err := os.Create(filepath.Join(os.TempDir(), fileName))\n\tif err != nil {\n\t\tif r != nil {\n\t\t\tr.Close()\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tfmt.Println(wf.Name())\n\n\treturn &ChatLogsArchive{\n\t\tfileName: fileName,\n\t\tr: r,\n\t\twf: wf,\n\t\tw: zip.NewWriter(wf),\n\t}, nil\n}", "func readChat(w http.ResponseWriter, r *http.Request, chatId uuid.UUID, db *bolt.DB) {\n\t// Ensure chat exists\n\tchat, err := models.FindChat(chatId, db)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: failed to query database for specified chat\")\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\treturn\n\t} else if chat == nil {\n\t\tresponses.Error(w, http.StatusNotFound, \"specified chat does not exist\")\n\t\treturn\n\t}\n\n\t// Get user\n\tself, err := models.FindUser(r.Header.Get(\"X-BPI-Username\"), db)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: failed to query database for requesting user: %v\\n\", err)\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\treturn\n\t}\n\n\t// Check that user in chat\n\tfor _, c := range self.Chats {\n\t\tif c == chatId.String() {\n\t\t\tresponses.SuccessWithData(w, map[string]string{\n\t\t\t\t\"user1\": chat.User1,\n\t\t\t\t\"user2\": chat.User2,\n\t\t\t\t\"last_message\": chat.Messages[len(chat.Messages)-1],\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t}\n\n\tresponses.Error(w, http.StatusForbidden, \"user not in specified chat\")\n}", "func ReadFile(fileName string) (string, error) {\n\n\tfileName = keptnutils.ExpandTilde(fileName)\n\tif _, err := os.Stat(fileName); os.IsNotExist(err) {\n\t\treturn \"\", fmt.Errorf(\"Cannot find file %s\", fileName)\n\t}\n\tdata, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(data), nil\n}", "func LogFileOpenRead(baseFileName string) (log *LogFile, err error) {\n\tlog = new(LogFile)\n\tlog.byteOrder = binary.LittleEndian\n\n\t// Open for reading from the start of the file\n\tlog.entryReadFile, err = os.Open(logFileName(baseFileName))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tlog.entryReadFile.Close()\n\t\t}\n\t}()\n\n\t// Open & read in the meta file\n\tlog.metaFile, err = os.Open(metaFileName(baseFileName))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tlog.metaFile.Close()\n\t\t}\n\t}()\n\n\tmetaData, err := log.readMetaData()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t\n\t// Update the log from the metadata\n\tlog.headOffset = metaData.HeadOffset\n\tlog.tailOffset = metaData.TailOffset\n\tlog.NumEntries = metaData.NumEntries\n\tlog.maxSizeBytes = metaData.MaxSizeBytes\n\tlog.numSizeBytes = metaData.NumSizeBytes\n\tlog.wrapNum = metaData.WrapNum\n\n\t// position us at the start of the entry data file\n\t// seek to tail - want to read from tail to head\n\tstdlog.Printf(\"seek to tail: %v\\n\", metaData.TailOffset)\n\t_, err = log.entryReadFile.Seek(int64(metaData.TailOffset), 0)\n\n\treturn log, err\n}", "func ReadLogs(filePath string) (plog.Logs, error) {\n\tb, err := os.ReadFile(filePath)\n\tif err != nil {\n\t\treturn plog.Logs{}, err\n\t}\n\tif strings.HasSuffix(filePath, \".yaml\") || strings.HasSuffix(filePath, \".yml\") {\n\t\tvar m map[string]interface{}\n\t\tif err = yaml.Unmarshal(b, &m); err != nil {\n\t\t\treturn plog.Logs{}, err\n\t\t}\n\t\tb, err = json.Marshal(m)\n\t\tif err != nil {\n\t\t\treturn plog.Logs{}, err\n\t\t}\n\t}\n\tunmarshaler := plog.JSONUnmarshaler{}\n\treturn unmarshaler.UnmarshalLogs(b)\n}", "func (s *Server) ReadLogfile(len int) ([]string, error) {\n\treturn s.Environment.Readlog(len)\n}", "func (a *ChatLogsArchive) ListChatLogFileNames(accountName string) (absolutePaths []string, relativePaths []string, err error) {\n\tif a.r == nil {\n\t\treturn nil, nil, nil\n\t}\n\n\tvar logFileNames []string\n\tfor _, f := range a.r.File {\n\t\t// Take only .txt files.\n\t\tif filepath.Ext(f.Name) != \".txt\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tpath := filepath.Dir(f.Name)\n\t\tif path != accountName {\n\t\t\tcontinue\n\t\t}\n\n\t\tfileName := filepath.Base(f.Name)\n\t\tif !IsReservedFileName(fileName) {\n\t\t\tabsolutePaths = append(absolutePaths, f.Name)\n\t\t\trelativePaths = append(logFileNames, fileName)\n\t\t}\n\t}\n\n\treturn\n}", "func readFromFileFile(fileName string) (string, error) {\n\n\t// try opening the file\n\tf, err := os.OpenFile(fileName, os.O_RDONLY, os.ModePerm)\n\tif err != nil {\n\t\tlog.Printf(\"Error by opening %s: %v\", fileName, err)\n\t\treturn \"\", err\n\t}\n\tdefer f.Close()\n\n\t// read from file\n\tbuf := make([]byte, maxReadSize)\n\t_, err = f.Read(buf)\n\tif err != nil {\n\t\tlog.Printf(\"Error by reading from %s: %v\", fileName, err)\n\t\treturn \"\", err\n\t}\n\n\treturn strings.TrimSpace(fmt.Sprintf(\"%s\", buf)), nil\n}", "func ReadFile(filePath string) string {\n\tbytes, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\tlogger.Info(err.Error())\n\t}\n\n\treturn string(bytes)\n}", "func (c *Chat) ReadChatLine() *LogLineParsed {\n\tif c.logger.readCursor == c.logger.writeCursor {\n\t\treturn nil\n\t}\n\n\tl := &c.logger.ChatLines[c.logger.readCursor]\n\tc.logger.readCursor++\n\tif c.logger.readCursor > numInteralLogLines {\n\t\tc.logger.readCursor -= numInteralLogLines\n\t}\n\n\treturn l\n}", "func readLog(filename string) ([]byte, error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tvar r io.Reader = f\n\tif strings.HasSuffix(filename, \".gz\") {\n\t\tr, err = gzip.NewReader(f)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn ioutil.ReadAll(r)\n}", "func (arc *AppRoleCredentials) ReadFile(filepath string) error {\n\tcontents, err := ioutil.ReadFile(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := json.Unmarshal(contents, arc); err != nil {\n\t\treturn err\n\t}\n\n\treturn arc.Validate()\n}", "func (r *ProtocolIncus) GetNetworkACLLogfile(name string) (io.ReadCloser, error) {\n\tif !r.HasExtension(\"network_acl_log\") {\n\t\treturn nil, fmt.Errorf(`The server is missing the required \"network_acl_log\" API extension`)\n\t}\n\n\t// Prepare the HTTP request\n\turl := fmt.Sprintf(\"%s/1.0/network-acls/%s/log\", r.httpBaseURL.String(), url.PathEscape(name))\n\turl, err := r.setQueryAttributes(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Send the request\n\tresp, err := r.DoHTTP(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Check the return value for a cleaner error\n\tif resp.StatusCode != http.StatusOK {\n\t\t_, _, err := incusParseResponse(resp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn resp.Body, err\n}", "func ReadFile(fileName string) string{\r\n\tcontent, err := ioutil.ReadFile(fileName)\r\n\r\n\t\tif err != nil {\r\n\t\t\tlog.Fatal(err)\r\n\t\t}\r\n\r\n\t\treturn string(content)\r\n}", "func ReadLogsFromFile(fileName string) []GoTestJSONRowData {\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\tlog.Println(\"error opening file: \", err)\n\t\tos.Exit(1)\n\t}\n\tdefer func() {\n\t\terr := file.Close()\n\t\tif err != nil {\n\t\t\tlog.Println(\"error closing file: \", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}()\n\n\tscanner := bufio.NewScanner(file)\n\trowData := make([]GoTestJSONRowData, 0)\n\n\tfor scanner.Scan() {\n\t\trow := GoTestJSONRowData{}\n\n\t\t// unmarshall each line to GoTestJSONRowData\n\t\terr := json.Unmarshal([]byte(scanner.Text()), &row)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error to unmarshall test logs: \", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\trowData = append(rowData, row)\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Println(\"error with file scanner: \", err)\n\t\tos.Exit(1)\n\t}\n\treturn rowData\n}", "func (c *Client) ReadFile(ctx context.Context, name string) ([]byte, error) {\n\tres, err := c.fs.ReadFile(ctx, &baserpc.ReadFileRequest{Name: name})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res.Error != nil {\n\t\treturn nil, decodeErr(res.Error)\n\t}\n\treturn res.Content, nil\n}", "func (b *Bot) ReadMessageFromFile(file string) string {\n\n\t// read mesasge template from file\n\tdata, err := common.ReadFile(file)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// get channel list. add to message\n\treturn b.addChannelsToMessage(string(data))\n}", "func (c *Client) ReadLog(offset int, length int) (string, error) {\n\tvar log string\n\terr := c.Call(\"supervisor.readLog\", []interface{}{offset, length}, &log)\n\n\treturn log, err\n}", "func (l *FileLog) read(path string) {\n\tl.init() // start with a fresh entries log\n\n\tf, err := os.OpenFile(path, os.O_RDONLY, os.ModePerm)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\tsc := bufio.NewScanner(f)\n\tfor sc.Scan() {\n\t\tentry := new(Entry)\n\t\tif err = entry.Load(sc.Bytes()); err != nil {\n\t\t\treturn\n\t\t}\n\t\tl.entries = append(l.entries, entry)\n\t}\n}", "func readFromFile() error {\n\tvar errlist []error\n\tif err := readByJSON(userPath, &userList); err != nil {\n\t\terrlist = append(errlist, err)\n\t}\n\tif err := readByJSON(meetingPath, &meetingList); err != nil {\n\t\terrlist = append(errlist, err)\n\t}\n\tif err := readByJSON(curUserPath, &curUser); err != nil {\n\t\terrlist = append(errlist, err)\n\t}\n\tswitch len(errlist) {\n\tcase 1:\n\t\treturn errlist[0]\n\tcase 2:\n\t\treturn errors.New(errlist[0].Error() + \"\\n\" + errlist[1].Error())\n\tcase 3:\n\t\treturn errors.New(errlist[0].Error() + \"\\n\" + errlist[1].Error() + \"\\n\" + errlist[2].Error())\n\tdefault:\n\t\treturn nil\n\t}\n}", "func readFile(fileName string) (string, error) {\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer file.Close()\n\tb, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}", "func (a *ChatLogsArchive) WriteChatLog(accountName string, fileName string, messages Messages) error {\n\tlogFilePath := strings.Join([]string{accountName, fileName}, \"/\")\n\n\tf, err := a.w.Create(logFilePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating file %s: %w\", logFilePath, err)\n\t}\n\n\terr = messages.Write(f)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing file %s: %w\", logFilePath, err)\n\t}\n\n\treturn nil\n}", "func (f *fileManager) ReadFile(filePath string) (data []byte, err error) {\n\texists, err := f.FileExists(filePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot read file: %w\", err)\n\t} else if !exists {\n\t\treturn nil, fmt.Errorf(\"cannot read file: %q does not exist\", filePath)\n\t}\n\treturn f.readFile(filePath)\n}", "func (cl *CompositeLogger) ReadLog(offset, length int64) (string, error) {\n\treturn cl.loggers[0].ReadLog(offset, length)\n}", "func readLogfileRecent(v *gocui.View, logfile stat.Logfile) (int64, []byte, error) {\n\t// Calculate necessary number of lines and buffer size depending on size available screen.\n\tx, y := v.Size()\n\tlinesLimit := y - 1 // available number of lines\n\tbufsize := x * y * 2 // max size of used buffer - don't need to read log more than that amount\n\n\tinfo, err := os.Stat(logfile.Path)\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\n\t// Do nothing if logfile is not changed or empty.\n\tif info.Size() == logfile.Size || info.Size() == 0 {\n\t\treturn info.Size(), nil, nil\n\t}\n\n\t// Read the log for necessary number of lines or until bufsize reached.\n\tbuf, err := logfile.Read(linesLimit, bufsize)\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\n\t// return the log's size and buffer content\n\treturn info.Size(), buf, nil\n}", "func (c *Client) ReadLogs(namespace, podName, containerName string, lastContainerLog bool, tail *int64) (string, error) {\n\treturn \"ContainerLogs\", nil\n}", "func readFile(path string) []byte {\n\t_l := metrics.StartLogDiff(\"read-file\")\n\n\t// Do it\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tmetrics.StopLogDiff(\"read-file\", _l)\n\treturn data\n}", "func (lw *LogWatcher) read(fInfo os.FileInfo, buf []byte) (int, error) {\n\tf, err := os.Open(lw.Filename)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tlw.debugf(\"logwatcher.read: %+v\", lw)\n\tif lw.lastPos > 0 {\n\t\t// seek to last position read\n\t\tlw.debugf(\"logwatcher.read: %q seeking to %d\", lw.Filename,\n\t\t\tlw.lastPos)\n\n\t\tif _, err := f.Seek(lw.lastPos, 0); err != nil {\n\t\t\treturn 0, ErrSeek\n\t\t}\n\t}\n\n\tn, err := f.Read(buf)\n\tif err != nil {\n\t\tlw.debugf(\"logwatcher.read: err = %v\", err)\n\t\treturn 0, err\n\t}\n\n\tlw.debugf(\"logwatcher.read: %q read %d: %q\", lw.Filename,\n\t\tn, string(buf[0:n]))\n\tlw.lastFInfo = fInfo\n\tlw.lastPos += int64(n)\n\n\tif err = f.Close(); err != nil {\n\t\treturn n, err\n\t}\n\treturn n, nil\n}", "func ReadFile(path string, plaintext_path string, usr_info []string) internal.DownloadReturn {\n\tbody, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn internal.DownloadReturn{Err: ErrorMessage(\"open\", plaintext_path)}\n\t}\n\treturn internal.DownloadReturn{Body: body}\n}", "func GetLogReader(filename string, restricted bool) (io.ReadCloser, error) {\n\tdir, err := logging.logDir.get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch restricted {\n\tcase true:\n\t\t// Verify there are no path separators in a restricted-mode pathname.\n\t\tif filepath.Base(filename) != filename {\n\t\t\treturn nil, errors.Errorf(\"pathnames must be basenames only: %s\", filename)\n\t\t}\n\t\tfilename = filepath.Join(dir, filename)\n\t\t// Symlinks are not followed in restricted mode.\n\t\tinfo, err := os.Lstat(filename)\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\treturn nil, errors.Errorf(\"no such file %s in the log directory\", filename)\n\t\t\t}\n\t\t\treturn nil, errors.Wrapf(err, \"Lstat: %s\", filename)\n\t\t}\n\t\tmode := info.Mode()\n\t\tif mode&os.ModeSymlink != 0 {\n\t\t\treturn nil, errors.Errorf(\"symlinks are not allowed\")\n\t\t}\n\t\tif !mode.IsRegular() {\n\t\t\treturn nil, errors.Errorf(\"not a regular file\")\n\t\t}\n\tcase false:\n\t\tinfo, err := osStat(filename)\n\t\tif err != nil {\n\t\t\tif !os.IsNotExist(err) {\n\t\t\t\treturn nil, errors.Wrapf(err, \"Stat: %s\", filename)\n\t\t\t}\n\t\t\t// The absolute filename didn't work, so try within the log\n\t\t\t// directory if the filename isn't a path.\n\t\t\tif filepath.IsAbs(filename) {\n\t\t\t\treturn nil, errors.Errorf(\"no such file %s\", filename)\n\t\t\t}\n\t\t\tfilenameAttempt := filepath.Join(dir, filename)\n\t\t\tinfo, err = osStat(filenameAttempt)\n\t\t\tif err != nil {\n\t\t\t\tif os.IsNotExist(err) {\n\t\t\t\t\treturn nil, errors.Errorf(\"no such file %s either in current directory or in %s\", filename, dir)\n\t\t\t\t}\n\t\t\t\treturn nil, errors.Wrapf(err, \"Stat: %s\", filename)\n\t\t\t}\n\t\t\tfilename = filenameAttempt\n\t\t}\n\t\tfilename, err = filepath.EvalSymlinks(filename)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif !info.Mode().IsRegular() {\n\t\t\treturn nil, errors.Errorf(\"not a regular file\")\n\t\t}\n\t}\n\n\t// Check that the file name is valid.\n\tif _, err := parseLogFilename(filepath.Base(filename)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn os.Open(filename)\n}", "func ReadFileToString(filePath string) (string, error) {\n\tif fileExists(filePath) {\n\t\tdata, err := ioutil.ReadFile(filePath)\n\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\treturn string(data), nil\n\t} else {\n\t\treturn \"\", nil\n\t}\n}", "func ReadFile() {\n\n\t// 開檔\n\tinputFile, Error := os.Open(\"MyTestingReadFile/errorMessage.txt\")\n\n\tfmt.Println(\"reading...\")\n\t// 判斷是否開檔錯誤\n\tif Error != nil {\n\t\tfmt.Println(\"開檔錯誤!\")\n\t\t//return\n\t}\n\t// 離開時自動執行關檔\n\tdefer inputFile.Close()\n\n\t//\n\tinputReader := bufio.NewReader(inputFile)\n\t//^^^^^^^^^^^ ^^^^^^^ ^^^^^^^\n\t// 緩衝輸入物件 建立函數 來源:已開啟檔案\n\n\t// 用迴圈讀取檔案內容\n\tfor {\n\t\t// 讀取字串直到遇到跳行符號\n\t\t//inputString, Error := inputReader.ReadString('\\n')\n\t\tinputString, Error := inputReader.ReadString(':')\n\t\t// 若到檔尾時分發生 io.EOF 錯誤\n\t\t// 根據此錯誤 判斷是否離開\n\t\tif Error == io.EOF {\n\t\t\tfmt.Println(\"已讀取到檔尾!!\")\n\t\t\tbreak\n\t\t}\n\n\t\t//fmt.Println(inputString)\n\t\t//fmt.Println(strings.Index(inputString, \"\\\"\"))\n\n\t\tif strings.Index(inputString, \"\\\"\") != -1 {\n\t\t\tmylist = append(mylist, List{name: inputString})\n\t\t}\n\t\t//fmt.Println(\"length\", len(channels))\n\t}\n\tfmt.Println(\"the list: \", mylist)\n\t//fmt.Println(reflect.TypeOf(mylist))\n}", "func (s *sshClient) ReadFile(src string) ([]byte, error) {\n\tconn, err := ssh.Dial(\"tcp\", s.host, s.conf)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can not establish a connection to %s: %w\", s.host, err)\n\t}\n\tdefer conn.Close()\n\n\tsftpClient, err := sftp.NewClient(conn)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creates SFTP client failed: %w\", err)\n\t}\n\tdefer sftpClient.Close()\n\n\treturn s.readFile(sftpClient, src)\n}", "func (c *Chat) ReadChatFull() []LogLineParsed {\n\tif c.logger.hasWrapped {\n\t\treturn append(\n\t\t\tc.logger.ChatLines[c.logger.writeCursor:],\n\t\t\tc.logger.ChatLines[:c.logger.writeCursor]...)\n\t}\n\n\treturn c.logger.ChatLines[:c.logger.writeCursor]\n}", "func (e *EndToEndTest) ReadFile(repo string, volume string, filename string) (string, error) {\n\tmountpoint, err := e.GetVolumePath(repo, volume)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tpath := fmt.Sprintf(\"%s/%s\", mountpoint, filename)\n\tout, err := exec.Command(\"docker\", \"exec\", e.GetContainer(\"server\"), \"cat\", path).Output()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(out), nil\n}", "func ReadLogger(cpath string) (*Logger, error) {\n\tbytes, err := ioutil.ReadFile(cpath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot read config file: %v\", err)\n\t}\n\treturn MakeLogger(string(bytes))\n}", "func read_messages(uname string, num_messages int) (string, bool) {\n\tfilename := uname + \".txt\"\n\tcreate_and_lock(filename) // lock user message file\n\tdefer lock_for_files_map[filename].Unlock()\n\n\tmessage_file, open_err := os.OpenFile(filename, os.O_CREATE, 0600) //create file if not exist\n\tdefer message_file.Close()\n\tif open_err != nil {\n\t\treturn fmt.Sprintf(\"error: Server open error%s\\n\", END_TAG), false\n\t}\n\n\tmessages_in_byte, read_err := ioutil.ReadFile(filename)\n\tif read_err != nil {\n\t\treturn fmt.Sprintf(\"error: Server read error%s\\n\", END_TAG), false\n\t}\n\n\tmessages_in_string := string(messages_in_byte)\n\n\tmessage_array := strings.SplitAfter(messages_in_string, USER_MESSAGE_SEPERATOR)\n\tmessage_array = message_array[0 : len(message_array)-1] //last index is empty cause of how splitafter works\n\trecent_messages := message_array\n\tif num_messages < len(message_array) {\n\t\t//only show recent num messages if there exist more than that\n\t\trecent_messages = message_array[len(message_array)-num_messages:]\n\t}\n\t//fmt.Fprintf(os.Stderr, \"printing message%s\\n\", recent_messages)\n\t//give back most recent num_messages of messages\n\tresponse := \"\"\n\tfor _, message := range recent_messages {\n\t\tresponse += message + \"\\n\"\n\t}\n\treturn fmt.Sprintf(\"success: %s%s\\n\", response, END_TAG), false\n}", "func ReadFile(fileName string) ([]string, error) {\n\t// Create folder if it doesn't exists\n\n\tf, err := os.OpenFile(fileName, os.O_RDONLY, os.ModePerm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() { _ = f.Close() }()\n\n\treader := bufio.NewReader(f)\n\toutput := []string{}\n\tfor {\n\t\ts, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\toutput = append(output, strings.TrimSpace(s))\n\t}\n\treturn output, nil\n}", "func (f *attachEmbedFS) ReadFile(name string) ([]byte, error) {\n\treturn f.EmbedFS.ReadFile(f.path(name))\n}", "func readFile(fileName string) ([]string, error) {\n\tvar err error\n\tif fileExists(fileName) {\n\t\tcontent, err := ioutil.ReadFile(fileName)\n\t\tCheckerr(err)\n\t\tdata := strings.Split(toUtf8(content), \"\\r\\n\")\n\t\treturn data, err\n\n\t} else {\n\t\treturn nil, err\n\t}\n}", "func readCacheFile(fileName string) ([]cacheEntry, error) {\n\t// Lock the mutex\n\tcacheMutex.Lock()\n\tdefer cacheMutex.Unlock()\n\n\t// Open our cache file\n\tfile, err := os.OpenFile(fileName, os.O_CREATE|os.O_RDONLY, 0644)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar entries []cacheEntry\n\t// Iterate through lines in file\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\t// Split the line with |\n\t\tsplit := strings.Split(line, \"|\")\n\n\t\t// If the line if not formatted correctly, return an error\n\t\tif len(split) != 4 {\n\t\t\treturn nil, fmt.Errorf(\"line in cache file %s was not formatted correctly: %s\", fileName, line)\n\t\t}\n\n\t\t// Parse the status number\n\t\tstatusNum, err := strconv.Atoi(split[2])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"status must be a number in cache file %s: %s\", fileName, line)\n\t\t}\n\n\t\t// Make sure we have a valid status number\n\t\tif statusNum > int(StatusUnknown) {\n\t\t\treturn nil, fmt.Errorf(\"status must be less than %d in cache file %s: %d\", int(StatusUnknown), fileName, statusNum)\n\t\t}\n\n\t\t// Parse the time\n\t\tentryTimeUnix, err := strconv.ParseInt(split[3], 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid number in cache file %s: %s\", fileName, line)\n\t\t}\n\n\t\t// Make a time object from the unix\n\t\tentryTime := time.Unix(int64(entryTimeUnix), 0)\n\n\t\t// Create our new cache entry from this line\n\t\tvar newCacheEntry cacheEntry\n\t\tnewCacheEntry.ServiceName = split[0]\n\t\tnewCacheEntry.Username = split[1]\n\t\tnewCacheEntry.Status = Status(statusNum)\n\t\tnewCacheEntry.Time = entryTime\n\n\t\t// Append our new entry\n\t\tentries = append(entries, newCacheEntry)\n\t}\n\n\treturn entries, nil\n}", "func _readLinesChannel(filePath string) (<-chan string, error) {\n\tc := make(chan string)\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo func() {\n\t\tdefer file.Close()\n\t\tscanner := bufio.NewScanner(file)\n\t\tfor scanner.Scan() {\n\t\t\tc <- scanner.Text()\n\t\t}\n\t\tclose(c)\n\t}()\n\treturn c, nil\n}", "func ListenToFile(path string, strategy Strategy, config StrategyConfig) (ListenedLogFile, error) {\n\tvar file ListenedLogFile\n\n\tswitch strategy {\n\tcase LocalListeningStrategy:\n\t\tfile = createLocallyListenedFile(path)\n\t\tbreak\n\tcase RemoteListeningStrategy:\n\t\tfile = createRemotelyListenedFile(path, config)\n\t\tbreak\n\tdefault:\n\t\treturn nil, ErrInvalidStrategy\n\t}\n\n\tif isFileOpened(file.GetHash()) {\n\t\treturn file, ErrAlreadyOpened\n\t}\n\n\tlistenedLogFiles = append(listenedLogFiles, file)\n\n\tvar err error\n\n\tgo func() {\n\t\terr = file.Listen()\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn file, nil\n}", "func ReadFile(path string) ([]byte, error) {\n\tftpConn, err := connect()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer ftpConn.Quit()\n\tres, err := ftpConn.Retr(path)\n\tdefer func() {\n\t\tif res != nil {\n\t\t\tres.Close()\n\t\t}\n\t}()\n\tif err != nil {\n\t\tlog.Printf(\"[c.Retr] with file(%v) failed:\\n%v\\n\", path, err)\n\t\treturn nil, &FTPError{\n\t\t\tMessage: fmt.Sprintf(\"读取文件%s失败\", path),\n\t\t\tOriginErr: err,\n\t\t}\n\t}\n\n\tbuf, err := ioutil.ReadAll(res)\n\tif err != nil {\n\t\tlog.Printf(\"[ReadFile] ioutil.ReadAll response failed: %v\\n\", err)\n\t\treturn nil, &FTPError{\n\t\t\tMessage: fmt.Sprintf(\"读取文件%s失败\", path),\n\t\t\tOriginErr: err,\n\t\t}\n\t}\n\n\treturn buf, nil\n}", "func (e *Environment) Readlog(lines int) ([]string, error) {\n\tr, err := e.client.ContainerLogs(context.Background(), e.Id, types.ContainerLogsOptions{\n\t\tShowStdout: true,\n\t\tShowStderr: true,\n\t\tTail: strconv.Itoa(lines),\n\t})\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tdefer r.Close()\n\n\tvar out []string\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\tout = append(out, scanner.Text())\n\t}\n\n\treturn out, nil\n}", "func (r *readerImpl) Read(filePath string) (<-chan []string, <-chan error, error) {\n\t// create absolute path from given path\n\tfullpath, err := filepath.Abs(filePath)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"invalid file path: %v; error: %v \", filePath, err)\n\t}\n\n\t// open the file for reading\n\tfile, err := os.Open(fullpath)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to open file: %v; error: %v \", fullpath, err)\n\t}\n\n\tcsvReader := csv.NewReader(bufio.NewReader(file))\n\n\t// create channels for row and error\n\trowChan := make(chan []string, buffSize)\n\terrChan := make(chan error)\n\n\t// spawn a goroutine to concurrently read data from file\n\tgo func() {\n\t\t// read each row from the file\n\t\tfor {\n\t\t\trow, err := csvReader.Read()\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else if err != nil {\n\t\t\t\terrChan <- fmt.Errorf(\"failed to read from file: %v; error: %v \", fullpath, err)\n\t\t\t}\n\n\t\t\trowChan <- row\n\t\t}\n\n\t\t// close file\n\t\tfile.Close()\n\n\t\t// close channels\n\t\tclose(rowChan)\n\t\tclose(errChan)\n\t}()\n\n\treturn rowChan, errChan, nil\n}", "func (r *KubeRunner) GetAccessLog(container, podName, ns string, since time.Time, match string) (string, error) {\n\trs, err := r.client.CoreV1().Pods(ns).GetLogs(podName, &v1.PodLogOptions{\n\t\tFollow: true,\n\t\tSinceTime: &metav1.Time{Time: since},\n\t\tContainer: container,\n\t}).Stream(context.TODO())\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer rs.Close()\n\n\t// todo may need timeout control\n\tsc := bufio.NewScanner(rs)\n\n\tfor sc.Scan() {\n\t\tline := sc.Text()\n\t\tif strings.Contains(line, match) {\n\t\t\treturn line, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"log not found\")\n}", "func getName(username string, lock *Lock) string {\r\n\t\r\n\t//acquires shared lock to read file\r\n\tacquireLock(\"read\", lock)\r\n\t\r\n\tuserFile, err := os.Open(usersFileName)\r\n\t\r\n\tif err != nil {\r\n\t\tlog.Println(\"Could not open file properly.\")\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\t\r\n\tuserScanner := bufio.NewScanner(userFile)\r\n\r\n\tdefer releaseLock(\"read\",lock)\r\n\tdefer userFile.Close()\r\n\r\n\t//goes through users.txt file, when current user found return their name\r\n\tfor userScanner.Scan() {\r\n\t\tcurUser := userScanner.Text()\r\n\t\tuserArr := strings.SplitAfter(curUser,\",\")\r\n\t\tcurUsername := string(userArr[0][0:len(userArr[0])-1])\r\n\t\tif (username == curUsername) {\r\n\t\t\tcurName := string(userArr[2])\r\n\t\t\treturn curName\r\n\t\t}\r\n\t}\r\n\treturn \"\"\r\n}", "func (bb *BasicBot) ReadCredentials() error {\n\n\t// reads from the file\n\tcredFile, err := ioutil.ReadFile(bb.PrivatePath)\n\tif nil != err {\n\t\treturn err\n\t}\n\n\tbb.Credentials = &OAuthCred{}\n\n\t// parses the file contents\n\tdec := json.NewDecoder(strings.NewReader(string(credFile)))\n\tif err = dec.Decode(bb.Credentials); nil != err && io.EOF != err {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func ReadFile(filePath string) []byte {\n\tvar fileBytes []byte\n\tvar err error\n\tif filePath == \"-\" {\n\t\tfileBytes, err = ioutil.ReadAll(os.Stdin)\n\t} else {\n\t\tfileBytes, err = ioutil.ReadFile(filePath)\n\t}\n\tif err != nil {\n\t\tFatal(FILE_IO_ERROR, i18n.GetMessagePrinter().Sprintf(\"reading %s failed: %v\", filePath, err))\n\t}\n\treturn fileBytes\n}", "func (c Client) ReadFile(filename string, mode string, handler func(r *io.PipeReader)) error {\n\taddr, err := net.ResolveUDPAddr(UDP_NET, \":0\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tconn, err := net.ListenUDP(UDP_NET, addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tread, write := io.Pipe()\n\treceive := &receiver{c.RemoteAddr, conn, write, filename, mode, c.Log}\n\tvar wait sync.WaitGroup\n\treadWriteLock.RLock()\n\twait.Add(1)\n\tgo func() {\n\t\thandler(read)\n\t\twait.Done()\n\t}()\n\treceive.run(false)\n\twait.Wait()\n\tdefer readWriteLock.RUnlock()\n\treturn nil\n}", "func (s *SmtpConfig) ReadFromFile(location string) {\n\n\tfile, err := os.Open(location)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = json.NewDecoder(file).Decode(&s)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tfmt.Println(s.Server)\n\tfmt.Println(s.Username)\n\n}", "func readCacheFileStream(filePath string, offset, length int64) (io.ReadCloser, error) {\n\tif filePath == \"\" || offset < 0 {\n\t\treturn nil, errInvalidArgument\n\t}\n\tif err := checkPathLength(filePath); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfr, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn nil, osErrToFileErr(err)\n\t}\n\t// Stat to get the size of the file at path.\n\tst, err := fr.Stat()\n\tif err != nil {\n\t\terr = osErrToFileErr(err)\n\t\treturn nil, err\n\t}\n\n\tif err = os.Chtimes(filePath, time.Now(), st.ModTime()); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Verify if its not a regular file, since subsequent Seek is undefined.\n\tif !st.Mode().IsRegular() {\n\t\treturn nil, errIsNotRegular\n\t}\n\n\tif err = os.Chtimes(filePath, time.Now(), st.ModTime()); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Seek to the requested offset.\n\tif offset > 0 {\n\t\t_, err = fr.Seek(offset, io.SeekStart)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn struct {\n\t\tio.Reader\n\t\tio.Closer\n\t}{Reader: io.LimitReader(fr, length), Closer: fr}, nil\n}", "func (config *CMConfig) ReadFile(fileName string) error {\n\n\tdata,err := ioutil.ReadFile(fileName)\n\tif err != nil{\n\t\treturn err\n\t}\n\n\terr = yaml.Unmarshal(data,config)\n\tif err != nil{\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func ReadMsgAPI(ServerVars *Variables, c string, k string, w *http.ResponseWriter, t time.Time) {\n\tServerVars.ChannelListMu.Lock()\n\tdefer ServerVars.ChannelListMu.Unlock()\n\n\t_, exists := ServerVars.ChannelList[c] //Checking if the channel exists or not\n\tif !exists {\n\t\t_, err := (*w).Write([]byte(fmt.Sprintf(\"No channel exists with the name %s\\n\", c)))\n\t\tCheckError(ServerVars, err)\n\t\treturn\n\t}\n\n\tif ServerVars.ChannelList[c].Access == \"private\" && k != ServerVars.ChannelList[c].Key { // If the channnel is private, verify if key is correct or not\n\t\t_, err := (*w).Write([]byte(fmt.Sprintf(\"Key is not valid for the private channel %s\\n\", c)))\n\t\tCheckError(ServerVars, err)\n\t\treturn\n\t}\n\n\tServerVars.ChannelList[c].Mu.Lock()\n\tbt, err := ioutil.ReadFile(fmt.Sprintf(\"%s/%s.json\", ServerVars.Conf.ChDataFolder, c)) // Reading json file containing the history\n\tCheckError(ServerVars, err)\n\tServerVars.ChannelList[c].Mu.Unlock()\n\n\tvar Dhist []Data\n\terr = json.Unmarshal(bt, &Dhist) // Converting json encoding to slice of type Data\n\tCheckError(ServerVars, err)\n\n\tts := t.Format(\"2006-01-02 15:04:05\")\n\tServerVars.ActivityLogsChannel <- fmt.Sprintf(ServerVars.LogActivityFormat, \"Read Message History\", \"\", c, \"API\", ts) // Log Activity\n\n\tfor k := range Dhist { //Iterating over messages\n\t\tts = Dhist[k].Time.Format(\"2006-01-02 15:04:05\")\n\t\ttxt := fmt.Sprintf(\"\\nMessage: %s\\nSent by: %s\\nTime: %s\\n\\n\", Dhist[k].Msg, Colors[\"Blue\"](Dhist[k].Username), Colors[\"Yellow\"](ts))\n\t\t_, err := (*w).Write([]byte(txt)) // Sending msg to user \"k\"\n\t\tCheckError(ServerVars, err)\n\t}\n}", "func (lw *LogWatcher) Read(buf []byte) (int, error) {\n\tvar err error\n\tvar fInfo os.FileInfo\n\n\tif fInfo, err = os.Stat(lw.Filename); err == nil {\n\t\tdoRead := false\n\t\tnewFile := false\n\n\t\tlw.debugf(\"logwatcher.Read: fInfo: %+v\", fInfo)\n\n\t\tif lw.lastFInfo == nil {\n\t\t\tnewFile = true\n\t\t\t// User can pass a checkpointed position.\n\t\t\tlw.lastPos = lw.StartPosition\n\t\t\tlw.debugf(\"logwatcher.Read: newfile, lastpos = %d\", lw.lastPos)\n\t\t} else if !os.SameFile(lw.lastFInfo, fInfo) {\n\t\t\tnewFile = true\n\t\t\tlw.debugf(\"logwatcher.Read: not samefile.\")\n\t\t} else if fInfo.Size() < lw.lastFInfo.Size() {\n\t\t\t// Truncated\n\t\t\tlw.lastPos = 0\n\t\t\tnewFile = true\n\t\t\tlw.debugf(\"logwatcher.Read: truncated.\")\n\t\t} else if fInfo.Size() > lw.lastFInfo.Size() {\n\t\t\t// logfile grew, read it\n\t\t\tdoRead = true\n\t\t\tlw.debugf(\"logwatcher.Read: bigger file reading.\")\n\t\t} else if fInfo.Size() > lw.lastPos {\n\t\t\t// logfile grew, read it\n\t\t\tdoRead = true\n\t\t\tlw.debugf(\"logwatcher.Read: stuff left to read, reading.\")\n\t\t} else {\n\t\t\t// same size, don't read\n\t\t\tlw.debugf(\"logwatcher.Read: no change, ignoring.\")\n\t\t\terr = io.EOF\n\t\t}\n\n\t\tif newFile && fInfo.Size() > 0 {\n\t\t\t// Reset pointers\n\t\t\tlw.lastFInfo = nil\n\t\t\tdoRead = true\n\t\t\tlw.debugf(\"logwatcher.Read: bigger file reading.\")\n\t\t}\n\n\t\tif doRead {\n\t\t\treturn lw.read(fInfo, buf)\n\t\t}\n\t}\n\tlw.debugf(\"logwatcher.Read: Returning 0, %v\", err)\n\treturn 0, err\n}", "func Decrypt(filePath string, params params.CliParams) {\n\tcontents := crypto.Decrypt(filePath, params.Key)\n\tnormPathname := journal.NormalizePathname(filePath)\n\n\tfile, err := os.Create(normPathname)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tw := bufio.NewWriter(file)\n\t_, err = w.WriteString(contents)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tw.Flush()\n\n\tlog.Info(\"wrote decrypted contents to file: `\" + normPathname + \"'\")\n}", "func (userdata *User) ReceiveFile(filename string, sender string,\n\tmagic_string string) error {\n\n\tif _, ok := userdata.Files[filename]; ok {\n\t\treturn errors.New(\"User already has the file\")\n\t} else if _, ok2 := userdata.ReceivedFiles[filename]; ok2 {\n\t\tif userdata.stillShared(filename) {\n\t\t\treturn errors.New(\"User has already received the file, and still has access to it\")\n\t\t} else {\n\t\t\t//file has been revoked from this user before, delete revoked/invalid access record\n\t\t\tdelete(userdata.ReceivedFiles, filename)\n\t\t}\n\t}\n\n\t//decode magic_string into an array of marshalled bytes, unmarshal this into the signed struct\n\tmagicBytes, _ := hex.DecodeString(magic_string)\n\n\tvar signedAccess Signed\n\tjson.Unmarshal(magicBytes, &signedAccess)\n\n\t//decode encrypted/marshalled accessStruct\n\tmarshAccess, _ := userlib.PKEDec(userdata.RSA, signedAccess.Message)\n\tmarshAccess2, _ := userlib.PKEDec(userdata.RSA, signedAccess.Message2)\n\n\tmarshAccess = append(marshAccess, marshAccess2...)\n\n\t//Verify signature\n\tsenderPub, _ := userlib.KeystoreGet(sender + \"DS\")\n\n\terr := userlib.DSVerify(senderPub, marshAccess, signedAccess.Sig)\n\tif err != nil {\n\t\treturn errors.New(\"Access Token has been modified, digital signature system failed to verify expected sender\")\n\t}\n\n\tvar access AccessRecord\n\t_ = json.Unmarshal(marshAccess, &access)\n\n\t//store accessRecord struct in userdata\n\tif userdata.ReceivedFiles == nil {\n\t\tuserdata.ReceivedFiles = make(map[string]AccessRecord)\n\t}\n\tuserdata.ReceivedFiles[filename] = access\n\n\treturn nil\n}", "func ReadFile(fileName string) []string {\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlines := make([]string, 0)\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\tfile.Close()\n\treturn lines\n}", "func (l Local) ReadFile(filepath string) ([]byte, error) {\n\treturn ioutil.ReadFile(filepath)\n}", "func (userdata *User) ReceiveFile(filename string, sender string,\r\n\taccessToken uuid.UUID) error {\r\n\t//IMPLEMENT AccessTokens field IN USER STRUCT\r\n\t//even if revoked ok to not error, but bob cant see new file updates\r\n\tupdatedUser, err := GetLatestUser(userdata.UUID_, userdata.PasswordHash, userdata.HMACKey, userdata.EncKey)\r\n\tif err != nil {\r\n\t\treturn errors.New(\"Failed to retrieve latest user info.\")\r\n\t}\r\n\t_, already_received := updatedUser.Filespace[filename]\r\n\r\n\tif already_received {\r\n\t\treturn errors.New(\"File already in user's file space.\")\r\n\t}\r\n\r\n\tsharedInviteDS, fileKeyFound := userlib.DatastoreGet(accessToken)\r\n\r\n\tif !fileKeyFound {\r\n\t\treturn errors.New(\"Access token did not find a shared file.\")\r\n\t}\r\n\r\n\tvar sharedInvite ShareInvite\r\n\terr = json.Unmarshal(sharedInviteDS, &sharedInvite)\r\n\r\n\tif err != nil {\r\n\t\treturn errors.New(\"Error unmarshaling shared file key.\")\r\n\t}\r\n\r\n\t//now verify that sharedInvite has not been tampered with\r\n\tvar senderKey userlib.PKEEncKey\r\n\tif sharedInvite.Sender == sender {\r\n\t\tsenderKey, _ = userlib.KeystoreGet(sender + \"ds\")\r\n\t} else { //owner has updated ShareInvite\r\n\t\tsenderKey, _ = userlib.KeystoreGet(sharedInvite.Sender + \"ds\")\r\n\t}\r\n\t//should check out if owner changes invite too\r\n\terr = userlib.DSVerify(senderKey, sharedInvite.RSAFileKey, sharedInvite.Signature)\r\n\r\n\tif err != nil {\r\n\t\treturn errors.New(\"Failed to verify sender.\")\r\n\t}\r\n\r\n\t//now we can finally receive the fileKey after unmarshaling\r\n\t//trying to decrypt marshaled RSAFileKey\r\n\trsaFK_dec, err := userlib.PKEDec(userdata.PrivRSAKey, sharedInvite.RSAFileKey)\r\n\tif err != nil {\r\n\t\treturn errors.New(\"Failed to decrypt FileKeyMeta info.\")\r\n\t}\r\n\r\n\tvar rsaFK FileKeyMeta\r\n\terr = json.Unmarshal(rsaFK_dec, &rsaFK)\r\n\tif err != nil {\r\n\t\treturn errors.New(\"Error unmarshaling file key metadata.\")\r\n\t}\r\n\r\n\t//now lets retrieve the fileKey from the datastore and append that to our users filespace\r\n\tfileKey, fkFound := userlib.DatastoreGet(rsaFK.DSid)\r\n\r\n\tif !fkFound {\r\n\t\treturn errors.New(\"Could not find original file.\")\r\n\t}\r\n\r\n\t//authenticate HMAC, decrypt, depad, demarshal fileKey and add to users filespace\r\n\tlen_fk := len(fileKey) - userlib.HashSizeBytes\r\n\tif len(fileKey[:len_fk]) < userlib.HashSizeBytes {\r\n\t\t//automatically return error, file has been changed\r\n\t\treturn errors.New(\"File key data length has changed.\")\r\n\t}\r\n\r\n\tcomputedMac, _ := userlib.HMACEval(rsaFK.HMACkey, fileKey[:len_fk])\r\n\tif !userlib.HMACEqual(computedMac, fileKey[len_fk:]) {\r\n\t\t//should error if access revoked!\r\n\t\treturn errors.New(\"File key struct has been tampered with in Datastore.\")\r\n\t}\r\n\t//decrypt\r\n\tfileKey_dec := userlib.SymDec(rsaFK.ENCkey, fileKey[:len_fk])\r\n\tfileKey_dec = PKCS(fileKey_dec, \"remove\")\r\n\tvar finalFK FileKey\r\n\terr = json.Unmarshal(fileKey_dec, &finalFK)\r\n\r\n\tif err != nil {\r\n\t\treturn errors.New(\"Error unmarshaling actual file key.\")\r\n\t}\r\n\t//generate a new fileKey for user! user can name file whatever they want\r\n\r\n\t//marshal, pad, encrypt, add HMAC and send userdata to DS\r\n\tuserdata.Filespace[filename] = finalFK\r\n\tuserdata.AccessTokens[filename] = accessToken\r\n\tuser_json, _ := json.Marshal(userdata)\r\n\tuser_IV := userlib.RandomBytes(userlib.AESBlockSizeBytes)\r\n\tuser_enc := userlib.SymEnc(userdata.EncKey, user_IV, PKCS(user_json, \"add\"))\r\n\r\n\tuser_mac, _ := userlib.HMACEval(userdata.HMACKey, user_enc)\r\n\tuser_enc = append(user_enc, user_mac...)\r\n\tuserlib.DatastoreSet(userdata.UUID_, user_enc)\r\n\r\n\treturn nil\r\n}", "func readCSVFile(filePath string) ([][]string, error) {\n\tf, err := os.Open(filePath)\n\tif err != nil {\n\t\tlog.Fatalf(\"could not read input file: %v, %v\", filePath, err)\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tcsvr := csv.NewReader(f)\n\tif _, err := csvr.Read(); err != nil {\n\t\treturn nil, err\n\t}\n\n\trecords, err := csvr.ReadAll()\n\tif err != nil {\n\t\tlog.Fatalf(\"could not parse file as CSV for path: %v ,%v\", filePath, err)\n\t\treturn nil, err\n\t}\n\n\treturn records, nil\n}", "func (l *Logger) handleFile(path string, info os.FileInfo, err error) error {\n\tif info.IsDir() {\n\t\treturn nil\n\t}\n\tif !strings.HasPrefix(info.Name(), l.filePrefix+\"-\") {\n\t\treturn nil\n\t}\n\tif !strings.HasSuffix(info.Name(), \".log\") {\n\t\treturn nil\n\t}\n\tlidx := strings.LastIndex(info.Name(), \".log\")\n\ttstring := info.Name()[len(l.filePrefix)+1 : lidx]\n\tglog.WithField(\"log_ts\", tstring).Debug(\"Found log.\")\n\n\t// Handle if we find the current log file.\n\tif tstring == \"current\" {\n\t\treturn nil\n\t}\n\n\tts, err := strconv.ParseInt(tstring, 16, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlf := new(logFile)\n\tlf.endTs = ts\n\tlf.path = path\n\tl.list = append(l.list, lf)\n\n\tl.updateLastLogTs(lf.endTs)\n\treturn nil\n}", "func (c *Config) readFlannelFile() ([]byte, error) {\n\tfileContent, err := ioutil.ReadFile(c.Flag.Service.FlannelFile)\n\tif err != nil {\n\t\treturn nil, microerror.Maskf(invalidFlannelFileError, \"%s\", c.Flag.Service.FlannelFile)\n\t}\n\n\treturn fileContent, nil\n}", "func readFile(fileName string) (content string) { //method that will read a file and return lines or error\n\tfileContents, err := ioutil.ReadFile(fileName)\n\tif isError(err) {\n\t\tprint(\"Error reading \", fileName, \"=\", err)\n\t\treturn\n\t}\n\tcontent = string(fileContents)\n\treturn\n}", "func (m MockFS) ReadFile(name string) ([]byte, error) {\n\tfile, ok := m.Files[name]\n\tif !ok {\n\t\treturn []byte{}, errors.New(\"file not found\")\n\t}\n\n\treturn file.Content(), nil\n}", "func ReadConfigFromFile(filePath string) (*BotConfig, error) {\n\tf, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err, fmt.Sprintf(\"failed to open file: %v\", filePath))\n\t}\n\n\tdefer f.Close()\n\treturn ReadConfig(f)\n}", "func GetLogFile(client kubernetes.Interface, namespace, podID string, container string, usePreviousLogs bool) (\n\tio.ReadCloser, error) {\n\tlogOptions := &v1.PodLogOptions{\n\t\tContainer: container,\n\t\tFollow: false,\n\t\tPrevious: usePreviousLogs,\n\t\tTimestamps: false,\n\t}\n\tlogStream, err := openStream(client, namespace, podID, logOptions)\n\treturn logStream, err\n}", "func (cache *FileCache) ReadFile(name string) (content []byte, err error) {\n\tif cache.InCache(name) {\n\t\tcontent, _ = cache.GetItem(name)\n\t} else {\n\t\tgo cache.Cache(name)\n\t\tcontent, err = os.ReadFile(name)\n\t\tif err == nil && !SquelchItemNotInCache {\n\t\t\terr = ItemNotInCache\n\t\t}\n\t}\n\treturn\n}", "func (s *ServiceImpl) readQueryFile(filename string) (string, error) {\n\tqueryPath := filepath.Join(s.queriesPath, filename)\n\n\tbytes, err := ioutil.ReadFile(queryPath)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to read query file %s: %v\", filename, err)\n\t}\n\n\treturn string(bytes), nil\n}", "func (m *AccountManagerImpl) loadFile(addr common.Address, passphrase []byte) error {\n\tacc, err := m.getAccount(addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\traw, err := ioutil.ReadFile(acc.path)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = m.Load(raw, passphrase)\n\treturn err\n}", "func (w *xcWallet) logFilePath() (string, error) {\n\tlogFiler, ok := w.Wallet.(asset.LogFiler)\n\tif !ok {\n\t\treturn \"\", errors.New(\"wallet does not support getting log file\")\n\t}\n\treturn logFiler.LogFilePath(), nil\n}", "func (c *Client) LoadFromFilePath(filePath string) error {\n\tusr, err := user.Current()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif strings.Index(filePath, \"~/\") == 0 {\n\t\tfilePath = strings.Replace(filePath, \"~/\", usr.HomeDir+\"/\", 1)\n\t}\n\n\tcYAML, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.LoadFromContent(cYAML); err != nil {\n\t\treturn err\n\t}\n\n\treturn c.check()\n}", "func readFile(filePath string) (*[]string, error) {\n\tf, err := os.Open(filePath)\n\tif err != nil {\n\t\tlog.Errorf(\"File \\\"%s\\\" could not be read; %s\\n\", filePath, err)\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err = f.Close(); err != nil {\n\t\t\tlog.Errorf(\"File \\\"%s\\\" could not be closed: %s\\n\", filePath, err)\n\t\t}\n\t}()\n\tvar lines []string\n\ts := bufio.NewScanner(f)\n\tfor s.Scan() {\n\t\tlines = append(lines, s.Text())\n\t}\n\terr = s.Err()\n\tif err != nil {\n\t\tlog.Errorf(\"Error while reading file \\\"%s\\\": %s\\n\", filePath, err)\n\t\treturn nil, err\n\t}\n\treturn &lines, nil\n}", "func CCMRead(conf_file string) CCMConf {\n\tccm_path := os.Getenv(\"CCM_REPO_PATH\")\n\tconfig_file_path := ccm_path + \"/ccm_configs/\" + conf_file\n\tfile_data, err := ioutil.ReadFile(config_file_path)\n\tERRHandler(err, \"read ccm_config file \")\n\tif err != nil {\n\t\treturn CCMConf{}\n\t}\n\tvar ccm_configuration CCMConf\n\tERRHandler(json.Unmarshal(file_data, &ccm_configuration), \"CcmConf unmarshal : \")\n\treturn ccm_configuration\n}", "func ReadFile(fileName string) ([]string, error) {\n\tf, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tb, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn strings.Split(strings.TrimRight(string(b), \"\\n\"), \"\\n\"), nil\n}", "func (m *Master) ReadInfoFromFile(filepath string) error {\n\t// open file\n\tfile, err := os.OpenFile(filepath, os.O_RDONLY|os.O_CREATE, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// close file\n\tdefer file.Close()\n\n\t// check file size\n\t// stats, err := file.Stat()\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\t// fileSize := stats.Size()\n\t// buf := make([]byte, fileSize)\n\n\t// read file\n\tdataLenBytes := make([]byte, 8)\n\tuserTypeBytes := make([]byte, 1)\n\tfor {\n\t\t// data len\n\t\tvar dataLen int64 = 0 // data len\n\t\tn, err := io.ReadFull(file, dataLenBytes)\n\t\tif err != nil || n != 8 {\n\t\t\tbreak\n\t\t}\n\t\tbytesBuffer := bytes.NewBuffer(dataLenBytes)\n\t\tbinary.Read(bytesBuffer, binary.LittleEndian, &dataLen)\n\t\t// fmt.Println(\"data len =\", dataLen)\n\n\t\t// user type\n\t\tn, err = io.ReadFull(file, userTypeBytes)\n\t\tif err != nil || n != 1 {\n\t\t\tbreak\n\t\t}\n\t\t// fmt.Println(\"user type =\", userTypeBytes[0])\n\n\t\t// data\n\t\tfile.Seek(-1, 1) // 回退一个字节,用户类型\n\t\tdataBytes := make([]byte, dataLen)\n\t\tn, err = io.ReadFull(file, dataBytes)\n\t\tif err != nil || int64(n) != dataLen {\n\t\t\tbreak\n\t\t}\n\n\t\tswitch model.UserType(userTypeBytes[0]) {\n\t\tcase model.TypeTeacher:\n\t\t\ts := &model.Teacher{}\n\t\t\tif err := s.UnSerialize(dataBytes); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// s.DisplayInfo()\n\t\t\tm.allUserInfo[model.AllUserType[0]][s.ID] = s\n\t\tcase model.TypeStudent:\n\t\t\tt := &model.Student{}\n\t\t\tif err := t.UnSerialize(dataBytes); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// t.DisplayInfo()\n\t\t\tm.allUserInfo[model.AllUserType[1]][t.ID] = t\n\t\t}\n\t}\n\t// fmt.Println(\"file size =\", fileSize, \",read size =\", n)\n\n\treturn nil\n}", "func read(fileName string) (*Configuration, error) {\n\tif fileName == \"\" {\n\t\treturn Config, fmt.Errorf(\"Empty file name\")\n\t}\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn Config, err\n\t}\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(Config)\n\tif err == nil {\n\t\tlog.Infof(\"Read config: %s\", fileName)\n\t} else {\n\t\tlog.Fatal(\"Cannot read config file:\", fileName, err)\n\t}\n\tif err := Config.postReadAdjustments(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn Config, err\n}", "func parseLogFile(file string, ignoreMissingFields bool) (LogEntries, error) {\n\t// logfmt is unhappy attempting to read hex-encoded bytes in strings,\n\t// so hide those from it by escaping them.\n\treader := NewHexByteReader(file)\n\n\treturn parseLogFmtData(reader, file, ignoreMissingFields)\n}", "func (a *RepoAPI) readFileLines(params interface{}) (resp *rpc.Response) {\n\tm := objx.New(cast.ToStringMap(params))\n\tvar revision []string\n\tif rev := m.Get(\"revision\").Str(); rev != \"\" {\n\t\trevision = []string{rev}\n\t}\n\treturn rpc.Success(util.Map{\n\t\t\"lines\": a.mods.Repo.ReadFileLines(m.Get(\"name\").Str(), m.Get(\"path\").Str(), revision...),\n\t})\n}", "func (f *FileCache) nextReadFile() (name string) {\n\tvar names []string\n\tf.eLock.RLock()\n\tfor name = range f.logs {\n\t\tnames = append(names, name)\n\t}\n\tf.eLock.RUnlock()\n\tif len(names) > 0 {\n\t\tsort.Strings(names)\n\t\tname = names[0]\n\t}\n\treturn\n}", "func parseSlowLogFile(tz *time.Location, filePath string) ([][]types.Datum, error) {\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tdefer func() {\n\t\tif err = file.Close(); err != nil {\n\t\t\tlogutil.BgLogger().Error(\"close slow log file failed.\", zap.String(\"file\", filePath), zap.Error(err))\n\t\t}\n\t}()\n\treturn ParseSlowLog(tz, bufio.NewReader(file))\n}", "func readToken(filePath string) (string, error) {\n\tb, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}", "func (fs *Fs) ReadFile(name string) ([]byte, error) {\n\treturn os.ReadFile(filepath.Clean(name))\n}", "func ReadTxFromDBLogFile(beginHeight int, endHeight int) ([]string, error) {\n\tf, err := os.Open(DbTxLogFilePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuf := bufio.NewReader(f)\n\tstrList := make([]string, 0)\n\tfor {\n\t\tline, err := buf.ReadString('\\n')\n\t\tsplit := strings.Split(line, \" | \")\n\t\tif len(split) < 6 {\n\t\t\tbreak\n\t\t}\n\t\theight, err := strconv.Atoi(split[4])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif height > endHeight {\n\t\t\tbreak\n\t\t} else if height < beginHeight {\n\t\t\tcontinue\n\t\t}\n\t\tstrList = append(strList, split[0])\n\t}\n\treturn strList, nil\n}", "func receiveChat() {\n\treq := new(pb.ReceiveChatRequest)\n\tstream, err := RpcClientD.ReceiveMsg(context.Background(), req)\n\tif err != nil {\n\t\tlog.Error(err)\n\t} else {\n\t\tfor {\n\t\t\trcv, err := stream.Recv()\n\t\t\tif err != nil {\n\t\t\t\tlog.Warn(err)\n\t\t\t\tstream, _ = RpcClientD.ReceiveMsg(context.Background(), req)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tChats <- rcv.Chat\n\t\t}\n\t}\n}", "func ReadFile(path string, currentLine int) (string, error) {\n\tline, err := ReadFileWithBuffers(path, currentLine, 0, 0)\n\treturn line.Exact, err\n}", "func ReadFile(ctx context.Context, repo gitserver.Repo, commit api.CommitID, name string, maxBytes int64) ([]byte, error) {\n\tif Mocks.ReadFile != nil {\n\t\treturn Mocks.ReadFile(commit, name)\n\t}\n\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"Git: ReadFile\")\n\tspan.SetTag(\"Name\", name)\n\tdefer span.Finish()\n\n\tif err := checkSpecArgSafety(string(commit)); err != nil {\n\t\treturn nil, err\n\t}\n\n\tname = util.Rel(name)\n\tb, err := readFileBytes(ctx, repo, commit, name, maxBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn b, nil\n}", "func (fs FileSystem) ReadFile(filename string) ([]byte, error) {\n\tfs.testDriver()\n\tfilename = filepath.FromSlash(filename)\n\treturn fs.drv.ReadFile(filename)\n}", "func (a *RepoAPI) readFile(params interface{}) (resp *rpc.Response) {\n\tm := objx.New(cast.ToStringMap(params))\n\tvar revision []string\n\tif rev := m.Get(\"revision\").Str(); rev != \"\" {\n\t\trevision = []string{rev}\n\t}\n\treturn rpc.Success(util.Map{\n\t\t\"content\": a.mods.Repo.ReadFile(m.Get(\"name\").Str(), m.Get(\"path\").Str(), revision...),\n\t})\n}", "func ReadConfigFile(filePath string) (TelemetryConfig, error) {\n\tconfig := TelemetryConfig{}\n\n\tb, err := os.ReadFile(filePath)\n\tif err != nil {\n\t\tlog.Logf(\"[Telemetry] Failed to read telemetry config: %v\", err)\n\t\treturn config, err\n\t}\n\n\tif err = json.Unmarshal(b, &config); err != nil {\n\t\tlog.Logf(\"[Telemetry] unmarshal failed with %v\", err)\n\t}\n\n\treturn config, err\n}", "func ReadFile(relativePath string) ([]byte, error) {\n\tpath, err := filepath.Abs(relativePath)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\treturn ioutil.ReadFile(path)\n}", "func (l *JSONFileLogger) ReadLogs(config logger.ReadConfig) *logger.LogWatcher {\n\tlogWatcher := logger.NewLogWatcher()\n\n\tgo l.readLogs(logWatcher, config)\n\treturn logWatcher\n}", "func (c *RouteRegistry) ReadFile(path string) error {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.Read(f)\n}", "func (ctx *Context) ReadFile(filename string) ([]byte, error) {\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, buildererror.Errorf(buildererror.StatusInternal, \"reading file %q: %v\", filename, err)\n\t}\n\treturn data, nil\n}", "func LogFile(filepath string) ([]event.EloEvent, error) {\n\tevents := []event.EloEvent{}\n\n\tit, err := NewFieldsIterator(filepath)\n\tdefer it.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor {\n\t\tlineNum, m, err := it.Next()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif lineNum < 0 {\n\t\t\tbreak // EOF\n\t\t}\n\t\tevent, err := EloEvent(m)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing event from line %d: %v\", lineNum, err)\n\t\t}\n\t\tif event != nil {\n\t\t\tevents = append(events, event)\n\t\t}\n\t}\n\n\treturn events, nil\n}", "func (self *RegisObjManager) LoadPersonalChatLogObj(id string) *RedisPersonalChatLogObj {\n\tvalue, ok := self.Load(id)\n\tif ok {\n\t\treturn value.(*RedisPersonalChatLogObj)\n\t}\n\treturn nil\n}", "func ReadConfigFile(filePath string) (TelemetryConfig, error) {\n\tconfig := TelemetryConfig{}\n\n\tb, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\tlog.Logf(\"[Telemetry] Failed to read telemetry config: %v\", err)\n\t\treturn config, err\n\t}\n\n\tif err = json.Unmarshal(b, &config); err != nil {\n\t\tlog.Logf(\"[Telemetry] unmarshal failed with %v\", err)\n\t}\n\n\treturn config, err\n}", "func NewFileLogger(fileName string) Logger4 {\n\tvar log = logrus.New()\n\n\t// -------- 判断目录是否存在 -------- Begin\n\t// 判断当前应用程序目录,在用 go run 命令执行时,一般在一个临时目录\n\t// if AppPath, err := filepath.Abs(filepath.Dir(os.Args[0])); err != nil {\n\t// \tpanic(err)\n\t// } else {\n\t// \tfmt.Println(\"AppPath\", AppPath)\n\t// }\n\n\t// 获取当前工作目录\n\tworkPath, err := os.Getwd()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// 设置 logs 输出文件目录\n\tlogFolderPath := filepath.Join(workPath, \"logs\")\n\n\t// 如果目录不存在,则创建\n\tif !commonutils.PathExists(logFolderPath) {\n\t\tif err = os.Mkdir(logFolderPath, os.ModePerm); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\t// -------- 判断目录是否存在 -------- End\n\n\tbaseLogPath := fmt.Sprintf(\"logs/%s\", fileName)\n\tnewLogName := baseLogPath[:strings.LastIndex(baseLogPath, \".\")]\n\tfileExe := baseLogPath[strings.LastIndex(baseLogPath, \".\")+1:]\n\twriter, _ := rotatelogs.New(\n\t\tnewLogName+\".%F.\"+fileExe,\n\t\trotatelogs.WithClock(rotatelogs.Local), // 使用本地时区\n\t\trotatelogs.WithLinkName(baseLogPath), // 生成软链,指向最新日志文件\n\t\trotatelogs.WithMaxAge(7*24*time.Hour), // 文件最大保存时间\n\t\trotatelogs.WithRotationTime(24*time.Hour), // 日志切割时间间隔\n\t)\n\n\t// 输出到文本的格式\n\tlogFormat := &logrus.TextFormatter{TimestampFormat: \"2006-01-02 15:04:05\", FullTimestamp: true, DisableTimestamp: false, DisableColors: false, ForceColors: true, DisableSorting: false}\n\t// logFormat := &logrus.JSONFormatter{TimestampFormat: \"2006-01-02 15:04:05\", DisableTimestamp: false}\n\n\t// 参考:http://xiaorui.cc/2018/01/11/golang-logrus%E7%9A%84%E9%AB%98%E7%BA%A7%E9%85%8D%E7%BD%AEhook-logrotate/\n\tlfHook := lfshook.NewHook(lfshook.WriterMap{\n\t\tlogrus.DebugLevel: writer, // 为不同级别设置不同的输出目的\n\t\tlogrus.InfoLevel: writer,\n\t\tlogrus.WarnLevel: writer,\n\t\tlogrus.ErrorLevel: writer,\n\t\tlogrus.FatalLevel: writer,\n\t\tlogrus.PanicLevel: writer,\n\t}, logFormat)\n\tlog.AddHook(lfHook)\n\n\t// 输出到屏幕的格式\n\tlog.Formatter = &logrus.TextFormatter{TimestampFormat: \"2006-01-02 15:04:05\", FullTimestamp: true, DisableTimestamp: false, DisableColors: false, ForceColors: true, DisableSorting: false}\n\tlog.SetLevel(logrus.DebugLevel)\n\tlog.Out = os.Stdout\n\t// log.SetFormatter(logFormat)\n\n\treturn &apiFileLogger{\n\t\tLogFileWrite: log,\n\t\tLogOutPut: nil,\n\t}\n\n}", "func (i *IrcClient) WatchChat(msgHandler func(msg *IrcMessage)) {\n\tlog(\"IRC watch chat - watching chat\")\n\n\ttp := textproto.NewReader((bufio.NewReader(i.Conn)));\n\n\tfor i.Connected {\n\t\tline, err := tp.ReadLine()\n\n\t\tif err != nil {\n\t\t\tlog(\"IRC watch chat - error reading line\")\n\t\t\tlog(err.Error())\n\t\t\ti.Disconnect()\n\t\t\tbreak\n\t\t}\n\n\t\t// log msg\n\t\tlog(line)\n\n\t\t// callback to handle received message & parse msg\n\t\tmsgHandler(ParseMsg(line))\n\n\t\t// Don't know if sleeping is needed but feel better with it\n\t\ttime.Sleep(200 * time.Millisecond)\n\t}\n\n\ti.Disconnect()\n}" ]
[ "0.56653655", "0.5360153", "0.5000259", "0.49861518", "0.49759206", "0.49630967", "0.49528545", "0.4927083", "0.48838076", "0.4834497", "0.48316693", "0.4819896", "0.4802459", "0.47713745", "0.47349924", "0.47146568", "0.4690015", "0.46746495", "0.45360166", "0.45357734", "0.4498115", "0.44967905", "0.44875517", "0.44865224", "0.4464945", "0.44616878", "0.44539946", "0.44445914", "0.44326746", "0.44286162", "0.44227055", "0.44145042", "0.44035098", "0.43878648", "0.43842316", "0.43819928", "0.43776983", "0.43584993", "0.43552035", "0.43483385", "0.4345827", "0.43397465", "0.43226236", "0.4316389", "0.42975473", "0.4295396", "0.42769983", "0.4275246", "0.42712447", "0.4266277", "0.42632443", "0.4263034", "0.42569095", "0.4255643", "0.42482528", "0.42292953", "0.42148566", "0.41915023", "0.41873118", "0.41866738", "0.4167583", "0.4164704", "0.41581002", "0.41544557", "0.415191", "0.41483176", "0.41404098", "0.41400844", "0.41390294", "0.41324055", "0.4122448", "0.4118459", "0.41130394", "0.41094416", "0.41015175", "0.41014314", "0.41009408", "0.40997982", "0.40945", "0.4090849", "0.40772185", "0.40752077", "0.40599635", "0.40548974", "0.40518364", "0.40435004", "0.4042756", "0.40254954", "0.40220618", "0.40167755", "0.4014666", "0.40143502", "0.40137732", "0.40112513", "0.40090322", "0.399935", "0.39964685", "0.39925513", "0.39917558", "0.39885932" ]
0.7860538
0
WriteChatLog writes chat log messages into new archive.
func (a *ChatLogsArchive) WriteChatLog(accountName string, fileName string, messages Messages) error { logFilePath := strings.Join([]string{accountName, fileName}, "/") f, err := a.w.Create(logFilePath) if err != nil { return fmt.Errorf("error creating file %s: %w", logFilePath, err) } err = messages.Write(f) if err != nil { return fmt.Errorf("error writing file %s: %w", logFilePath, err) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (l *logger) WriteLog(s ...interface{}) {\n\tl.Lock()\n\tdefer l.Unlock()\n\tl.buffer.WriteString(fmt.Sprintf(\"%s %s\", l.timeInterface.GetNow(), l.GetLogLevel()))\n\tl.makeLogContent(s...)\n\t//l.mysqlChan <- l.buffer.String()\n\tl.buffer.WriteString(\"\\n\")\n\tl.fd.Write(l.buffer.Bytes())\n\tl.buffer.Reset()\n}", "func writeToLog(file *os.File, msg string, offSet int64) error {\n\tbs, err := json.Marshal(&msg)\n\tcheck(err)\n\t_, err = file.WriteAt(bs, offSet)\n\treturn err\n}", "func (bot *ChatBot) WriteChatData() error {\n\tmsgList := *bot.data.Messages\n\tmsgSlice := make([]*ChatMessage, msgList.Len())\n\n\tfor i, e := 0, msgList.Front(); e != nil; i, e = i+1, e.Next() {\n\t\tmsgSlice[i] = e.Value.(*ChatMessage)\n\t}\n\n\tatomNum := rand.Intn(1024)\n\tatomFilename := fmt.Sprintf(\"data.gob.atom%d\", atomNum)\n\twriter, err := os.Create(atomFilename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer writer.Close()\n\n\tencoder := gob.NewEncoder(writer)\n\terr = encoder.Encode(RawDataRoot{\n\t\tMessages: msgSlice,\n\t\tVersion: bot.data.Version,\n\t\tFlags: bot.data.Flags,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\twriter.Close()\n\n\terr = os.Rename(atomFilename, \"data.gob\")\n\treturn err\n}", "func (w *FileLoggerWriter) writeLog(msg []byte) {\n\tw.msgChan <- msg\n}", "func WriteLogs(filepath, data string) error {\n\n\t// First, we create an instance of a timezone location object\n\tconst layout = \"Jan 2, 2006 at 3:04 PM\"\n\n\t// Get log file\n\tlogFile, err := file.Open(filepath)\n\tdefer file.Close(logFile)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdata = time.Now().Format(layout) + \" - \" + data + \"\\n\"\n\t_, err = file.Write(logFile, []byte(data))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = file.Sync(logFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (f *fileLogger) LogWrite(when time.Time, msgText interface{}, level int) error {\r\n\tmsg, ok := msgText.(string)\r\n\tif !ok {\r\n\t\treturn nil\r\n\t}\r\n\tif level > f.LogLevel {\r\n\t\treturn nil\r\n\t}\r\n\r\n\tday := when.Day()\r\n\tmsg += \"\\n\"\r\n\tif f.Append {\r\n\t\tf.RLock()\r\n\t\tif f.needCreateFresh(len(msg), day) {\r\n\t\t\tf.RUnlock()\r\n\t\t\tf.Lock()\r\n\t\t\tif f.needCreateFresh(len(msg), day) {\r\n\t\t\t\tif err := f.createFreshFile(when); err != nil {\r\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"createFreshFile(%q): %s\\n\", f.Filename, err)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tf.Unlock()\r\n\t\t} else {\r\n\t\t\tf.RUnlock()\r\n\t\t}\r\n\t}\r\n\r\n\tf.Lock()\r\n\t_, err := f.fileWriter.Write([]byte(msg))\r\n\tif err == nil {\r\n\t\tf.maxLinesCurLines++\r\n\t\tf.maxSizeCurSize += len(msg)\r\n\t}\r\n\tf.Unlock()\r\n\treturn err\r\n}", "func (log *Logger) write(msg LogMessage) error {\n\t//check if its a zero LogMessage\n\tif msg.M == \"\" {\n\t\treturn nil\n\t}\n\n\ttimeStamp := time.Now().Format(time.RFC3339)\n\tlogMessage := timeStamp + \" - \" + strings.ToUpper(msg.S) + \" - \" + msg.M\n\n\tif msg.D == \"system\" {\n\t\t_, err := log.SystemLog.WriteString(logMessage + \"\\n\")\n\t\tif err != nil {\n\t\t\treturn errors.New(\"Logger: Failed to write to system log file, with error: \" + err.Error())\n\t\t}\n\t} else if msg.D == \"network\" {\n\t\t_, err := log.NetworkLog.WriteString(logMessage + \"\\n\")\n\t\tif err != nil {\n\t\t\treturn errors.New(\"Logger: Failed to write to network log file, with error: \" + err.Error())\n\t\t}\n\t}\n\treturn nil\n}", "func (flogs *fileLogs) StreamAll(dataID, version dvid.UUID, ch chan storage.LogMessage) error {\n\tdefer close(ch)\n\n\tk := string(dataID + \"-\" + version)\n\tfilename := filepath.Join(flogs.path, k)\n\n\tflogs.RLock()\n\tfl, found := flogs.files[k]\n\tflogs.RUnlock()\n\tif found {\n\t\t// close then reopen later.\n\t\tfl.Lock()\n\t\tfl.Close()\n\t\tflogs.Lock()\n\t\tdelete(flogs.files, k)\n\t\tflogs.Unlock()\n\t}\n\n\tf, err := os.OpenFile(filename, os.O_RDONLY, 0755)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\tdata, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\tf.Close()\n\n\tif len(data) > 0 {\n\t\tvar pos uint32\n\t\tfor {\n\t\t\tif len(data) < int(pos+6) {\n\t\t\t\tdvid.Criticalf(\"malformed filelog %q at position %d\\n\", filename, pos)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tentryType := binary.LittleEndian.Uint16(data[pos : pos+2])\n\t\t\tsize := binary.LittleEndian.Uint32(data[pos+2 : pos+6])\n\t\t\tpos += 6\n\t\t\tdatabuf := data[pos : pos+size]\n\t\t\tpos += size\n\t\t\tch <- storage.LogMessage{EntryType: entryType, Data: databuf}\n\t\t\tif len(data) == int(pos) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif found {\n\t\tf2, err2 := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND|os.O_SYNC, 0755)\n\t\tif err2 != nil {\n\t\t\tdvid.Errorf(\"unable to reopen write log %s: %v\\n\", k, err)\n\t\t} else {\n\t\t\tflogs.Lock()\n\t\t\tflogs.files[k] = &fileLog{File: f2}\n\t\t\tflogs.Unlock()\n\t\t}\n\t\tfl.Unlock()\n\t}\n\treturn nil\n}", "func (p *partition) WriteLog(msg []byte) error {\n\tif len(msg) == 0 {\n\t\treturn nil\n\t}\n\treturn p.log.Put(msg)\n}", "func WriteLog(sText string) {\n\n\tf, err := os.OpenFile(sLogName, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0600)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\tf.WriteString(sText)\n\n}", "func (lf *JSONLogFile) WriteLogMessage(msg *logger.LogMessage) error {\n\tb, err := lf.marshalFunc(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlf.mu.Lock()\n\tdefer lf.mu.Unlock()\n\t_, err = lf.f.Write(b)\n\treturn err\n}", "func (self logWriter) Write(buf[]byte) (int, error) {\n line := string(buf)\n\n logMsg := LogMsg{\n Line: strings.TrimRight(line, \"\\n\"),\n }\n\n self.writeChan <- logMsg\n\n return len(buf), nil\n}", "func writeLog(msg ...interface{}) {\n\tlogLocker.Lock()\n\tdefer logLocker.Unlock()\n\tif *confVerbose {\n\t\tcolor.Green(fmt.Sprint(time.Now().Format(\"02_01_06-15.04.05\"), \"[WRITE] ->\", msg))\n\t}\n}", "func (logWriter LogWriter) writeLog(logger *logrus.Logger, testName string, text string) error {\n\tfile, err := logWriter.getOrCreateFile(logger, testName)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error retrieving log for test: %s\", testName)\n\t\treturn errors.WithStackTrace(err)\n\t}\n\t_, err = file.WriteString(text + \"\\n\")\n\tif err != nil {\n\t\tlogger.Errorf(\"Error (%s) writing log entry: %s\", err, text)\n\t\treturn errors.WithStackTrace(err)\n\t}\n\tfile.Sync()\n\treturn nil\n}", "func (wechatPush *WechatPush) WriteMsg(when time.Time, msg string, level int) error {\n\tif level > wechatPush.Level {\n\t\treturn nil\n\t}\n\n\tdata := InitPushData(msg)\n\n\tfor _, id := range wechatPush.WechatIds {\n\t\terr := wechatPush.message.Push(id, \"\", wechatPush.TmpId, data)\n\t\tfmt.Printf(\"push data to user:%v, error:%v\\n\", id, err)\n\t}\n\treturn nil\n}", "func writeLogs(filePath string, logs plog.Logs) error {\n\tunmarshaler := &plog.JSONMarshaler{}\n\tfileBytes, err := unmarshaler.MarshalLogs(logs)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar jsonVal map[string]interface{}\n\tif err = json.Unmarshal(fileBytes, &jsonVal); err != nil {\n\t\treturn err\n\t}\n\tb := &bytes.Buffer{}\n\tenc := yaml.NewEncoder(b)\n\tenc.SetIndent(2)\n\tif err := enc.Encode(jsonVal); err != nil {\n\t\treturn err\n\t}\n\treturn os.WriteFile(filePath, b.Bytes(), 0600)\n}", "func writeLog(text string) {\n\tf, _ := os.OpenFile(logFile, os.O_APPEND|os.O_WRONLY, 0600)\n\t// f.. microsoft\n\tf.WriteString(time.Now().Format(\"Mon Jan _2 15:04:05 2006\") + \" \" + text + \"\\r\\n\")\n\tf.Sync()\n\n\tdefer f.Close()\n}", "func (n *PaxosNode) writeAtSlot(slotNumber int, buf []byte) error {\n\twriteLog, _ := os.OpenFile(n.logFileName, os.O_RDWR, 0666)\n\toffset := int64(slotNumber * MAX_SLOT_BYTES)\n\twriteLog.Seek(offset, 0) // from origin of file go to current offset\n\tnbytes, err := writeLog.WriteString(string(buf) + \"\\n\")\n\tif err != nil {\n\t\tLOGE.Printf(\"Error in writing to log\")\n\t\treturn err\n\t}\n\tLOGV.Printf(\"wrote %d bytes\\n\", nbytes)\n\twriteLog.Sync()\n\twriteLog.Close()\n\n\tn.MessageAvailable <- true\n\n\treturn nil\n}", "func (a *ChatLogsArchive) ReadChatLog(accountName string, fileName string) (Messages, error) {\n\tif a.r == nil {\n\t\treturn nil, nil\n\t}\n\n\tlogFilePath := strings.Join([]string{accountName, fileName}, \"/\")\n\tf, err := a.r.Open(logFilePath)\n\n\t// Do not return error if file doesn't exists.\n\tif errors.Is(err, os.ErrNotExist) {\n\t\treturn nil, nil\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open chat log %s: %w\", logFilePath, err)\n\t}\n\tdefer f.Close()\n\n\tmessages, err := ReadMessages(f)\n\tif err != nil {\n\t\treturn messages, fmt.Errorf(\"unable to read chat log %s: %w\", logFilePath, err)\n\t}\n\n\treturn messages, nil\n}", "func (a *ChatLogsArchive) Close() error {\n\tif a.r != nil {\n\t\t_ = a.r.Close()\n\t}\n\n\twrittenFileName := a.wf.Name()\n\n\terr := a.w.Close()\n\tif err != nil {\n\t\ta.wf.Close()\n\t\t_ = os.Remove(writtenFileName)\n\t\treturn fmt.Errorf(\"error closing .zip file %s: %w\", a.wf.Name(), err)\n\t}\n\n\terr = a.wf.Close()\n\tif err != nil {\n\t\t_ = os.Remove(writtenFileName)\n\t\treturn fmt.Errorf(\"error closing file %s: %w\", writtenFileName, err)\n\t}\n\n\terr = MoveFile(writtenFileName, a.fileName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error overwriting file %s with %s: %w\", a.fileName, writtenFileName, err)\n\t}\n\n\treturn nil\n}", "func (c *Client) Chat(msg string) error {\n\tif len(msg) > 256 {\n\t\treturn errors.New(\"message too long\")\n\t}\n\n\treturn c.conn.WritePacket(pk.Marshal(\n\t\tdata.ChatServerbound,\n\t\tpk.String(msg),\n\t))\n}", "func (w *LogWriter) Write(data []byte) (int, error) {\n\tw.finLk.RLock()\n\tdefer w.finLk.RUnlock()\n\tif w.closed {\n\t\treturn len(data), nil\n\t}\n\tif w.msgCh == nil {\n\t\treturn len(data), w.write(data)\n\t}\n\tcopied := make([]byte, len(data))\n\tcopy(copied, data)\n\tw.msgCh <- copied\n\treturn len(data), nil\n}", "func (a *DBAppender) WriteLog(level string, catalog string, callin int, v ...interface{}) {\n\t// arg call in not used.\n\tcallin = 3\n\ta.mu.Lock()\n\tm := LogTable{}\n\tm.Level = level\n\tm.Catalog = catalog\n\tm.Message = fmt.Sprint(v...)\n\tm.CreateTime = time.Now()\n\n\t_, file, line, ok := runtime.Caller(callin)\n\tif !ok {\n\t\tfile = \"???\"\n\t\tline = 0\n\t}\n\n\tm.Source = file\n\tm.Line = line\n\n\t// do save\n\tif err := Insert(a.Sql, m); err != nil {\n\t\tfmt.Printf(\"Write Logger to DB Error: %v\\n\", err)\n\t}\n\n\ta.mu.Unlock()\n}", "func (f *FileHandler) WriteLog(e *Entry) {\n\tvar logfile string\n\tif !f.separate {\n\t\tlogfile = f.path\n\t} else {\n\t\tlogfile = fmt.Sprintf(\"%s-%s.log\", strings.ToLower(e.Level.String()), e.Logger.Name())\n\t\tlogfile = path.Join(f.path, logfile)\n\t}\n\n\tf.m.Lock()\n\tdefer f.m.Unlock()\n\n\tfile, err := os.OpenFile(logfile, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644)\n\tif err != nil {\n\t\tfmt.Printf(\"Error opening log file: %v\\n\", err)\n\t}\n\tdefer file.Close()\n\n\t_, err = file.Write(f.formatter.FormatByte(e))\n\tif err != nil {\n\t\tfmt.Printf(\"Error writing to log file: %v\\n\", err)\n\t}\n\treturn\n}", "func (d *DestinyLogger) Log(mc <-chan *common.Message) {\n\tvar subTrigger bool\n\tfor {\n\t\tm := <-mc\n\n\t\tswitch m.Command {\n\t\tcase \"BAN\":\n\t\t\td.writeLine(m.Time, \"Ban\", m.Data+\" banned by \"+m.Nick)\n\t\tcase \"UNBAN\":\n\t\t\td.writeLine(m.Time, \"Ban\", m.Data+\" unbanned by \"+m.Nick)\n\t\tcase \"MUTE\":\n\t\t\td.writeLine(m.Time, \"Ban\", m.Data+\" muted by \"+m.Nick)\n\t\tcase \"UNMUTE\":\n\t\t\td.writeLine(m.Time, \"Ban\", m.Data+\" unmuted by \"+m.Nick)\n\t\tcase \"BROADCAST\":\n\t\t\tif strings.Contains(m.Data, \"subscriber!\") || strings.Contains(m.Data, \"subscribed on Twitch!\") || strings.Contains(m.Data, \"has resubscribed! Active for\") {\n\t\t\t\td.writeLine(m.Time, \"Subscriber\", m.Data)\n\t\t\t\tsubTrigger = true\n\t\t\t} else if subTrigger {\n\t\t\t\td.writeLine(m.Time, \"SubscriberMessage\", m.Data)\n\t\t\t} else {\n\t\t\t\td.writeLine(m.Time, \"Broadcast\", m.Data)\n\t\t\t}\n\t\tcase \"MSG\":\n\t\t\td.writeLine(m.Time, m.Nick, m.Data)\n\t\t\tsubTrigger = false\n\t\t}\n\t}\n}", "func SaveChatNotificationRecord(message *saver.ChatMessage, session *mgo.Session, appid uint16) error {\n\tmessage.Creation = time.Now()\n\tmessage.ExpireTime = message.Creation.Add(time.Duration(message.ExpireInterval) * 1000 * 1000 * 1000)\n\tcountTime := message.ExpireTime.Add(time.Duration(netConf().DefaultExpire*-1) * 1000 * 1000 * 1000)\n\n\tb := bson.D{bson.DocElem{FieldJid, message.To}, bson.DocElem{FieldMsgId, message.MsgId},\n\t\tbson.DocElem{FieldMsgType, message.Type}, bson.DocElem{FieldMsgFrom, message.From},\n\t\tbson.DocElem{FieldMsgCTime, message.Creation}, bson.DocElem{FieldExpireTime, message.ExpireTime},\n\t\tbson.DocElem{FieldExpireInterval, message.ExpireInterval}, bson.DocElem{FieldCountTime, countTime},\n\t\tbson.DocElem{FieldMsgSn, message.TraceSN}, bson.DocElem{FieldModified, message.Creation},\n\t\tbson.DocElem{FieldMsgData, []byte(message.Content)}}\n\n\tcollection := FormatCollection(NotificationMsgCol, appid)\n\tif err := session.DB(NotificationMsgDB).C(collection).Insert(&b); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (l *JSONFileLogger) Log(msg *logger.Message) error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\ttimestamp, err := timeutils.FastMarshalJSON(msg.Timestamp)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = (&jsonlog.JSONLogs{\n\t\tLog: append(msg.Line, '\\n'),\n\t\tStream: msg.Source,\n\t\tCreated: timestamp,\n\t\tRawAttrs: l.extra,\n\t}).MarshalJSONBuf(l.buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.buf.WriteByte('\\n')\n\t_, err = writeLog(l)\n\treturn err\n}", "func (l *JSONFileLogger) Log(msg *logger.Message) error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\ttimestamp, err := timeutils.FastMarshalJSON(msg.Timestamp)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = (&jsonlog.JSONLogs{\n\t\tLog: append(msg.Line, '\\n'),\n\t\tStream: msg.Source,\n\t\tCreated: timestamp,\n\t\tRawAttrs: l.extra,\n\t}).MarshalJSONBuf(l.buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.buf.WriteByte('\\n')\n\t_, err = writeLog(l)\n\treturn err\n}", "func ReadChatLogsArchive(fileName string) (*ChatLogsArchive, error) {\n\tr, err := zip.OpenReader(fileName)\n\tif err != nil && !errors.Is(err, os.ErrNotExist) {\n\t\treturn nil, err\n\t}\n\n\twf, err := os.Create(filepath.Join(os.TempDir(), fileName))\n\tif err != nil {\n\t\tif r != nil {\n\t\t\tr.Close()\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tfmt.Println(wf.Name())\n\n\treturn &ChatLogsArchive{\n\t\tfileName: fileName,\n\t\tr: r,\n\t\twf: wf,\n\t\tw: zip.NewWriter(wf),\n\t}, nil\n}", "func TestLogWriteFail(t *testing.T) {\n\tcm := NewChatManager(&FailWriter{}, historySize)\n\tdc := dummyconn.NewDummyConn()\n\terr := cm.Join(\"testuser\", dc)\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error: %s\", err)\n\t}\n\n\tbuf := make([]byte, bufSize)\n\tn, err := dc.Read(buf)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\trMsg := buf[:n]\n\texpected := []byte(testTime + \" * testuser has joined\\n\")\n\tif !bytes.Equal(rMsg, expected) {\n\t\tt.Fatalf(\"Unexpected read: %s, want %s.\", rMsg, expected)\n\t}\n}", "func (f *Filter) writeToChan(rec *LogRecord) {\n\tif f.closing {\n\t\tLogLogError(\"Channel closed. Can not write Message [%s]\", rec.Message)\n\t\treturn\n\t}\n\tf.rec <- rec\n}", "func WriteLog(class int, format string, args ...interface{}) {\n\tif class < 0 || class >= len(loggers) {\n\t\tWriteLog(InternalLogger, \"ERROR: Invalid Log() class %d\", class)\n\n\t\treturn\n\t}\n\n\ts := formatLogMessage(class, format, args...)\n\n\tif logFile != nil {\n\t\t_, err := logFile.Write([]byte(s + \"\\n\"))\n\t\tif err != nil {\n\t\t\tlogFile = nil\n\n\t\t\tWriteLog(InternalLogger, \"ERROR: Log() unable to write log entry; %v\", err)\n\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tfmt.Println(s)\n\t}\n}", "func (hc ApplicationsController) streamPodLogs(ctx context.Context, orgName, appName, stageID string, cluster *kubernetes.Cluster, follow bool) error {\n\tlogger := tracelog.NewLogger().WithName(\"streaming-logs-to-websockets\").V(1)\n\tlogChan := make(chan tailer.ContainerLogLine)\n\tlogCtx, logCancelFunc := context.WithCancel(ctx)\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\tgo func(outerWg *sync.WaitGroup) {\n\t\tvar tailWg sync.WaitGroup\n\t\terr := application.Logs(logCtx, logChan, &tailWg, cluster, follow, appName, stageID, orgName)\n\t\tif err != nil {\n\t\t\tlogger.Error(err, \"setting up log routines failed\")\n\t\t}\n\t\ttailWg.Wait() // Wait until all child routines are stopped\n\t\tclose(logChan) // Close the channel so the loop below can stop\n\t\touterWg.Done() // Let the outer method know we are done\n\t}(&wg)\n\n\tdefer func() {\n\t\tlogCancelFunc() // Just in case return some error, out of the normal flow.\n\t\twg.Wait()\n\t}()\n\n\t// Send logs received on logChan to the websockets connection until either\n\t// logChan is closed or websocket connection is closed.\n\tfor logLine := range logChan {\n\t\tmsg, err := json.Marshal(logLine)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = hc.conn.WriteMessage(websocket.TextMessage, msg)\n\t\tif err != nil {\n\t\t\tlogger.Error(err, \"failed to write to websockets\")\n\n\t\t\tif websocket.IsCloseError(err, websocket.CloseNormalClosure) {\n\t\t\t\thc.conn.Close()\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif websocket.IsUnexpectedCloseError(err) {\n\t\t\t\thc.conn.Close()\n\t\t\t\tlogger.Error(err, \"websockets connection unexpectedly closed\")\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tnormalCloseErr := hc.conn.WriteControl(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"), time.Time{})\n\t\t\tif normalCloseErr != nil {\n\t\t\t\terr = errors.Wrap(err, normalCloseErr.Error())\n\t\t\t}\n\n\t\t\tabnormalCloseErr := hc.conn.Close()\n\t\t\tif abnormalCloseErr != nil {\n\t\t\t\terr = errors.Wrap(err, abnormalCloseErr.Error())\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := hc.conn.WriteControl(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"), time.Time{}); err != nil {\n\t\treturn err\n\t}\n\n\treturn hc.conn.Close()\n}", "func (ml *MissingLog) SaveLog() error {\n\n\tjsonData, err := json.Marshal(ml.Entries)\n\tif nil != err {\n\t\tfmt.Printf(\"error marshalling log: %s\", err)\n\t\treturn err\n\t}\n\n\treturn ioutil.WriteFile(ml.LogFile, jsonData, os.ModeExclusive)\n\n}", "func EventChat(uuid, userID string, data map[string]string) (map[string]string, error) {\n\n\t// create a new session map to save users answers\n\tsession := sessions[uuid]\n\n\t// add user id to the session\n\tsession[\"userID\"] = userID\n\t// set processor to EventChatProcessor\n\tProcessFunc(eventChatProcessor)\n\n\t// Process the received message\n\tmessage, err := processor(session, data[\"message\"], userID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// check if message is done which means that the user done with entering all the needed information\n\t// so we will delete the map that holds the user data from the sessions global map\n\tif message == \"done\" {\n\t\t// Write a JSON containg the processed response\n\t\tdelete(sessions, uuid)\n\t\treturn map[string]string{\n\t\t\t\"message\": \"Your event has been created successfully \",\n\t\t}, nil\n\n\t}\n\n\t// Write a JSON containg the processed response\n\treturn map[string]string{\n\t\t\"message\": message,\n\t}, nil\n\n}", "func (db *MsgLogDB) WriteMessages() {\n\tif db.db == nil || db.err != nil {\n\t\tdb.tryOpenDatabase()\n\t}\n\tif db.Error() != nil {\n\t\tlog.Fatalf(\"database: %+v\", errors.Wrap(db.Error(), \"write messages\"))\n\t}\n\tif len(db.msgs) == 0 {\n\t\treturn\n\t}\n\tsqlStr := \"INSERT INTO dmon(stamp, level, system, component, message) VALUES \"\n\tvals := []interface{}{}\n\tfor _, m := range db.msgs {\n\t\tsqlStr += \"(?, ?, ?, ?, ?),\"\n\t\tvals = append(vals, m.Stamp, m.Level, m.System, m.Component, m.Message)\n\t}\n\tsqlStr = strings.TrimSuffix(sqlStr, \",\")\n\tstmt, _ := db.db.Prepare(sqlStr)\n\t_, db.err = stmt.Exec(vals...)\n\tif db.err != nil {\n\t\tdb.err = errors.Wrap(db.err, \"write to db\")\n\t\tlog.Printf(\"%v\", db.err)\n\t\tdb.db.Close()\n\t\tdb.db = nil\n\t\tdb.msgs = db.msgs[:0]\n\t\treturn\n\t}\n\tdb.msgs = db.msgs[:0]\n}", "func (gs *GeneralStore) CreateChat(ctx context.Context, chat *types.Chat, userIDs []string) error {\n\tif err := gs.createEntity(ctx, chat, createChatSQL); err != nil {\n\t\treturn fmt.Errorf(\"CreateChat error: %v\", err.Error())\n\t}\n\n\treturn nil\n}", "func StoreMongoChatMessages(req *saver.StoreMessagesRequest,\n\tresp *saver.StoreMessagesResponse) (ret error) {\n\t// count request response time if need\n\tif netConf().StatResponseTime {\n\t\tcountFunc := countP2pResponseTime(\"\", req.TraceSN, \"StoreMongoChatMessages\", req.Appid)\n\t\tdefer countFunc()\n\t}\n\n\tLogger.Trace(\"\", req.Appid, \"\", \"StoreMongoChatMessages\",\n\t\t\"Get store message request\", req)\n\n\tswitch req.ChatChannel {\n\tcase saver.ChatChannelNotify:\n\t\tret = SaveMongoNotifyChannel(req, resp)\n\t\t// count peer store operation\n\t\tif ret != nil {\n\t\t\trequestStat.AtomicAddStorePeerFails(1)\n\t\t} else {\n\t\t\trequestStat.AtomicAddStorePeers(1)\n\t\t}\n\tcase saver.ChatChannelPublic:\n\t\tret = SaveMongoPublicChannel(req, resp)\n\t\t// count public store operation, because public operation is very few,\n\t\t// so just treat it as peer for they are both send by our system\n\t\tif ret != nil {\n\t\t\trequestStat.AtomicAddStorePeerFails(1)\n\t\t} else {\n\t\t\trequestStat.AtomicAddStorePeers(1)\n\t\t}\n\tcase saver.ChatChannelIM:\n\t\tret = SaveMongoImChannel(req, resp)\n\t\t// count IM store operation\n\t\tif ret != nil {\n\t\t\trequestStat.AtomicAddStoreIMFails(1)\n\t\t} else {\n\t\t\trequestStat.AtomicAddStoreIMs(1)\n\t\t}\n\tdefault:\n\t\terr := fmt.Sprintf(\"%s channel is not supported now\", req.ChatChannel)\n\t\tLogger.Error(\"\", req.Appid, \"\", \"StoreMongoChatMessages\",\n\t\t\t\"Saved message to storage failed\", err)\n\t\tret = errors.New(err)\n\t}\n\treturn\n}", "func (l *Logstash) Writeln(message string) error {\n\tvar err = errors.New(\"tcp connection is nil\")\n\tmessage = fmt.Sprintf(\"%s\\n\", message)\n\tif l.Connection != nil {\n\t\t_, err = l.Connection.Write([]byte(message))\n\t\tif err != nil {\n\t\t\tif neterr, ok := err.(net.Error); ok && neterr.Timeout() {\n\t\t\t\tl.Connection.Close()\n\t\t\t\tl.Connection = nil\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tl.Connection.Close()\n\t\t\t\tl.Connection = nil\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\t// Successful write! Let's extend the timeoul.\n\t\t\tl.SetTimeouts()\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn err\n}", "func (rw *RemoteTimeWriter) Write(b []byte) {\n\ts := string(b[:])\n\tselect {\n\tcase rw.logs <- s:\n\tdefault:\n\t\tTLOG.Error(\"remote log chan is full\")\n\t}\n}", "func (t *MessageType) sendLobbyChatToAll(reply string, start *time.Time, counter *int,\n\tip string, log *log.Logger) bool {\n\tif len(reply) > 225 {\n\t\tlog.Printf(\"User: %s IP %s has exeeded the 225 character limit by %d byte units.\\n\",\n\t\t\tt.Name, ip, len(reply))\n\t\treturn false\n\t}\n\t//keeps track of messages are sent in a given interval\n\t*counter++\n\n\tif *counter > 4 {\n\t\telapsed := time.Since(*start)\n\t\tif elapsed < time.Second*10 {\n\t\t\tlog.Printf(\"User: %s IP: %s was spamming chat.\\n\", t.Name, ip)\n\t\t\treturn false\n\t\t}\n\t\t*start = time.Now()\n\t\t*counter = 0\n\t}\n\tgo func() {\n\t\tfor name, cs := range Chat.Lobby {\n\t\t\tif err := websocket.Message.Send(cs, reply); err != nil {\n\t\t\t\t// we could not send the message to a peer\n\t\t\t\tlog.Println(\"Could not send message to \", name, err)\n\t\t\t}\n\t\t}\n\t}()\n\treturn true\n}", "func (r *Raft) AppendToLog_Follower(request AppendEntriesReq) {\n\tTerm := request.LeaderLastLogTerm\n\tcmd := request.Entries\n\tindex := request.PrevLogIndex + 1\n\tlogVal := LogVal{Term, cmd, 0} //make object for log's value field\n\n\tif len(r.MyLog) == index {\n\t\tr.MyLog = append(r.MyLog, logVal) //when trying to add a new entry\n\t} else {\n\t\tr.MyLog[index] = logVal //overwriting in case of log repair\n\t}\n\n\tr.MyMetaData.LastLogIndex = index\n\tr.MyMetaData.PrevLogIndex = index - 1\n\tif index == 0 {\n\t\tr.MyMetaData.PrevLogTerm = r.MyMetaData.PrevLogTerm + 1 //or simple -1\n\t} else if index >= 1 {\n\t\tr.MyMetaData.PrevLogTerm = r.MyLog[index-1].Term\n\t}\n\tleaderCI := float64(request.LeaderCommitIndex) //Update commit index\n\tmyLI := float64(r.MyMetaData.LastLogIndex)\n\tif request.LeaderCommitIndex > r.MyMetaData.CommitIndex {\n\t\tr.MyMetaData.CommitIndex = int(math.Min(leaderCI, myLI))\n\t}\n\tr.WriteLogToDisk()\n}", "func (st *LogInfo) WriteTo(buf *codec.Buffer) (err error) {\n\terr = buf.WriteString(st.Appname, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = buf.WriteString(st.Servername, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = buf.WriteString(st.SFilename, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = buf.WriteString(st.SFormat, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif st.Setdivision != \"\" {\n\t\terr = buf.WriteString(st.Setdivision, 4)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif st.BHasSufix != true {\n\t\terr = buf.WriteBool(st.BHasSufix, 5)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif st.BHasAppNamePrefix != true {\n\t\terr = buf.WriteBool(st.BHasAppNamePrefix, 6)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif st.BHasSquareBracket != false {\n\t\terr = buf.WriteBool(st.BHasSquareBracket, 7)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif st.SConcatStr != \"_\" {\n\t\terr = buf.WriteString(st.SConcatStr, 8)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif st.SSepar != \"|\" {\n\t\terr = buf.WriteString(st.SSepar, 9)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif st.SLogType != \"\" {\n\t\terr = buf.WriteString(st.SLogType, 10)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn err\n}", "func (l *Logger) logMessage(msg []byte) (err error) {\n\t// Write timestamp\n\tif _, err = l.w.Write(getTimestampBytes()); err != nil {\n\t\treturn\n\t}\n\n\t// Write '@', which separates timestamp and the message\n\tif err = l.w.WriteByte('@'); err != nil {\n\t\treturn\n\t}\n\n\t// Write message\n\tif _, err = l.w.Write(msg); err != nil {\n\t\treturn\n\t}\n\n\t// Write newline to follow message\n\treturn l.w.WriteByte('\\n')\n}", "func writeLogs() (err error) {\n\t// Logging to a file.\n\thome, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn err\n\t}\n\tf, err := os.Create(home + \"/Desktop/\" + \"gin.log\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tgin.DefaultWriter = io.MultiWriter(f)\n\treturn nil\n}", "func (zw ZerologWriter) Write(p []byte) (n int, err error) {\n\tdata := parseJSONLogData(p)\n\tenrichedLog := zw.w.EnrichLog(data, p)\n\treturn zw.w.Write(enrichedLog)\n}", "func (zw ZerologWriter) Write(p []byte) (n int, err error) {\n\tdata := parseJSONLogData(p)\n\tenrichedLog := zw.w.EnrichLog(data, p)\n\treturn zw.w.Write(enrichedLog)\n}", "func WriteLog(ctx context.Context, log *Log, db *sql.DB) error {\n\tdefer metrics.InsertLogDbTime.Time(time.Now())\n\tdlock.Lock().Lock()\n\tdefer dlock.Lock().Unlock()\n\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = tx.Exec(`\n INSERT INTO\n\t\t\tintegration_log (integration_parent, run_id, kind, level, datatype, value)\n\t\t\tVALUES (\n\t\t\t\t?, ?, ?, ?, ?, ?\n\t\t\t);\n\t`, log.ParentUID, log.RunID, log.Kind, log.Level, log.Datatype, log.Value)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\treturn tx.Commit()\n}", "func (core *SysLogCore) Write(entry zapcore.Entry, fields []zapcore.Field) error {\n\t// Generate the message.\n\tbuffer, err := core.encoder.EncodeEntry(entry, fields)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to encode log entry\")\n\t}\n\n\t//message := fmt.Sprintf(\"[metadata={process='microgateway',function='microgateway',TMG_CLUSTER_NAME='%s',TMG_ZONE_NAME='%s',POD_IP='%s'}] \", os.Getenv(\"TMG_CLUSTER_NAME\"), os.Getenv(\"TMG_ZONE_NAME\"), os.Getenv(\"POD_IP\")) + buffer.String()\n\tmessage := buffer.String()\n\n\t// Write the message.\n\tswitch entry.Level {\n\tcase zapcore.DebugLevel:\n\t\treturn core.writer.Debug(message)\n\n\tcase zapcore.InfoLevel:\n\t\treturn core.writer.Info(message)\n\n\tcase zapcore.WarnLevel:\n\t\treturn core.writer.Warning(message)\n\n\tcase zapcore.ErrorLevel:\n\t\treturn core.writer.Err(message)\n\n\tcase zapcore.DPanicLevel:\n\t\treturn core.writer.Crit(message)\n\n\tcase zapcore.PanicLevel:\n\t\treturn core.writer.Crit(message)\n\n\tcase zapcore.FatalLevel:\n\t\treturn core.writer.Crit(message)\n\n\tdefault:\n\t\treturn errors.Errorf(\"unknown log level: %v\", entry.Level)\n\t}\n}", "func (u *UnityServer) writeToSocket(msg string) {\n\t// Write tries to write the message to the file\n\t// if an EOF error is found the connection has been closed\n\t_, err := u.conn.Write([]byte(msg))\n\tif err != nil {\n\t\tu.Logger.Error(\"Error: sending message\")\n\t\treturn\n\t}\n\tu.Logger.Debugf(\"Messsage sent: %v\", msg)\n}", "func (c *Chat) Log(lvl LogCat, s string) {\n\ts = strings.Replace(strings.Replace(s, \"\\\\\", \"\\\\\\\\\", -1), \"\\n\", \"\\\\n\", -1)\n\n\tc.logger.LogLine(MakeLogLine(lvl, s))\n}", "func writeToDataStoreOverChannel(logChannel chan string) {\n\t// fmt.Println(\"Logchannel starting, waiting for channel data\")\n\tlogger.Debug().Msg(\"Loggingchannel starting, waiting for channel data\")\n\tfor {\n\t\tlogData := <-logChannel\n\t\t// fmt.Println(\"Preparing channeldata for store: \",logData)\n\t\tlogger.Debug().Msg(\"Preparing channeldata for store: \" + logData)\n\t\tlog.Println(logData)\n\t\t// log.Output(8, logData)\n\t}\n}", "func TestWrite(t *testing.T) {\n\t// create test messages\n\tmessages := []logvac.Message{\n\t\tlogvac.Message{\n\t\t\tTime: time.Now(),\n\t\t\tUTime: time.Now().UnixNano(),\n\t\t\tId: \"myhost\",\n\t\t\tTag: []string{\"test[bolt]\"},\n\t\t\tType: \"app\",\n\t\t\tPriority: 4,\n\t\t\tContent: \"This is a test message\",\n\t\t},\n\t\tlogvac.Message{\n\t\t\tTime: time.Now(),\n\t\t\tUTime: time.Now().UnixNano(),\n\t\t\tId: \"myhost\",\n\t\t\tTag: []string{\"test[expire]\"},\n\t\t\tType: \"deploy\",\n\t\t\tPriority: 4,\n\t\t\tContent: \"This is another test message\",\n\t\t},\n\t}\n\t// write test messages\n\tdrain.Archiver.Write(messages[0])\n\tdrain.Archiver.Write(messages[1])\n\n\t// test successful write\n\tappMsgs, err := drain.Archiver.Slice(\"app\", \"\", []string{\"\"}, 0, 0, 100, 0)\n\tif err != nil {\n\t\tt.Error(err)\n\t\tt.FailNow()\n\t}\n\t// compare written message to original\n\tif len(appMsgs) != 1 || appMsgs[0].Content != messages[0].Content {\n\t\tt.Errorf(\"%q doesn't match expected out\", appMsgs)\n\t\tt.FailNow()\n\t}\n}", "func (h *Handler) WriteToClient(user uuid.UUID, msg *Message) error {\n\tif msg.command == nil {\n\t\treturn errors.New(\"command may not be empty\")\n\t}\n\tif len(msg.command) > 255 {\n\t\treturn errors.New(\"command may not be longer than 255 characters\")\n\t}\n\treturn h.writeToClient(user, msg.command, msg.content)\n}", "func createChat(w http.ResponseWriter, r *http.Request, db *bolt.DB) {\n\t// Validate initial request headers, and body existence\n\tif r.Header.Get(\"Content-Type\") != \"application/json\" {\n\t\tresponses.Error(w, http.StatusBadRequest, \"header 'Content-Type' must be 'application/json'\")\n\t\treturn\n\t} else if r.Body == nil {\n\t\tresponses.Error(w, http.StatusBadRequest, \"request body must be present\")\n\t\treturn\n\t}\n\n\t// Parse and validate body fields\n\tvar body struct {\n\t\tTo string `json:\"to\"`\n\t\tMessage string `json:\"message\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&body); err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, \"invalid json format for request body\")\n\t\treturn\n\t} else if body.To == \"\" || body.Message == \"\" {\n\t\tresponses.Error(w, http.StatusBadRequest, \"fields 'name' and 'message' are required\")\n\t\treturn\n\t}\n\n\t// Get self\n\tself, err := models.FindUser(r.Header.Get(\"X-BPI-Username\"), db)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: failed to query database for self: %v\\n\", err)\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\treturn\n\t}\n\n\t// Check if specified user exists\n\trecipient, err := models.FindUser(body.To, db)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: failed to query database for recipient user existence: %v\\n\", err)\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\treturn\n\t} else if recipient == nil {\n\t\tresponses.Error(w, http.StatusBadRequest, \"specified recipient does not exist\")\n\t\treturn\n\t}\n\n\t// Create the chat\n\tchat := models.NewChat(self.Username, recipient.Username, body.Message)\n\tif err := chat.Save(db); err != nil {\n\t\tlog.Printf(\"ERROR: failed to write chat to database: %v\\n\", err)\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to write to database\")\n\t\treturn\n\t}\n\n\t// Add chat id to each user\n\tself.AddChat(chat.Id.String())\n\trecipient.AddChat(chat.Id.String())\n\n\t// Save users\n\tif err := self.Save(db); err != nil {\n\t\tlog.Printf(\"ERROR: failed to write chat id to requesting user: %v\\n\", err)\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to write to database\")\n\t\treturn\n\t}\n\tif err := recipient.Save(db); err != nil {\n\t\tlog.Printf(\"ERROR: failed to write chat id to recipient user: %v\\n\", err)\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to write to database\")\n\t\treturn\n\t}\n\n\tresponses.Success(w)\n}", "func saveChatImOutboxRecord(message *saver.ChatMessage, inboxId uint64, session *mgo.Session, appid uint16) error {\n\tmessage.Creation = time.Now()\n\tmessage.ExpireTime = message.Creation.Add(time.Duration(message.ExpireInterval) * 1000 * 1000 * 1000)\n\tcountTime := message.ExpireTime.Add(time.Duration(netConf().DefaultExpire*-1) * 1000 * 1000 * 1000)\n\tvar buf bytes.Buffer\n\tbuf.WriteString(message.Content)\n\tb := bson.D{bson.DocElem{FieldOwner, message.From}, bson.DocElem{FieldMsgId, message.MsgId},\n\t\tbson.DocElem{FieldMsgType, message.Type}, bson.DocElem{FieldMsgTo, message.To},\n\t\tbson.DocElem{FieldMsgCTime, message.Creation}, bson.DocElem{FieldExpireTime, message.ExpireTime},\n\t\tbson.DocElem{FieldExpireInterval, message.ExpireInterval}, bson.DocElem{FieldCountTime, countTime},\n\t\tbson.DocElem{FieldMsgSn, message.TraceSN}, bson.DocElem{FieldModified, message.Creation},\n\t\tbson.DocElem{FieldInboxMsgId, inboxId}, bson.DocElem{FieldMsgData, buf.Bytes()}}\n\n\tcollection := FormatCollection(ImOutBoxCol, appid)\n\tif err := session.DB(ImOutboxDB).C(collection).Insert(&b); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func writeLog(line string, file string) {\r\n\tlogLine := line\r\n\tf, err := os.OpenFile(file, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)\r\n\tcheck(err)\r\n\tdefer f.Close()\r\n\t_, err = f.WriteString(logLine + \"\\n\")\r\n\tcheck(err)\r\n}", "func (l *Logger) Write(s []byte) error {\n\tif _, err := l.Logfile.Write(s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (lp *LogFile) writeLog(p []byte) {\n\tfileOnly := lp.Flags&FileOnly == FileOnly\n\n\tif !fileOnly {\n\t\t_, err := os.Stderr.Write(p)\n\t\tif err != nil {\n\t\t\t// Well I can't write to stderr to report it... so just return\n\t\t\treturn\n\t\t}\n\t}\n\n\tif lp.file == nil {\n\t\treturn\n\t}\n\n\t// Am I about to go over my file size limit?\n\tif lp.MaxSize > 0 && (lp.size+int64(len(p))) >= lp.MaxSize {\n\t\tlp.closeLog()\n\n\t\tif lp.RotateFileFunc != nil {\n\t\t\tlp.RotateFileFunc()\n\t\t}\n\n\t\t// Recreate the logfile truncating it (in case it wasn't rotated)\n\t\tif !lp.openLogFile(truncateLog) {\n\t\t\treturn\n\t\t}\n\t}\n\n\tn, err := lp.buf.Write(p)\n\tif err != nil {\n\t\tlp.PrintError(\"Logfile error writing to %s: %s\\n\", lp.FileName, err)\n\t}\n\tif lp.FlushSeconds <= 0 {\n\t\tlp.flushLog()\n\t}\n\n\tlp.size += int64(n)\n\n\treturn\n}", "func logConsumer(executor *executor.BashExecutor, logDir string) {\n\tconfig := config.GetInstance()\n\tlogChannel := executor.LogChannel()\n\n\t// init path for shell, log and raw log\n\tlogPath := filepath.Join(logDir, executor.CmdID()+\".log\")\n\tf, _ := os.Create(logPath)\n\twriter := bufio.NewWriter(f)\n\n\t// upload log after flush!!\n\tdefer func() {\n\t\t_ = writer.Flush()\n\t\t_ = f.Close()\n\n\t\terr := uploadLog(logPath)\n\t\tutil.LogIfError(err)\n\n\t\tutil.LogDebug(\"[Exit]: logConsumer\")\n\t}()\n\n\tfor {\n\t\titem, ok := <-logChannel\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\n\t\tutil.LogDebug(\"[LOG]: %s\", item)\n\n\t\t// write to file\n\t\twriteLogToFile(writer, item)\n\n\t\t// send to queue\n\t\tif config.HasQueue() {\n\t\t\texchangeName := config.Settings.Queue.LogsExchange\n\t\t\tchannel := config.Queue.LogChannel\n\n\t\t\twriteLogToQueue(exchangeName, channel, item)\n\t\t}\n\t}\n}", "func (config *Config) WriteLog(LogLevel int, format string, a ...interface{}) {\n\tif config.LogLevel < LogLevel || config.Logger == nil {\n\t\treturn\n\t}\n\n\tvar logBuffer bytes.Buffer\n\tlogBuffer.WriteString(LogTag[LogLevel-1])\n\tlogBuffer.WriteString(fmt.Sprintf(format, a...))\n\tconfig.Logger.Printf(\"%s\", logBuffer.String())\n}", "func (r *UserRepository) CreateChat(idChat string, idUser string, typeChat string) (*model.Chat, error) {\n\tvar c model.Chat\n\tif err := r.store.db.QueryRow(\n\t\t\"INSERT INTO chats (id_chat, id_user, type_chat) VALUES ($1, $2, $3) RETURNING id_chat, id_user, type_chat\",\n\t\tidChat,\n\t\tidUser,\n\t\ttypeChat,\n\t).Scan(\n\t\t&c.IdChat,\n\t\t&c.IdUser,\n\t\t&c.TypeChat,\n\t\t); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &c, nil\n}", "func chatroom() {\n\tarchive := list.New()\n\tsubscribers := list.New()\n\n\tfor {\n\t\tselect {\n\t\tcase ch := <-subscribe:\n\t\t\tvar events []Event\n\t\t\tfor e := archive.Front(); e != nil; e = e.Next() {\n\t\t\t\tevents = append(events, e.Value.(Event))\n\t\t\t}\n\t\t\tsubscriber := make(chan Event, 10)\n\t\t\tsubscribers.PushBack(subscriber)\n\t\t\tch <- Subscription{events, subscriber}\n\n\t\tcase event := <-publish:\n\t\t\t// {{{ クソ\n\t\t\tevent.RoomInfo.Updated = false\n\t\t\tif event.Type == \"join\" {\n\t\t\t\tif _, already := info.Users[event.User.ScreenName]; !already {\n\t\t\t\t\tinfo.Users[event.User.ScreenName] = event.User\n\t\t\t\t}\n\t\t\t\tevent.RoomInfo = info\n\t\t\t\tevent.RoomInfo.Updated = true\n\t\t\t}\n\t\t\tif event.Type == \"leave\" {\n\t\t\t\tdelete(info.Users, event.User.ScreenName)\n\t\t\t\tevent.RoomInfo = info\n\t\t\t\tevent.RoomInfo.Updated = true\n\t\t\t}\n\t\t\t// }}}\n\t\t\tfor ch := subscribers.Front(); ch != nil; ch = ch.Next() {\n\t\t\t\tch.Value.(chan Event) <- event\n\t\t\t}\n\t\t\tif event.Type == \"message\" {\n\t\t\t\tsound, soundError := factory.SoundFromText(event.Text, event.User)\n\t\t\t\tif soundError == nil {\n\t\t\t\t\t//fmt.Printf(\"このサウンドをアーカイブ:\\t%+v\\n\", sound)\n\t\t\t\t\tif SoundTrack.Len() >= soundArchiveSize {\n\t\t\t\t\t\tSoundTrack.Remove(SoundTrack.Front())\n\t\t\t\t\t}\n\t\t\t\t\tSoundTrack.PushBack(sound)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif archive.Len() >= archiveSize {\n\t\t\t\tarchive.Remove(archive.Front())\n\t\t\t}\n\t\t\tarchive.PushBack(event)\n\n\t\tcase unsub := <-unsubscribe:\n\t\t\tfor ch := subscribers.Front(); ch != nil; ch = ch.Next() {\n\t\t\t\tif ch.Value.(chan Event) == unsub {\n\t\t\t\t\tsubscribers.Remove(ch)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (r *Raft) AppendToLog_Follower(request AppendEntriesReq) {\n\tterm := request.term\n\tcmd := request.entries\n\tindex := request.prevLogIndex + 1\n\tlogVal := LogVal{term, cmd, 0} //make object for log's value field\n\n\tif len(r.myLog) == index {\n\t\tr.myLog = append(r.myLog, logVal) //when trying to add a new entry\n\t} else {\n\t\tr.myLog[index] = logVal //overwriting in case of log repair\n\t\t//fmt.Println(\"Overwiriting!!\")\n\t}\n\t//fmt.Println(r.myId(), \"Append to log\", string(cmd))\n\t//modify metadata after appending\n\t//r.myMetaData.lastLogIndex = r.myMetaData.lastLogIndex + 1\n\t//r.myMetaData.prevLogIndex = r.myMetaData.lastLogIndex\n\t//\tif len(r.myLog) == 1 {\n\t//\t\tr.myMetaData.prevLogTerm = r.myMetaData.prevLogTerm + 1\n\t//\t} else if len(r.myLog) > 1 {\n\t//\t\tr.myMetaData.prevLogTerm = r.myLog[r.myMetaData.prevLogIndex].Term\n\t//\t}\n\n\t//Changed on 4th april, above is wrong in case of overwriting of log\n\tr.myMetaData.lastLogIndex = index\n\tr.myMetaData.prevLogIndex = index - 1\n\tif index == 0 {\n\t\tr.myMetaData.prevLogTerm = r.myMetaData.prevLogTerm + 1 //or simple -1\n\t} else if index >= 1 {\n\t\tr.myMetaData.prevLogTerm = r.myLog[index-1].Term\n\t}\n\n\t//Update commit index\n\tleaderCI := float64(request.leaderCommitIndex)\n\tmyLI := float64(r.myMetaData.lastLogIndex)\n\tif request.leaderCommitIndex > r.myMetaData.commitIndex {\n\t\tif myLI == -1 { //REDUNDANT since Append to log will make sure it is never -1,also must not copy higher CI if self LI is -1\n\t\t\tr.myMetaData.commitIndex = int(leaderCI)\n\t\t} else {\n\t\t\tr.myMetaData.commitIndex = int(math.Min(leaderCI, myLI))\n\t\t}\n\t}\n\t//fmt.Println(r.myId(), \"My CI is:\", r.myMetaData.commitIndex)\n\tr.WriteLogToDisk()\n}", "func initialiseLogger() {\n // make and set location of log file\n date := time.Now().Format(\"2006-01-02\")\n var logpath = getCurrentExecDir() + \"/log/\" + date + \"_server.log\"\n os.MkdirAll(getCurrentExecDir()+\"/log/\", os.ModePerm)\n // open file for create and append\n var file, err = os.OpenFile(logpath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)\n if err != nil { panic(fmt.Sprintf(\"Could not open logfile `%s`: %s\", logpath, err)) }\n // make new Logger io\n log_writer := io.MultiWriter(os.Stdout, file)\n Logger = log.New(log_writer, \" \", log.LstdFlags)\n Logger.Println(\"LogFile : \" + logpath)\n}", "func (dblog *DataBaseLogger) WriteToDB(str string) {\n\tstmt, err := dblog.database.Prepare(\"INSERT INTO Log(PREFIX, DATE, TIME, MESSAGE) VALUES(?, ?, ?, ?)\")\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\tdate, time := getDateTime()\n\t_, err = stmt.Exec(dblog.prefix, date, time, str)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n}", "func chatroom() {\n\tarchive := list.New()\n\tsubscribers := list.New()\n\n\tfor {\n\t\tselect {\n\t\tcase ch := <-subscribe:\n\t\t\tvar events []Event\n\t\t\tfor e := archive.Front(); e != nil; e = e.Next() {\n\t\t\t\tevents = append(events, e.Value.(Event))\n\t\t\t}\n\t\t\tsubscriber := make(chan Event, 10)\n\t\t\tsubscribers.PushBack(subscriber)\n\t\t\tch <- Subscription{events, subscriber}\n\n\t\tcase event := <-publish:\n\t\t\tfor ch := subscribers.Front(); ch != nil; ch = ch.Next() {\n\t\t\t\tch.Value.(chan Event) <- event\n\t\t\t}\n\t\t\tif archive.Len() >= archiveSize {\n\t\t\t\tarchive.Remove(archive.Front())\n\t\t\t}\n\t\t\tarchive.PushBack(event)\n\n\t\tcase unsub := <-unsubscribe:\n\t\t\tfor ch := subscribers.Front(); ch != nil; ch = ch.Next() {\n\t\t\t\tif ch.Value.(chan Event) == unsub {\n\t\t\t\t\tsubscribers.Remove(ch)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func WriteLogs(t *testing.T, filePath string, logs plog.Logs) error {\n\tif err := writeLogs(filePath, logs); err != nil {\n\t\treturn err\n\t}\n\tt.Logf(\"Golden file successfully written to %s.\", filePath)\n\tt.Log(\"NOTE: The WriteLogs call must be removed in order to pass the test.\")\n\tt.Fail()\n\treturn nil\n}", "func (c *Client) RouteChat(ctx context.Context) error {\n\tstream, err := c.GRPC.RouteChat(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i := 0; i < 20; i++ {\n\t\tvar (\n\t\t\tpoint = randPoint()\n\t\t\tmsg = fmt.Sprintf(\"[%s] ack=0 msg='message #%d'\", time.Now(), i)\n\t\t\tnote = &pb.RouteNote{\n\t\t\t\tLocation: point,\n\t\t\t\tMessage: msg,\n\t\t\t}\n\t\t)\n\t\tlog.Printf(\"[RouteChat] (req) %+v\\n\", note)\n\n\t\tif err := stream.Send(note); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresp, err := stream.Recv()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\theader, err := stream.Header()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\toutput(APIRouteChat, header, resp)\n\t}\n\n\treturn nil\n}", "func (logger *DefaultLogger) WriteLog(log Log) {\n\t// Tiny format: \"Method Url Status Content-Length - Response-time ms\"\n\tstr := fmt.Sprintf(\"%s %s %s %d - %.3f ms\",\n\t\tColorMethod(log[\"Method\"].(string)),\n\t\tlog[\"URL\"],\n\t\tColorStatus(log[\"Status\"].(int)),\n\t\tlog[\"Length\"],\n\t\tfloat64(time.Now().Sub(log[\"Start\"].(time.Time)))/1e6,\n\t)\n\t// Don't block current process.\n\tgo func() {\n\t\tif _, err := fmt.Fprintln(logger.W, str); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n}", "func (l *Log) Append(ctx context.Context, msg Message) error {\n\tdata, err := json.Marshal(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar b pgx.Batch\n\tb.Queue(\"begin\")\n\tb.Queue(\"lock table switchover_log in exclusive mode\")\n\tb.Queue(\"insert into switchover_log (id, timestamp, data) values (coalesce((select max(id)+1 from switchover_log), 1), now(), $1)\", data)\n\tb.Queue(\"commit\")\n\tb.Queue(\"rollback\")\n\n\tconn, err := stdlib.AcquireConn(l.db)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer releaseConn(l.db, conn)\n\n\terr = conn.SendBatch(ctx, &b).Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (l *Log) SendLogs(log *[]Log, success *bool) error {\n\t// TODO: Enregistrement des logs et envoi par mail\n\n\t*success = true\n\n\treturn nil\n}", "func (wac *Conn) writeJson(data []interface{}) (<-chan string, error) {\n\n\tch := make(chan string, 1)\n\n\twac.writerLock.Lock()\n\tdefer wac.writerLock.Unlock()\n\n\td, err := json.Marshal(data)\n\tif err != nil {\n\t\tclose(ch)\n\t\treturn ch, err\n\t}\n\n\tts := time.Now().Unix()\n\tmessageTag := fmt.Sprintf(\"%d.--%d\", ts, wac.msgCount)\n\tbytes := []byte(fmt.Sprintf(\"%s,%s\", messageTag, d))\n\n\tif wac.timeTag == \"\" {\n\t\ttss := fmt.Sprintf(\"%d\", ts)\n\t\twac.timeTag = tss[len(tss)-3:]\n\t}\n\n\twac.addListener(ch, messageTag)\n\n\terr = wac.write(websocket.TextMessage, bytes)\n\tif err != nil {\n\t\tclose(ch)\n\t\twac.removeListener(messageTag)\n\t\treturn ch, err\n\t}\n\n\twac.msgCount++\n\treturn ch, nil\n}", "func chat(w http.ResponseWriter, r *http.Request, store *sessions.CookieStore, room *ChatRoom) {\n\n //check for session to see if client is authenticated\n session, err := store.Get(r, \"flash-session\")\n if err != nil {\n http.Error(w, err.Error(), http.StatusInternalServerError)\n }\n fm := session.Flashes(\"message\")\n if fm == nil {\n fmt.Println(\"Trying to log in as invalid user\")\n fmt.Fprint(w, \"No flash messages\")\n return\n }\n //session.Save(r, w)\n\n fmt.Println(\"New user connected to chat\")\n\n //use the id and username attached to the session to create the player\n chatterHandler := ChatterHandler{Id: session.Values[\"userid\"].(int), Username: session.Values[\"username\"].(string), Room: room}\n\n chatterHandler.createChatter(w, r)\n}", "func (lp *LogFile) Write(p []byte) (n int, err error) {\n\t// LogFile cannot guarantee that it will have finished with p before this\n\t// function returns. To prevent corruption use a copy of p.\n\tpLen := len(p)\n\tbuf := make([]byte, pLen)\n\tcopy(buf, p)\n\n\tlp.messages <- logMessage{action: writeLog, data: buf}\n\tif lp.FlushSeconds <= 0 {\n\t\tlp.Flush()\n\t}\n\treturn pLen, nil\n}", "func (rf *Raft) writeApplyCh() {// {{{\n for {\n <-rf.cmtChan \n rf.mu.Lock()\n for i := rf.applyIdx + 1; i <= rf.cmtIdx; i++ {\n var newApplyMsg ApplyMsg\n newApplyMsg.Index = i \n newApplyMsg.Command = rf.log[i].Cmd\n rf.applyChan<- newApplyMsg \n rf.applyIdx = i \n rf.debug(\"Applied committed msg: cmtIdx=%v, applyIdx=%v\\n\", rf.cmtIdx, rf.applyIdx)\n }\n rf.mu.Unlock()\n }\n}", "func (r *ProjectsLogsEntriesService) Write(projectsId string, logsId string, writelogentriesrequest *WriteLogEntriesRequest) *ProjectsLogsEntriesWriteCall {\n\treturn &ProjectsLogsEntriesWriteCall{\n\t\ts: r.s,\n\t\tprojectsId: projectsId,\n\t\tlogsId: logsId,\n\t\twritelogentriesrequest: writelogentriesrequest,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"v1beta3/projects/{projectsId}/logs/{logsId}/entries:write\",\n\t}\n}", "func SaveChatPublicRecord(message *saver.ChatMessage, session *mgo.Session, appid uint16) error {\n\tmessage.Creation = time.Now()\n\tmessage.ExpireTime = message.Creation.Add(time.Duration(message.ExpireInterval) * 1000 * 1000 * 1000)\n\tcountTime := message.ExpireTime.Add(time.Duration(netConf().DefaultExpire*-1) * 1000 * 1000 * 1000)\n\n\tb := bson.D{bson.DocElem{FieldMsgId, message.MsgId}, bson.DocElem{FieldMsgType, message.Type},\n\t\tbson.DocElem{FieldMsgCTime, message.Creation}, bson.DocElem{FieldExpireTime, message.ExpireTime},\n\t\tbson.DocElem{FieldExpireInterval, message.ExpireInterval}, bson.DocElem{FieldCountTime, countTime},\n\t\tbson.DocElem{FieldMsgSn, message.TraceSN}, bson.DocElem{FieldModified, message.Creation},\n\t\tbson.DocElem{FieldMsgData, []byte(message.Content)}}\n\n\tcollection := FormatCollection(PublicMsgCol, appid)\n\tif err := session.DB(PubligMsgDB).C(collection).Insert(&b); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (l *Logs) Log(uuid string, out io.Writer) error {\n\ts, e, err := l.Subscribe(uuid)\n\tif err != nil {\n\t\treturn err\n\t}\nstop:\n\tfor {\n\t\tselect {\n\t\tcase rcv := <-s:\n\t\t\tnerr := l.write(out, rcv)\n\t\t\tif nerr != nil {\n\t\t\t\tfmt.Println(nerr)\n\t\t\t}\n\t\tcase errrcv := <-e:\n\t\t\terr = errors.New(string(errrcv))\n\t\t\tbreak stop\n\t\tcase <-l.stop:\n\t\t\tfmt.Println(\"resingo: stopping streaming logs\")\n\t\t\tbreak stop\n\t\t}\n\t}\n\tl.nub.Abort()\n\treturn err\n}", "func (r *raftLog) StoreLogs(logs []*raft.Log) error {\n\ttx, err := r.conn.Begin(true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbucket := tx.Bucket(logsBucket)\n\tfor _, log := range logs {\n\t\tvar (\n\t\t\tkey [8]byte\n\t\t\tval []byte\n\t\t)\n\t\tbinary.BigEndian.PutUint64(key[:], log.Index)\n\t\tval, err = r.encodeRaftLog(log)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\terr = bucket.Put(key[:], val)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tif err != nil {\n\t\ttx.Rollback()\n\t} else {\n\t\terr = tx.Commit()\n\t\tif err == nil && r.hasCache {\n\t\t\tr.Lock()\n\t\t\t// Cache only on success\n\t\t\tfor _, l := range logs {\n\t\t\t\tr.cache[l.Index%r.cacheSize] = l\n\t\t\t}\n\t\t\tr.Unlock()\n\t\t}\n\t}\n\treturn err\n}", "func write2File(buf []byte, logname string) error {\n\tpath, _ := filepath.Abs(filepath.Dir(os.Args[0]))\n\tos.Chdir(path)\n\tlogpath := fmt.Sprintf(\"%s.%s\", logname, time.Now().Format(\"20060102-150405\"))\n\n\tvar err error\n\tvar file *os.File\n\tif file, err = os.OpenFile(logpath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644); err == nil {\n\t\tdefer file.Close()\n\t\troutinenum := fmt.Sprintf(\"current running goroutine num %d!\\n\\n\", runtime.NumGoroutine())\n\t\tif _, err := file.WriteString(routinenum); err == nil {\n\t\t\twriteObj := bufio.NewWriterSize(file, 4096)\n\t\t\tif _, err := writeObj.Write(buf); err == nil {\n\t\t\t\tif err := writeObj.Flush(); err == nil {\n\t\t\t\t\tfmt.Println(\"successfully flush write into file\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "func send_log(fd net.Conn, lreader *logreader) {\n\tdefer fd.Close()\n\tvar err error\n\tfor {\n\t\tmsg := <-lreader.logchan\n\t\tif msg != nil {\n\t\t\t_, err = fd.Write(msg.Body)\n\t\t}\n\t\t_, err = fd.Write([]byte(\"\\n\"))\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"TCP connect write error\")\n\t\t\tbreak\n\t\t} else {\n\t\t\tmsg.returnChannel <- &nsq.FinishedMessage{msg.Id, 0, true}\n\t\t}\n\t}\n\tfmt.Printf(\"TCP closed!\\n\")\n}", "func Write(info []byte, In string, Out string, WhoAmI string) {\n\t//Build complete String\n\tFullString := WhoAmI + \", \" + In + \", \" + Out + \", \" + string(info) + \"\\n\"\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tlogfile.Write([]byte(FullString))\n}", "func (writer *FileLogWriter) Write(log *Log) (err error) {\n\tfor l := writer.level; l <= log.Level; l++ {\n\t\tif writer.files[l].write(log.String()) != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (w *Writer) Write(byt []byte) (int, error) {\n\tlog := &HostLog{\n\t\tBaseHostLog: logx.BaseHostLog{\n\t\t\tTime: time.Now(),\n\n\t\t\t// Used for storing data in special tables in the backend.\n\t\t\tType: HostLogType,\n\t\t},\n\t\tCtx: w.Context,\n\t}\n\tlog.SetMessage(byt)\n\treturn w.ctx.Run(log)\n}", "func (w *FileLogWriter) WriteMsg(msg string, level logrus.Level) error {\n\tif level > w.C.Level {\n\t\treturn nil\n\t}\n\tw.Rl.Write([]byte(msg))\n\treturn nil\n}", "func loggerJSON(l jsonLog) {\n\tl.Date = time.Now()\n\tif l.Level == 0 {\n\t\tl.Level = 6\n\t}\n\tif Config.MinLogLevel >= l.Level {\n\t\tif l.Version == \"\" {\n\t\t\tl.Version = \"1.1\"\n\t\t}\n\t\tif l.Host == \"\" {\n\t\t\tl.Host = \"Quotes\"\n\t\t}\n\t\tif l.ResponseCode == 0 {\n\t\t\tl.ResponseCode = 200\n\t\t}\n\t\t_ = os.MkdirAll(\"./logs/\", os.ModePerm)\n\t\tf, err := os.OpenFile(\"./logs/logs.json\", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error opening logs.json file: %v\", err)\n\t\t}\n\t\tdata, _ := json.Marshal(l)\n\t\tf.WriteString(string(data) + \"\\n\")\n\t\tf.Close()\n\t}\n}", "func chatHandler(w http.ResponseWriter, r *http.Request) {\n\t// Parse the chat room name out of the url query params, i.e. ?room=skiabot_alerts.\n\tto := r.URL.Query().Get(\"room\")\n\tif to == \"\" {\n\t\thttputils.ReportError(w, r, fmt.Errorf(\"Missing room in URL: %q\", r.RequestURI), \"Chat room name missing.\")\n\t\treturn\n\t}\n\n\t// Compose the message.\n\tbody, err := alertmanager.Chat(r.Body)\n\tif err != nil {\n\t\thttputils.ReportError(w, r, err, \"Failed to encode outgoing chat.\")\n\t\treturn\n\t}\n\n\t// Send the message to the chat room.\n\tif err := chatbot.Send(body, to); err != nil {\n\t\thttputils.ReportError(w, r, err, \"Failed to send outgoing chat.\")\n\t\treturn\n\t}\n}", "func logWriteFile(fileName, fileDir, title string, value interface{}) {\n\t//create dir\n\tFileDirAutoCreate(fileDir)\n\n\t//delete time out file\n\tlogDelTimeOutFile(fileDir)\n\n\tpath := fileDir + logFileName(\"\")\n\n\t//format content struct\n\tformatContent := LogFormat{\n\t\tType: fileName,\n\t\tTypeVal: value,\n\t\tTitle: title,\n\t}\n\n\tcontent := logFormatContent(formatContent)\n\tstatus := FileWrite(path, content)\n\n\tif !status {\n\t\tLog(formatContent)\n\t}\n}", "func (l *Logger) ProcessLogEntries() {\n\tlfile, err := os.Create(l.OutputFile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdefer lfile.Close()\n\n\tfor {\n\t\tmsg := <-l.LogChannel\n\n\t\tif msg == \"<EOC>\" {\n\t\t\tbreak\n\t\t}\n\n\t\tfmt.Println(msg)\n\t\tlfile.WriteString(fmt.Sprintf(\"%s\\n\", msg))\n\t}\n}", "func Chat(chub *connections.ConnectionHub) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tgo chub.WriteMessage()\n\t\tlog.Println(\"wrote message\")\n\t})\n}", "func sendAppendEntries(s *Sailor, peer string) error {\n\tam := appendMessage{}\n\tam.Term = s.currentTerm\n\tam.LeaderId = s.client.NodeName\n\tam.PrevLogIndex = s.leader.nextIndex[peer] - 1\n\t// This is just some fancy logic to check for the bounds on the log\n\t// e.g. our log has 0 entries, so the prevEntryTerm cannot be pulled from the log\n\tif len(s.log) == 0 {\n\t\tam.PrevLogTerm = 0\n\t\tam.Entries = nil\n\t} else {\n\t\t// If our log is too short to have prevTerm, use 0\n\t\tif int(s.leader.nextIndex[peer])-2 < 0 {\n\t\t\tam.PrevLogTerm = 0\n\t\t} else {\n\t\t\tam.PrevLogTerm = s.log[s.leader.nextIndex[peer]-2].Term\n\t\t}\n\t\t// If our nextIndex is a value we don't have yet, send nothing\n\t\tif s.leader.nextIndex[peer] > uint(len(s.log)) {\n\t\t\tam.Entries = []entry{}\n\t\t} else {\n\t\t\tam.Entries = s.log[s.leader.nextIndex[peer]-1:]\n\t\t}\n\t}\n\n\tam.LeaderCommit = s.volatile.commitIndex\n\tap := messages.Message{}\n\tap.Type = \"appendEntries\"\n\tap.ID = 0\n\tap.Source = s.client.NodeName\n\tap.Value = makePayload(am)\n\treturn s.client.SendToPeer(ap, peer)\n}", "func (s *stepSaver) WriteLog(l *logLine) error {\n\tstoredLine := storedLogLine{\n\t\tTime: l.Time,\n\t\tMessage: l.Message,\n\t\tLine: s.lineCount,\n\t\tStepName: l.Step,\n\t}\n\n\tif len(storedLine.Message) > maxLineSize {\n\t\tvar buffer bytes.Buffer\n\t\tbuffer.WriteString(storedLine.Message[:maxLineSize])\n\t\tbuffer.WriteString(fmt.Sprintf(\" [line truncated after %d characters]\", maxLineSize))\n\t\tstoredLine.Message = buffer.String()\n\t}\n\tif err := s.encoder.Encode(storedLine); err != nil {\n\t\treturn fmt.Errorf(\"marshaling log line %v: %v\", storedLine, err)\n\t}\n\n\treturn nil\n}", "func (s *Server) EscribirLog(ctx context.Context, in *Signal) (*Signal, error) {\n var nombre string = in.Nombre\n var partes int = int(in.Id)\n var direcciones = strings.Split(in.Body, \",\")\n \n f, err := os.OpenFile(\"log.txt\",os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)\n if err != nil {\n log.Println(err)\n }\n defer f.Close()\n \n var buffer string = nombre+\" \"+strconv.Itoa(partes)+\"\\n\"\n \n if _, err := f.WriteString(buffer); err != nil {\n log.Println(err)\n }\n \n for i := 0; i < partes; i++ {\n if err != nil {\n log.Fatalf(\"fail: %s\", err)\n }\n \n buffer = nombre+\" Parte_\"+strconv.Itoa(i+1)+\" \"+direcciones[i]+\"\\n\"\n \n if _, err := f.WriteString(buffer); err != nil {\n log.Println(err)\n }\n } \n\n\n return &Signal{Body: \"Log actualizado\"}, nil\n}", "func (l *Log) write(severity string, format string, args ...interface{}) {\n\tl.mu.RLock()\n\t{\n\t\tm := fmt.Sprintf(format, args...)\n\t\tmessage := fmt.Sprintf(\"[%s] %s\\n\", severity, m)\n\t\tl.writer.Write([]byte(message))\n\t}\n\tl.mu.RUnlock()\n}", "func (w *Writer) Write(logline *types.Log) error {\n\tif w.stdout {\n\t\tlog.Info(logline)\n\t}\n\terr := w.checkConn()\n\tif err == nil {\n\t\terr = w.enc.Encode(logline)\n\t}\n\tw.checkError(err)\n\treturn err\n}", "func (r *Raft) AppendToLog_Leader(cmd []byte) {\n\tterm := r.currentTerm\n\tlogVal := LogVal{term, cmd, 0} //make object for log's value field with acks set to 0\n\t//fmt.Println(\"Before putting in log,\", logVal)\n\tr.myLog = append(r.myLog, logVal)\n\t//fmt.Println(\"I am:\", r.Myconfig.Id, \"Added cmd to my log\")\n\n\t//modify metadata after appending\n\t//fmt.Println(\"Metadata before appending,lastLogIndex,prevLogIndex,prevLogTerm\", r.myMetaData.lastLogIndex, r.myMetaData.prevLogIndex, r.myMetaData.prevLogTerm)\n\tlastLogIndex := r.myMetaData.lastLogIndex + 1\n\tr.myMetaData.prevLogIndex = r.myMetaData.lastLogIndex\n\tr.myMetaData.lastLogIndex = lastLogIndex\n\t//fmt.Println(r.myId(), \"Length of my log is\", len(r.myLog))\n\tif len(r.myLog) == 1 {\n\t\tr.myMetaData.prevLogTerm = r.myMetaData.prevLogTerm + 1 //as for empty log prevLogTerm is -2\n\n\t} else if len(r.myLog) > 1 { //explicit check, else would have sufficed too, just to eliminate len=0 possibility\n\t\tr.myMetaData.prevLogTerm = r.myLog[r.myMetaData.prevLogIndex].Term\n\t}\n\t//r.currentTerm = term\n\t//fmt.Println(\"I am leader, Appended to log, last index, its term is\", r.myMetaData.lastLogIndex, r.myLog[lastLogIndex].term)\n\t//fmt.Println(\"Metadata after appending,lastLogIndex,prevLogIndex,prevLogTerm\", r.myMetaData.lastLogIndex, r.myMetaData.prevLogIndex, r.myMetaData.prevLogTerm)\n\tr.setNextIndex_All() //Added-28 march for LogRepair\n\t//Write to disk\n\t//fmt.Println(r.myId(), \"In append_leader, appended to log\", string(cmd))\n\tr.WriteLogToDisk()\n\n}", "func (i *IrcClient) WatchChat(msgHandler func(msg *IrcMessage)) {\n\tlog(\"IRC watch chat - watching chat\")\n\n\ttp := textproto.NewReader((bufio.NewReader(i.Conn)));\n\n\tfor i.Connected {\n\t\tline, err := tp.ReadLine()\n\n\t\tif err != nil {\n\t\t\tlog(\"IRC watch chat - error reading line\")\n\t\t\tlog(err.Error())\n\t\t\ti.Disconnect()\n\t\t\tbreak\n\t\t}\n\n\t\t// log msg\n\t\tlog(line)\n\n\t\t// callback to handle received message & parse msg\n\t\tmsgHandler(ParseMsg(line))\n\n\t\t// Don't know if sleeping is needed but feel better with it\n\t\ttime.Sleep(200 * time.Millisecond)\n\t}\n\n\ti.Disconnect()\n}", "func (enc *jsonEncoder) WriteMessage(sink io.Writer, lvl string, msg string, ts time.Time) error {\n\t// Grab an encoder from the pool so that we can re-use the underlying\n\t// buffer.\n\tfinal := newJSONEncoder()\n\tdefer final.Free()\n\n\tfinal.bytes = append(final.bytes, `{\"msg\":\"`...)\n\tfinal.safeAddString(msg)\n\tfinal.bytes = append(final.bytes, `\",\"level\":\"`...)\n\tfinal.bytes = append(final.bytes, lvl...)\n\tfinal.bytes = append(final.bytes, `\",\"ts\":`...)\n\tfinal.bytes = strconv.AppendInt(final.bytes, ts.UnixNano(), 10)\n\tfinal.bytes = append(final.bytes, `,\"fields\":{`...)\n\tfinal.bytes = append(final.bytes, enc.bytes...)\n\tfinal.bytes = append(final.bytes, \"}}\\n\"...)\n\n\tn, err := sink.Write(final.bytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif n != len(final.bytes) {\n\t\treturn fmt.Errorf(\"incomplete write: only wrote %v of %v bytes\", n, len(final.bytes))\n\t}\n\treturn nil\n}", "func deleteChat(w http.ResponseWriter, r *http.Request, chatId uuid.UUID, db *bolt.DB) {\n\t// Ensure chat exists\n\tchat, err := models.FindChat(chatId, db)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: failed to query database for specified chat\")\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\treturn\n\t} else if chat == nil {\n\t\tresponses.Error(w, http.StatusNotFound, \"specified chat does not exist\")\n\t\treturn\n\t}\n\n\t// Get user\n\tself, err := models.FindUser(r.Header.Get(\"X-BPI-Username\"), db)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: failed to query database for requesting user: %v\\n\", err)\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\treturn\n\t}\n\n\t// Check that user in chat\n\tvalid := false\n\tfor _, c := range self.Chats {\n\t\tif c == chatId.String() {\n\t\t\tvalid = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !valid {\n\t\tresponses.Error(w, http.StatusForbidden, \"user not in specified chat\")\n\t\treturn\n\t}\n\n\t// Get second user\n\tvar user *models.User\n\tif self.Username == chat.User1 {\n\t\tuser, err = models.FindUser(chat.User2, db)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"ERROR: failed to query database for second user in chat: %v\\n\", err)\n\t\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tuser, err = models.FindUser(chat.User1, db)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"ERROR: failed to query database for second user in chat: %v\\n\", err)\n\t\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to query database\")\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Remove chat from second user if exists\n\tif user != nil {\n\t\tuser.RemoveChat(chat.Id.String())\n\t\tif err := user.Save(db); err != nil {\n\t\t\tlog.Printf(\"ERROR: failed to write user information to database: %v\\n\", err)\n\t\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to write to database\")\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Remove chat for requesting user\n\tself.RemoveChat(chat.Id.String())\n\tif err := self.Save(db); err != nil {\n\t\tlog.Printf(\"ERROR: failed to write user information to database: %v\\n\", err)\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to write to database\")\n\t\treturn\n\t}\n\n\t// Remove chat entirely\n\tif err := chat.Delete(db); err != nil {\n\t\tlog.Printf(\"ERROR: failed to delete chat from database: %v\\n\", err)\n\t\tresponses.Error(w, http.StatusInternalServerError, \"failed to delete from database\")\n\t\treturn\n\t}\n\n\tresponses.Success(w)\n}" ]
[ "0.58933955", "0.5856779", "0.58256936", "0.5651839", "0.55754846", "0.5318599", "0.5200086", "0.5196391", "0.5128157", "0.51127017", "0.51021284", "0.5074709", "0.5048144", "0.50400126", "0.50149804", "0.50058657", "0.4966603", "0.49502128", "0.49371424", "0.49354956", "0.4911701", "0.4835221", "0.4827136", "0.4819953", "0.47973323", "0.47972766", "0.47891232", "0.47891232", "0.47793016", "0.4763162", "0.4755091", "0.47243848", "0.47085828", "0.47083968", "0.47015423", "0.46844247", "0.4683816", "0.46759742", "0.46678346", "0.46535262", "0.4643607", "0.46300605", "0.46206588", "0.46153626", "0.4611136", "0.46077123", "0.46077123", "0.46026382", "0.45935625", "0.45922607", "0.4582968", "0.4581728", "0.4576953", "0.4571348", "0.45593575", "0.4557808", "0.45564362", "0.4552248", "0.454475", "0.45421228", "0.45365858", "0.45338875", "0.45304054", "0.45303246", "0.45212033", "0.4504273", "0.4496832", "0.44960707", "0.4494058", "0.44927666", "0.44886652", "0.4488631", "0.4486726", "0.44777238", "0.44711503", "0.44600487", "0.44547024", "0.44529626", "0.44483852", "0.44384766", "0.44383988", "0.44379768", "0.44346166", "0.44337824", "0.4432679", "0.4428219", "0.44236356", "0.44175747", "0.4411626", "0.4404032", "0.43928775", "0.43920928", "0.43880245", "0.4382272", "0.4381022", "0.43562093", "0.43559003", "0.43556577", "0.43546978", "0.4351947" ]
0.79911566
0
New prepares and returns a parser for a lexer
func New(l *lexer.Lexer) *Parser { p := &Parser{ l: l, errors: []error{}, } p.Next() // Roll forward once to set the peek token p.Next() // Roll forward twice to make the first peek token the current token return p }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func New(l *lexer.Lexer) *Parser {\n\tp := &Parser{l: l}\n\n\tp.nextToken()\n\tp.nextToken()\n\n\treturn p\n}", "func New(input io.Reader) *Lexer {\n\tl := &Lexer{}\n\tl.t = NewTokenizer(input)\n\treturn l\n}", "func New(input string) *Lexer {\n\treturn &Lexer{\n\t\tinput: input,\n\t}\n}", "func New(input string) *Lexer {\n\treturn &Lexer{\n\t\tinput: input,\n\t\tcurrentPos: 0,\n\t}\n}", "func New(input string) *Lexer {\n\tl := &Lexer{input: input}\n\tl.readChar() // start up the lexer.\n\treturn l\n}", "func New(input string) *Lexer {\n\tlexer := Lexer{input: input}\n\tlexer.consumeChar()\n\treturn &lexer\n}", "func New(input string) *Lexer {\n\ts := &Lexer{\n\t\tinput: input,\n\t\tstate: lexCode,\n\t\ttokens: make(chan token.Token, len(input)), // buffer is same size as input to avoid deadlock\n\t\tline: 1,\n\t}\n\treturn s\n}", "func New(input string) *Lexer {\n\tl := &Lexer{input: input}\n\tl.readChar() // initialize\n\treturn l\n}", "func New(input string) *Lexer {\n\tlexer := Lexer{input: input}\n\tlexer.readChar()\n\treturn &lexer\n}", "func New(input string) *Lexer {\n\tl := &Lexer{input: input}\n\tl.readChar() //initialize lexer to state pos = 0 readPos = 1\n\treturn l\n}", "func New(input string) *Lexer {\n\tl := &Lexer{input: input}\n\tl.readChar()\n\tl.line = 1\n\treturn l\n}", "func New(input string) *Lexer {\n\tl := &Lexer{input: input} //instantiate and return its location\n\tl.readChar()\n\treturn l\n}", "func New(input string) *Lexer {\n\tl := &Lexer{\n\t\tinput: input,\n\t\tinputLen: len(input),\n\t\tline: 1,\n\t}\n\t// this ensures that our position, readPosition, and column number are\n\t// all initialized before the caller uses the lexer\n\tl.readChar()\n\treturn l\n}", "func newParser(input string) *parser {\n\tp := &parser{\n\t\tlex: lex(input),\n\t}\n\treturn p\n}", "func New(input string) *Lexer {\n\tl := &Lexer{input: input}\n\tl.readChar()\n\treturn l\n}", "func NewParser(l *Lexer) *Parser {\n\tp := &Parser{\n\t\tl: l,\n\t\terrors: []string{},\n\t}\n\n\tp.prefixParseFns = map[TokenType]prefixParseFn{}\n\tp.registerPrefix(IDENT, p.parseIdentifier)\n\tp.registerPrefix(NOT, p.parsePrefixExpression)\n\tp.registerPrefix(LPAREN, p.parseGroupedExpression)\n\tp.registerPrefix(SET, p.parseSetExpression)\n\n\tp.infixParseFns = make(map[TokenType]infixParseFn)\n\tp.registerInfix(EQ, p.parseInfixExpression)\n\tp.registerInfix(NotEQ, p.parseInfixExpression)\n\tp.registerInfix(LBRACKET, p.parseIndexExpression)\n\tp.registerInfix(DOT, p.parseIndexExpression)\n\tp.registerInfix(BETWEEN, p.parseBetweenExpression)\n\tp.registerInfix(LT, p.parseInfixExpression)\n\tp.registerInfix(GT, p.parseInfixExpression)\n\tp.registerInfix(LTE, p.parseInfixExpression)\n\tp.registerInfix(GTE, p.parseInfixExpression)\n\tp.registerInfix(AND, p.parseInfixExpression)\n\tp.registerInfix(OR, p.parseInfixExpression)\n\tp.registerInfix(LPAREN, p.parseCallExpression)\n\n\tp.registerInfix(PLUS, p.parseInfixExpression)\n\tp.registerInfix(MINUS, p.parseInfixExpression)\n\n\t// Read two tokens, so curToken and peekToken are both set\n\tp.nextToken()\n\tp.nextToken()\n\n\treturn p\n}", "func New(l *lexer.Lexer) *Parser {\n\n\t// Create the parser, and prime the pump\n\tp := &Parser{l: l, errors: []Error{}}\n\tp.nextToken()\n\tp.nextToken()\n\n\t// Register prefix-functions\n\tp.prefixParseFns = [tokentype.TokenType_Count]prefixParseFn{\n\t\ttokentype.BACKTICK: p.parseBacktickLiteral,\n\t\ttokentype.BANG: p.parsePrefixExpression,\n\t\ttokentype.DEFINE_FUNCTION: p.parseFunctionDefinition,\n\t\ttokentype.EOF: p.parsingBroken,\n\t\ttokentype.FALSE: p.parseBoolean,\n\t\ttokentype.FLOAT: p.parseFloatLiteral,\n\t\ttokentype.FOR: p.parseForLoopExpression,\n\t\ttokentype.FOREACH: p.parseForEach,\n\t\ttokentype.FUNCTION: p.parseFunctionLiteral,\n\t\ttokentype.IDENT: p.parseIdentifier,\n\t\ttokentype.IF: p.parseIfExpression,\n\t\ttokentype.ILLEGAL: p.parsingBroken,\n\t\ttokentype.INT: p.parseIntegerLiteral,\n\t\ttokentype.LBRACE: p.parseHashLiteral,\n\t\ttokentype.LBRACKET: p.parseArrayLiteral,\n\t\ttokentype.LPAREN: p.parseGroupedExpression,\n\t\ttokentype.MINUS: p.parsePrefixExpression,\n\t\ttokentype.REGEXP: p.parseRegexpLiteral,\n\t\ttokentype.STRING: p.parseStringLiteral,\n\t\ttokentype.SWITCH: p.parseSwitchStatement,\n\t\ttokentype.TRUE: p.parseBoolean,\n\t}\n\n\t// Register infix functions\n\tp.infixParseFns = [tokentype.TokenType_Count]infixParseFn{\n\t\ttokentype.AND: p.parseInfixExpression,\n\t\ttokentype.ASSIGN: p.parseAssignExpression,\n\t\ttokentype.ASTERISK: p.parseInfixExpression,\n\t\ttokentype.ASTERISK_EQUALS: p.parseAssignExpression,\n\t\ttokentype.CONTAINS: p.parseInfixExpression,\n\t\ttokentype.DOTDOT: p.parseInfixExpression,\n\t\ttokentype.EQ: p.parseInfixExpression,\n\t\ttokentype.GT: p.parseInfixExpression,\n\t\ttokentype.GT_EQUALS: p.parseInfixExpression,\n\t\ttokentype.LBRACKET: p.parseIndexExpression,\n\t\ttokentype.LPAREN: p.parseCallExpression,\n\t\ttokentype.LT: p.parseInfixExpression,\n\t\ttokentype.LT_EQUALS: p.parseInfixExpression,\n\t\ttokentype.MINUS: p.parseInfixExpression,\n\t\ttokentype.MINUS_EQUALS: p.parseAssignExpression,\n\t\ttokentype.MOD: p.parseInfixExpression,\n\t\ttokentype.NOT_CONTAINS: p.parseInfixExpression,\n\t\ttokentype.NOT_EQ: p.parseInfixExpression,\n\t\ttokentype.OR: p.parseInfixExpression,\n\t\ttokentype.PERIOD: p.parseMethodCallExpression,\n\t\ttokentype.PLUS: p.parseInfixExpression,\n\t\ttokentype.PLUS_EQUALS: p.parseAssignExpression,\n\t\ttokentype.POW: p.parseInfixExpression,\n\t\ttokentype.QUESTION: p.parseTernaryExpression,\n\t\ttokentype.SLASH: p.parseInfixExpression,\n\t\ttokentype.SLASH_EQUALS: p.parseAssignExpression,\n\t}\n\n\t// Register postfix functions.\n\tp.postfixParseFns = [tokentype.TokenType_Count]postfixParseFn{\n\t\ttokentype.MINUS_MINUS: p.parsePostfixExpression,\n\t\ttokentype.PLUS_PLUS: p.parsePostfixExpression,\n\t}\n\n\t// All done\n\treturn p\n}", "func New(l *lexer.Lexer) *Parser {\n\tp := &Parser{\n\t\tl: l,\n\t\terrors: []string{},\n\t}\n\n\t// Intialize the prefixParseFns map on Parser and register a parsing function\n\tp.prefixParseFns = make(map[token.TokenType]prefixParseFn)\n\tp.registerPrefix(token.IDENT, p.parseIdentifier)\n\tp.registerPrefix(token.INT, p.parseIntegerLiteral)\n\tp.registerPrefix(token.MINUS, p.parsePrefixExpression)\n\tp.registerPrefix(token.BANG, p.parsePrefixExpression)\n\tp.registerPrefix(token.LPAREN, p.parseGroupedExpression)\n\n\t// Intialize the infixParseFns map on Parser and register a parsing function\n\tp.infixParseFns = make(map[token.TokenType]infixParseFn)\n\tp.registerInfix(token.PLUS, p.parseInfixExpression)\n\tp.registerInfix(token.MINUS, p.parseInfixExpression)\n\tp.registerInfix(token.SLASH, p.parseInfixExpression)\n\tp.registerInfix(token.ASTERISK, p.parseInfixExpression)\n\tp.registerInfix(token.EQ, p.parseInfixExpression)\n\tp.registerInfix(token.NOT_EQ, p.parseInfixExpression)\n\tp.registerInfix(token.LT, p.parseInfixExpression)\n\tp.registerInfix(token.GT, p.parseInfixExpression)\n\n\t// Read two token so curToken and peekToken are both set\n\tp.nextToken()\n\tp.nextToken()\n\n\treturn p\n}", "func NewLexer(input []byte) *Lexer {\n\treturn &Lexer{\n\t\tinput: input,\n\t\titems: make(chan Item, 2),\n\t\tstate: lexBytes,\n\t}\n}", "func New(input string) *Lexer {\n\tl := &Lexer{input: input, charNo: -1, lineNo: 0}\n\n\tl.readChar() // read the first character\n\treturn l\n}", "func New(l *lexer.Lexer) *Parser {\n\tp := &Parser{l: l}\n\n\tlog.Println(\"Making new parser\")\n\n\tp.prefixParseFns = make(map[token.Typ]prefixParseFn)\n\tp.prefixParseFns[token.IDENT] = p.parseIdent\n\tp.prefixParseFns[token.INT] = p.parseIntegerLiteral\n\tp.prefixParseFns[token.NOT] = p.parsePrefixExpr\n\tp.prefixParseFns[token.MINUS] = p.parsePrefixExpr\n\n\tp.infixParseFns = make(map[token.Typ]infixParseFn)\n\tp.infixParseFns[token.PLUS] = p.parseInfixExpr\n\tp.infixParseFns[token.MINUS] = p.parseInfixExpr\n\tp.infixParseFns[token.MULT] = p.parseInfixExpr\n\tp.infixParseFns[token.DIVIDE] = p.parseInfixExpr\n\tp.infixParseFns[token.GREATER] = p.parseInfixExpr\n\tp.infixParseFns[token.LESS] = p.parseInfixExpr\n\tp.infixParseFns[token.EQ] = p.parseInfixExpr\n\tp.infixParseFns[token.NEQ] = p.parseInfixExpr\n\n\tp.nextToken()\n\tp.nextToken()\n\n\treturn p\n}", "func NewParser(input string) *Parser {\n\tlexer := newLexer(Tokens, input)\n\n\tparser := &Parser{\n\t\tlexer: lexer,\n\t\trule: &ParsedRule{},\n\t}\n\n\treturn parser\n}", "func New(r io.Reader) (Scanner, error) {\n\ttoks, err := lexer.Parse(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &scanner{toks: toks}, nil\n}", "func New(src string) *Lexer {\n\tl := &Lexer{\n\t\tinput: src,\n\t}\n\t// step to the first character in order to be ready\n\tl.readChar()\n\treturn l\n}", "func New(input string) *Lexer {\n\tl := &Lexer{input: input, runes: []rune(input)}\n\tl.readChar()\n\treturn l\n}", "func New(start StateFn, input string) *Lexer {\n\tif start == nil {\n\t\tpanic(\"nil start state\")\n\t}\n\treturn &Lexer{\n\t\tstate: start,\n\t\tinput: input,\n\t\titems: list.New(),\n\t}\n}", "func New(l *lexer.Lexer) *Parser {\n\tp := &Parser{\n\t\tl: l,\n\t\terrors: []string{},\n\t}\n\n\t// Read two tokens, so curToken and peekToken are both set\n\tp.nextToken()\n\tp.nextToken()\n\n\tp.prefixParseFns = make(map[token.Type]prefixParseFn)\n\n\tp.registerPrefix(token.IDENT, p.parseIdentifier)\n\tp.registerPrefix(token.TRUE, p.parseBoolean)\n\tp.registerPrefix(token.FALSE, p.parseBoolean)\n\tp.registerPrefix(token.INT, p.parseIntegerLiteral)\n\tp.registerPrefix(token.BANG, p.parsePrefixExpression)\n\tp.registerPrefix(token.MINUS, p.parsePrefixExpression)\n\tp.registerPrefix(token.LPAREN, p.parseGroupedExpression)\n\tp.registerPrefix(token.IF, p.parseIfExpression)\n\tp.registerPrefix(token.FUNCTION, p.parseFunctionLiteral)\n\n\tp.infixParseFns = make(map[token.Type]infixParseFn)\n\n\tp.registerInfix(token.PLUS, p.parseInfixExpression)\n\tp.registerInfix(token.MINUS, p.parseInfixExpression)\n\tp.registerInfix(token.SLASH, p.parseInfixExpression)\n\tp.registerInfix(token.ASTERISK, p.parseInfixExpression)\n\tp.registerInfix(token.EQ, p.parseInfixExpression)\n\tp.registerInfix(token.NEQ, p.parseInfixExpression)\n\tp.registerInfix(token.LT, p.parseInfixExpression)\n\tp.registerInfix(token.GT, p.parseInfixExpression)\n\tp.registerInfix(token.LPAREN, p.parseCallExpression)\n\n\treturn p\n}", "func NewParser(lxr *lexer.Lexer) *Parser {\n\treturn &Parser{lexer: lxr}\n}", "func NewParser(lexer *Lexer) *Parser {\n\tp := Parser{lexer: lexer}\n\tp.currentToken = p.lexer.getNextToken()\n\treturn &p\n}", "func New(l *lexer.Lexer) *Parser {\n\tp := &Parser{\n\t\tl: l,\n\t\terrors: []string{},\n\t}\n\n\tp.prefixParseFns = make(map[token.Type]prefixParseFn)\n\tp.registerPrefix(token.IDENT, p.parseIdentifier)\n\tp.registerPrefix(token.INT, p.parseIntegerLiteral)\n\tp.registerPrefix(token.NOT, p.parsePrefixExpression)\n\tp.registerPrefix(token.LPAREN, p.parseGroupedExpression)\n\n\tp.infixParseFns = make(map[token.Type]infixParseFn)\n\tp.registerInfix(token.PLUS, p.parseInfixExpression)\n\tp.registerInfix(token.MINUS, p.parseInfixExpression)\n\tp.registerInfix(token.DIVIDE, p.parseInfixExpression)\n\tp.registerInfix(token.MULTIPLY, p.parseInfixExpression)\n\tp.registerInfix(token.ASSIGN, p.parseInfixExpression)\n\tp.registerInfix(token.EQ, p.parseInfixExpression)\n\tp.registerInfix(token.LT, p.parseInfixExpression)\n\tp.registerInfix(token.AND, p.parseInfixExpression)\n\tp.registerInfix(token.OR, p.parseInfixExpression)\n\tp.registerInfix(token.LPAREN, p.parseCallExpression)\n\n\tp.nextToken()\n\tp.nextToken()\n\treturn p\n}", "func New(l *lexer.Lexer) *Parser {\n\tp := &Parser{\n\t\tl: l,\n\t\terrors: []string{},\n\t\tacceptBlock: true,\n\t}\n\n\t// Read two tokens, so curToken and peekToken are both set.\n\tp.nextToken()\n\tp.nextToken()\n\n\tp.prefixParseFns = make(map[token.Type]prefixParseFn)\n\tp.registerPrefix(token.Ident, p.parseIdentifier)\n\tp.registerPrefix(token.Constant, p.parseConstant)\n\tp.registerPrefix(token.InstanceVariable, p.parseInstanceVariable)\n\tp.registerPrefix(token.Int, p.parseIntegerLiteral)\n\tp.registerPrefix(token.String, p.parseStringLiteral)\n\tp.registerPrefix(token.True, p.parseBooleanLiteral)\n\tp.registerPrefix(token.False, p.parseBooleanLiteral)\n\tp.registerPrefix(token.Null, p.parseNilExpression)\n\tp.registerPrefix(token.Minus, p.parsePrefixExpression)\n\tp.registerPrefix(token.Bang, p.parsePrefixExpression)\n\tp.registerPrefix(token.LParen, p.parseGroupedExpression)\n\tp.registerPrefix(token.If, p.parseIfExpression)\n\tp.registerPrefix(token.Self, p.parseSelfExpression)\n\tp.registerPrefix(token.LBracket, p.parseArrayExpression)\n\tp.registerPrefix(token.LBrace, p.parseHashExpression)\n\tp.registerPrefix(token.Semicolon, p.parseSemicolon)\n\tp.registerPrefix(token.Yield, p.parseYieldExpression)\n\n\tp.infixParseFns = make(map[token.Type]infixParseFn)\n\tp.registerInfix(token.Plus, p.parseInfixExpression)\n\tp.registerInfix(token.Minus, p.parseInfixExpression)\n\tp.registerInfix(token.Slash, p.parseInfixExpression)\n\tp.registerInfix(token.Eq, p.parseInfixExpression)\n\tp.registerInfix(token.Asterisk, p.parseInfixExpression)\n\tp.registerInfix(token.Pow, p.parseInfixExpression)\n\tp.registerInfix(token.NotEq, p.parseInfixExpression)\n\tp.registerInfix(token.LT, p.parseInfixExpression)\n\tp.registerInfix(token.LTE, p.parseInfixExpression)\n\tp.registerInfix(token.GT, p.parseInfixExpression)\n\tp.registerInfix(token.GTE, p.parseInfixExpression)\n\tp.registerInfix(token.COMP, p.parseInfixExpression)\n\tp.registerInfix(token.Dot, p.parseCallExpression)\n\tp.registerInfix(token.LParen, p.parseCallExpression)\n\tp.registerInfix(token.LBracket, p.parseArrayIndexExpression)\n\tp.registerInfix(token.Incr, p.parsePostfixExpression)\n\tp.registerInfix(token.Decr, p.parsePostfixExpression)\n\tp.registerInfix(token.And, p.parseInfixExpression)\n\tp.registerInfix(token.Or, p.parseInfixExpression)\n\tp.registerInfix(token.ResolutionOperator, p.parseInfixExpression)\n\n\treturn p\n}", "func NewLexer(br *bufio.Reader) *Lexer {\n\tb, err := br.ReadByte()\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn &Lexer{br, nil, getSingleByteArray(b), UnknownToken, nil}\n}", "func New(input string) *Lexer {\n\tl := &Lexer{characters: []rune(input)}\n\tl.readChar()\n\treturn l\n}", "func NewLexer(input string) *Lexer {\n\tl := &Lexer{\n\t\tinput: input,\n\t\ttokens: make(chan *Token),\n\t}\n\tgo l.run()\n\treturn l\n}", "func NewLexer() *Lexer {\r\n\tl := new(Lexer)\r\n\tl.SpecialSymbols = map[string]string{\r\n\t\t` `: `ident`, `(`: `left parentesis`, `)`: `right parentesis`,\r\n\t\t`;`: `semicolon`, `:`: `double colon`, `,`: `comma`, `{`: `left tuple`,\r\n\t\t`}`: `right tuple`, `[`: `left array`, `]`: `right array`, `.`: `dot`, \"\\n\": `whitespace`,\r\n\t}\r\n\tl.Operators = NewPythonOperators()\r\n\tl.KeyWords = map[string]string{\r\n\t\t`def`: `function`, `return`: `return value`,\r\n\t\t`for`: `for cycle`, `while`: `while cycle`,\r\n\t}\r\n\tl.Values = NewValues()\r\n\r\n\treturn l\r\n}", "func newLexer(r io.Reader) *lexer {\n\treturn &lexer{\n\t\tscanner: newScanner(r),\n\t}\n}", "func NewLexer(r io.Reader) *Lexer {\n\treturn &Lexer{scanner: NewScanner(r), Errors: make(chan error, 1)}\n}", "func NewLexer(text []string) lexer {\n\treturn lexer{text, 0, text[0]}\n}", "func NewLexer(scan Scanner) (lx Lexer) {\n\tlx.Scanner = scan\n\tlx.pos = Position{1, 0}\n\tlx.rawPos = Position{1, 0}\n\treturn\n}", "func NewLexer(name string, in io.Reader) (*Lexer, error) {\n\tbuf, err := ioutil.ReadAll(in)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl := &Lexer{\n\t\tname: name,\n\t\tinput: string(buf),\n\t\tstate: lexOuter,\n\t\ttokens: make(chan Token, 4),\n\t}\n\treturn l, nil\n}", "func NewLexer(inputName string, rd io.Reader) *Lexer {\n\treturn &Lexer{\n\t\tin: bufio.NewReader(rd),\n\t\tcurrent: &Position{\n\t\t\tName: inputName,\n\t\t\tRow: 1,\n\t\t},\n\t\tlast: &Position{},\n\t}\n}", "func NewLexer(r io.Reader) (*Lexer, error) {\n\n\ttokenizer, err := NewTokenizer(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlexer := &Lexer{tokenizer: tokenizer}\n\treturn lexer, nil\n}", "func New(l *lexer.Lexer) *Parser {\n\tp := &Parser{\n\t\tLexer: l,\n\t\tacceptBlock: true,\n\t}\n\n\tp.fsm = fsm.NewFSM(\n\t\tstates.Normal,\n\t\tfsm.Events{\n\t\t\t{Name: events.ParseFuncCall, Src: []string{states.Normal}, Dst: states.ParsingFuncCall},\n\t\t\t{Name: events.ParseMethodParam, Src: []string{states.Normal, states.ParsingAssignment}, Dst: states.ParsingMethodParam},\n\t\t\t{Name: events.ParseAssignment, Src: []string{states.Normal, states.ParsingFuncCall}, Dst: states.ParsingAssignment},\n\t\t\t{Name: events.BackToNormal, Src: []string{states.ParsingFuncCall, states.ParsingMethodParam, states.ParsingAssignment}, Dst: states.Normal},\n\t\t},\n\t\tfsm.Callbacks{},\n\t)\n\n\tp.prefixParseFns = make(map[token.Type]prefixParseFn)\n\tp.registerPrefix(token.Ident, p.parseIdentifier)\n\tp.registerPrefix(token.Constant, p.parseConstant)\n\tp.registerPrefix(token.InstanceVariable, p.parseInstanceVariable)\n\tp.registerPrefix(token.Int, p.parseIntegerLiteral)\n\tp.registerPrefix(token.String, p.parseStringLiteral)\n\tp.registerPrefix(token.True, p.parseBooleanLiteral)\n\tp.registerPrefix(token.False, p.parseBooleanLiteral)\n\tp.registerPrefix(token.Null, p.parseNilExpression)\n\tp.registerPrefix(token.Minus, p.parsePrefixExpression)\n\tp.registerPrefix(token.Plus, p.parsePrefixExpression)\n\tp.registerPrefix(token.Asterisk, p.parsePrefixExpression)\n\tp.registerPrefix(token.Bang, p.parsePrefixExpression)\n\tp.registerPrefix(token.LParen, p.parseGroupedExpression)\n\tp.registerPrefix(token.If, p.parseIfExpression)\n\tp.registerPrefix(token.Case, p.parseCaseExpression)\n\tp.registerPrefix(token.Self, p.parseSelfExpression)\n\tp.registerPrefix(token.LBracket, p.parseArrayExpression)\n\tp.registerPrefix(token.LBrace, p.parseHashExpression)\n\tp.registerPrefix(token.Semicolon, p.parseSemicolon)\n\tp.registerPrefix(token.Yield, p.parseYieldExpression)\n\tp.registerPrefix(token.GetBlock, p.parseGetBlockExpression)\n\n\tp.infixParseFns = make(map[token.Type]infixParseFn)\n\tp.registerInfix(token.Plus, p.parseInfixExpression)\n\tp.registerInfix(token.PlusEq, p.parseAssignExpression)\n\tp.registerInfix(token.Minus, p.parseInfixExpression)\n\tp.registerInfix(token.MinusEq, p.parseAssignExpression)\n\tp.registerInfix(token.Modulo, p.parseInfixExpression)\n\tp.registerInfix(token.Slash, p.parseInfixExpression)\n\tp.registerInfix(token.Pow, p.parseInfixExpression)\n\tp.registerInfix(token.Eq, p.parseInfixExpression)\n\tp.registerInfix(token.NotEq, p.parseInfixExpression)\n\tp.registerInfix(token.LT, p.parseInfixExpression)\n\tp.registerInfix(token.LTE, p.parseInfixExpression)\n\tp.registerInfix(token.GT, p.parseInfixExpression)\n\tp.registerInfix(token.GTE, p.parseInfixExpression)\n\tp.registerInfix(token.COMP, p.parseInfixExpression)\n\tp.registerInfix(token.And, p.parseInfixExpression)\n\tp.registerInfix(token.Or, p.parseInfixExpression)\n\tp.registerInfix(token.OrEq, p.parseAssignExpression)\n\tp.registerInfix(token.Comma, p.parseMultiVariables)\n\tp.registerInfix(token.ResolutionOperator, p.parseInfixExpression)\n\tp.registerInfix(token.Assign, p.parseAssignExpression)\n\tp.registerInfix(token.Range, p.parseRangeExpression)\n\tp.registerInfix(token.Dot, p.parseCallExpressionWithReceiver)\n\tp.registerInfix(token.LParen, p.parseCallExpressionWithoutReceiver)\n\tp.registerInfix(token.LBracket, p.parseIndexExpression)\n\tp.registerInfix(token.Colon, p.parseArgumentPairExpression)\n\tp.registerInfix(token.Asterisk, p.parseInfixExpression)\n\n\treturn p\n}", "func newLexer(input string) *lexer {\n\tl := &lexer{input: input}\n\tl.readChar()\n\treturn l\n}", "func NewLexer(rd io.Reader) *Lexer {\n\tp := Lexer{}\n\tp.rd = rd\n\tp.lastByte = bufSize\n\tp.buf = make([]byte, bufSize)\n\tp.r = -1\n\tp.fill()\n\treturn &p\n}", "func NewParser(tokens []lexer.Token) parser {\n\tp := parser{}\n\tp.tokens = tokens\n\tp.current = 0\n\n\treturn p\n}", "func newLexer(r io.Reader) *lexer {\n\ts := bufio.NewScanner(r)\n\n\treturn &lexer{\n\t\tscanner: s,\n\t\tindexPosition: 0,\n\t}\n\n}", "func New(reader *reader.Reader) *Lexer {\n\tl := &Lexer{\n\t\treader: reader,\n\t\trow: 1,\n\t\tcol: 1,\n\t\trewinded: false,\n\t\tsymbol: &Symbol{},\n\t}\n\n\t// List of valid keywords.\n\tl.symbol.Insert(\"true\", token.BOOLEAN)\n\tl.symbol.Insert(\"false\", token.BOOLEAN)\n\tl.symbol.Insert(\"nil\", token.NIL)\n\tl.symbol.Insert(\"let\", token.LET)\n\tl.symbol.Insert(\"var\", token.VAR)\n\tl.symbol.Insert(\"func\", token.FUNCTION)\n\tl.symbol.Insert(\"do\", token.DO)\n\tl.symbol.Insert(\"end\", token.END)\n\tl.symbol.Insert(\"if\", token.IF)\n\tl.symbol.Insert(\"else\", token.ELSE)\n\tl.symbol.Insert(\"for\", token.FOR)\n\tl.symbol.Insert(\"in\", token.IN)\n\tl.symbol.Insert(\"is\", token.IS)\n\tl.symbol.Insert(\"as\", token.AS)\n\tl.symbol.Insert(\"return\", token.RETURN)\n\tl.symbol.Insert(\"then\", token.THEN)\n\tl.symbol.Insert(\"switch\", token.SWITCH)\n\tl.symbol.Insert(\"case\", token.CASE)\n\tl.symbol.Insert(\"default\", token.DEFAULT)\n\tl.symbol.Insert(\"break\", token.BREAK)\n\tl.symbol.Insert(\"continue\", token.CONTINUE)\n\tl.symbol.Insert(\"module\", token.MODULE)\n\tl.symbol.Insert(\"import\", token.IMPORT)\n\n\t// Move to the first token.\n\tl.advance()\n\n\treturn l\n}", "func NewLexer(f io.Reader) (*lexer, <-chan *lexData, <-chan error) {\n\tlexchan := make(chan *lexData)\n\terrchan := make(chan error, 1)\n\tbuf := bufio.NewReader(f)\n\n\treturn &lexer{buf: buf, lexchan: lexchan, errchan: errchan}, lexchan, errchan\n}", "func newLexer(scan scanner) lexer {\n\treturn lexer{\n\t\tscan: scan,\n\t\ttokens: make([]token, 0, 20)}\n}", "func NewLexer(sourceCode string) *Lexer {\n\treturn &Lexer{sourceCode, 0, nil}\n}", "func New(l *lexer.Lexer) *Parser {\n\tp := &Parser{l: l}\n\tp.readNextToken()\n\tp.readNextToken() // To set the init value of curToken and the nextToken.\n\tp.ParseFnForPrefixToken = make(map[string]prefixTokenParseFn) // Need to assign a non-nil map, otherwise cannot assign to a nil nap.\n\tp.registerParseFuncForPrefixToken(token.IDENTIFIER, p.parseIdentifier)\n\tp.registerParseFuncForPrefixToken(token.INT, p.parseIntegerLiteral)\n\tp.registerParseFuncForPrefixToken(token.STRING, p.parseStringLiteral)\n\tp.registerParseFuncForPrefixToken(token.BANG, p.parsePrefixExpression)\n\tp.registerParseFuncForPrefixToken(token.MINUS, p.parsePrefixExpression)\n\tp.registerParseFuncForPrefixToken(token.TRUE, p.parseBooleanLiteral)\n\tp.registerParseFuncForPrefixToken(token.FALSE, p.parseBooleanLiteral)\n\tp.registerParseFuncForPrefixToken(token.LPAREN, p.parseGroupedExpression)\n\tp.registerParseFuncForPrefixToken(token.IF, p.parseIfExpression)\n\tp.registerParseFuncForPrefixToken(token.FUNCTION, p.parseFunctionLiteralExpression)\n\tp.ParseFnForInfixToken = make(map[string]infixTokenParseFn)\n\tp.registerParseFuncForInfixToken(token.PLUS, p.parseInfixExpression)\n\tp.registerParseFuncForInfixToken(token.MINUS, p.parseInfixExpression)\n\tp.registerParseFuncForInfixToken(token.ASTERISK, p.parseInfixExpression)\n\tp.registerParseFuncForInfixToken(token.LT, p.parseInfixExpression)\n\tp.registerParseFuncForInfixToken(token.GT, p.parseInfixExpression)\n\tp.registerParseFuncForInfixToken(token.EQ, p.parseInfixExpression)\n\tp.registerParseFuncForInfixToken(token.NOTEQ, p.parseInfixExpression)\n\tp.registerParseFuncForInfixToken(token.LPAREN, p.parseCallExpression)\n\tp.registerParseFuncForInfixToken(token.SLASH, p.parseInfixExpression)\n\treturn p\n}", "func NewLexer(raw []rune) *Lexer {\n\treturn &Lexer{\n\t\tbuf: raw,\n\t\tnormal: true,\n\t}\n}", "func New(l *lexer.Lexer, context string) *Parser {\n\tp := &Parser{\n\t\tl: l,\n\t\tContext: context,\n\t\terrors: []string{},\n\t}\n\n\tp.prefixParseFns = make(map[token.Type]prefixParseFn)\n\tp.registerPrefix(token.Ident, p.parseIdentifier)\n\tp.registerPrefix(token.Int, p.parseIntegerLiteral)\n\tp.registerPrefix(token.String, p.parseStringLiteral)\n\tp.registerPrefix(token.Bang, p.parsePrefixExpression)\n\tp.registerPrefix(token.Minus, p.parsePrefixExpression)\n\tp.registerPrefix(token.True, p.parseBoolean)\n\tp.registerPrefix(token.False, p.parseBoolean)\n\tp.registerPrefix(token.Lparen, p.parseGroupedExpression)\n\tp.registerPrefix(token.If, p.parseIfExpression)\n\tp.registerPrefix(token.Function, p.parseFunctionLiteral)\n\tp.registerPrefix(token.Lbracket, p.parseArray)\n\n\tp.infixParseFns = make(map[token.Type]infixParseFn)\n\tp.registerInfix(token.Plus, p.parseInfixExpression)\n\tp.registerInfix(token.Minus, p.parseInfixExpression)\n\tp.registerInfix(token.Slash, p.parseInfixExpression)\n\tp.registerInfix(token.Astersik, p.parseInfixExpression)\n\tp.registerInfix(token.EQ, p.parseInfixExpression)\n\tp.registerInfix(token.NEQ, p.parseInfixExpression)\n\tp.registerInfix(token.LT, p.parseInfixExpression)\n\tp.registerInfix(token.GT, p.parseInfixExpression)\n\tp.registerInfix(token.LTE, p.parseInfixExpression)\n\tp.registerInfix(token.GTE, p.parseInfixExpression)\n\tp.registerInfix(token.Lparen, p.parseCallExpression)\n\tp.registerInfix(token.Dot, p.parseInfixCallExpression)\n\tp.registerInfix(token.Assign, p.parseAssignmentExpression)\n\n\tp.nextToken() // set currToken\n\tp.nextToken() // set peekToken\n\n\treturn p\n}", "func NewLexer(input io.Reader, opts ...Option) *Lexer {\n\tlex := new(Lexer)\n\tfor _, opt := range opts {\n\t\topt(lex)\n\t}\n\n\tlex.Error = func(_ *Lexer, err error) {\n\t\tlog.Printf(`Lexer encountered the error \"%v\"`, err)\n\t}\n\tlex.scanner = scanner.NewScanner(input, lex.scannerOpts...)\n\treturn lex\n}", "func NewParser(tokenizer *Tokenizer) *Parser {\n\treturn &Parser{\n\t\ttokenizer: tokenizer,\n\t\tloopCount: 0,\n\t\tskipSemicolon: false,\n\t}\n}", "func NewParser(f io.Reader) *Parser {\n\tlex := lexer.New(f)\n\tp := &Parser{\n\t\tlex: lex,\n\t\terrors: make([]*ParserError, 0),\n\t}\n\tp.advanceTokens()\n\tp.advanceTokens()\n\treturn p\n}", "func NewParser(r io.Reader, lang *Language) *Parser {\n\treturn &Parser{s: NewScanner(r), lang: lang}\n}", "func NewLexer(reader io.Reader, capacity int) *Lexer {\n\tl := &Lexer{\n\t\treader: reader,\n\t\tbuffer: make([]byte, capacity),\n\t}\n\n\treturn l\n}", "func New(f io.RuneReader, init StateFn) Interface {\n\t// add line 1 to file\n\t// f.AddLine(0, 1)\n\treturn &Lexer{\n\t\tf: f,\n\t\ti: init,\n\t\t// initial q size must be an exponent of 2\n\t\tq: &queue{items: make([]Item, 2)},\n\t}\n}", "func New(l *lexer.Lexer) *Parser {\n\tp := &Parser{\n\t\tlexer: l,\n\t\terrors: []string{},\n\t\tprefixFns: make(map[token.Type]prefixFn),\n\t\tinfixFns: make(map[token.Type]infixFn),\n\t}\n\n\tp.registerPrefixFn(token.BANG, p.parsePrefixExpression)\n\tp.registerPrefixFn(token.FALSE, p.parseBoolean)\n\tp.registerPrefixFn(token.FUNCTION, p.parseFunctionLiteral)\n\tp.registerPrefixFn(token.IDENT, p.parseIdentifier)\n\tp.registerPrefixFn(token.IF, p.parseIfExpression)\n\tp.registerPrefixFn(token.INT, p.parseIntegerLiteral)\n\tp.registerPrefixFn(token.LBRACKET, p.parseArrayLiteral)\n\tp.registerPrefixFn(token.LPAREN, p.parseGroupedExpression)\n\tp.registerPrefixFn(token.MINUS, p.parsePrefixExpression)\n\tp.registerPrefixFn(token.STRING, p.parseStringLiteral)\n\tp.registerPrefixFn(token.TRUE, p.parseBoolean)\n\n\tp.registerInfixFn(token.ASTERISK, p.parseInfixExpression)\n\tp.registerInfixFn(token.EQUAL, p.parseInfixExpression)\n\tp.registerInfixFn(token.GT, p.parseInfixExpression)\n\tp.registerInfixFn(token.LBRACKET, p.parseIndexExpression)\n\tp.registerInfixFn(token.LPAREN, p.parseCallExpression)\n\tp.registerInfixFn(token.LT, p.parseInfixExpression)\n\tp.registerInfixFn(token.MINUS, p.parseInfixExpression)\n\tp.registerInfixFn(token.NOT_EQUAL, p.parseInfixExpression)\n\tp.registerInfixFn(token.PLUS, p.parseInfixExpression)\n\tp.registerInfixFn(token.SLASH, p.parseInfixExpression)\n\n\tp.advance()\n\tp.advance()\n\treturn p\n}", "func NewParser(tokens []Token) *Parser {\n\treturn &Parser{tokens: tokens}\n}", "func NewParser() *Parser {\r\n\treturn &Parser{\"\",make(map[string]*NonTerminal)}\r\n}", "func New() *Parser {\n\treturn &Parser{\n\t\thclParser: hclparse.NewParser(),\n\t\tfiles: make(map[string]bool),\n\t}\n}", "func NewParser() *Parser {\n\treturn &Parser{}\n}", "func NewParser() *Parser {\n\treturn &Parser{}\n}", "func NewParser() *Parser {\n\treturn &Parser{}\n}", "func NewParser() *Parser {\n\treturn &Parser{}\n}", "func NewParser(lexer *Lexer, config conf.Config) *Parser {\n\treturn &Parser{\n\t\tLexer: lexer,\n\t\terrHandlerFunc: config.ErrorHandlerFunc,\n\t\tbuilder: position.NewBuilder(),\n\t}\n}", "func New(r io.Reader) *Parser {\n\treturn &Parser{s: NewScanner(r)}\n}", "func NewLexer(name string, r io.Reader, rec Record) (l *Lexer, err error) {\n\tif len(rec.States) == 0 {\n\t\terr = fmt.Errorf(\"rec.states must not be empty.\")\n\t\treturn\n\t}\n\tif rec.Buflen < 1 {\n\t\terr = fmt.Errorf(\"rec.Buflen must be > 0: %d\", rec.Buflen)\n\t\treturn\n\t}\n\tif rec.ErrorFn == nil {\n\t\terr = fmt.Errorf(\"rec.ErrorFn must not be nil\")\n\t\treturn\n\t}\n\tl = &Lexer{\n\t\tname: name,\n\t\tr: r,\n\t\trec: rec,\n\t\titems: make(chan Item),\n\t\tnext: make([]byte, rec.Buflen),\n\t\teof: false,\n\t}\n\tgo l.run()\n\treturn\n}", "func NewLexer(config *Config, rules Rules) (*RegexLexer, error) {\n\tif config == nil {\n\t\tconfig = &Config{}\n\t}\n\tif _, ok := rules[\"root\"]; !ok {\n\t\treturn nil, fmt.Errorf(\"no \\\"root\\\" state\")\n\t}\n\tcompiledRules := map[string][]*CompiledRule{}\n\tfor state, rules := range rules {\n\t\tcompiledRules[state] = nil\n\t\tfor _, rule := range rules {\n\t\t\tflags := \"\"\n\t\t\tif !config.NotMultiline {\n\t\t\t\tflags += \"m\"\n\t\t\t}\n\t\t\tif config.CaseInsensitive {\n\t\t\t\tflags += \"i\"\n\t\t\t}\n\t\t\tif config.DotAll {\n\t\t\t\tflags += \"s\"\n\t\t\t}\n\t\t\tcompiledRules[state] = append(compiledRules[state], &CompiledRule{Rule: rule, flags: flags})\n\t\t}\n\t}\n\treturn &RegexLexer{\n\t\tconfig: config,\n\t\trules: compiledRules,\n\t}, nil\n}", "func newLexer(src string) *lexer {\n\tl := &lexer{src: src,\n\t\ttokenChan: make(chan token),\n\t}\n\tgo l.run()\n\treturn l\n}", "func NewParser() *Parser {\n\treturn &Parser{\n\t\tLCh: make(chan *Lexeme),\n\t}\n}", "func New(r io.Reader) *Parser {\n\tp := &Parser{\n\t\ts: bufio.NewScanner(r),\n\t\thasMoreCommand: true,\n\t}\n\treturn p\n}", "func NewParser(r io.Reader) *Parser {\n\tparser := &Parser{\n\t\tscanner: NewScanner(r),\n\t\tnext: buf{tok: ILLEGAL, lit: \"\"},\n\t}\n\tparser.buffer()\n\treturn parser\n}", "func NewParser() *Parser {\n\treturn &Parser{parser.New()}\n}", "func NewParser(fileName string, scanner *scan.Scanner, context value.Context) *Parser {\n\treturn &Parser{\n\t\tscanner: scanner,\n\t\tfileName: fileName,\n\t\tcontext: context,\n\t}\n}", "func NewParser(source io.Reader) *Parser {\n\treturn &Parser{\n\t\tsource: source,\n\t\tscanner: bufio.NewScanner(source),\n\t}\n}", "func NewParser(dir string) *Parser {\n\treturn &Parser{\n\t\tdir: dir,\n\t}\n}", "func NewParser(filename string) (*Parser, error) {\n\tcontents, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\t// Ok if file does not exists but report read errors.\n\t\tif os.IsNotExist(err) == false {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, nil\n\t}\n\tp := &Parser{\n\t\tlexer: NewLexer(filename, string(contents)),\n\t}\n\treturn p, nil\n}", "func New(input []rune) *Lexer {\n\tlex := &Lexer{\n\t\tI: input,\n\t\tTokens: make([]*token.Token, 0, 2048),\n\t}\n\tlext := 0\n\tfor lext < len(lex.I) {\n\t\tfor lext < len(lex.I) && unicode.IsSpace(lex.I[lext]) {\n\t\t\tlext++\n\t\t}\n\t\tif lext < len(lex.I) {\n\t\t\ttok := lex.scan(lext)\n\t\t\tlext = tok.Rext()\n\t\t\tif !tok.Suppress() {\n\t\t\t\tlex.addToken(tok)\n\t\t\t}\n\t\t}\n\t}\n\tlex.add(token.EOF, len(input), len(input))\n\treturn lex\n}", "func New(input []rune) *Lexer {\n\tlex := &Lexer{\n\t\tI: input,\n\t\tTokens: make([]*token.Token, 0, 2048),\n\t}\n\tlext := 0\n\tfor lext < len(lex.I) {\n\t\tfor lext < len(lex.I) && unicode.IsSpace(lex.I[lext]) {\n\t\t\tlext++\n\t\t}\n\t\tif lext < len(lex.I) {\n\t\t\ttok := lex.scan(lext)\n\t\t\tlext = tok.Rext()\n\t\t\tif !tok.Suppress() {\n\t\t\t\tlex.addToken(tok)\n\t\t\t}\n\t\t}\n\t}\n\tlex.add(token.EOF, len(input), len(input))\n\treturn lex\n}", "func NewParser(symbols interfaces.SymbolCollector) *Parser {\n\tparser := new(Parser)\n\tparser.symbols = symbols\n\treturn parser\n}", "func NewParser(fileName string, scanner *scan.Scanner, context value.Context) *Parser {\n\treturn &Parser{\n\t\tscanner: scanner,\n\t\tfileName: fileName,\n\t\tcontext: context.(*exec.Context),\n\t}\n}", "func NewParser(rules []*rule.Rule, ignorer *ignore.Ignore) *Parser {\n\treturn &Parser{\n\t\tRules: rules,\n\t\tIgnorer: ignorer,\n\t\trchan: make(chan result.FileResults),\n\t}\n}", "func NewParser(r io.Reader, filename string) *Parser {\n return &Parser{ NewScanner(r, filename) }\n}", "func NewParser() *Parser {\n\tp := Parser{}\n\treturn &p\n}", "func NewParser(table *lua.LTable) (Parser, error) {\n\tt := table.RawGet(lua.LString(\"type\")).String()\n\tswitch t {\n\tcase \"re2\":\n\t\tregexp, err := regexp.Compile(table.RawGet(lua.LString(\"expression\")).String())\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"invalid regular expression\")\n\t\t}\n\t\treturn &RE2{regexp: regexp}, nil\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"parser type not found\")\n\t}\n}", "func NewParser(r io.Reader) *Parser {\n\treturn &Parser{s: NewScanner(r)}\n}", "func NewParser(r io.Reader) *Parser {\n\treturn &Parser{s: NewScanner(r)}\n}", "func NewParser(r io.Reader) *Parser {\n\treturn &Parser{s: NewScanner(r)}\n}", "func NewParser(r io.Reader) *Parser {\n\treturn &Parser{s: NewScanner(r)}\n}", "func NewParser(r io.Reader) *Parser {\n\treturn &Parser{s: NewScanner(r)}\n}", "func NewParser(source string) *NJSParser {\n\tinputStream := antlr.NewInputStream(source)\n\n\t// Create the Lexer\n\tlexer := NewNJSLexer(inputStream)\n\tstream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)\n\n\t// Create the Parser\n\treturn NewNJSParser(stream)\n}", "func NewParser(strg dataStore, clck commandClock) *Parser {\n\treturn &Parser{strg: strg, clck: clck}\n}", "func NewParser(description string, p Parser) Parser {\n\treturn p\n}", "func NewParser(_ context.Context, templateDirectory TemplateDirectory) (Parser, error) {\n\treturn Parser{templateDirectory: templateDirectory}, nil\n}", "func NewParser(r io.Reader) *Parser {\n\treturn &Parser{s: NewBufScanner(r)}\n}", "func NewFromString(input string) Scanner {\n\ttoks := lexer.ParseString(input)\n\treturn &scanner{toks: toks}\n}" ]
[ "0.8064323", "0.78764266", "0.7851809", "0.7849034", "0.7814091", "0.7794731", "0.7764925", "0.7754973", "0.77535576", "0.774895", "0.77142864", "0.77135056", "0.7701048", "0.76761323", "0.7674024", "0.76244766", "0.7578205", "0.75602937", "0.7557465", "0.7536161", "0.75165784", "0.74844223", "0.7476614", "0.7459528", "0.7443379", "0.74277437", "0.74241847", "0.7421505", "0.7398378", "0.73914665", "0.7390194", "0.7367939", "0.7362814", "0.7359637", "0.73556066", "0.731525", "0.72997856", "0.729779", "0.72647464", "0.72432065", "0.7241916", "0.7239961", "0.722589", "0.7221361", "0.7219218", "0.72145593", "0.72123903", "0.7195037", "0.71699667", "0.71470636", "0.7143612", "0.714104", "0.71288973", "0.71071976", "0.7101763", "0.7071627", "0.7069947", "0.70631325", "0.7051879", "0.7046884", "0.7044656", "0.7036564", "0.70285434", "0.7011354", "0.6958201", "0.6958201", "0.6958201", "0.6958201", "0.6953366", "0.69504637", "0.69355255", "0.6933364", "0.688146", "0.6864937", "0.68537945", "0.6849541", "0.68381196", "0.68055135", "0.6804909", "0.67802495", "0.67766213", "0.67606956", "0.67606956", "0.67576605", "0.6755582", "0.6741651", "0.6721237", "0.6675198", "0.66687626", "0.66681725", "0.66681725", "0.66681725", "0.66681725", "0.66681725", "0.66373783", "0.6622233", "0.659714", "0.6553162", "0.65381444", "0.6528362" ]
0.77720714
6